Fix Qemu disk creation with unicode characters not supported by local filesystem #1058 (#1063)

This commit is contained in:
ziajka authored and Julien Duponchelle committed 2017-06-07 12:35:41 +02:00
1 parent e0b519eced
commit eb6068c3d3
2 files changed
+27 -2

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()):