For now, if only '--wipe-storage' is assigned, user can undefine a domain normally. But actually '--wipe-storage' doesn't work, this may confuse user. And since '--wipe-storage' wipes data on the removed volumes, if no removed volume storage assigned, we'd better raise an error message. 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' needs storage volume deletion: '--stroage <string>' or '--remove-all-storage' is necessary. Signed-off-by: Li Yang <liyang.fnst@xxxxxxxxxxxxxx> --- tools/virsh-domain.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 3a7c260..25236a0 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2982,6 +2982,14 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ignore_value(vshCommandOptString(cmd, "storage", &vol_string)); + if (!(vol_string || remove_all_storage) && wipe_storage) { + vshError(ctl, + _("'--wipe-storage' needs storage volume deletion: " + "'--stroage <string>' or '--remove-all-storage' " + "is necessary.")); + return false; + } + if (managed_save) { flags |= VIR_DOMAIN_UNDEFINE_MANAGED_SAVE; managed_save_safe = true; -- 1.7.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list