mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 11:22:23 +00:00
virsh: reject undefine --wipe-storage without also naming storage
For now, if only '--wipe-storage' is assigned, user can undefine a domain normally. But actually '--wipe-storage' doesn't do anything, and this may confuse user. Better is to require that '--wipe-storage' only works if the user specifies volumes to be removed. Before: $ virsh undefine virt-tests-vm1 --wipe-storage Domain virt-tests-vm1 has been undefined After: $ virsh undefine virt-tests-vm1 --wipe-storage error: '--wipe-storage' requires '--storage <string>' or '--remove-all-storage' Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
660d661e85
commit
ed5950909d
@ -2979,9 +2979,15 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
|
|||||||
size_t i;
|
size_t i;
|
||||||
size_t j;
|
size_t j;
|
||||||
|
|
||||||
|
|
||||||
ignore_value(vshCommandOptString(cmd, "storage", &vol_string));
|
ignore_value(vshCommandOptString(cmd, "storage", &vol_string));
|
||||||
|
|
||||||
|
if (!(vol_string || remove_all_storage) && wipe_storage) {
|
||||||
|
vshError(ctl,
|
||||||
|
_("'--wipe-storage' requires '--storage <string>' or "
|
||||||
|
"'--remove-all-storage'"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (managed_save) {
|
if (managed_save) {
|
||||||
flags |= VIR_DOMAIN_UNDEFINE_MANAGED_SAVE;
|
flags |= VIR_DOMAIN_UNDEFINE_MANAGED_SAVE;
|
||||||
managed_save_safe = true;
|
managed_save_safe = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user