mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
storage: test default_target_path
This commit is contained in:
parent
199e9593bf
commit
fd8847c24e
@ -1,12 +1,12 @@
|
||||
<volume type="file">
|
||||
<name>pool-dir-volclone</name>
|
||||
<key>/some/target/path/pool-dir-vol</key>
|
||||
<key>/var/lib/libvirt/images/pool-dir/pool-dir-vol</key>
|
||||
<source>
|
||||
</source>
|
||||
<capacity unit="bytes">10737418240</capacity>
|
||||
<allocation unit="bytes">5368709120</allocation>
|
||||
<target>
|
||||
<path>/some/target/path/pool-dir-vol</path>
|
||||
<path>/var/lib/libvirt/images/pool-dir/pool-dir-vol</path>
|
||||
<format type="raw"/>
|
||||
<permissions>
|
||||
<mode>0700</mode>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<pool type="dir">
|
||||
<name>pool-dir</name>
|
||||
<target>
|
||||
<path>/some/target/path</path>
|
||||
<path>/var/lib/libvirt/images/pool-dir</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
@ -1,12 +1,12 @@
|
||||
<volume type="file">
|
||||
<name>pool-fs-volclone</name>
|
||||
<key>/some/target/path/pool-fs-vol</key>
|
||||
<key>/var/lib/libvirt/images/pool-fs/pool-fs-vol</key>
|
||||
<source>
|
||||
</source>
|
||||
<capacity unit="bytes">10737418240</capacity>
|
||||
<allocation unit="bytes">5368709120</allocation>
|
||||
<target>
|
||||
<path>/some/target/path/pool-fs-vol</path>
|
||||
<path>/var/lib/libvirt/images/pool-fs/pool-fs-vol</path>
|
||||
<format type="raw"/>
|
||||
<permissions>
|
||||
<mode>0700</mode>
|
||||
|
@ -5,6 +5,6 @@
|
||||
<device path="/some/source/path"/>
|
||||
</source>
|
||||
<target>
|
||||
<path>/some/target/path</path>
|
||||
<path>/var/lib/libvirt/images/pool-fs</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
@ -8,6 +8,6 @@
|
||||
</initiator>
|
||||
</source>
|
||||
<target>
|
||||
<path>/some/target/path</path>
|
||||
<path>/dev/disk/by-path</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
@ -5,6 +5,6 @@
|
||||
<name>vgname</name>
|
||||
</source>
|
||||
<target>
|
||||
<path>/some/target/path</path>
|
||||
<path>/dev/pool-logical-srcname</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<pool type="mpath">
|
||||
<name>pool-mpath</name>
|
||||
<target>
|
||||
<path>/some/target/path</path>
|
||||
<path>/dev/mapper</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
@ -1,12 +1,12 @@
|
||||
<volume type="file">
|
||||
<name>pool-netfs-volclone</name>
|
||||
<key>/some/target/path/pool-netfs-vol</key>
|
||||
<key>/var/lib/libvirt/images/pool-netfs/pool-netfs-vol</key>
|
||||
<source>
|
||||
</source>
|
||||
<capacity unit="bytes">10737418240</capacity>
|
||||
<allocation unit="bytes">5368709120</allocation>
|
||||
<target>
|
||||
<path>/some/target/path/pool-netfs-vol</path>
|
||||
<path>/var/lib/libvirt/images/pool-netfs/pool-netfs-vol</path>
|
||||
<format type="raw"/>
|
||||
<permissions>
|
||||
<mode>0700</mode>
|
||||
|
@ -6,6 +6,6 @@
|
||||
<dir path="/some/source/path"/>
|
||||
</source>
|
||||
<target>
|
||||
<path>/some/target/path</path>
|
||||
<path>/var/lib/libvirt/images/pool-netfs</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
@ -4,6 +4,6 @@
|
||||
<adapter name="/some/source/path"/>
|
||||
</source>
|
||||
<target>
|
||||
<path>/some/target/path</path>
|
||||
<path>/dev/disk/by-path</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
@ -33,7 +33,8 @@ def createPool(conn, ptype, poolname=None, fmt=None, target_path=None,
|
||||
if pool_inst.supports_source_path():
|
||||
pool_inst.source_path = source_path or "/some/source/path"
|
||||
if pool_inst.supports_target_path():
|
||||
pool_inst.target_path = target_path or "/some/target/path"
|
||||
pool_inst.target_path = (target_path or
|
||||
pool_inst.default_target_path())
|
||||
if fmt and pool_inst.supports_format():
|
||||
pool_inst.format = fmt
|
||||
if pool_inst.supports_source_name():
|
||||
@ -160,7 +161,8 @@ class TestStorage(unittest.TestCase):
|
||||
def testDiskPool(self):
|
||||
poolobj = createPool(self.conn,
|
||||
StoragePool.TYPE_DISK,
|
||||
"pool-disk", fmt="auto")
|
||||
"pool-disk", fmt="auto",
|
||||
target_path="/some/target/path")
|
||||
invol = createVol(self.conn, poolobj)
|
||||
createVol(self.conn, poolobj,
|
||||
volname=invol.name() + "input", input_vol=invol)
|
||||
@ -209,6 +211,10 @@ class TestStorage(unittest.TestCase):
|
||||
diskvol.pool = diskpool
|
||||
self.assertTrue(diskvol.supports_format() is False)
|
||||
|
||||
diskpoolxml = StoragePool(fullconn)
|
||||
diskpoolxml.type = "disk"
|
||||
self.assertEqual(diskpoolxml.default_target_path(), "/dev")
|
||||
|
||||
glusterpool.destroy()
|
||||
StoragePool.ensure_pool_is_running(glusterpool)
|
||||
|
||||
|
@ -8,6 +8,6 @@
|
||||
</initiator>
|
||||
</source>
|
||||
<target>
|
||||
<path>/some/target/path</path>
|
||||
<path>/dev/disk/by-path</path>
|
||||
</target>
|
||||
</pool>
|
||||
|
@ -268,7 +268,6 @@ class StoragePool(_StorageObject):
|
||||
return _DEFAULT_SCSI_TARGET
|
||||
if self.type == self.TYPE_MPATH:
|
||||
return _DEFAULT_MPATH_TARGET
|
||||
raise RuntimeError("No default target_path for type=%s" % self.type)
|
||||
|
||||
def _type_to_source_prop(self):
|
||||
if (self.type == self.TYPE_NETFS or
|
||||
|
Loading…
Reference in New Issue
Block a user