You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2013/07/18 01:29:08 UTC

git commit: updated refs/heads/4.2 to 83c7b9a

Updated Branches:
  refs/heads/4.2 c22504a04 -> 83c7b9ae5


fix localendpoint npe


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/83c7b9ae
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/83c7b9ae
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/83c7b9ae

Branch: refs/heads/4.2
Commit: 83c7b9ae57974e1f0616e43155b257d89f4c6ae5
Parents: c22504a
Author: Edison Su <su...@gmail.com>
Authored: Wed Jul 17 16:28:30 2013 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Wed Jul 17 16:28:49 2013 -0700

----------------------------------------------------------------------
 client/tomcatconf/nonossComponentContext.xml.in |  1 +
 .../cloudstack/storage/LocalHostEndpoint.java   |  5 ++++
 .../xen/resource/CitrixResourceBase.java        |  3 +-
 .../xen/resource/XenServerStorageProcessor.java | 29 ++++++++++++--------
 tools/marvin/marvin/deployDataCenter.py         |  3 +-
 5 files changed, 27 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83c7b9ae/client/tomcatconf/nonossComponentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in
index ffa6281..6fd51ef 100644
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@ -212,6 +212,7 @@
         <ref bean="cloudStackPrimaryDataStoreProviderImpl"/>
         <ref bean="cloudStackImageStoreProviderImpl"/>
         <ref bean="s3ImageStoreProviderImpl"/>
+        <ref local="swiftImageStoreProviderImpl"/>
         <ref bean="solidFireDataStoreProvider"/>
       </list>
     </property>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83c7b9ae/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java b/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
index 060ad6a..68faa47 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;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83c7b9ae/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
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 25b67ad..2bd1c0a 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
@@ -3959,7 +3959,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 ) {
@@ -3970,6 +3970,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             lfilename = snapshotUuid + ".vhd";
         }
         swiftUpload(conn, swift, container, ldir, lfilename, isISCSI, wait);
+        return lfilename;
     }
 
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83c7b9ae/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageProcessor.java
----------------------------------------------------------------------
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 074375e..f13225d 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<String> 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 {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83c7b9ae/tools/marvin/marvin/deployDataCenter.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py
index 100f442..2472b20 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: