Changes

Jump to: navigation, search

stoney conductor: VM Backup

146 bytes added, 12:05, 26 June 2014
/* Backup */
object machine = args[0];
if( snapshotcreateSsnapshot( machine ) )
{
if ( mergeexportSnapshot( machine ) )
{
if ( retaincommitSnapshot( machine ) )
{
printf("Successfully backed up machine %s\n", machine);
} else
{
printf("Error while retaining committing snapshot for machine %s: %s\n", machine, error);
}
} else
{
printf("Error while merging exporting snapshot for machine %s: %s\n", machine, error);
}
=== Backup multiple machines at the same time ===
When backing up multiple machines at the same time, we need to make sure that the downtime snapshots for the machines are as close together as possible. Therefore the control instance should call first the snapshot createSnapshot process for all machines. After every machine has been snapshotted, the control instance can call the merge exportSnapshot and retain commitSnapshot process for every machine. The most important part here is, that the control instance somehow remembers, if the snapshot for a given machine was successful or not. Because if the snapshot failed, it must not call the merge exportSnapshot and retain commitSnapshot process. So the control instance needs a little bit more logic:
<source lang="c">
# If the snapshot was successful, put the machine into the
# successful_snapshots array
if ( snapshotcreateSnapshot( machines[i] ) )
{
successful_snapshots[machines[i]];
}
# Merge export and reatin commit all successful_snapshot machines
for ( int i = 0; i < sizeof(successful_snapshots) / sizeof(object) ; i++ ) )
{
if ( successful_snapshots[i] )
{
if ( mergeexportSnapshot( successful_snapshots[i] ) )
{
if ( retaincommitSnapshot( successful_snapshots[i] ) )
{
printf("Successfully backed-up machine %s\n", successful_snapshots[i]);
} else
{
printf("Error while retaining committing snapshot for machine %s: %s\n", successful_snapshots[i],error);
}
} else
{
printf("Error while merging exporting snapshot for machine %s: %s\n", successful_snapshots[i],error);
}
}
If you want to re include a machine, simply delete the machines whole backup subtree. It will be recreated during the next backup run.
== Next steps ==
= Restore =
486
edits