::
- pool-define file
+ pool-define file [--validate]
Define an inactive persistent storage pool or modify an existing persistent one
from the XML *file*.
+Optionally, the format of the input XML file can be validated against an
+internal RNG schema with *--validate*.
pool-define-as
static const vshCmdOptDef opts_pool_define[] = {
VIRSH_COMMON_OPT_FILE(N_("file containing an XML pool description")),
-
+ {.name = "validate",
+ .type = VSH_OT_BOOL,
+ .help = N_("validate the XML against the schema")
+ },
{.name = NULL}
};
const char *from = NULL;
bool ret = true;
g_autofree char *buffer = NULL;
+ unsigned int flags = 0;
virshControl *priv = ctl->privData;
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
return false;
+ if (vshCommandOptBool(cmd, "validate"))
+ flags |= VIR_STORAGE_POOL_DEFINE_VALIDATE;
+
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
return false;
- pool = virStoragePoolDefineXML(priv->conn, buffer, 0);
+ pool = virStoragePoolDefineXML(priv->conn, buffer, flags);
if (pool != NULL) {
vshPrintExtra(ctl, _("Pool %s defined from %s\n"),