mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
cli: Add --disk source.file, source.dir, source.dev
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
65a39a7495
commit
ffc48af4ee
@ -38,9 +38,9 @@
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-kvm</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<disk type="block" device="disk">
|
||||
<driver name="qemu" type="raw" cache="writeback" io="threads" iothread="3"/>
|
||||
<source file="/dev/default-pool/UPPER"/>
|
||||
<source dev="/dev/default-pool/UPPER"/>
|
||||
<target dev="vda" bus="virtio"/>
|
||||
<serial>WD-WMAP9A966149</serial>
|
||||
<wwn>123456789abcdefa</wwn>
|
||||
@ -232,6 +232,11 @@
|
||||
<source file="/fooroot.img"/>
|
||||
<target dev="vds" bus="virtio"/>
|
||||
</disk>
|
||||
<disk type="dir" device="disk">
|
||||
<driver name="qemu"/>
|
||||
<source dir="/"/>
|
||||
<target dev="vdt" bus="virtio"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="ich9-ehci1">
|
||||
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
|
||||
</controller>
|
||||
|
@ -591,8 +591,8 @@ vcpus.vcpu1.id=2,vcpus.vcpu1.enabled=yes
|
||||
--cpu none
|
||||
--iothreads 5
|
||||
|
||||
--disk /dev/default-pool/UPPER,cache=writeback,io=threads,perms=sh,serial=WD-WMAP9A966149,wwn=123456789abcdefa,boot_order=2,driver.iothread=3
|
||||
--disk %(NEWIMG1)s,sparse=false,size=.001,perms=ro,error_policy=enospace,discard=unmap,detect_zeroes=unmap,address.type=drive,address.controller=0,address.target=2,address.unit=0
|
||||
--disk type=block,source.dev=/dev/default-pool/UPPER,cache=writeback,io=threads,perms=sh,serial=WD-WMAP9A966149,wwn=123456789abcdefa,boot_order=2,driver.iothread=3
|
||||
--disk source.file=%(NEWIMG1)s,sparse=false,size=.001,perms=ro,error_policy=enospace,discard=unmap,detect_zeroes=unmap,address.type=drive,address.controller=0,address.target=2,address.unit=0
|
||||
--disk device=cdrom,bus=sata,read_bytes_sec=1,read_iops_sec=2,write_bytes_sec=5,write_iops_sec=6,driver.copy_on_read=on,geometry.cyls=16383,geometry.heads=16,geometry.secs=63,geometry.trans=lba
|
||||
--disk size=1
|
||||
--disk /iscsi-pool/diskvol1,total_bytes_sec=10,total_iops_sec=20,bus=scsi,device=lun,sgio=unfiltered,rawio=yes
|
||||
@ -618,6 +618,7 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
|
||||
--disk size=.0001,pool=disk-pool
|
||||
--disk path=%(EXISTIMG1)s,type=dir
|
||||
--disk path=/fooroot.img,size=.0001
|
||||
--disk source.dir=/
|
||||
|
||||
--network user,mac=12:34:56:78:11:22,portgroup=foo,link_state=down,rom_bar=on,rom_file=/tmp/foo
|
||||
--network bridge=foobar,model=virtio,driver_name=qemu,driver_queues=3,filterref=foobar,rom.bar=off,rom.file=/some/rom,source.portgroup=foo
|
||||
|
@ -3342,6 +3342,9 @@ class ParserDisk(VirtCLIParser):
|
||||
cls.add_arg("cache", "driver_cache", cb=cls.noset_cb)
|
||||
|
||||
# More standard XML props
|
||||
cls.add_arg("source.dir", "source_dir")
|
||||
cls.add_arg("source.file", "source_file")
|
||||
cls.add_arg("source.dev", "source_dev")
|
||||
cls.add_arg("source.pool", "source_pool")
|
||||
cls.add_arg("source.volume", "source_volume")
|
||||
cls.add_arg("source.name", "source_name")
|
||||
|
@ -294,7 +294,7 @@ class DeviceDisk(Device):
|
||||
"driver_name", "driver_type",
|
||||
"driver_cache", "driver_discard", "driver_detect_zeroes",
|
||||
"driver_io", "error_policy",
|
||||
"_source_file", "_source_dev", "_source_dir",
|
||||
"source_file", "source_dev", "source_dir",
|
||||
"auth_username", "auth_secret_type", "auth_secret_uuid",
|
||||
"source_volume", "source_pool", "source_protocol", "source_name",
|
||||
"source_host_name", "source_host_port",
|
||||
@ -406,9 +406,9 @@ class DeviceDisk(Device):
|
||||
# XML source media handling #
|
||||
#############################
|
||||
|
||||
_source_file = XMLProperty("./source/@file")
|
||||
_source_dev = XMLProperty("./source/@dev")
|
||||
_source_dir = XMLProperty("./source/@dir")
|
||||
source_file = XMLProperty("./source/@file")
|
||||
source_dev = XMLProperty("./source/@dev")
|
||||
source_dir = XMLProperty("./source/@dir")
|
||||
|
||||
source_pool = XMLProperty("./source/@pool")
|
||||
source_volume = XMLProperty("./source/@volume")
|
||||
@ -526,9 +526,9 @@ class DeviceDisk(Device):
|
||||
"""
|
||||
Unset all XML properties that describe the actual source media
|
||||
"""
|
||||
self._source_file = None
|
||||
self._source_dev = None
|
||||
self._source_dir = None
|
||||
self.source_file = None
|
||||
self.source_dev = None
|
||||
self.source_dir = None
|
||||
self.source_volume = None
|
||||
self.source_pool = None
|
||||
self.source_name = None
|
||||
@ -541,11 +541,11 @@ class DeviceDisk(Device):
|
||||
def _disk_type_to_object_prop_name(self):
|
||||
disk_type = self.type
|
||||
if disk_type == DeviceDisk.TYPE_BLOCK:
|
||||
return "_source_dev"
|
||||
return "source_dev"
|
||||
elif disk_type == DeviceDisk.TYPE_DIR:
|
||||
return "_source_dir"
|
||||
return "source_dir"
|
||||
elif disk_type == DeviceDisk.TYPE_FILE:
|
||||
return "_source_file"
|
||||
return "source_file"
|
||||
return None
|
||||
|
||||
|
||||
@ -553,12 +553,12 @@ class DeviceDisk(Device):
|
||||
# they don't have any special properties aside from needing to match
|
||||
# 'type' value with the source property used.
|
||||
def _get_xmlpath(self):
|
||||
if self._source_file:
|
||||
return self._source_file
|
||||
if self._source_dev:
|
||||
return self._source_dev
|
||||
if self._source_dir:
|
||||
return self._source_dir
|
||||
if self.source_file:
|
||||
return self.source_file
|
||||
if self.source_dev:
|
||||
return self.source_dev
|
||||
if self.source_dir:
|
||||
return self.source_dir
|
||||
return None
|
||||
def _set_xmlpath(self, val):
|
||||
self._clear_source_xml()
|
||||
|
@ -185,10 +185,9 @@ class Installer(object):
|
||||
guest.add_device(self._unattended_install_cdrom_device)
|
||||
|
||||
if self.conn.in_testsuite():
|
||||
# pylint: disable=protected-access
|
||||
# Hack to set just the XML path differently for the test suite.
|
||||
# Setting this via regular 'path' will error that it doesn't exist
|
||||
dev._source_file = _make_testsuite_path(location)
|
||||
dev.source_file = _make_testsuite_path(location)
|
||||
|
||||
def _remove_unattended_install_cdrom_device(self, guest):
|
||||
dummy = guest
|
||||
|
Loading…
Reference in New Issue
Block a user