virtinst: add support for disk type="volume"
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
69b131f81f
commit
cce5827195
|
@ -9,7 +9,7 @@
|
|||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
@@ -333,4 +328,5 @@
|
||||
@@ -339,4 +334,5 @@
|
||||
<address type="isa" iobase="0x505"/>
|
||||
</panic>
|
||||
</devices>
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<clock offset="utc">
|
||||
<timer name="rtc" tickpolicy="catchup"/>
|
||||
<timer name="pit" tickpolicy="delay"/>
|
||||
@@ -333,4 +316,5 @@
|
||||
@@ -339,4 +322,5 @@
|
||||
<address type="isa" iobase="0x505"/>
|
||||
</panic>
|
||||
</devices>
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<boot order="1"/>
|
||||
+ <readonly/>
|
||||
</disk>
|
||||
<disk type="block" device="disk">
|
||||
<source dev="/dev/default-pool/overlay.img"/>
|
||||
<disk type="volume" device="disk">
|
||||
<driver name="qemu"/>
|
||||
|
||||
Domain 'test-many-devices' defined successfully.
|
||||
Changes will take effect after the next domain shutdown.
|
|
@ -12,7 +12,7 @@
|
|||
<memory unit="KiB">409600</memory>
|
||||
<currentMemory unit="KiB">204800</currentMemory>
|
||||
<blkiotune>
|
||||
@@ -333,4 +333,5 @@
|
||||
@@ -339,4 +339,5 @@
|
||||
<address type="isa" iobase="0x505"/>
|
||||
</panic>
|
||||
</devices>
|
||||
|
|
|
@ -174,6 +174,12 @@
|
|||
<source startupPolicy='requisite'/>
|
||||
<target dev='hdb' bus='ide'/>
|
||||
</disk>
|
||||
<disk type="volume" device="disk">
|
||||
<driver name="qemu"/>
|
||||
<source pool="pool" volume="foobarvolume"/>
|
||||
<target dev="hdc" bus="virtio"/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
|
||||
|
||||
<!-- interfaces -->
|
||||
|
|
|
@ -62,6 +62,12 @@
|
|||
<source dev="/dev/null"/>
|
||||
<target dev="vda" bus="virtio"/>
|
||||
</disk>
|
||||
<disk type='volume' device='disk'>
|
||||
<driver name='qemu'/>
|
||||
<source pool='defaultPool' volume='foobar'/>
|
||||
<target dev='vda' bus='virtio'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/>
|
||||
<console type="pty"/>
|
||||
|
|
|
@ -64,6 +64,12 @@
|
|||
<source dev="/dev/null"/>
|
||||
<target dev="vda" bus="virtio"/>
|
||||
</disk>
|
||||
<disk type="volume" device="disk">
|
||||
<driver name="qemu"/>
|
||||
<source pool="anotherPool" volume="foobar"/>
|
||||
<target dev="vda" bus="virtio"/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/>
|
||||
<console type="pty"/>
|
||||
|
|
|
@ -331,6 +331,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
disk3.size = 1
|
||||
disk6 = disks[5]
|
||||
disk6.size = 1
|
||||
disk9 = disks[8]
|
||||
|
||||
check = self._make_checker(disk1)
|
||||
check("path", "/tmp/test.img", "/dev/null")
|
||||
|
@ -370,6 +371,9 @@ class XMLParseTest(unittest.TestCase):
|
|||
check = self._make_checker(disk6.boot)
|
||||
check("order", None, 7, None)
|
||||
|
||||
check = self._make_checker(disk9)
|
||||
check("sourcePool", "defaultPool", "anotherPool")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
|
||||
def testSingleDisk(self):
|
||||
|
|
|
@ -182,7 +182,8 @@ class VirtualDisk(VirtualDevice):
|
|||
TYPE_FILE = "file"
|
||||
TYPE_BLOCK = "block"
|
||||
TYPE_DIR = "dir"
|
||||
types = [TYPE_FILE, TYPE_BLOCK, TYPE_DIR]
|
||||
TYPE_VOLUME = "volume"
|
||||
types = [TYPE_FILE, TYPE_BLOCK, TYPE_DIR, TYPE_VOLUME]
|
||||
|
||||
IO_MODE_NATIVE = "native"
|
||||
IO_MODE_THREADS = "threads"
|
||||
|
@ -214,6 +215,8 @@ class VirtualDisk(VirtualDevice):
|
|||
return "dev"
|
||||
elif disk_type == VirtualDisk.TYPE_DIR:
|
||||
return "dir"
|
||||
elif disk_type == VirtualDisk.TYPE_VOLUME:
|
||||
return "volume"
|
||||
return "file"
|
||||
|
||||
@staticmethod
|
||||
|
@ -606,6 +609,7 @@ class VirtualDisk(VirtualDevice):
|
|||
clear_first=["./source/@" + target for target in
|
||||
_TARGET_PROPS])
|
||||
|
||||
sourcePool = XMLProperty("./source/@pool")
|
||||
sourceStartupPolicy = XMLProperty("./source/@startupPolicy")
|
||||
device = XMLProperty("./@device",
|
||||
default_cb=lambda s: s.DEVICE_DISK)
|
||||
|
|
Loading…
Reference in New Issue