diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in index ffa62818970..6fd51ef0f0a 100644 --- a/client/tomcatconf/nonossComponentContext.xml.in +++ b/client/tomcatconf/nonossComponentContext.xml.in @@ -212,6 +212,7 @@ + diff --git a/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java b/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java index 060ad6a9910..68faa47541b 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java +++ b/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java @@ -45,6 +45,10 @@ public class LocalHostEndpoint implements EndPoint { ConfigurationDao configDao; public LocalHostEndpoint() { + + } + + private void configure() { // get mount parent folder configured in global setting, if set, this will overwrite _parent in NfsSecondaryStorageResource to work // around permission issue for default /mnt folder String mountParent = configDao.getValue(Config.MountParent.key()); @@ -59,6 +63,7 @@ public class LocalHostEndpoint implements EndPoint { public static EndPoint getEndpoint() { LocalHostEndpoint endpoint = ComponentContext.inject(LocalHostEndpoint.class); + endpoint.configure(); return endpoint; } diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 991a890fadd..f80d4b62940 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -3940,7 +3940,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return false; } - public void swiftBackupSnapshot(Connection conn, SwiftTO swift, String srUuid, String snapshotUuid, String container, Boolean isISCSI, int wait) { + public String swiftBackupSnapshot(Connection conn, SwiftTO swift, String srUuid, String snapshotUuid, String container, Boolean isISCSI, int wait) { String lfilename; String ldir; if ( isISCSI ) { @@ -3951,6 +3951,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe lfilename = snapshotUuid + ".vhd"; } swiftUpload(conn, swift, container, ldir, lfilename, isISCSI, wait); + return lfilename; } diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java index 074375e128c..f13225defa4 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java @@ -1051,7 +1051,7 @@ public class XenServerStorageProcessor implements StorageProcessor { return result; } - public void swiftBackupSnapshot(Connection conn, SwiftTO swift, String srUuid, String snapshotUuid, String container, Boolean isISCSI, int wait) { + public String swiftBackupSnapshot(Connection conn, SwiftTO swift, String srUuid, String snapshotUuid, String container, Boolean isISCSI, int wait) { String lfilename; String ldir; if ( isISCSI ) { @@ -1062,6 +1062,7 @@ public class XenServerStorageProcessor implements StorageProcessor { lfilename = snapshotUuid + ".vhd"; } swiftUpload(conn, swift, container, ldir, lfilename, isISCSI, wait); + return lfilename; } private static List serializeProperties(final Object object, @@ -1280,6 +1281,7 @@ public class XenServerStorageProcessor implements StorageProcessor { String secondaryStorageMountPath = uri.getHost() + ":" + uri.getPath(); DataStoreTO destStore = destData.getDataStore(); String folder = destPath; + String finalPath = null; if (fullbackup) { // the first snapshot is always a full snapshot @@ -1297,11 +1299,14 @@ public class XenServerStorageProcessor implements StorageProcessor { if( destStore instanceof SwiftTO) { try { - hypervisorResource.swiftBackupSnapshot(conn, (SwiftTO)destStore, snapshotSr.getUuid(conn), snapshotBackupUuid, "S-" + snapshotTO.getVolume().getVolumeId().toString(), false, wait); - snapshotBackupUuid = snapshotBackupUuid + ".vhd"; + String container = "S-" + snapshotTO.getVolume().getVolumeId().toString(); + snapshotBackupUuid = swiftBackupSnapshot(conn, (SwiftTO)destStore, snapshotSr.getUuid(conn), snapshotBackupUuid, container, false, wait); + String swiftPath = container + File.separator + snapshotBackupUuid; + finalPath = container + File.separator + swiftPath; } finally { deleteSnapshotBackup(conn, folder, secondaryStorageMountPath, snapshotBackupUuid); } + } else if (destStore instanceof S3TO) { try { backupSnapshotToS3(conn, (S3TO)destStore, snapshotSr.getUuid(conn), snapshotBackupUuid, isISCSI, wait); @@ -1309,6 +1314,9 @@ public class XenServerStorageProcessor implements StorageProcessor { } finally { deleteSnapshotBackup(conn, folder, secondaryStorageMountPath, snapshotBackupUuid); } + finalPath = folder + File.separator + snapshotBackupUuid; + } else { + finalPath = folder + File.separator + snapshotBackupUuid; } } finally { @@ -1319,26 +1327,23 @@ public class XenServerStorageProcessor implements StorageProcessor { } else { String primaryStorageSRUuid = primaryStorageSR.getUuid(conn); if( destStore instanceof SwiftTO ) { - swiftBackupSnapshot(conn, (SwiftTO)destStore, primaryStorageSRUuid, snapshotPaUuid, "S-" + snapshotTO.getVolume().getVolumeId().toString(), isISCSI, wait); - if ( isISCSI ) { - snapshotBackupUuid = "VHD-" + snapshotPaUuid; - } else { - snapshotBackupUuid = snapshotPaUuid + ".vhd"; - } - + String container = "S-" + snapshotTO.getVolume().getVolumeId().toString(); + snapshotBackupUuid = swiftBackupSnapshot(conn, (SwiftTO)destStore, primaryStorageSRUuid, snapshotPaUuid, "S-" + snapshotTO.getVolume().getVolumeId().toString(), isISCSI, wait); + finalPath = container + File.separator + snapshotBackupUuid; } else if (destStore instanceof S3TO ) { backupSnapshotToS3(conn, (S3TO)destStore, primaryStorageSRUuid, snapshotPaUuid, isISCSI, wait); + finalPath = folder + File.separator + snapshotPaUuid; } else { snapshotBackupUuid = backupSnapshot(conn, primaryStorageSRUuid, folder + File.separator + UUID.nameUUIDFromBytes(secondaryStorageMountPath.getBytes()) , secondaryStorageMountPath, snapshotUuid, prevBackupUuid, isISCSI, wait); - + finalPath = folder + File.separator + snapshotBackupUuid; } } String volumeUuid = snapshotTO.getVolume().getPath(); destroySnapshotOnPrimaryStorageExceptThis(conn, volumeUuid, snapshotUuid); SnapshotObjectTO newSnapshot = new SnapshotObjectTO(); - newSnapshot.setPath(folder + File.separator + snapshotBackupUuid); + newSnapshot.setPath(finalPath); if (fullbackup) { newSnapshot.setParentSnapshotPath(null); } else { diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py index 100f4425d44..2472b2039b3 100644 --- a/tools/marvin/marvin/deployDataCenter.py +++ b/tools/marvin/marvin/deployDataCenter.py @@ -440,8 +440,9 @@ specify a valid config file" % cfgFile) networkId = networkcmdresponse.id self.createpods(zone.pods, zoneId, networkId) - self.createSecondaryStorages(zone.secondaryStorages, zoneId) + '''Note: Swift needs cache storage first''' self.createCacheStorages(zone.cacheStorages, zoneId) + self.createSecondaryStorages(zone.secondaryStorages, zoneId) enabled = getattr(zone, 'enabled', 'True') if enabled == 'True' or enabled is None: