mirror of
https://github.com/libvirt/libvirt.git
synced 2026-10-02 12:20:06 -05:00
virsh: blockresize: Introduce '--extend' flag
Use the new VIR_DOMAIN_BLOCK_RESIZE_EXTEND to prevent accidentally shrinking a disk and thus destroying data. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
1 parent
47ed93c216
commit
6499c0a28f
2 files changed
+13
-1
No files matched your search
@@ -3339,6 +3339,10 @@ static const vshCmdOptDef opts_blockresize[] = {
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("resize to capacity of source (block device)")
|
||||
},
|
||||
{.name = "extend",
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("ensure that the new size is larger than actual capacity (prevent shrink)")
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
@@ -3352,6 +3356,9 @@ cmdBlockresize(vshControl *ctl, const vshCmd *cmd)
|
||||
|
||||
VSH_ALTERNATIVE_OPTIONS("size", "capacity");
|
||||
|
||||
if (vshCommandOptBool(cmd, "extend"))
|
||||
flags |= VIR_DOMAIN_BLOCK_RESIZE_EXTEND;
|
||||
|
||||
if (vshCommandOptString(ctl, cmd, "path", (const char **) &path) < 0)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in new issue
Block a user