
Reviewed-by: Aline Manera <alinefm@linux.vnet.ibm.com> The UI should be updated according to those changes too, ie, remove the filter (you did it in the previous patch), add the warn message etc On 12/05/2015 11:58, CrÃstian Deives wrote:
As discussed in an e-mail thread (http://lists.ovirt.org/pipermail/kimchi-devel/2015-March/010154.html), we should stop blocking the user from creating VM storages when the storage has already been added to some VM. The UI may display a warning when that cases happens so the user should decide what to do.
Remove check on 'used_by' when creating a VM storage.
Signed-off-by: CrÃstian Deives <cristiandeives@gmail.com> --- src/kimchi/i18n.py | 1 - src/kimchi/model/vmstorages.py | 2 -- tests/test_model.py | 6 ++++++ 3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/kimchi/i18n.py b/src/kimchi/i18n.py index 18e84bc..6b4726c 100644 --- a/src/kimchi/i18n.py +++ b/src/kimchi/i18n.py @@ -285,7 +285,6 @@ messages = { "KCHVMSTOR0013E": _("Specify path to update virtual machine disk"), "KCHVMSTOR0014E": _("Controller type %(type)s limitation of %(limit)s devices reached"), "KCHVMSTOR0015E": _("Cannot retrieve disk path information for given pool/volume: %(error)s"), - "KCHVMSTOR0016E": _("Volume already in use by other virtual machine."), "KCHVMSTOR0017E": _("Only one of path or pool/volume can be specified to add a new virtual machine disk"), "KCHVMSTOR0018E": _("Volume chosen with format %(format)s does not fit in the storage type %(type)s"),
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py index d3d4a8b..87cd6c8 100644 --- a/src/kimchi/model/vmstorages.py +++ b/src/kimchi/model/vmstorages.py @@ -111,8 +111,6 @@ class VMStoragesModel(object): raise InvalidParameter("KCHVMSTOR0012E") except Exception as e: raise InvalidParameter("KCHVMSTOR0015E", {'error': e}) - if len(vol_info['used_by']) != 0: - raise InvalidParameter("KCHVMSTOR0016E")
valid_format = { "disk": ["raw", "bochs", "qcow", "qcow2", "qed", "vmdk"], diff --git a/tests/test_model.py b/tests/test_model.py index 88c020e..be00fe1 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -449,6 +449,12 @@ class ModelTests(unittest.TestCase): inst.vm_start(vm_name) disk = _attach_disk()
+ # make sure a disk can be attached more than once + prev_count += 1 + dup_disk = _attach_disk() + inst.vmstorage_delete(vm_name, dup_disk) + prev_count -= 1 + # VM disk still there after powered off inst.vm_poweroff(vm_name) disk_info = inst.vmstorage_lookup(vm_name, disk)