Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> --- tools/virsh-domain.c | 8 ++++++++ tools/virsh.pod | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8d7ff61..30922d1 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -3604,6 +3604,10 @@ static const vshCmdOptDef opts_undefine[] = { .type = VSH_OT_BOOL, .help = N_("remove nvram file, if inactive") }, + {.name = "keep-nvram", + .type = VSH_OT_BOOL, + .help = N_("keep nvram file, if inactive") + }, {.name = NULL} }; @@ -3629,6 +3633,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) bool remove_all_storage = vshCommandOptBool(cmd, "remove-all-storage"); bool delete_snapshots = vshCommandOptBool(cmd, "delete-snapshots"); bool nvram = vshCommandOptBool(cmd, "nvram"); + bool keep_nvram = vshCommandOptBool(cmd, "keep-nvram"); /* Positive if these items exist. */ int has_managed_save = 0; int has_snapshots_metadata = 0; @@ -3657,6 +3662,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) virshControlPtr priv = ctl->privData; VSH_REQUIRE_OPTION("delete-snapshots", "remove-all-storage"); + VSH_EXCLUSIVE_OPTIONS("nvram", "keep-nvram"); ignore_value(vshCommandOptStringQuiet(ctl, cmd, "storage", &vol_string)); @@ -3680,6 +3686,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) } if (nvram) flags |= VIR_DOMAIN_UNDEFINE_NVRAM; + if (keep_nvram) + flags |= VIR_DOMAIN_UNDEFINE_KEEP_NVRAM; if (!(dom = virshCommandOptDomain(ctl, cmd, &name))) return false; diff --git a/tools/virsh.pod b/tools/virsh.pod index 6844823..c2aea4c 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -2373,7 +2373,7 @@ Output the device used for the TTY console of the domain. If the information is not available the processes will provide an exit code of 1. =item B<undefine> I<domain> [I<--managed-save>] [I<--snapshots-metadata>] -[I<--nvram>] +[I<--nvram>] [I<--keep-nvram>] [ {I<--storage> B<volumes> | I<--remove-all-storage> [I<--delete-snapshots>]} I<--wipe-storage>] @@ -2391,8 +2391,8 @@ domain. Without the flag, attempts to undefine an inactive domain with snapshot metadata will fail. If the domain is active, this flag is ignored. -The I<--nvram> flag ensures no nvram (/domain/os/nvram/) file is -left behind. If the domain has an nvram file and the flag is +I<--nvram> and I<--keep-nvram> specify accordingly to delete or keep nvram +(/domain/os/nvram/) file. If the domain has an nvram file and the flags are omitted, the undefine will fail. The I<--storage> flag takes a parameter B<volumes>, which is a comma separated -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list