[fedora-virt-maint] rpms/python-virtinst/F-11 virtinst-0.400.3-default-bridge-error.patch, NONE, 1.1 virtinst-0.400.3-sles-virtio.patch, NONE, 1.1 virtinst-0.400.3-virtio-dev-limit.patch, NONE, 1.1 python-virtinst.spec, 1.69, 1.70

Cole Robinson crobinso at fedoraproject.org
Sun Sep 13 23:48:36 UTC 2009


Author: crobinso

Update of /cvs/pkgs/rpms/python-virtinst/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23121

Modified Files:
	python-virtinst.spec 
Added Files:
	virtinst-0.400.3-default-bridge-error.patch 
	virtinst-0.400.3-sles-virtio.patch 
	virtinst-0.400.3-virtio-dev-limit.patch 
Log Message:
Fix parse error when looking for default bridge (bz 506319)
Use virtio for SLES guests (bz 505317)
Don't erroneously set limit for amount of virtio devices (bz 499654)


virtinst-0.400.3-default-bridge-error.patch:
 VirtualNetworkInterface.py |    2 -
 _util.py                   |   50 ++++++++++++++++++++++++++++++++++++++
 util.py                    |   58 +++++++++------------------------------------
 3 files changed, 62 insertions(+), 48 deletions(-)

--- NEW FILE virtinst-0.400.3-default-bridge-error.patch ---
# HG changeset patch
# User Cole Robinson <crobinso at redhat.com>
# Date 1245253380 14400
# Node ID 503cd42936a950399e3684430d6caffe3aa75c1f
# Parent  9da0cafaf0e9c68a0e3ada8ca33eff0999493533
Refactor default net device searching.

We had some duplicate code, and some pretty careless code that could
bomb out in corner cases (rhbz 506319)

diff -rup old/virtinst/_util.py virtinst-0.400.3/virtinst/_util.py
--- old/virtinst/_util.py	2009-09-13 18:44:41.000000000 -0400
+++ virtinst-0.400.3/virtinst/_util.py	2009-09-13 18:51:17.000000000 -0400
@@ -28,10 +28,12 @@ import os
 import re
 import commands
 import logging
+import platform
+import subprocess
 
 import libvirt
 
-from virtinst import util
+import virtinst.util as util
 from virtinst import _virtinst as _
 
 def is_vdisk(path):
@@ -176,6 +178,52 @@ def fetch_all_guests(conn):
     return (active, inactive)
 
 
+def default_nic():
+    """
+    Return the default NIC to use, if one is specified.
+    """
+
+    dev = ''
+
+    if platform.system() != 'SunOS':
+        return dev
+
+    # XXX: fails without PRIV_XVM_CONTROL
+    proc = subprocess.Popen(['/usr/lib/xen/bin/xenstore-read',
+        'device-misc/vif/default-nic'], stdout=subprocess.PIPE,
+        stderr=subprocess.PIPE)
+    out = proc.stdout.readlines()
+    if len(out) > 0:
+        dev = out[0].rstrip()
+
+    return dev
+
+def default_bridge2(conn = None):
+    if platform.system() == 'SunOS':
+        return ["bridge", default_nic()]
+
+    dev = util.default_route()
+
+    if (dev is not None and
+        (not conn or not is_uri_remote(conn.getURI()))):
+        # New style peth0 == phys dev, eth0 == bridge, eth0 == default route
+        if os.path.exists("/sys/class/net/%s/bridge" % dev):
+            return ["bridge", dev]
+
+        # Old style, peth0 == phys dev, eth0 == netloop, xenbr0 == bridge,
+        # vif0.0 == netloop enslaved, eth0 == default route
+        try:
+            defn = int(dev[-1])
+        except:
+            defn = -1
+
+        if (defn >= 0 and
+            os.path.exists("/sys/class/net/peth%d/brport" % defn) and
+            os.path.exists("/sys/class/net/xenbr%d/bridge" % defn)):
+            return ["bridge", "xenbr%d" % defn]
+
+    return None
+
 #
 # These functions accidentally ended up in the API under virtinst.util
 #
diff -rup old/virtinst/util.py virtinst-0.400.3/virtinst/util.py
--- old/virtinst/util.py	2009-09-13 18:44:41.000000000 -0400
+++ virtinst-0.400.3/virtinst/util.py	2009-09-13 18:51:17.000000000 -0400
@@ -38,6 +38,7 @@ from sys import stderr
 
 import libvirt
 from virtinst import _virtinst as _
+import virtinst
 import CapabilitiesParser
 from User import User
 
@@ -75,59 +76,24 @@ def default_route(nic = None):
             continue
     return None
 
-def _default_nic():
-    """Return the default NIC to use, if one is specified.
-       This is NOT part of the API and may change at will."""
-
-    dev = ''
-
-    if platform.system() != 'SunOS':
-        return dev
-
-    # XXX: fails without PRIV_XVM_CONTROL
-    proc = subprocess.Popen(['/usr/lib/xen/bin/xenstore-read',
-        'device-misc/vif/default-nic'], stdout=subprocess.PIPE,
-        stderr=subprocess.PIPE)
-    out = proc.stdout.readlines()
-    if len(out) > 0:
-        dev = out[0].rstrip()
-
-    return dev
 
 def default_bridge():
-    if platform.system() == 'SunOS':
-        return _default_nic()
-
-    rt = default_route()
-    if rt is None:
-        defn = None
+    ret = virtinst._util.default_bridge2(None)
+    if not ret:
+        # Maintain this behavior for back compat
+        ret = "xenbr0"
     else:
-        defn = int(rt[-1])
+        ret = ret[1]
 
-    if defn is None:
-        return "xenbr0"
-    else:
-        return "xenbr%d"%(defn)
+    return ret
 
 def default_network(conn):
-    if platform.system() == 'SunOS':
-        return ["bridge", _default_nic()]
-
-    dev = default_route()
-
-    if dev is not None and not is_uri_remote(conn.getURI()):
-        # New style peth0 == phys dev, eth0 == bridge, eth0 == default route
-        if os.path.exists("/sys/class/net/%s/bridge" % dev):
-            return ["bridge", dev]
-
-        # Old style, peth0 == phys dev, eth0 == netloop, xenbr0 == bridge,
-        # vif0.0 == netloop enslaved, eth0 == default route
-        defn = int(dev[-1])
-        if os.path.exists("/sys/class/net/peth%d/brport" % defn) and \
-           os.path.exists("/sys/class/net/xenbr%d/bridge" % defn):
-            return ["bridge", "xenbr%d" % defn]
+    ret = virtinst._util.default_bridge2(conn)
+    if not ret:
+        # FIXME: Check that this exists
+        ret = ["network", "default"]
 
-    return ["network", "default"]
+    return ret
 
 def default_connection():
     if os.path.exists('/var/lib/xend'):
diff -rup old/virtinst/VirtualNetworkInterface.py virtinst-0.400.3/virtinst/VirtualNetworkInterface.py
--- old/virtinst/VirtualNetworkInterface.py	2009-09-13 18:44:41.000000000 -0400
+++ virtinst-0.400.3/virtinst/VirtualNetworkInterface.py	2009-09-13 18:51:17.000000000 -0400
@@ -127,7 +127,7 @@ class VirtualNetworkInterface(VirtualDev
                     raise RuntimeError(msg)
 
         if not self.bridge and self.type == "bridge":
-            self.bridge = _util.default_bridge()
+            self.bridge = _util.default_bridge2(self.conn)
 
     def get_xml_config(self):
         src_xml = ""

virtinst-0.400.3-sles-virtio.patch:
 osdict.py |    7 +++++++
 1 file changed, 7 insertions(+)

--- NEW FILE virtinst-0.400.3-sles-virtio.patch ---
# HG changeset patch
# User Cole Robinson <crobinso at redhat.com>
# Date 1247623635 14400
# Node ID dbda3bfc28f8d81d244c7b54998e63a85ddf9824
# Parent  3c68ba7758a6190f28ec32ab20a3ce96f7802542
osdict: Add SLES 11 (supports virtio)

diff -r 3c68ba7758a6 -r dbda3bfc28f8 virtinst/osdict.py
--- a/virtinst/osdict.py	Tue Jul 14 12:13:50 2009 -0400
+++ b/virtinst/osdict.py	Tue Jul 14 22:07:15 2009 -0400
@@ -174,6 +174,13 @@
                      }},
         "sles10": { "label": "Suse Linux Enterprise Server",
                     "distro": "suse" },
+        "sles11": { "label": "Suse Linux Enterprise Server 11",
+                    "distro": "suse",
+                      "devices" : {
+                        "disk" : { "bus"   : [ (["kvm"], "virtio") ] },
+                        "net"  : { "model" : [ (["kvm"], "virtio") ] },
+                    },
+                  },
         "debianetch": { "label": "Debian Etch", "distro": "debian" },
         "debianlenny": { "label": "Debian Lenny", "distro": "debian",
                       "devices" : {

virtinst-0.400.3-virtio-dev-limit.patch:
 VirtualDisk.py |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- NEW FILE virtinst-0.400.3-virtio-dev-limit.patch ---
# HG changeset patch
# User Cole Robinson <crobinso at redhat.com>
# Date 1252861553 14400
# Node ID 726dc69533961f5cf7865e35be2b851f5f686c52
# Parent  0d3cdc5ff5d091dd73d3ef0fe21123fb63b4d7a0
Don't erroneously limit the amount of virtio disks (bz 499654)

Just let qemu error if we add too many.

diff -r 0d3cdc5ff5d0 -r 726dc6953396 virtinst/VirtualDisk.py
--- a/virtinst/VirtualDisk.py	Wed Aug 05 14:37:02 2009 -0400
+++ b/virtinst/VirtualDisk.py	Sun Sep 13 13:05:53 2009 -0400
@@ -1142,12 +1142,14 @@
         the passed parameters.
         @returns: str prefix, or None if no reasonable guess can be made
         """
+        # The upper limits here aren't necessarilly 1024, but let the HV
+        # error as appropriate.
         if self.bus == "virtio":
-            return ("vd", 16)
+            return ("vd", 1024)
         elif self.bus == "scsi" or self.bus == "usb":
-            return ("sd", 16)
+            return ("sd", 1024)
         elif self.bus == "xen":
-            return ("xvd", 16)
+            return ("xvd", 1024)
         elif self.bus == "fdc" or self.device == self.DEVICE_FLOPPY:
             return ("fd", 2)
         elif self.bus == "ide":


Index: python-virtinst.spec
===================================================================
RCS file: /cvs/pkgs/rpms/python-virtinst/F-11/python-virtinst.spec,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -p -r1.69 -r1.70
--- python-virtinst.spec	6 May 2009 16:10:47 -0000	1.69
+++ python-virtinst.spec	13 Sep 2009 23:48:25 -0000	1.70
@@ -17,7 +17,7 @@
 Summary: Python modules and utilities for installing virtual machines
 Name: python-%{appname}
 Version: 0.400.3
-Release: 8%{_extra_release}
+Release: 9%{_extra_release}
 Source0: http://virt-manager.org/download/sources/%{appname}/%{appname}-%{version}.tar.gz
 Patch1: %{appname}-%{version}-fix-virtimage-scratch.patch
 Patch2: %{appname}-%{version}-hostdev-libvirt-calls.patch
@@ -33,6 +33,13 @@ Patch7: %{appname}-%{version}-updated-tr
 Patch8: %{appname}-%{version}-selinux-warn.patch
 # Fix PCI assignment detach/reset calls (bz 499267)
 Patch9: %{appname}-%{version}-fix-pci-assign.patch
+# Fix parse error when looking for default bridge (bz 506319)
+Patch10: %{appname}-%{version}-default-bridge-error.patch
+# Use virtio for SLES guests (bz 505317)
+Patch11: %{appname}-%{version}-sles-virtio.patch
+# Don't erroneously set limit for amount of virtio devices (bz 499654)
+Patch12: %{appname}-%{version}-virtio-dev-limit.patch
+
 License: GPLv2+
 Group: Development/Libraries
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -68,6 +75,9 @@ and install new VMs) and virt-clone (clo
 %patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch10 -p1
+%patch11 -p1
+%patch12 -p1
 
 %build
 python setup.py build
@@ -103,6 +113,11 @@ rm -rf $RPM_BUILD_ROOT
 %{_bindir}/virt-convert
 
 %changelog
+* Sun Sep 13 2009 Cole Robinson <crobinso at redhat.com> - 0.400.3-9.fc11
+- Fix parse error when looking for default bridge (bz 506319)
+- Use virtio for SLES guests (bz 505317)
+- Don't erroneously set limit for amount of virtio devices (bz 499654)
+
 * Wed May 06 2009 Cole Robinson <crobinso at redhat.com> - 0.400.3-8.fc11
 - Fix PCI assignment (bz 499267)
 




More information about the virt-maint mailing list