+ kernel_path = hvp[constants.HV_KERNEL_PATH]
+ if kernel_path:
+ kvm_cmd.extend(['-kernel', kernel_path])
+ initrd_path = hvp[constants.HV_INITRD_PATH]
+ if initrd_path:
+ kvm_cmd.extend(['-initrd', initrd_path])
+ root_append = ['root=%s' % hvp[constants.HV_ROOT_PATH],
+ hvp[constants.HV_KERNEL_ARGS]]
+ if hvp[constants.HV_SERIAL_CONSOLE]:
+ root_append.append('console=ttyS0,38400')
+ kvm_cmd.extend(['-append', ' '.join(root_append)])
+
+ mouse_type = hvp[constants.HV_USB_MOUSE]
+ if mouse_type:
+ kvm_cmd.extend(['-usb'])
+ kvm_cmd.extend(['-usbdevice', mouse_type])
+
+ # FIXME: handle vnc password
+ vnc_bind_address = hvp[constants.HV_VNC_BIND_ADDRESS]
+ if vnc_bind_address:
+ if utils.IsValidIP(vnc_bind_address):
+ if instance.network_port > constants.VNC_BASE_PORT:
+ display = instance.network_port - constants.VNC_BASE_PORT
+ if vnc_bind_address == '0.0.0.0':
+ vnc_arg = ':%d' % (display)
+ else:
+ vnc_arg = '%s:%d' % (vnc_bind_address, display)
+ else:
+ logging.error("Network port is not a valid VNC display (%d < %d)."
+ " Not starting VNC" %
+ (instance.network_port,
+ constants.VNC_BASE_PORT))
+ vnc_arg = 'none'
+
+ # Only allow tls and other option when not binding to a file, for now.
+ # kvm/qemu gets confused otherwise about the filename to use.
+ vnc_append = ''
+ if hvp[constants.HV_VNC_TLS]:
+ vnc_append = '%s,tls' % vnc_append
+ if hvp[constants.HV_VNC_X509_VERIFY]:
+ vnc_append = '%s,x509verify=%s' % (vnc_append,
+ hvp[constants.HV_VNC_X509])
+ elif hvp[constants.HV_VNC_X509]:
+ vnc_append = '%s,x509=%s' % (vnc_append,
+ hvp[constants.HV_VNC_X509])
+ vnc_arg = '%s%s' % (vnc_arg, vnc_append)