Commit 8feeb253 authored by Christos Stavrakakis's avatar Christos Stavrakakis Committed by Guido Trotter
Browse files

kvm: Use -uuid to set system UUID



Use kvm '-uuid' option to set guest's system UUID to instance's UUID.
Signed-off-by: default avatarChristos Stavrakakis <cstavr@grnet.gr>
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 2590d723
......@@ -571,6 +571,7 @@ class KVMHypervisor(hv_base.BaseHypervisor):
# dashes not preceeded by a new line (which would mean another option
# different than -drive is starting)
_BOOT_RE = re.compile(r"^-drive\s([^-]|(?<!^)-)*,boot=on\|off", re.M | re.S)
_UUID_RE = re.compile(r"^-uuid\s", re.M)
ANCILLARY_FILES = [
_KVM_NETWORK_SCRIPT,
......@@ -1386,6 +1387,10 @@ class KVMHypervisor(hv_base.BaseHypervisor):
for dev in hvp[constants.HV_USB_DEVICES].split(","):
kvm_cmd.extend(["-usbdevice", dev])
# Set system UUID to instance UUID
if self._UUID_RE.search(kvmhelp):
kvm_cmd.extend(["-uuid", instance.uuid])
if hvp[constants.HV_KVM_EXTRA]:
kvm_cmd.extend([hvp[constants.HV_KVM_EXTRA]])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment