Remove pending vm handling mechanism from scheduler + fixed issue that update VM's hostname even on migration failure
This commit is contained in:
parent
d2d6c6bf5c
commit
d13a4bcc37
5 changed files with 40 additions and 94 deletions
|
|
@ -38,13 +38,14 @@ class VM:
|
|||
else:
|
||||
self.uuid = vm_entry.key.split("/")[-1]
|
||||
self.host_key = self.vm["hostname"]
|
||||
logger.debug('VM Hostname {}'.format(self.host_key))
|
||||
|
||||
def get_qemu_args(self):
|
||||
command = (
|
||||
"-name {owner}_{name}"
|
||||
" -drive file={file},format=raw,if=virtio,cache=none"
|
||||
"-drive file={file},format=raw,if=virtio,cache=none"
|
||||
" -device virtio-rng-pci"
|
||||
" -m {memory} -smp cores={cores},threads={threads}"
|
||||
" -name {owner}_{name}"
|
||||
).format(
|
||||
owner=self.vm["owner"],
|
||||
name=self.vm["name"],
|
||||
|
|
@ -67,11 +68,7 @@ class VM:
|
|||
except Exception as err:
|
||||
declare_stopped(self.vm)
|
||||
self.vm["log"].append("Cannot Setup Network Properly")
|
||||
logger.error(
|
||||
"Cannot Setup Network Properly for vm %s",
|
||||
self.uuid,
|
||||
exc_info=err,
|
||||
)
|
||||
logger.error("Cannot Setup Network Properly for vm %s", self.uuid, exc_info=err)
|
||||
else:
|
||||
self.vmm.start(
|
||||
uuid=self.uuid,
|
||||
|
|
@ -81,6 +78,7 @@ class VM:
|
|||
)
|
||||
|
||||
status = self.vmm.get_status(self.uuid)
|
||||
logger.debug('VM {} status is {}'.format(self.uuid, status))
|
||||
if status == "running":
|
||||
self.vm["status"] = VMStatus.running
|
||||
self.vm["vnc_socket"] = self.vmm.get_vnc(self.uuid)
|
||||
|
|
@ -99,7 +97,7 @@ class VM:
|
|||
else:
|
||||
self.stop()
|
||||
declare_stopped(self.vm)
|
||||
|
||||
logger.debug('VM {} has hostname {}'.format(self.uuid, self.vm['hostname']))
|
||||
self.sync()
|
||||
|
||||
def stop(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue