::
restore state-file [--bypass-cache] [--xml file]
- [{--running | --paused}] [--reset-nvram]
+ [{--running | --paused}] [--reset-nvram] [--parallel] [--parallel-channels]
Restores a domain from a ``virsh save`` state file. See *save* for more info.
If *--bypass-cache* is specified, the restore will avoid the file system
-cache, although this may slow down the operation.
+cache. Depending on the specific scenario this may slow down or speed up
+the operation.
*--xml* ``file`` is usually omitted, but can be used to supply an
alternative XML file for use on the restored guest with changes only
If *--reset-nvram* is specified, any existing NVRAM file will be deleted
and re-initialized from its pristine template.
+*--parallel* option will cause the save data to be loaded using the number
+of parallel IO channels specified with *--parallel-channels*. Parallel
+channels will help speed up large restore operations.
+
``Note``: To avoid corrupting file system contents within the domain, you
should not reuse the saved state file for a second ``restore`` unless you
have also reverted all storage volumes back to the same contents as when
.type = VSH_OT_BOOL,
.help = N_("avoid file system cache when restoring")
},
+ {.name = "parallel",
+ .type = VSH_OT_BOOL,
+ .help = N_("enable parallel restore")
+ },
+ {.name = "parallel-channels",
+ .type = VSH_OT_INT,
+ .help = N_("number of IO channels to use for parallel restore")
+ },
{.name = "xml",
.type = VSH_OT_STRING,
.unwanted_positional = true,
const char *xmlfile = NULL;
g_autofree char *xml = NULL;
virshControl *priv = ctl->privData;
+ virTypedParameterPtr params = NULL;
+ int nparams = 0;
+ int maxparams = 0;
+ int nchannels = 1;
int rc;
- if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
- return false;
-
if (vshCommandOptBool(cmd, "bypass-cache"))
flags |= VIR_DOMAIN_SAVE_BYPASS_CACHE;
+ if (vshCommandOptBool(cmd, "parallel"))
+ flags |= VIR_DOMAIN_SAVE_PARALLEL;
if (vshCommandOptBool(cmd, "running"))
flags |= VIR_DOMAIN_SAVE_RUNNING;
if (vshCommandOptBool(cmd, "paused"))
if (vshCommandOptBool(cmd, "reset-nvram"))
flags |= VIR_DOMAIN_SAVE_RESET_NVRAM;
+ if (vshCommandOptString(ctl, cmd, "file", &from) < 0)
+ return false;
+ if (from &&
+ virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_DOMAIN_SAVE_PARAM_FILE, from) < 0)
+ return false;
+
if (vshCommandOptString(ctl, cmd, "xml", &xmlfile) < 0)
return false;
if (xmlfile &&
virFileReadAll(xmlfile, VSH_MAX_XML_FILE, &xml) < 0)
return false;
+ if (xml &&
+ virTypedParamsAddString(¶ms, &nparams, &maxparams,
+ VIR_DOMAIN_SAVE_PARAM_DXML, xml) < 0)
+ return false;
+
+ if (flags & VIR_DOMAIN_SAVE_PARALLEL) {
+ if ((rc = vshCommandOptInt(ctl, cmd, "parallel-channels", &nchannels)) < 0)
+ return false;
+
+ if (virTypedParamsAddInt(¶ms, &nparams, &maxparams,
+ VIR_DOMAIN_SAVE_PARAM_PARALLEL_CHANNELS, nchannels) < 0)
+ return false;
+ }
if (flags || xml) {
- rc = virDomainRestoreFlags(priv->conn, from, xml, flags);
+ rc = virDomainRestoreParams(priv->conn, params, nparams, flags);
} else {
rc = virDomainRestore(priv->conn, from);
}