.help = N_("file containing an XML pool description") \
} \
+#define VSH_POOL_BUILD_OPT_COMMON \
+ {.name = "build", \
+ .type = VSH_OT_BOOL, \
+ .flags = 0, \
+ .help = N_("build the pool as normal") \
+ } \
+
#define VSH_POOL_NO_OVERWRITE_OPT_COMMON \
{.name = "no-overwrite", \
.type = VSH_OT_BOOL, \
static const vshCmdOptDef opts_pool_create[] = {
VSH_POOL_FILE_OPT_COMMON,
+ VSH_POOL_BUILD_OPT_COMMON,
+ VSH_POOL_NO_OVERWRITE_OPT_COMMON,
+ VSH_POOL_OVERWRITE_OPT_COMMON,
{.name = NULL}
};
const char *from = NULL;
bool ret = true;
char *buffer;
+ bool build;
+ bool overwrite;
+ bool no_overwrite;
+ unsigned int flags = 0;
virshControlPtr priv = ctl->privData;
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
return false;
+ build = vshCommandOptBool(cmd, "build");
+ overwrite = vshCommandOptBool(cmd, "overwrite");
+ no_overwrite = vshCommandOptBool(cmd, "no-overwrite");
+
+ VSH_EXCLUSIVE_OPTIONS_EXPR("overwrite", overwrite,
+ "no-overwrite", no_overwrite);
+
+ if (build)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD;
+ if (overwrite)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE;
+ if (no_overwrite)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE;
+
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
return false;
- pool = virStoragePoolCreateXML(priv->conn, buffer, 0);
+ pool = virStoragePoolCreateXML(priv->conn, buffer, flags);
VIR_FREE(buffer);
if (pool != NULL) {
static const vshCmdOptDef opts_pool_create_as[] = {
VSH_POOL_X_AS_OPT_COMMON,
+ VSH_POOL_BUILD_OPT_COMMON,
+ VSH_POOL_NO_OVERWRITE_OPT_COMMON,
+ VSH_POOL_OVERWRITE_OPT_COMMON,
{.name = NULL}
};
const char *name;
char *xml;
bool printXML = vshCommandOptBool(cmd, "print-xml");
+ bool build;
+ bool overwrite;
+ bool no_overwrite;
+ unsigned int flags = 0;
virshControlPtr priv = ctl->privData;
+ build = vshCommandOptBool(cmd, "build");
+ overwrite = vshCommandOptBool(cmd, "overwrite");
+ no_overwrite = vshCommandOptBool(cmd, "no-overwrite");
+
+ VSH_EXCLUSIVE_OPTIONS_EXPR("overwrite", overwrite,
+ "no-overwrite", no_overwrite);
+
+ if (build)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD;
+ if (overwrite)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE;
+ if (no_overwrite)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE;
+
if (!virshBuildPoolXML(ctl, cmd, &name, &xml))
return false;
vshPrint(ctl, "%s", xml);
VIR_FREE(xml);
} else {
- pool = virStoragePoolCreateXML(priv->conn, xml, 0);
+ pool = virStoragePoolCreateXML(priv->conn, xml, flags);
VIR_FREE(xml);
if (pool != NULL) {
static const vshCmdOptDef opts_pool_start[] = {
VSH_POOL_OPT_COMMON,
+ VSH_POOL_BUILD_OPT_COMMON,
+ VSH_POOL_NO_OVERWRITE_OPT_COMMON,
+ VSH_POOL_OVERWRITE_OPT_COMMON,
{.name = NULL}
};
virStoragePoolPtr pool;
bool ret = true;
const char *name = NULL;
+ bool build;
+ bool overwrite;
+ bool no_overwrite;
+ unsigned int flags = 0;
if (!(pool = virshCommandOptPool(ctl, cmd, "pool", &name)))
return false;
- if (virStoragePoolCreate(pool, 0) == 0) {
+ build = vshCommandOptBool(cmd, "build");
+ overwrite = vshCommandOptBool(cmd, "overwrite");
+ no_overwrite = vshCommandOptBool(cmd, "no-overwrite");
+
+ VSH_EXCLUSIVE_OPTIONS_EXPR("overwrite", overwrite,
+ "no-overwrite", no_overwrite);
+
+ if (build)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD;
+ if (overwrite)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_OVERWRITE;
+ if (no_overwrite)
+ flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE;
+
+ if (virStoragePoolCreate(pool, flags) == 0) {
vshPrint(ctl, _("Pool %s started\n"), name);
} else {
vshError(ctl, _("Failed to start pool %s"), name);
by the pool source format type or "dos" if not specified for the pool.
=item B<pool-create> I<file>
+[I<--build>] [[I<--overwrite>] | [I<--no-overwrite>]]
Create and start a pool object from the XML I<file>.
+[I<--build>] [[I<--overwrite>] | [I<--no-overwrite>]] perform a
+B<pool-build> after creation in order to remove the need for a
+follow-up command to build the pool. The I<--overwrite> and
+I<--no-overwrite> flags follow the same rules as B<pool-build>. If
+just I<--build> is provided, then B<pool-build> is called with no flags.
+
=item B<pool-create-as> I<name> I<type> [I<--print-xml>]
[I<--source-host hostname>] [I<--source-path path>] [I<--source-dev path>]
[I<--source-name name>] [I<--target path>] [I<--source-format format>]
[I<--auth-type authtype> I<--auth-username username> I<--secret-usage usage>]
[[I<--adapter-name name>] | [I<--adapter-wwnn> I<--adapter-wwpn>]
[I<--adapter-parent parent>]]
+[I<--build>] [[I<--overwrite>] | [I<--no-overwrite>]]
Create and start a pool object I<name> from the raw parameters. If
optionally provides the name of the scsi_hostN node device to be used for
the vHBA.
+[I<--build>] [[I<--overwrite>] | [I<--no-overwrite>]] perform a
+B<pool-build> after creation in order to remove the need for a
+follow-up command to build the pool. The I<--overwrite> and
+I<--no-overwrite> flags follow the same rules as B<pool-build>. If
+just I<--build> is provided, then B<pool-build> is called with no flags.
+
=item B<pool-define> I<file>
Define an inactive persistent storage pool or modify an existing persistent one
without defining the pool. Otherwise, the pool has the specified
I<type>.
-Use the same arguments as B<pool-create-as>.
+Use the same arguments as B<pool-create-as>, except for the I<--build>,
+I<--overwrite>, and I<--no-overwrite> options.
=item B<pool-destroy> I<pool-or-uuid>
Refresh the list of volumes contained in I<pool>.
=item B<pool-start> I<pool-or-uuid>
+[I<--build>] [[I<--overwrite>] | [I<--no-overwrite>]]
Start the storage I<pool>, which is previously defined but inactive.
+[I<--build>] [[I<--overwrite>] | [I<--no-overwrite>]] perform a
+B<pool-build> prior to B<pool-start> to ensure the pool environment is
+in an expected state rather than needing to run the build command prior
+to startup. The I<--overwrite> and I<--no-overwrite> flags follow the
+same rules as B<pool-build>. If just I<--build> is provided, then
+B<pool-build> is called with no flags.
+
B<Note>: A storage pool that relies on remote resources such as an
"iscsi" or a (v)HBA backed "scsi" pool may need to be refreshed multiple
times in order to have all the volumes detected (see B<pool-refresh>).