Merge branch '2.1' into embed_shell

This commit is contained in:
Julien Duponchelle committed 2017-06-19 11:10:24 +02:00
commit e5bc7c7a66
17 files changed
+98 -15

No files matched your search

+7 -2
View File
@@ -247,8 +247,13 @@ class Qemu(BaseManager):
directory = self.get_images_directory()
os.makedirs(directory, exist_ok=True)
path = os.path.join(directory, os.path.basename(path))
if os.path.exists(path):
raise QemuError("Could not create disk image {} already exist".format(path))
try:
if os.path.exists(path):
raise QemuError("Could not create disk image {} already exist".format(path))
except UnicodeEncodeError:
raise QemuError("Could not create disk image {}, "
"path contains characters not supported by filesystem".format(path))
command = [qemu_img, "create", "-f", img_format]
for option in sorted(options.keys()):
@@ -209,7 +209,12 @@ class VirtualBoxVM(BaseNode):
Fix the VM uuid in the case of linked clone
"""
if os.path.exists(self._linked_vbox_file()):
tree = ET.parse(self._linked_vbox_file())
try:
tree = ET.parse(self._linked_vbox_file())
except ET.ParseError:
raise VirtualBoxError("Cannot modify VirtualBox linked nodes file. "
"File {} is corrupted.".format(self._linked_vbox_file()))
machine = tree.getroot().find("{http://www.virtualbox.org/}Machine")
if machine is not None and machine.get("uuid") != "{" + self.id + "}":
+2 -1
View File
@@ -169,7 +169,8 @@ class VPCSVM(BaseNode):
if self.script_file:
content = self.startup_script
content = content.replace(self._name, new_name)
content = re.sub(r"^set pcname .+$", "set pcname " + new_name, content, flags=re.MULTILINE)
escaped_name = re.escape(new_name)
content = re.sub(r"^set pcname .+$", "set pcname " + escaped_name, content, flags=re.MULTILINE)
self.startup_script = content
super(VPCSVM, VPCSVM).name.__set__(self, new_name)