Make is_blktap_capable take a connection
So we don't perform the check if we're using a remote connection
This commit is contained in:
parent
ba3aa9ecca
commit
3005382e0d
|
@ -24,7 +24,7 @@ from tests import utils
|
|||
# Access to protected member, needed to unittest stuff
|
||||
|
||||
# Force certain helpers to return consistent values
|
||||
virtinst.util.is_blktap_capable = lambda: False
|
||||
virtinst.util.is_blktap_capable = lambda ignore: False
|
||||
virtinst.util.default_bridge = lambda ignore1: ["bridge", "eth0"]
|
||||
|
||||
# Setup logging
|
||||
|
|
|
@ -139,7 +139,7 @@ class TestXMLConfig(unittest.TestCase):
|
|||
def testBootParavirtDiskFileBlktapCapable(self):
|
||||
oldblktap = virtinst.util.is_blktap_capable
|
||||
try:
|
||||
virtinst.util.is_blktap_capable = lambda: True
|
||||
virtinst.util.is_blktap_capable = lambda ignore: True
|
||||
g = utils.get_basic_paravirt_guest()
|
||||
g.add_device(utils.get_filedisk())
|
||||
self._compare(g, "boot-paravirt-disk-drv-tap", False)
|
||||
|
|
|
@ -1336,7 +1336,7 @@ class vmmAddHardware(vmmGObjectUI):
|
|||
|
||||
if (disk.type == virtinst.VirtualDisk.TYPE_FILE and
|
||||
not self.vm.is_hvm() and
|
||||
virtinst.util.is_blktap_capable()):
|
||||
virtinst.util.is_blktap_capable(self.conn.get_backend())):
|
||||
disk.driver_name = virtinst.VirtualDisk.DRIVER_TAP
|
||||
|
||||
except Exception, e:
|
||||
|
|
|
@ -1309,8 +1309,8 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
# Default file backed PV guests to tap driver
|
||||
for d in devlist_func(VirtualDevice.VIRTUAL_DEV_DISK):
|
||||
if (d.type == VirtualDisk.TYPE_FILE
|
||||
and util.is_blktap_capable()
|
||||
and d.driver_name is None):
|
||||
and d.driver_name is None
|
||||
and util.is_blktap_capable(self.conn)):
|
||||
d.driver_name = VirtualDisk.DRIVER_TAP
|
||||
|
||||
for d in devlist_func(VirtualDevice.VIRTUAL_DEV_INPUT):
|
||||
|
|
|
@ -393,7 +393,11 @@ def default_connection():
|
|||
return None
|
||||
|
||||
|
||||
def is_blktap_capable():
|
||||
def is_blktap_capable(conn):
|
||||
# Ideally we would get this from libvirt capabilities XML
|
||||
if conn.is_remote():
|
||||
return False
|
||||
|
||||
f = open("/proc/modules")
|
||||
lines = f.readlines()
|
||||
f.close()
|
||||
|
|
Loading…
Reference in New Issue