cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] rafaelweingartner commented on a change in pull request #2298: CLOUDSTACK-9620: Enhancements for managed storage
Date Thu, 01 Jan 1970 00:00:00 GMT
rafaelweingartner commented on a change in pull request #2298: CLOUDSTACK-9620: Enhancements
for managed storage
URL: https://github.com/apache/cloudstack/pull/2298#discussion_r161305820
 
 

 ##########
 File path: engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java
 ##########
 @@ -916,19 +1987,45 @@ else if (dataObj instanceof SnapshotInfo) {
         throw new CloudRuntimeException("'dataObj' must be of type 'VolumeInfo' or 'SnapshotInfo'.");
     }
 
-    private CopyCmdAnswer performResignature(DataObject dataObj, HostVO hostVO) {
-        return performResignature(dataObj, hostVO, false);
+    private boolean isForVMware(DataObject dataObj) {
+        if (dataObj instanceof VolumeInfo) {
+            return ImageFormat.OVA.equals(((VolumeInfo)dataObj).getFormat());
+        }
+
+        if (dataObj instanceof SnapshotInfo) {
+            return ImageFormat.OVA.equals(((SnapshotInfo)dataObj).getBaseVolume().getFormat());
+        }
+
+        return dataObj instanceof TemplateInfo && HypervisorType.VMware.equals(((TemplateInfo)dataObj).getHypervisorType());
+    }
+
+    private CopyCmdAnswer performResignature(DataObject dataObj, HostVO hostVO, Map<String,
String> extraDetails) {
+        return performResignature(dataObj, hostVO, extraDetails, false);
     }
 
-    private CopyCmdAnswer performResignature(DataObject dataObj, HostVO hostVO, boolean keepGrantedAccess)
{
+    private CopyCmdAnswer performResignature(DataObject dataObj, HostVO hostVO, Map<String,
String> extraDetails, boolean keepGrantedAccess) {
         long storagePoolId = dataObj.getDataStore().getId();
         DataStore dataStore = dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
 
         Map<String, String> details = getDetails(dataObj);
 
+        if (extraDetails != null) {
+            details.putAll(extraDetails);
+        }
+
         ResignatureCommand command = new ResignatureCommand(details);
 
-        ResignatureAnswer answer = null;
+        ResignatureAnswer answer;
+
+        GlobalLock lock = GlobalLock.getInternLock(dataStore.getUuid());
+
+        if (!lock.lock(LOCK_TIME_IN_SECONDS)) {
+            String errMsg = "Couldn't lock the DB (in performResignature) on the following
string: " + dataStore.getUuid();
+
+            LOGGER.warn(errMsg);
+
+            throw new CloudRuntimeException(errMsg);
 
 Review comment:
   Got it. I thought that was the reason, but we should strive to force people not to swallow
exception anymore.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message