mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-08 21:18:04 +03:00
cli: Add disk type=nvme source properties
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
ffc48af4ee
commit
428948a690
@ -237,6 +237,12 @@
|
||||
<source dir="/"/>
|
||||
<target dev="vdt" bus="virtio"/>
|
||||
</disk>
|
||||
<disk type="nvme" device="disk">
|
||||
<source type="pci" managed="no" namespace="2">
|
||||
<address domain="1" bus="2" slot="0" function="0"/>
|
||||
</source>
|
||||
<target dev="vdu" bus="virtio"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="ich9-ehci1">
|
||||
<address type="pci" domain="0" bus="0" slot="4" function="7"/>
|
||||
</controller>
|
||||
|
@ -619,6 +619,7 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
|
||||
--disk path=%(EXISTIMG1)s,type=dir
|
||||
--disk path=/fooroot.img,size=.0001
|
||||
--disk source.dir=/
|
||||
--disk type=nvme,source.type=pci,source.managed=no,source.namespace=2,source.address.domain=0x0001,source.address.bus=0x02,source.address.slot=0x00,source.address.function=0x0
|
||||
|
||||
--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
|
||||
|
@ -3350,6 +3350,14 @@ class ParserDisk(VirtCLIParser):
|
||||
cls.add_arg("source.name", "source_name")
|
||||
cls.add_arg("source.protocol", "source_protocol")
|
||||
cls.add_arg("source.startupPolicy", "startup_policy")
|
||||
# type=nvme source props
|
||||
cls.add_arg("source.type", "source_type")
|
||||
cls.add_arg("source.namespace", "source_namespace")
|
||||
cls.add_arg("source.managed", "source_managed", is_onoff=True)
|
||||
cls.add_arg("source.address.domain", "source_address.domain")
|
||||
cls.add_arg("source.address.bus", "source_address.bus")
|
||||
cls.add_arg("source.address.slot", "source_address.slot")
|
||||
cls.add_arg("source.address.function", "source_address.function")
|
||||
|
||||
cls.add_arg("source.host[0-9]*.name", "name",
|
||||
find_inst_cb=cls.host_find_inst_cb)
|
||||
|
@ -13,7 +13,7 @@ from ..logger import log
|
||||
from .. import diskbackend
|
||||
from .. import progress
|
||||
from .. import xmlutil
|
||||
from .device import Device, DeviceSeclabel
|
||||
from .device import Device, DeviceAddress, DeviceSeclabel
|
||||
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
@ -40,6 +40,10 @@ class _Host(XMLBuilder):
|
||||
socket = XMLProperty("./@socket")
|
||||
|
||||
|
||||
class _DiskSourceAddress(DeviceAddress):
|
||||
pass
|
||||
|
||||
|
||||
class DeviceDisk(Device):
|
||||
XML_NAME = "disk"
|
||||
|
||||
@ -299,6 +303,7 @@ class DeviceDisk(Device):
|
||||
"source_volume", "source_pool", "source_protocol", "source_name",
|
||||
"source_host_name", "source_host_port",
|
||||
"source_host_transport", "source_host_socket",
|
||||
"source_type", "source_managed", "source_namespace", "source_address",
|
||||
"target", "bus",
|
||||
]
|
||||
|
||||
@ -427,6 +432,12 @@ class DeviceDisk(Device):
|
||||
source_host_transport = XMLProperty("./source/host/@transport")
|
||||
source_host_socket = XMLProperty("./source/host/@socket")
|
||||
|
||||
source_type = XMLProperty("./source/@type")
|
||||
source_managed = XMLProperty("./source/@managed", is_yesno=True)
|
||||
source_namespace = XMLProperty("./source/@namespace", is_int=True)
|
||||
source_address = XMLChildProperty(
|
||||
_DiskSourceAddress, is_single=True, relative_xpath="./source")
|
||||
|
||||
def _set_source_network_from_url(self, uri):
|
||||
from ..uri import URI
|
||||
uriobj = URI(uri)
|
||||
@ -696,7 +707,12 @@ class DeviceDisk(Device):
|
||||
return self.device == self.DEVICE_DISK
|
||||
|
||||
def can_be_empty(self):
|
||||
return self.is_floppy() or self.is_cdrom()
|
||||
if self.is_floppy() or self.is_cdrom():
|
||||
return True
|
||||
if self.type in ["file", "block", "dir", "volume", "network"]:
|
||||
return False
|
||||
# Don't error for unknown types
|
||||
return True
|
||||
|
||||
def _change_backend(self, path, vol_object, parent_pool):
|
||||
backend = diskbackend.StorageBackend(self.conn, path,
|
||||
|
Loading…
Reference in New Issue
Block a user