::
backup-begin domain [backupxml] [checkpointxml] [--reuse-external]
+ [--preserve-domain-on-shutdown]
Begin a new backup job. If *backupxml* is omitted, this defaults to a full
backup using a push model to filenames generated by libvirt; supplying XML
If *--reuse-external* is used it instructs libvirt to reuse temporary
and output files provided by the user in *backupxml*.
+When the *--preserve-domain-on-shutdown* flag is used libvirt will not
+terminate the VM if the guest OS shuts down while the backup is running. The VM
+will be instead kept in VIR_DOMAIN_PAUSED state until the backup job finishes.
+The vm can be also resumed in order to boot again.
+
If *checkpointxml* is specified, a second file with a top-level
element of *domaincheckpoint* is used to create a simultaneous
checkpoint, for doing a later incremental backup relative to the time
* Since: 6.0.0
*/
typedef enum {
- VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL = (1 << 0), /* reuse separately
- provided images (Since: 6.0.0) */
+ /* reuse separately provided images (Since: 6.0.0) */
+ VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL = (1 << 0),
+ /* preserve the domain if the guest OS shuts down while the backup is running (Since: 11.10.0) */
+ VIR_DOMAIN_BACKUP_BEGIN_PRESERVE_SHUTDOWN_DOMAIN = (1 << 1),
} virDomainBackupBeginFlags;
int virDomainBackupBegin(virDomainPtr domain,
* temporary files described by the @backupXML document were created by the
* caller with correct format and size to hold the backup or temporary data.
*
+ * When the VIR_DOMAIN_BACKUP_BEGIN_PRESERVE_SHUTDOWN_DOMAIN flag is used
+ * libvirt will not terminate the VM if the guest OS shuts down while the
+ * backup is running. The VM will be kept in the VIR_DOMAIN_PAUSED state
+ * until the backup job finishes or until it's resumed via virDomainResume.
+ *
* The creation of a new checkpoint allows for future incremental backups.
* Note that some hypervisors may require a particular disk format, such as
* qcow2, in order to take advantage of checkpoints, while allowing arbitrary
.type = VSH_OT_BOOL,
.help = N_("reuse files provided by caller"),
},
+ {.name = "preserve-domain-on-shutdown",
+ .type = VSH_OT_BOOL,
+ .help = N_("avoid shutdown of the domain while the backup is running"),
+ },
{.name = NULL}
};
if (vshCommandOptBool(cmd, "reuse-external"))
flags |= VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL;
+ if (vshCommandOptBool(cmd, "preserve-domain-on-shutdown"))
+ flags |= VIR_DOMAIN_BACKUP_BEGIN_PRESERVE_SHUTDOWN_DOMAIN;
+
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;