This commit is contained in:
ahmadbilalkhalid 2019-09-16 19:37:03 +05:00
parent f0af8aec72
commit f704772c6c

View file

@ -4,35 +4,26 @@
# For QEMU Monitor Protocol Commands Information, See # For QEMU Monitor Protocol Commands Information, See
# https://qemu.weilnetz.de/doc/qemu-doc.html#pcsys_005fmonitor # https://qemu.weilnetz.de/doc/qemu-doc.html#pcsys_005fmonitor
import subprocess
import traceback
import errno import errno
import os
import subprocess
import tempfile import tempfile
import time import time
import os import traceback
from functools import wraps
from os.path import join from os.path import join
from typing import Union from typing import Union
from functools import wraps
import bitmath import bitmath
import sshtunnel import sshtunnel
from decouple import config from decouple import config
from ucloud_common.helpers import get_ipv4_address
from ucloud_common.vm import VMStatus, VMEntry
from ucloud_common.request import RequestEntry, RequestType
import qmp import qmp
from config import (WITHOUT_CEPH, etcd_client, logging, request_pool,
from config import ( running_vms, vm_pool)
vm_pool, from ucloud_common.helpers import get_ipv4_address
request_pool, from ucloud_common.request import RequestEntry, RequestType
etcd_client, from ucloud_common.vm import VMEntry, VMStatus
logging,
running_vms,
WITHOUT_CEPH,
)
class VM: class VM:
@ -187,6 +178,7 @@ def start(vm_entry: VMEntry):
except (qmp.QEMUMachineError, TypeError, Exception): except (qmp.QEMUMachineError, TypeError, Exception):
vm_entry.declare_killed() vm_entry.declare_killed()
vm_entry.add_log("Machine Error occurred | %s", traceback.format_exc()) vm_entry.add_log("Machine Error occurred | %s", traceback.format_exc())
vm_entry.vnc_socket = vm.vnc_socket_file
vm_pool.put(vm_entry) vm_pool.put(vm_entry)
else: else:
running_vms.append(vm) running_vms.append(vm)
@ -296,6 +288,8 @@ def init_migration(vm_entry, destination_host_key):
vm.handle.shutdown() vm.handle.shutdown()
else: else:
vm_entry.in_migration = True vm_entry.in_migration = True
vm_entry.vnc_socket = vm.vnc_socket_file
vm_pool.put(vm_entry) vm_pool.put(vm_entry)
running_vms.append(vm) running_vms.append(vm)