mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-install: support network --disk's
Handle type=network in devicedisk.py, and wire up all the network fields for virt-install --disk. Right now it requires manually spelling out all the protocol, name, host/port etc fields. The one 'magic' bit is that VirtualDisk.path will be a pretty URL when all those network fields are specified. This is keeps things mostly working in various parts of the code where we expect 'path' to be an identifier for a VirtualDisk.
This commit is contained in:
@@ -77,6 +77,18 @@
|
||||
<source volume="some-rbd-vol" pool="rbd-ceph"/>
|
||||
<target dev="hdd" bus="ide"/>
|
||||
</disk>
|
||||
<disk type="network" device="disk">
|
||||
<source protocol="http" name="/path/to/my/file">
|
||||
<host name="example.com" port="8000"/>
|
||||
</source>
|
||||
<target dev="sdb" bus="scsi"/>
|
||||
</disk>
|
||||
<disk type="network" device="disk">
|
||||
<source protocol="nbd">
|
||||
<host transport="unix" socket="/tmp/socket"/>
|
||||
</source>
|
||||
<target dev="sdc" bus="scsi"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="ich9-ehci1">
|
||||
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
|
||||
</controller>
|
||||
@@ -226,6 +238,18 @@
|
||||
<source volume="some-rbd-vol" pool="rbd-ceph"/>
|
||||
<target dev="hdd" bus="ide"/>
|
||||
</disk>
|
||||
<disk type="network" device="disk">
|
||||
<source protocol="http" name="/path/to/my/file">
|
||||
<host name="example.com" port="8000"/>
|
||||
</source>
|
||||
<target dev="sdb" bus="scsi"/>
|
||||
</disk>
|
||||
<disk type="network" device="disk">
|
||||
<source protocol="nbd">
|
||||
<host transport="unix" socket="/tmp/socket"/>
|
||||
</source>
|
||||
<target dev="sdc" bus="scsi"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="ich9-ehci1">
|
||||
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
|
||||
</controller>
|
||||
|
||||
@@ -562,6 +562,8 @@ c.add_compare("""--hvm --pxe \
|
||||
--disk device=cdrom,bus=sata,read_bytes_sec=1,read_iops_sec=2,total_bytes_sec=10,total_iops_sec=20,write_bytes_sec=5,write_iops_sec=6 \
|
||||
--disk size=1 \
|
||||
--disk source_pool=rbd-ceph,source_volume=some-rbd-vol \
|
||||
--disk source_protocol=http,source_host_name=example.com,source_host_port=8000,source_name=/path/to/my/file,bus=scsi \
|
||||
--disk source_protocol=nbd,source_host_transport=unix,source_host_socket=/tmp/socket,bus=scsi \
|
||||
--serial tcp,host=:2222,mode=bind,protocol=telnet \
|
||||
--filesystem /source,/target,mode=squash \
|
||||
--network user,mac=12:34:56:78:11:22,portgroup=foo \
|
||||
|
||||
@@ -68,6 +68,22 @@
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<disk type='network' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source protocol='rbd' name='pool/image'>
|
||||
<host name='mon1.example.org' port='6321'/>
|
||||
<host name='mon2.example.org' port='6322'/>
|
||||
<host name='mon3.example.org' port='6322'/>
|
||||
</source>
|
||||
<target dev='vdc' bus='virtio'/>
|
||||
</disk>
|
||||
<disk type='network' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source protocol='nbd'>
|
||||
<host transport='unix' socket='/var/run/nbdsock'/>
|
||||
</source>
|
||||
<target dev='vdd' bus='virtio'/>
|
||||
</disk>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/>
|
||||
<console type="pty"/>
|
||||
|
||||
@@ -36,9 +36,12 @@
|
||||
<source dev="/dev/null"/>
|
||||
<target dev="hdd" bus="ide"/>
|
||||
</disk>
|
||||
<disk type="block" device="cdrom">
|
||||
<disk type="network" device="cdrom">
|
||||
<target dev="sda" bus="scsi"/>
|
||||
<readonly/>
|
||||
<source protocol="http" name="/my/file">
|
||||
<host name="exaaaaample.com"/>
|
||||
</source>
|
||||
</disk>
|
||||
<disk type="file" device="floppy">
|
||||
<target dev="fda" bus="fdc"/>
|
||||
@@ -66,10 +69,26 @@
|
||||
</disk>
|
||||
<disk type="volume" device="disk">
|
||||
<driver name="qemu"/>
|
||||
<source pool="anotherPool" volume="foobar"/>
|
||||
<source pool="anotherPool" volume="newvol"/>
|
||||
<target dev="vdb" bus="virtio"/>
|
||||
<readonly/>
|
||||
</disk>
|
||||
<disk type="network" device="disk">
|
||||
<driver name="qemu" type="raw"/>
|
||||
<source protocol="gluster" name="new-val/vol">
|
||||
<host name="diff.example.org" port="1234"/>
|
||||
<host name="mon2.example.org" port="6322"/>
|
||||
<host name="mon3.example.org" port="6322"/>
|
||||
</source>
|
||||
<target dev="vdc" bus="virtio"/>
|
||||
</disk>
|
||||
<disk type="network" device="disk">
|
||||
<driver name="qemu" type="raw"/>
|
||||
<source protocol="nbd">
|
||||
<host transport="unix" socket="/var/run/nbdsock"/>
|
||||
</source>
|
||||
<target dev="vdd" bus="virtio"/>
|
||||
</disk>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<graphics type="vnc" display=":3.4" xauth="/tmp/.Xauthority"/>
|
||||
<console type="pty"/>
|
||||
|
||||
@@ -347,6 +347,14 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("bus", "ide", "fdc")
|
||||
check("error_policy", "stop", None)
|
||||
|
||||
disk = _get_disk("sda")
|
||||
check = self._make_checker(disk)
|
||||
check("source_protocol", None, "http")
|
||||
check("source_name", None, "/my/file")
|
||||
check("source_host_name", None, "exaaaaample.com")
|
||||
disk.sync_path_props()
|
||||
check("path", "http://exaaaaample.com/my/file")
|
||||
|
||||
disk = _get_disk("fda")
|
||||
check = self._make_checker(disk)
|
||||
check("path", None, "/dev/default-pool/default-vol")
|
||||
@@ -369,6 +377,22 @@ class XMLParseTest(unittest.TestCase):
|
||||
disk = _get_disk("vdb")
|
||||
check = self._make_checker(disk)
|
||||
check("source_pool", "defaultPool", "anotherPool")
|
||||
check("source_volume", "foobar", "newvol")
|
||||
|
||||
disk = _get_disk("vdc")
|
||||
check = self._make_checker(disk)
|
||||
check("source_protocol", "rbd", "gluster")
|
||||
check("source_name", "pool/image", "new-val/vol")
|
||||
check("source_host_name", "mon1.example.org", "diff.example.org")
|
||||
check("source_host_port", 6321, 1234)
|
||||
check("path", "gluster://diff.example.org:1234/new-val/vol")
|
||||
|
||||
disk = _get_disk("vdd")
|
||||
check = self._make_checker(disk)
|
||||
check("source_protocol", "nbd")
|
||||
check("source_host_transport", "unix")
|
||||
check("source_host_socket", "/var/run/nbdsock")
|
||||
check("path", "nbd+unix:///var/run/nbdsock")
|
||||
|
||||
self._alter_compare(guest.get_xml_config(), outfile)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user