[Pkg-libvirt-commits] [SCM] Virtinst Debian packaging branch, master, updated. debian/0.600.3-2
Guido Günther
agx at sigxcpu.org
Thu Oct 11 17:15:51 UTC 2012
The following commit has been merged in the master branch:
commit 570b8dcddb71266e9eec8051022a2717c06f9021
Author: Guido Günther <agx at sigxcpu.org>
Date: Thu Oct 11 19:03:09 2012 +0200
virt-install: avoid disk name collisions
diff --git a/debian/patches/0006-virt-install-avoid-disk-name-collisions.patch b/debian/patches/0006-virt-install-avoid-disk-name-collisions.patch
new file mode 100644
index 0000000..885db16
--- /dev/null
+++ b/debian/patches/0006-virt-install-avoid-disk-name-collisions.patch
@@ -0,0 +1,79 @@
+From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx at sigxcpu.org>
+Date: Thu, 4 Oct 2012 11:05:12 +0200
+Subject: virt-install: avoid disk name collisions
+
+When specifying multiple disks in pool without giving a name:
+
+virt-install \
+ --disk=pool=test,bus=virtio,size=3.0,sparse=false
+ --disk=pool=test,bus=virtio,size=3.0,sparse=false
+ ...
+
+virt-install creates the names before hand which leads to name
+collisions later on. Avoid this by filling in a collision list
+with the image basenames.
+
+This is overly cautions but better than running into a name collision
+during the vm install.
+---
+ virt-install | 4 +++-
+ virtinst/cli.py | 10 ++++++----
+ 2 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/virt-install b/virt-install
+index d2cc37a..18227ce 100755
+--- a/virt-install
++++ b/virt-install
+@@ -134,7 +134,9 @@ def get_disk(diskopts, size, sparse, guest, is_file_path):
+ if is_file_path:
+ path = diskopts
+ else:
+- dev, size = cli.parse_disk(guest, diskopts)
++ collidelist = [os.path.basename(disk.path) for disk in guest.disks]
++ dev, size = cli.parse_disk(guest, diskopts,
++ collidelist=collidelist)
+ path = dev.path
+ sparse = dev.sparse
+
+diff --git a/virtinst/cli.py b/virtinst/cli.py
+index 580eefd..e0d8f21 100644
+--- a/virtinst/cli.py
++++ b/virtinst/cli.py
+@@ -1477,7 +1477,7 @@ def parse_security(guest, security):
+ # --disk parsing #
+ ##################
+
+-def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse):
++def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse, collidelist=None):
+ abspath = None
+ volinst = None
+ volobj = None
+@@ -1501,7 +1501,8 @@ def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse):
+ vname = virtinst.Storage.StorageVolume.find_free_name(conn=guest.conn,
+ pool_name=pool,
+ name=guest.name,
+- suffix=".img")
++ suffix=".img",
++ collidelist=collidelist)
+ volinst = vc(pool_name=pool, name=vname, conn=guest.conn,
+ allocation=0, capacity=(size and
+ size * 1024 * 1024 * 1024))
+@@ -1529,7 +1530,7 @@ def _parse_disk_source(guest, path, pool, vol, size, fmt, sparse):
+
+ return abspath, volinst, volobj
+
+-def parse_disk(guest, optstr, dev=None):
++def parse_disk(guest, optstr, dev=None, collidelist=None):
+ """
+ helper to properly parse --disk options
+ """
+@@ -1595,7 +1596,8 @@ def parse_disk(guest, optstr, dev=None):
+ device = opt_get("device")
+
+ abspath, volinst, volobj = _parse_disk_source(guest, path, pool, vol,
+- size, fmt, sparse)
++ size, fmt, sparse,
++ collidelist)
+
+ if not dev:
+ # Build a stub device that should always validate cleanly
diff --git a/debian/patches/series b/debian/patches/series
index 42fba28..ad31b7b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@
0003-Fix-path-to-keyboard-configuration.patch
0004-LogicalPool-properly-pass-on-autostart-flag.patch
0005-Don-t-overwrite-target-element-for-disks-that-have-i.patch
+0006-virt-install-avoid-disk-name-collisions.patch
--
Virtinst Debian packaging
More information about the Pkg-libvirt-commits
mailing list