Skip to content

Commit 7d02fcd

Browse files
committed
CLOUDSTACK-5264: add delta snapshot for existing xenserver
1 parent 4c95217 commit 7d02fcd

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public AttachAnswer attachIso(AttachCommand cmd) {
144144
throw new CloudRuntimeException("Unable to find CD-ROM VBD for VM: " + vmName);
145145
} else {
146146
// If an ISO is already inserted, eject it
147-
if (isoVBD.getEmpty(conn) == false) {
147+
if (!isoVBD.getEmpty(conn)) {
148148
isoVBD.eject(conn);
149149
}
150150

@@ -1291,7 +1291,8 @@ public Answer backupSnapshot(CopyCommand cmd) {
12911291
// By default assume failure
12921292
String details = null;
12931293
String snapshotBackupUuid = null;
1294-
boolean fullbackup = true;
1294+
Map<String, String> options = cmd.getOptions();
1295+
boolean fullbackup = Boolean.parseBoolean(options.get("fullSnapshot"));
12951296
try {
12961297
SR primaryStorageSR = hypervisorResource.getSRByNameLabelandHost(conn, primaryStorageNameLabel);
12971298
if (primaryStorageSR == null) {
@@ -1302,14 +1303,16 @@ public Answer backupSnapshot(CopyCommand cmd) {
13021303

13031304
VDI snapshotVdi = getVDIbyUuid(conn, snapshotUuid);
13041305
String snapshotPaUuid = null;
1305-
if ( prevBackupUuid != null ) {
1306+
if ( prevSnapshotUuid != null && !fullbackup) {
13061307
try {
13071308
snapshotPaUuid = getVhdParent(conn, psUuid, snapshotUuid, isISCSI);
13081309
if( snapshotPaUuid != null ) {
13091310
String snashotPaPaPaUuid = getVhdParent(conn, psUuid, snapshotPaUuid, isISCSI);
13101311
String prevSnashotPaUuid = getVhdParent(conn, psUuid, prevSnapshotUuid, isISCSI);
13111312
if (snashotPaPaPaUuid != null && prevSnashotPaUuid!= null && prevSnashotPaUuid.equals(snashotPaPaPaUuid)) {
13121313
fullbackup = false;
1314+
} else {
1315+
fullbackup = true;
13131316
}
13141317
}
13151318
} catch (Exception e) {

0 commit comments

Comments
 (0)