mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-23 17:34:21 +03:00
virtinst: disk: strip away file://
protocol
This commit is contained in:
parent
5fcf506e08
commit
ba3a098c3b
@ -929,6 +929,7 @@ c = vinst.add_category("storage", "--pxe --nographics --noautoconsole --hvm --os
|
||||
c.add_valid("--disk %(COLLIDE)s --check path_in_use=off") # Colliding storage with --check
|
||||
c.add_valid("--disk %(COLLIDE)s --force") # Colliding storage with --force
|
||||
c.add_valid("--disk %(NEWIMG1)s,sparse=true,size=100000000 --check disk_size=off") # Don't warn about fully allocated file exceeding disk space
|
||||
c.add_valid("--disk file://%(NEWIMG1)s,size=1") # Check that 'file://' prefix is removed correctly
|
||||
c.add_invalid("--disk /dev/zero --nodisks", grep="Cannot specify storage and use --nodisks")
|
||||
c.add_invalid("--file %(NEWIMG1)s --file-size 100000 --nonsparse", grep="There is not enough free space") # Nonexisting file, size too big
|
||||
c.add_invalid("--file %(NEWIMG1)s --file-size 100000", grep="The requested volume capacity will exceed the") # Huge file, sparse, but no prompting
|
||||
|
@ -636,6 +636,11 @@ class DeviceDisk(Device):
|
||||
return self._storage_backend.get_path()
|
||||
|
||||
def set_source_path(self, newpath):
|
||||
# Some file managers use 'file://' when passing files to
|
||||
# virt-manager, we need to strip it from the newpath.
|
||||
if newpath is not None:
|
||||
newpath = newpath.removeprefix("file://")
|
||||
|
||||
if self._storage_backend.will_create_storage():
|
||||
raise xmlutil.DevError(
|
||||
"Can't change disk path if storage creation info "
|
||||
|
Loading…
Reference in New Issue
Block a user