[fedora-virt-maint] rpms/python-virtinst/devel virtinst-0.500.0-bogus-driver-xml.patch, NONE, 1.1 virtinst-0.500.0-disk-format.patch, NONE, 1.1 virtinst-0.500.0-f12-distro.patch, NONE, 1.1 python-virtinst.spec, 1.71, 1.72

Cole Robinson crobinso at fedoraproject.org
Wed Sep 16 17:33:01 UTC 2009


Author: crobinso

Update of /cvs/pkgs/rpms/python-virtinst/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv3759

Modified Files:
	python-virtinst.spec 
Added Files:
	virtinst-0.500.0-bogus-driver-xml.patch 
	virtinst-0.500.0-disk-format.patch 
	virtinst-0.500.0-f12-distro.patch 
Log Message:
Don't generate bogus disk driver XML.
Add '--disk format=' for specifying format (qcow2, ...) when provisioning
Add Fedora12 to os dictionary


virtinst-0.500.0-bogus-driver-xml.patch:
 AUTHORS                 |    1 +
 virtinst/VirtualDisk.py |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

--- NEW FILE virtinst-0.500.0-bogus-driver-xml.patch ---
# HG changeset patch
# User Alban Browaeys <prahal at yahoo.com>
# Date 1249497422 14400
# Node ID 0d3cdc5ff5d091dd73d3ef0fe21123fb63b4d7a0
# Parent  07d296ecfbeb3c42e4db0efbeb03a9d8c4cac501
Set proper driver type from storage volume xml.

Fixes possible traceback if creating a qemu VM from a storage volume.

diff -r 07d296ecfbeb -r 0d3cdc5ff5d0 AUTHORS
--- a/AUTHORS	Wed Aug 05 14:32:40 2009 -0400
+++ b/AUTHORS	Wed Aug 05 14:37:02 2009 -0400
@@ -42,6 +42,7 @@
    Laurent Léonard <laurent-at-open-minds-dot-org>
    Christophe Sauthier <christophe-dot-sauthier-at-objectif-libre-dot-com>
    Michal Novotny <minovotn-at-redhat-dot-com>
+   Alban Browaeys <prahal-at-yahoo-dot-com>
 
    ...send patches and get your name here...
 
diff -r 07d296ecfbeb -r 0d3cdc5ff5d0 virtinst/VirtualDisk.py
--- a/virtinst/VirtualDisk.py	Wed Aug 05 14:32:40 2009 -0400
+++ b/virtinst/VirtualDisk.py	Wed Aug 05 14:37:02 2009 -0400
@@ -470,7 +470,7 @@
 
         if self.vol_object:
             drvtype = _util.get_xml_path(self.vol_object.XMLDesc(0),
-                                         "/volume/target/format")
+                                         "/volume/target/format/@type")
 
         elif self.vol_install:
             if drvname == self.DRIVER_QEMU:

virtinst-0.500.0-disk-format.patch:
 man/en/virt-install.1      |    5 +++++
 man/en/virt-install.pod.in |    6 ++++++
 tests/clitest.py           |   13 +++++++++++++
 virt-install               |   16 ++++++++++------
 virtinst/VirtualDisk.py    |   33 ++++++++++++++++++++++++++++++++-
 5 files changed, 66 insertions(+), 7 deletions(-)

--- NEW FILE virtinst-0.500.0-disk-format.patch ---
# HG changeset patch
# User Cole Robinson <crobinso at redhat.com>
# Date 1253112830 14400
# Node ID 6a398359952bfd8cc62e36afc26bb470862ce42d
# Parent  252ff7bc5ff9e95f49dd7deb6ef6af07287a5055
virt-install: Add 'format' option to --disk

Allows specifying storage volume format (raw, qcow2, etc.).

diff -r 252ff7bc5ff9 -r 6a398359952b man/en/virt-install.1
--- a/man/en/virt-install.1	Sun Sep 13 18:20:15 2009 -0400
+++ b/man/en/virt-install.1	Wed Sep 16 10:53:50 2009 -0400
@@ -659,6 +659,11 @@
 The cache value can be 'none', 'writethrough', or 'writeback'.
 \&'writethrough' provides read caching. 'writeback' provides
 read and write caching.
+.IP "\fBformat\fR" 4
+.IX Item "format"
+Image format to be used if creating managed storage. For file volumes, this
+can be 'raw', 'qcow2', 'vmdk', etc. See format types in
+<http://libvirt.org/storage.html> for possible values.
 .RE
 .RS 2
 .Sp
diff -r 252ff7bc5ff9 -r 6a398359952b man/en/virt-install.pod.in
--- a/man/en/virt-install.pod.in	Sun Sep 13 18:20:15 2009 -0400
+++ b/man/en/virt-install.pod.in	Wed Sep 16 10:53:50 2009 -0400
@@ -435,6 +435,12 @@
 'writethrough' provides read caching. 'writeback' provides
 read and write caching.
 
+=item B<format>
+
+Image format to be used if creating managed storage. For file volumes, this
+can be 'raw', 'qcow2', 'vmdk', etc. See format types in
+L<http://libvirt.org/storage.html> for possible values.
+
 =back
 
 See the examples section for some uses. This option deprecates C<--file>,
diff -r 252ff7bc5ff9 -r 6a398359952b tests/clitest.py
--- a/tests/clitest.py	Sun Sep 13 18:20:15 2009 -0400
+++ b/tests/clitest.py	Wed Sep 16 10:53:50 2009 -0400
@@ -62,6 +62,7 @@
     'MANAGEDEXIST2'     : "/default-pool/testvol2.img",
     'MANAGEDNEW1'       : "/default-pool/clonevol",
     'MANAGEDNEW2'       : "/default-pool/clonevol",
+    'MANAGEDDISKNEW1'   : "/disk-pool/newvol1.img",
 }
 
 debug = False
@@ -130,6 +131,12 @@
         "--disk path=%(EXISTIMG1)s --disk path=%(EXISTIMG1)s --disk path=%(EXISTIMG1)s --disk path=%(EXISTIMG1)s,device=cdrom",
         # > 16 scsi disks
         " --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi --disk path=%(EXISTIMG1)s,bus=scsi",
+        # Unmanaged file using format 'raw'
+        "--disk path=%(NEWIMG1)s,format=raw,size=.0000001",
+        # Managed file using format raw
+        "--disk path=%(MANAGEDNEW1)s,format=raw,size=.0000001",
+        # Managed file using format qcow2
+        "--disk path=%(MANAGEDNEW1)s,format=qcow2,size=.0000001",
       ],
 
       "invalid": [
@@ -153,6 +160,12 @@
         "--disk pool=%(POOL)s",
         # Unknown cache type
         "--disk path=%(EXISTIMG1)s,perms=ro,size=.0001,cache=FOOBAR",
+        # Unmanaged file using non-raw format
+        "--disk path=%(NEWIMG1)s,format=qcow2,size=.0000001",
+        # Managed file using unknown format
+        "--disk path=%(MANAGEDNEW1)s,format=frob,size=.0000001",
+        # Managed disk using any format
+        "--disk path=%(MANAGEDDISKNEW1)s,format=raw,size=.0000001",
       ]
      }, # category "storage"
 
diff -r 252ff7bc5ff9 -r 6a398359952b virt-install
--- a/virt-install	Sun Sep 13 18:20:15 2009 -0400
+++ b/virt-install	Wed Sep 16 10:53:50 2009 -0400
@@ -156,7 +156,8 @@
     ro = False
     shared = False
     sparse = True
-    option_whitelist = ["perms", "cache", "bus", "device", "size", "sparse"]
+    option_whitelist = ["perms", "cache", "bus", "device", "size", "sparse",
+                        "format"]
 
     # Strip media type
     path, ignore, optstr = partition(path, ",")
@@ -200,6 +201,7 @@
     devtype = opts.get("device")
     bus     = opts.get("bus")
     cache   = opts.get("cache")
+    fmt     = opts.get("format")
 
     # We return (path, (poolname, volname), volinst, device, bus, readonly,
     #            shared)
@@ -220,6 +222,8 @@
                                                               suffix=".img")
         volinst = vc(pool_name=path, name=vname, conn=guest.conn,
                      allocation=0, capacity=(size and size*1024*1024*1024))
+        if fmt:
+            volinst.format = fmt
 
     elif path_type == "vol=":
         if not path.count("/"):
@@ -235,7 +239,7 @@
     if not devtype:
         devtype = virtinst.VirtualDisk.DEVICE_DISK
     ret = (abspath, voltuple, volinst, devtype, bus, ro, shared, size, sparse,
-           cache)
+           cache, fmt)
     logging.debug("parse_disk: returning %s" % str(ret))
     return ret
 
@@ -252,13 +256,13 @@
         # Get disk parameters
         if is_file_path:
             (path, voltuple, volinst, device, bus, readOnly, shared, size,
-             sparse, cache) = \
+             sparse, cache, fmt) = \
              (disk, None, None, virtinst.VirtualDisk.DEVICE_DISK, None, False,
-              False, size, sparse, None)
+              False, size, sparse, None, None)
         else:
             (path, voltuple, volinst,
              device, bus, readOnly, shared,
-             size, sparse, cache) = parse_disk_option(guest, disk, size)
+             size, sparse, cache, fmt) = parse_disk_option(guest, disk, size)
             if not sparse and volinst:
                 volinst.allocation = volinst.capacity
 
@@ -266,7 +270,7 @@
                   'volInstall': volinst, 'volName': voltuple,
                   'readOnly': readOnly, 'shareable': shared,
                   'device': device, 'bus': bus, 'conn': guest.conn,
-                  'driverCache': cache}
+                  'driverCache': cache, 'format': fmt}
 
         d = cli.disk_prompt(None, kwargs)
 
diff -r 252ff7bc5ff9 -r 6a398359952b virtinst/VirtualDisk.py
--- a/virtinst/VirtualDisk.py	Sun Sep 13 18:20:15 2009 -0400
+++ b/virtinst/VirtualDisk.py	Wed Sep 16 10:53:50 2009 -0400
@@ -146,7 +146,7 @@
                  device=DEVICE_DISK, driverName=None, driverType=None,
                  readOnly=False, sparse=True, conn=None, volObject=None,
                  volInstall=None, volName=None, bus=None, shareable=False,
-                 driverCache=None, selinuxLabel=None):
+                 driverCache=None, selinuxLabel=None, format=None):
         """
         @param path: filesystem path to the disk image.
         @type path: C{str}
@@ -183,6 +183,8 @@
         @type driverCache: member of cache_types
         @param selinuxLabel: Used for labelling new or relabel existing storage
         @type selinuxLabel: C{str}
+        @param format: Storage volume format to use when creating storage
+        @type format: C{str}
         """
 
         VirtualDevice.__init__(self, conn=conn)
@@ -200,6 +202,7 @@
         self._driver_cache = None
         self._selinux_label = None
         self._clone_path = None
+        self._format = None
 
         # XXX: No property methods for these
         self.transient = transient
@@ -219,6 +222,7 @@
         self._set_shareable(shareable, validate=False)
         self._set_driver_cache(driverCache, validate=False)
         self._set_selinux_label(selinuxLabel, validate=False)
+        self._set_format(format, validate=False)
 
         if volName:
             self.__lookup_vol_name(volName)
@@ -375,6 +379,14 @@
         self.__validate_wrapper("_selinux_label", val, validate)
     selinux_label = property(_get_selinux_label, _set_selinux_label)
 
+    def _get_format(self):
+        return self._format
+    def _set_format(self, val, validate=True):
+        if val is not None:
+            self._check_str(val, "format")
+        self.__validate_wrapper("_format", val, validate)
+    format = property(_get_format, _set_format)
+
     # Validation assistance methods
 
     # Initializes attribute if it hasn't been done, then validates args.
@@ -392,6 +404,24 @@
                 setattr(self, varname, orig)
                 raise
 
+    def __set_format(self):
+        if not self.format:
+            return
+
+        if not self.__creating_storage():
+            return
+
+        if self.vol_install:
+            if not hasattr(self.vol_install, "format"):
+                raise ValueError(_("Storage type does not support format "
+                                   "parameter."))
+            if self.vol_install.format != self.format:
+                self.vol_install.format = self.format
+
+        elif self.format != "raw":
+            raise RuntimeError(_("Format cannot be specified for "
+                                 "unmanaged storage."))
+
     def __set_size(self):
         """
         Fill in 'size' attribute for existing storage.
@@ -700,6 +730,7 @@
         create_media = self.__creating_storage()
 
         self.__set_size()
+        self.__set_format()
 
         if not self.selinux_label:
             # If we are using existing storage, pull the label from it

virtinst-0.500.0-f12-distro.patch:
 osdict.py |    7 +++++++
 1 file changed, 7 insertions(+)

--- NEW FILE virtinst-0.500.0-f12-distro.patch ---
# HG changeset patch
# User Cole Robinson <crobinso at redhat.com>
# Date 1253115773 14400
# Node ID d8f88998215ae844534b2bf9a7024edc1bf46826
# Parent  6a398359952bfd8cc62e36afc26bb470862ce42d
osdict: Add 'Fedora 12' entry

diff -r 6a398359952b -r d8f88998215a virtinst/osdict.py
--- a/virtinst/osdict.py	Wed Sep 16 10:53:50 2009 -0400
+++ b/virtinst/osdict.py	Wed Sep 16 11:42:53 2009 -0400
@@ -179,6 +179,13 @@
                         "input" : { "type" : [ (["all"], "tablet") ],
                                     "bus"  : [ (["all"], "usb"), ] },
                      }},
+        "fedora12": { "label": "Fedora 12", "distro": "fedora",
+                      "devices" : {
+                        "disk" : { "bus"   : [ (["kvm"], "virtio") ] },
+                        "net"  : { "model" : [ (["kvm"], "virtio") ] },
+                        "input" : { "type" : [ (["all"], "tablet") ],
+                                    "bus"  : [ (["all"], "usb"), ] },
+                     }},
         "sles10": { "label": "Suse Linux Enterprise Server",
                     "distro": "suse" },
         "sles11": { "label": "Suse Linux Enterprise Server 11",


Index: python-virtinst.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-virtinst/devel/python-virtinst.spec,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -p -r1.71 -r1.72
--- python-virtinst.spec	13 Sep 2009 23:14:03 -0000	1.71
+++ python-virtinst.spec	16 Sep 2009 17:33:00 -0000	1.72
@@ -17,7 +17,7 @@
 Summary: Python modules and utilities for installing virtual machines
 Name: python-%{appname}
 Version: 0.500.0
-Release: 2%{_extra_release}
+Release: 3%{_extra_release}
 Source0: http://virt-manager.org/download/sources/%{appname}/%{appname}-%{version}.tar.gz
 # Don't erroneously set limit for amount of virtio devices (bz 499654)
 Patch1: %{appname}-%{version}-virtio-dev-limit.patch
@@ -27,6 +27,12 @@ Patch2: %{appname}-%{version}-virtio-cdr
 Patch3: %{appname}-%{version}-no-default-keymap.patch
 # Update test suite to verify patches
 Patch4: %{appname}-%{version}-update-testsuite.patch
+# Don't generate bogus disk driver XML.
+Patch5: /home/boston/crobinso/virtinst-0.500.0-bogus-driver-xml.patch
+# Add '--disk format=' for specifying format (qcow2, ...) when provisioning
+Patch6: /home/boston/crobinso/virtinst-0.500.0-disk-format.patch
+# Add Fedora12 to os dictionary
+Patch7: /home/boston/crobinso/virtinst-0.500.0-f12-distro.patch
 
 License: GPLv2+
 Group: Development/Libraries
@@ -58,6 +64,9 @@ and install new VMs) and virt-clone (clo
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
 
 %build
 python setup.py build
@@ -93,6 +102,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/virt-convert
 
 %changelog
+* Wed Sep 16 2009 Cole Robinson <crobinso at redhat.com> - 0.500.0-3.fc12
+- Don't generate bogus disk driver XML.
+- Add '--disk format=' for specifying format (qcow2, ...) when provisioning
+- Add Fedora12 to os dictionary
+
 * Sun Sep 13 2009 Cole Robinson <crobinso at redhat.com> - 0.500.0-2.fc12
 - Don't erroneously set limit for amount of virtio devices (bz 499654)
 - Don't use virtio for cdrom devices (bz 517151)




More information about the Fedora-virt-maint mailing list