/**
* virStoragePoolGetXMLDesc:
* @pool: pointer to storage pool
- * @flags: bitwise-OR of virDomainXMLFlags
+ * @flags: bitwise-OR of virStorageXMLFlags
*
* Fetch an XML document describing all aspects of the
* storage pool. This is suitable for later feeding back
{
virStorageDriverStatePtr driver = obj->conn->storagePrivateData;
virStoragePoolObjPtr pool;
+ virStoragePoolDefPtr def;
char *ret = NULL;
- virCheckFlags(0, NULL);
+ virCheckFlags(VIR_STORAGE_XML_INACTIVE, NULL);
storageDriverLock(driver);
pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid);
goto cleanup;
}
- ret = virStoragePoolDefFormat(pool->def);
+ if ((flags & VIR_STORAGE_XML_INACTIVE) && pool->newDef)
+ def = pool->newDef;
+ else
+ def = pool->def;
+
+ ret = virStoragePoolDefFormat(def);
cleanup:
if (pool)
static const vshCmdOptDef opts_pool_dumpxml[] = {
{"pool", VSH_OT_DATA, VSH_OFLAG_REQ, N_("pool name or uuid")},
+ {"inactive", VSH_OT_BOOL, 0, N_("show inactive defined XML")},
{NULL, 0, 0, NULL}
};
{
virStoragePoolPtr pool;
bool ret = true;
+ bool inactive = vshCommandOptBool(cmd, "inactive");
+ unsigned int flags = 0;
char *dump;
+ if (inactive)
+ flags |= VIR_STORAGE_XML_INACTIVE;
+
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
if (!(pool = vshCommandOptPool(ctl, cmd, "pool", NULL)))
return false;
- dump = virStoragePoolGetXMLDesc(pool, 0);
+ dump = virStoragePoolGetXMLDesc(pool, flags);
if (dump != NULL) {
vshPrint(ctl, "%s", dump);
VIR_FREE(dump);
bool ret = false;
virStoragePoolPtr pool = NULL;
virStoragePoolPtr pool_edited = NULL;
- unsigned int flags = 0;
+ unsigned int flags = VIR_STORAGE_XML_INACTIVE;
+ char *tmp_desc = NULL;
if (!vshConnectionUsability(ctl, ctl->conn))
goto cleanup;
if (pool == NULL)
goto cleanup;
+ /* Some old daemons don't support _INACTIVE flag */
+ if (!(tmp_desc = virStoragePoolGetXMLDesc(pool, flags))) {
+ if (last_error->code == VIR_ERR_INVALID_ARG) {
+ flags &= ~VIR_STORAGE_XML_INACTIVE;
+ virFreeError(last_error);
+ last_error = NULL;
+ } else {
+ goto cleanup;
+ }
+ } else {
+ VIR_FREE(tmp_desc);
+ }
+
#define EDIT_GET_XML virStoragePoolGetXMLDesc(pool, flags)
#define EDIT_NOT_CHANGED \
vshPrint(ctl, _("Pool %s XML configuration not changed.\n"), \
is non-recoverable. The I<pool> object will still exist after this
command, ready for the creation of new storage volumes.
-=item B<pool-dumpxml> I<pool-or-uuid>
+=item B<pool-dumpxml> [I<--inactive>] I<pool-or-uuid>
Returns the XML information about the I<pool> object.
+I<--inactive> tells virsh to dump pool configuration that will be used
+on next start of the pool as opposed to the current pool configuration.
=item B<pool-edit> I<pool-or-uuid>