diskbackend: Treat /dev paths on remote connections as 'block'
Currently if the path isn't managed on a remote connection we treat it as file. Add this simple heuristic to improve the common case. https://bugzilla.redhat.com/show_bug.cgi?id=1726202 Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
5573aeb441
commit
8c0704a921
|
@ -0,0 +1,92 @@
|
|||
<domain type="test">
|
||||
<name>vm1</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="i686">hvm</type>
|
||||
<boot dev="network"/>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<features>
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset="utc"/>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<pm>
|
||||
<suspend-to-mem enabled="no"/>
|
||||
<suspend-to-disk enabled="no"/>
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/test-hv</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<source file="/foo/bar/baz"/>
|
||||
<target dev="hda" bus="ide"/>
|
||||
</disk>
|
||||
<disk type="block" device="disk">
|
||||
<source dev="/dev/zde"/>
|
||||
<target dev="hdb" bus="ide"/>
|
||||
</disk>
|
||||
<controller type="usb" model="ich9-ehci1"/>
|
||||
<controller type="usb" model="ich9-uhci1">
|
||||
<master startport="0"/>
|
||||
</controller>
|
||||
<controller type="usb" model="ich9-uhci2">
|
||||
<master startport="2"/>
|
||||
</controller>
|
||||
<controller type="usb" model="ich9-uhci3">
|
||||
<master startport="4"/>
|
||||
</controller>
|
||||
<interface type="user">
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<model type="e1000"/>
|
||||
</interface>
|
||||
<console type="pty"/>
|
||||
</devices>
|
||||
</domain>
|
||||
<domain type="test">
|
||||
<name>vm1</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="i686">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<features>
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset="utc"/>
|
||||
<pm>
|
||||
<suspend-to-mem enabled="no"/>
|
||||
<suspend-to-disk enabled="no"/>
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/test-hv</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<source file="/foo/bar/baz"/>
|
||||
<target dev="hda" bus="ide"/>
|
||||
</disk>
|
||||
<disk type="block" device="disk">
|
||||
<source dev="/dev/zde"/>
|
||||
<target dev="hdb" bus="ide"/>
|
||||
</disk>
|
||||
<controller type="usb" model="ich9-ehci1"/>
|
||||
<controller type="usb" model="ich9-uhci1">
|
||||
<master startport="0"/>
|
||||
</controller>
|
||||
<controller type="usb" model="ich9-uhci2">
|
||||
<master startport="2"/>
|
||||
</controller>
|
||||
<controller type="usb" model="ich9-uhci3">
|
||||
<master startport="4"/>
|
||||
</controller>
|
||||
<interface type="user">
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<model type="e1000"/>
|
||||
</interface>
|
||||
<console type="pty"/>
|
||||
</devices>
|
||||
</domain>
|
|
@ -931,9 +931,10 @@ c.add_invalid("--install fedora29 --unattended user-login=root", grep="as user-l
|
|||
|
||||
c = vinst.add_category("remote", "--connect %(URI-TEST-REMOTE)s --nographics --noautoconsole")
|
||||
c.add_valid("--nodisks --pxe") # Simple pxe nodisks
|
||||
c.add_valid("--pxe --disk /foo/bar/baz,size=.01") # Creating any random path on the remote host
|
||||
c.add_valid("--pxe --disk /dev/zde") # /dev file that we just pass through to the remote VM
|
||||
c.add_valid("--cdrom %(EXISTIMG1)s --disk none --livecd --dry") # remote cdrom install
|
||||
c.add_compare("--pxe "
|
||||
"--pxe --disk /foo/bar/baz,size=.01 " # Creating any random path on the remote host
|
||||
"--disk /dev/zde ", "remote-storage") # /dev file that we just pass through to the remote VM
|
||||
c.add_invalid("--pxe --disk /foo/bar/baz") # File that doesn't exist after auto storage setup
|
||||
c.add_invalid("--nodisks --location /tmp") # Use of --location
|
||||
c.add_invalid("--file /foo/bar/baz --pxe") # Trying to use unmanaged storage without size argument
|
||||
|
|
|
@ -203,7 +203,14 @@ def _get_dev_type(path, vol_xml, vol_object, pool_xml, remote):
|
|||
if path_is_url(path):
|
||||
return "network"
|
||||
|
||||
if not remote:
|
||||
if remote:
|
||||
if not _can_auto_manage(path):
|
||||
# Just a heurisitic, if this path is one of the ones
|
||||
# we don't try to auto-import, then consider it a
|
||||
# block device, because managing those correctly is difficult
|
||||
return "block"
|
||||
|
||||
else:
|
||||
if os.path.isdir(path):
|
||||
return "dir"
|
||||
elif _stat_is_block(path):
|
||||
|
|
Loading…
Reference in New Issue