提交 34a6e847 编写于 作者: N Nikolay Shirokovskiy 提交者: Michal Privoznik

virsh: add --keep-nvram option to undefine command

Signed-off-by: NNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
上级 048e5c64
...@@ -3605,6 +3605,10 @@ static const vshCmdOptDef opts_undefine[] = { ...@@ -3605,6 +3605,10 @@ static const vshCmdOptDef opts_undefine[] = {
.type = VSH_OT_BOOL, .type = VSH_OT_BOOL,
.help = N_("remove nvram file, if inactive") .help = N_("remove nvram file, if inactive")
}, },
{.name = "keep-nvram",
.type = VSH_OT_BOOL,
.help = N_("keep nvram file, if inactive")
},
{.name = NULL} {.name = NULL}
}; };
...@@ -3630,6 +3634,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ...@@ -3630,6 +3634,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
bool remove_all_storage = vshCommandOptBool(cmd, "remove-all-storage"); bool remove_all_storage = vshCommandOptBool(cmd, "remove-all-storage");
bool delete_snapshots = vshCommandOptBool(cmd, "delete-snapshots"); bool delete_snapshots = vshCommandOptBool(cmd, "delete-snapshots");
bool nvram = vshCommandOptBool(cmd, "nvram"); bool nvram = vshCommandOptBool(cmd, "nvram");
bool keep_nvram = vshCommandOptBool(cmd, "keep-nvram");
/* Positive if these items exist. */ /* Positive if these items exist. */
int has_managed_save = 0; int has_managed_save = 0;
int has_snapshots_metadata = 0; int has_snapshots_metadata = 0;
...@@ -3658,6 +3663,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ...@@ -3658,6 +3663,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
virshControlPtr priv = ctl->privData; virshControlPtr priv = ctl->privData;
VSH_REQUIRE_OPTION("delete-snapshots", "remove-all-storage"); VSH_REQUIRE_OPTION("delete-snapshots", "remove-all-storage");
VSH_EXCLUSIVE_OPTIONS("nvram", "keep-nvram");
ignore_value(vshCommandOptStringQuiet(ctl, cmd, "storage", &vol_string)); ignore_value(vshCommandOptStringQuiet(ctl, cmd, "storage", &vol_string));
...@@ -3681,6 +3687,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) ...@@ -3681,6 +3687,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
} }
if (nvram) if (nvram)
flags |= VIR_DOMAIN_UNDEFINE_NVRAM; flags |= VIR_DOMAIN_UNDEFINE_NVRAM;
if (keep_nvram)
flags |= VIR_DOMAIN_UNDEFINE_KEEP_NVRAM;
if (!(dom = virshCommandOptDomain(ctl, cmd, &name))) if (!(dom = virshCommandOptDomain(ctl, cmd, &name)))
return false; return false;
......
...@@ -2443,7 +2443,7 @@ Output the device used for the TTY console of the domain. If the information ...@@ -2443,7 +2443,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. is not available the processes will provide an exit code of 1.
=item B<undefine> I<domain> [I<--managed-save>] [I<--snapshots-metadata>] =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<--storage> B<volumes> | I<--remove-all-storage> [I<--delete-snapshots>]}
I<--wipe-storage>] I<--wipe-storage>]
...@@ -2461,8 +2461,8 @@ domain. Without the flag, attempts to undefine an inactive domain with ...@@ -2461,8 +2461,8 @@ domain. Without the flag, attempts to undefine an inactive domain with
snapshot metadata will fail. If the domain is active, this flag is snapshot metadata will fail. If the domain is active, this flag is
ignored. ignored.
The I<--nvram> flag ensures no nvram (/domain/os/nvram/) file is I<--nvram> and I<--keep-nvram> specify accordingly to delete or keep nvram
left behind. If the domain has an nvram file and the flag is (/domain/os/nvram/) file. If the domain has an nvram file and the flags are
omitted, the undefine will fail. omitted, the undefine will fail.
The I<--storage> flag takes a parameter B<volumes>, which is a comma separated The I<--storage> flag takes a parameter B<volumes>, which is a comma separated
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册