Skip to content

Commit

Permalink
Cleanup code and add extra comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lamaral committed Sep 23, 2024
1 parent 9ff6fa7 commit 67cee04
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion igvm/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ def vm_build(
postboot=postboot,
cleanup_cert=rebuild,
barebones=barebones,
vg_name=vm.vg_name,
)
else:
raise NotImplementedError(
Expand Down
6 changes: 3 additions & 3 deletions igvm/hypervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, dataset_obj):
self._storage_type = None

def get_active_storage_pools(self):
# Return all active storage pools
# The 2 used as argument is the value of the VIR_CONNECT_LIST_STORAGE_POOLS_ACTIVE flag.
return self.conn().listAllStoragePools(2)

def find_vg_of_vm(self, dataset_obj):
Expand Down Expand Up @@ -738,7 +738,7 @@ def migrate_vm(
target_hypervisor.umount_vm_storage(vm)

target_hypervisor.define_vm(
vm=vm, transaction=transaction, vg_name=target_vg_name
vm=vm, transaction=transaction
)
else:
# For online migrations always use same volume name as VM
Expand Down Expand Up @@ -828,7 +828,7 @@ def redefine_vm(self, vm, new_fqdn=None):
# XXX: undefine_vm depends on vm.fqdn beeing the old name for finding
# legacy domains w/o an uid_name. The order is therefore important.
vm.fqdn = new_fqdn or vm.fqdn
self.define_vm(vm=vm, vg_name=vm.vg_name)
self.define_vm(vm=vm)

def _vm_sync_from_hypervisor(self, vm, result):
vm_info = self._get_domain(vm).info()
Expand Down
4 changes: 1 addition & 3 deletions igvm/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def __init__(self, dataset_obj, hypervisor=None, vg_name=None):
# Check if we can find it

if hypervisor is None:
# This is probably caused by an error,
# but we will pass as None
# At AWS we don't have assigned hypervisors hence no vg_name.
self.vg_name = None
else:
found_vg = self.hypervisor.find_vg_of_vm(dataset_obj)
Expand Down Expand Up @@ -661,7 +660,6 @@ def build(
postboot=None,
cleanup_cert=False,
barebones=False,
vg_name=DEFAULT_VG_NAME,
):
"""Builds a VM."""
hypervisor = self.hypervisor
Expand Down

0 comments on commit 67cee04

Please sign in to comment.