Skip to content

Conversation

@KTokarze
Copy link

This pull request refactors the VM class in mfd_hyperv/instances/vm.py to inherit from the Host class, adjusts its initialization logic to bypass the Host factory pattern, and makes several minor documentation and code improvements. The changes improve code reuse, maintainability, and clarity.

Class inheritance and initialization refactor:

  • Updated the VM class to inherit from Host and overrode the __new__ method to bypass the Host factory pattern for VM instances. The constructor now calls super().__init__, passing the connection and any additional keyword arguments. This enables better code reuse and integration with the Host class while maintaining the specific instantiation logic required for VMs. [1] [2] [3]

Documentation and readability improvements:

  • Fixed typos and clarified docstrings for methods and properties, such as correcting "untill" to "until" and standardizing the spelling of "HyperV" and "vNICs" in property and parameter descriptions. [1] [2] [3] [4]

Copilot AI review requested due to automatic review settings September 16, 2025 08:32
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the VM class to inherit from Host, enabling better code reuse and maintainability in the HyperV module. The changes override the Host factory pattern for VM instances while preserving VM-specific initialization logic.

  • Introduces inheritance from Host class with custom __new__ method to bypass factory pattern
  • Updates constructor to call super().__init__() with connection and additional kwargs
  • Fixes documentation typos and improves consistency in terminology

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Refactor VM object to inherit Host funcionalities, attributes and sub-objects.

Signed-off-by: Kacper Tokarzewski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant