mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-manager: Throw appropriate error when fs target string already exists.
In case of qemu for default fs type (mount) target is not actually a directory, it is merely a arbitrary string tag that is exported to the guest as a hint for where to mount. This tag is unique and is exported as a virito-9p-pci device and hence this patch adds check to ensure the target string/tag is never entered duplicate by the user when adding 2 or more filesystem devices. Signed-off-by: Deepak C Shetty <deepakcs@linux.vnet.ibm.com>
This commit is contained in:
parent
f96796dda3
commit
ea4f6f4ed3
@ -1380,6 +1380,10 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
if not target:
|
||||
return self.err.val_err(_("A filesystem target must be specified"))
|
||||
|
||||
if self.conn.is_qemu() and self.filesystem_target_present(target):
|
||||
return self.err.val_err(_('Invalid target path. A filesystem with'
|
||||
' that target already exists'))
|
||||
|
||||
try:
|
||||
self._dev = virtinst.VirtualFilesystem(conn=conn)
|
||||
self._dev.source = source
|
||||
@ -1391,6 +1395,15 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
except Exception, e:
|
||||
return self.err.val_err(_("Filesystem parameter error"), e)
|
||||
|
||||
def filesystem_target_present(self, target):
|
||||
fsdevs = self.vm.get_filesystem_devices()
|
||||
|
||||
for fs in fsdevs:
|
||||
if (fs.target == target):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def validate_page_smartcard(self):
|
||||
conn = self.conn.vmm
|
||||
mode = self.get_config_smartcard_mode()
|
||||
|
Loading…
Reference in New Issue
Block a user