mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: Add VIR_STORAGE_VOL_CREATE_VALIDATE flag
Allow users to request validation of the storage volume XML. Add new flag and virsh support. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
@@ -380,6 +380,10 @@ static const vshCmdOptDef opts_vol_create[] = {
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("preallocate metadata (for qcow2 instead of full allocation)")
|
||||
},
|
||||
{.name = "validate",
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("validate the XML against the schema")
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
@@ -395,6 +399,9 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd)
|
||||
if (vshCommandOptBool(cmd, "prealloc-metadata"))
|
||||
flags |= VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA;
|
||||
|
||||
if (vshCommandOptBool(cmd, "validate"))
|
||||
flags |= VIR_STORAGE_VOL_CREATE_VALIDATE;
|
||||
|
||||
if (!(pool = virshCommandOptPool(ctl, cmd, "pool", NULL)))
|
||||
return false;
|
||||
|
||||
@@ -446,6 +453,10 @@ static const vshCmdOptDef opts_vol_create_from[] = {
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("use btrfs COW lightweight copy")
|
||||
},
|
||||
{.name = "validate",
|
||||
.type = VSH_OT_BOOL,
|
||||
.help = N_("validate the XML against the schema")
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
@@ -468,6 +479,9 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd)
|
||||
if (vshCommandOptBool(cmd, "reflink"))
|
||||
flags |= VIR_STORAGE_VOL_CREATE_REFLINK;
|
||||
|
||||
if (vshCommandOptBool(cmd, "validate"))
|
||||
flags |= VIR_STORAGE_VOL_CREATE_VALIDATE;
|
||||
|
||||
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
|
||||
return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user