mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
tests: Switch away from set_create_storage
This commit is contained in:
parent
210ab4d8e0
commit
40a5ec75b7
@ -298,10 +298,10 @@ def make_pxe_installer():
|
||||
return virtinst.PXEInstaller(_conn)
|
||||
|
||||
|
||||
def build_win_kvm(path=None, fake=True):
|
||||
def build_win_kvm(path=None):
|
||||
g = get_basic_fullyvirt_guest("kvm")
|
||||
g.os_variant = "winxp"
|
||||
g.add_device(get_filedisk(path, fake=fake))
|
||||
g.add_device(get_filedisk(path))
|
||||
g.add_device(get_blkdisk())
|
||||
g.add_device(get_virtual_network())
|
||||
g.add_device(VirtualAudio(g.conn))
|
||||
@ -320,15 +320,18 @@ def get_floppy(path=None):
|
||||
return d
|
||||
|
||||
|
||||
def get_filedisk(path=None, fake=True):
|
||||
def get_filedisk(path=None):
|
||||
if not path:
|
||||
path = "/dev/default-pool/new-test-suite.img"
|
||||
d = VirtualDisk(_conn)
|
||||
d.path = path
|
||||
size = None
|
||||
if not fake:
|
||||
size = .000001
|
||||
d.set_create_storage(fake=fake, size=size)
|
||||
|
||||
if d.wants_storage_creation():
|
||||
parent_pool = d.get_parent_pool()
|
||||
vol_install = VirtualDisk.build_vol_install(_conn,
|
||||
os.path.basename(path), parent_pool, .0000001, True)
|
||||
d.set_vol_install(vol_install)
|
||||
|
||||
d.validate()
|
||||
return d
|
||||
|
||||
|
@ -943,7 +943,7 @@ class TestXMLConfig(unittest.TestCase):
|
||||
location="tests/cli-test-xml/fakerhel6tree")
|
||||
g = utils.get_basic_fullyvirt_guest("kvm", installer=i)
|
||||
g.add_device(utils.get_floppy())
|
||||
g.add_device(utils.get_filedisk("/dev/default-pool/rhel6.img", fake=False))
|
||||
g.add_device(utils.get_filedisk("/dev/default-pool/rhel6.img"))
|
||||
g.add_device(utils.get_blkdisk())
|
||||
g.add_device(utils.get_virtual_network())
|
||||
g.add_device(VirtualAudio(g.conn))
|
||||
@ -954,7 +954,7 @@ class TestXMLConfig(unittest.TestCase):
|
||||
|
||||
def testFullKVMWinxp(self):
|
||||
utils.set_conn(_plainkvm)
|
||||
g = utils.build_win_kvm("/dev/default-pool/winxp.img", fake=False)
|
||||
g = utils.build_win_kvm("/dev/default-pool/winxp.img")
|
||||
self._testInstall(g, "winxp-kvm-stage1",
|
||||
"winxp-kvm-stage3", "winxp-kvm-stage2")
|
||||
|
||||
|
@ -1568,7 +1568,7 @@ class ParserDisk(VirtCLIParser):
|
||||
StoragePool.build_default_pool(self.guest.conn)
|
||||
poolobj = self.guest.conn.storagePoolLookupByName(poolname)
|
||||
|
||||
if inst.path and not inst.source_exists():
|
||||
if inst.wants_storage_creation():
|
||||
newvolname = os.path.basename(inst.path)
|
||||
poolobj = inst.get_parent_pool()
|
||||
elif volname:
|
||||
|
@ -749,8 +749,12 @@ class VirtualDisk(VirtualDevice):
|
||||
# Need to retrigger this if self.type changed
|
||||
self._set_xmlpath(path)
|
||||
|
||||
def source_exists(self):
|
||||
return self._storage_backend.exists()
|
||||
def wants_storage_creation(self):
|
||||
"""
|
||||
If true, this disk needs storage creation parameters or things
|
||||
will error.
|
||||
"""
|
||||
return self.path and not self._storage_backend.exists()
|
||||
|
||||
def __managed_storage(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user