@@ -116,17 +116,20 @@ class VM:
self.address_cache = address_cache
self.pci_assignable = None
- # Find available monitor filename
+ # Find available filenames for monitor and guest serial redirection
while True:
- # The monitor filename should be unique
+ # The filenames should be unique
self.instance = (time.strftime("%Y%m%d-%H%M%S-") +
kvm_utils.generate_random_string(4))
- self.monitor_file_name = os.path.join("/tmp",
- "monitor-" + self.instance)
- if not os.path.exists(self.monitor_file_name):
- break
-
+ names = [os.path.join("/tmp", type + self.instance) for type in
+ "monitor-", "serial-"]
+ if True in [os.path.exists(file) for file in names]:
+ continue
+ else:
+ [self.monitor_file_name, self.serial_file_name] = names
+ break
+
def clone(self, name=None, params=None, root_dir=None, address_cache=None):
"""
Return a clone of the VM object with optionally modified parameters.
@@ -316,6 +319,8 @@ class VM:
for pci_id in self.pa_pci_ids:
qemu_cmd += " -pcidevice host=%s" % pci_id
+ qemu_cmd += " -serial unix:%s,server,nowait" % self.serial_file_name
+
return qemu_cmd