mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00: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:
parent
563ef19f9b
commit
db5f05dd22
@ -6574,7 +6574,7 @@ vol-create
|
||||
|
||||
::
|
||||
|
||||
vol-create pool-or-uuid FILE [--prealloc-metadata]
|
||||
vol-create pool-or-uuid FILE [--prealloc-metadata] [--validate]
|
||||
|
||||
Create a volume from an XML <file>.
|
||||
|
||||
@ -6589,6 +6589,9 @@ support full allocation). This option creates a sparse image file with metadata,
|
||||
resulting in higher performance compared to images with no preallocation and
|
||||
only slightly higher initial disk space usage.
|
||||
|
||||
If *--validate* is specified, validates the format of the XML document against
|
||||
an internal RNG schema.
|
||||
|
||||
**Example:**
|
||||
|
||||
::
|
||||
@ -6606,7 +6609,7 @@ vol-create-from
|
||||
::
|
||||
|
||||
vol-create-from pool-or-uuid FILE vol-name-or-key-or-path
|
||||
[--inputpool pool-or-uuid] [--prealloc-metadata] [--reflink]
|
||||
[--inputpool pool-or-uuid] [--prealloc-metadata] [--reflink] [--validate]
|
||||
|
||||
Create a volume, using another volume as input.
|
||||
|
||||
@ -6628,6 +6631,8 @@ When *--reflink* is specified, perform a COW lightweight copy,
|
||||
where the data blocks are copied only when modified.
|
||||
If this is not possible, the copy fails.
|
||||
|
||||
If *--validate* is specified, validates the format of the XML document against
|
||||
an internal RNG schema.
|
||||
|
||||
vol-create-as
|
||||
-------------
|
||||
|
@ -437,6 +437,7 @@ const char* virStorageVolGetKey (virStorageVolPtr vol);
|
||||
typedef enum {
|
||||
VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA = 1 << 0, /* (Since: 1.0.1) */
|
||||
VIR_STORAGE_VOL_CREATE_REFLINK = 1 << 1, /* perform a btrfs lightweight copy (Since: 1.2.13) */
|
||||
VIR_STORAGE_VOL_CREATE_VALIDATE = 1 << 2, /* Validate the XML document against schema (Since: 8.10.0) */
|
||||
} virStorageVolCreateFlags;
|
||||
|
||||
virStorageVolPtr virStorageVolCreateXML (virStoragePoolPtr pool,
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user