Revision 8cb5634a lib/hypervisor/hv_kvm.py
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
549 | 549 |
_DISABLE_KVM_RE = re.compile(r"^-disable-kvm\s", re.M) |
550 | 550 |
_NETDEV_RE = re.compile(r"^-netdev\s", re.M) |
551 | 551 |
_DISPLAY_RE = re.compile(r"^-display\s", re.M) |
552 |
_MACHINE_RE = re.compile(r"^-machine\s", re.M) |
|
552 | 553 |
_NEW_VIRTIO_RE = re.compile(r"^name \"%s\"" % _VIRTIO_NET_PCI, re.M) |
553 | 554 |
# match -drive.*boot=on|off on different lines, but in between accept only |
554 | 555 |
# dashes not preceeded by a new line (which would mean another option |
... | ... | |
1050 | 1051 |
mversion = hvp[constants.HV_KVM_MACHINE_VERSION] |
1051 | 1052 |
if not mversion: |
1052 | 1053 |
mversion = self._GetDefaultMachineVersion(kvm) |
1053 |
kvm_cmd.extend(["-M", mversion]) |
|
1054 |
if self._MACHINE_RE.search(kvmhelp): |
|
1055 |
# TODO (2.8): kernel_irqchip and kvm_shadow_mem machine properties, as |
|
1056 |
# extra hypervisor parameters. We should also investigate whether and how |
|
1057 |
# shadow_mem should be considered for the resource model. |
|
1058 |
if (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_ENABLED): |
|
1059 |
specprop = ",accel=kvm" |
|
1060 |
else: |
|
1061 |
specprop = "" |
|
1062 |
machinespec = "%s%s" % (mversion, specprop) |
|
1063 |
kvm_cmd.extend(["-machine", machinespec]) |
|
1064 |
else: |
|
1065 |
kvm_cmd.extend(["-M", mversion]) |
|
1066 |
if (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_ENABLED and |
|
1067 |
self._ENABLE_KVM_RE.search(kvmhelp)): |
|
1068 |
kvm_cmd.extend(["-enable-kvm"]) |
|
1069 |
elif (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_DISABLED and |
|
1070 |
self._DISABLE_KVM_RE.search(kvmhelp)): |
|
1071 |
kvm_cmd.extend(["-disable-kvm"]) |
|
1054 | 1072 |
|
1055 | 1073 |
kernel_path = hvp[constants.HV_KERNEL_PATH] |
1056 | 1074 |
if kernel_path: |
... | ... | |
1064 | 1082 |
if startup_paused: |
1065 | 1083 |
kvm_cmd.extend([_KVM_START_PAUSED_FLAG]) |
1066 | 1084 |
|
1067 |
if (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_ENABLED and |
|
1068 |
self._ENABLE_KVM_RE.search(kvmhelp)): |
|
1069 |
kvm_cmd.extend(["-enable-kvm"]) |
|
1070 |
elif (hvp[constants.HV_KVM_FLAG] == constants.HT_KVM_DISABLED and |
|
1071 |
self._DISABLE_KVM_RE.search(kvmhelp)): |
|
1072 |
kvm_cmd.extend(["-disable-kvm"]) |
|
1073 |
|
|
1074 | 1085 |
if boot_network: |
1075 | 1086 |
kvm_cmd.extend(["-boot", "n"]) |
1076 | 1087 |
|
Also available in: Unified diff