diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index a314fc1457c489ca7e94a3175df121d28ce2321b..69b0126b70fc54af3c884dc83d6f04a9488500f9 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -654,8 +654,20 @@ class KVMHypervisor(hv_base.BaseHypervisor): if mem_path: kvm_cmd.extend(["-mem-path", mem_path, "-mem-prealloc"]) + monitor_dev = ("unix:%s,server,nowait" % + self._InstanceMonitor(instance.name)) + kvm_cmd.extend(["-monitor", monitor_dev]) + if hvp[constants.HV_SERIAL_CONSOLE]: + serial_dev = ("unix:%s,server,nowait" % + self._InstanceSerial(instance.name)) + kvm_cmd.extend(["-serial", serial_dev]) + else: + kvm_cmd.extend(["-serial", "none"]) + mouse_type = hvp[constants.HV_USB_MOUSE] vnc_bind_address = hvp[constants.HV_VNC_BIND_ADDRESS] + spice_bind = hvp[constants.HV_KVM_SPICE_BIND] + spice_ip_version = None if mouse_type: kvm_cmd.extend(["-usb"]) @@ -707,22 +719,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): vnc_arg = "unix:%s/%s.vnc" % (vnc_bind_address, instance.name) kvm_cmd.extend(["-vnc", vnc_arg]) - else: - kvm_cmd.extend(["-nographic"]) - - monitor_dev = ("unix:%s,server,nowait" % - self._InstanceMonitor(instance.name)) - kvm_cmd.extend(["-monitor", monitor_dev]) - if hvp[constants.HV_SERIAL_CONSOLE]: - serial_dev = ("unix:%s,server,nowait" % - self._InstanceSerial(instance.name)) - kvm_cmd.extend(["-serial", serial_dev]) - else: - kvm_cmd.extend(["-serial", "none"]) - - spice_bind = hvp[constants.HV_KVM_SPICE_BIND] - spice_ip_version = None - if spice_bind: + elif spice_bind: if netutils.IsValidInterface(spice_bind): # The user specified a network interface, we have to figure out the IP # address. @@ -768,6 +765,9 @@ class KVMHypervisor(hv_base.BaseHypervisor): logging.info("KVM: SPICE will listen on port %s", instance.network_port) kvm_cmd.extend(["-spice", spice_arg]) + else: + kvm_cmd.extend(["-nographic"]) + if hvp[constants.HV_USE_LOCALTIME]: kvm_cmd.extend(["-localtime"])