cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/object_store to 8f6eb26
Date Thu, 23 May 2013 21:35:59 GMT
Updated Branches:
  refs/heads/object_store 4e4112fce -> 8f6eb26e3


fix suffix for extratemplate for kvm


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

Branch: refs/heads/object_store
Commit: 8f6eb26e38b221e4a38345f29ca5ce1ce25c0603
Parents: 4e4112f
Author: Edison Su <sudison@gmail.com>
Authored: Thu May 23 14:35:19 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Thu May 23 14:35:19 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/server/ManagementServerImpl.java |   42 ++-------------
 .../com/cloud/storage/upload/UploadMonitor.java    |    3 +-
 .../cloud/storage/upload/UploadMonitorImpl.java    |    4 +-
 3 files changed, 8 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f6eb26e/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index a8185b8..17f87a5 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -3440,33 +3440,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             extractMode = mode.equals(Upload.Mode.FTP_UPLOAD.toString()) ? Upload.Mode.FTP_UPLOAD
: Upload.Mode.HTTP_DOWNLOAD;
         }
 
-        // If mode is upload perform extra checks on url and also see if there
-        // is an ongoing upload on the same.
-        if (extractMode == Upload.Mode.FTP_UPLOAD) {
-            URI uri = new URI(url);
-            if ((uri.getScheme() == null) || (!uri.getScheme().equalsIgnoreCase("ftp")))
{
-                throw new IllegalArgumentException("Unsupported scheme for url: " + url);
-            }
-
-            String host = uri.getHost();
-            try {
-                InetAddress hostAddr = InetAddress.getByName(host);
-                if (hostAddr.isAnyLocalAddress() || hostAddr.isLinkLocalAddress() || hostAddr.isLoopbackAddress()
|| hostAddr.isMulticastAddress()) {
-                    throw new IllegalArgumentException("Illegal host specified in url");
-                }
-                if (hostAddr instanceof Inet6Address) {
-                    throw new IllegalArgumentException("IPV6 addresses not supported (" +
hostAddr.getHostAddress() + ")");
-                }
-            } catch (UnknownHostException uhe) {
-                throw new IllegalArgumentException("Unable to resolve " + host);
-            }
-
-            if (_uploadMonitor.isTypeUploadInProgress(volumeId, Upload.Type.VOLUME)) {
-                throw new IllegalArgumentException(volume.getName()
-                        + " upload is in progress. Please wait for some time to schedule
another upload for the same");
-            }
-        }
-
         long accountId = volume.getAccountId();
         StoragePool srcPool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId());
         DataStore secStore = this.dataStoreMgr.getImageStore(zoneId);
@@ -3526,7 +3499,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                 throw new CloudRuntimeException(errorString);
             }
 
-            String volumeLocalPath = "volumes/" + volume.getId() + "/" + cvAnswer.getVolumePath()
+ "." + getFormatForPool(srcPool);
+            String volumeLocalPath = "volumes/" + volume.getId() + "/" + cvAnswer.getVolumePath()
+ "." + volume.getFormat().toString().toLowerCase();
           //Fang:  volss, handle the ova special case;
             if (getFormatForPool(srcPool) == "ova") {
                 CreateVolumeOVACommand cvOVACmd = new CreateVolumeOVACommand(secondaryStorageURL,
volumeLocalPath, cvAnswer.getVolumePath(), srcPool, copyvolumewait);
@@ -3546,16 +3519,9 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             uploadJob.setInstallPath(volumeLocalPath);
             _uploadDao.update(uploadJob.getId(), uploadJob);
 
-            if (extractMode == Mode.FTP_UPLOAD) { // Now that the volume is
-                // copied perform the actual
-                // uploading
-                _uploadMonitor.extractVolume(uploadJob, secStore, volume, url, zoneId, volumeLocalPath,
cmd.getStartEventId(), job.getId(), _asyncMgr);
-                return uploadJob.getId();
-            } else { // Volume is copied now make it visible under apache and
-                // create a URL.
-                _uploadMonitor.createVolumeDownloadURL(volumeId, volumeLocalPath, Upload.Type.VOLUME,
zoneId, uploadJob.getId());
-                return uploadJob.getId();
-            }
+            // create a URL.
+            _uploadMonitor.createVolumeDownloadURL(volumeId, volumeLocalPath, Upload.Type.VOLUME,
zoneId, uploadJob.getId(), volume.getFormat());
+            return uploadJob.getId();
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f6eb26e/server/src/com/cloud/storage/upload/UploadMonitor.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadMonitor.java b/server/src/com/cloud/storage/upload/UploadMonitor.java
index 4e41048..b4ba531 100755
--- a/server/src/com/cloud/storage/upload/UploadMonitor.java
+++ b/server/src/com/cloud/storage/upload/UploadMonitor.java
@@ -22,6 +22,7 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
 
 import com.cloud.async.AsyncJobManager;
 import com.cloud.host.HostVO;
+import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Upload.Mode;
 import com.cloud.storage.Upload.Status;
 import com.cloud.storage.Upload.Type;
@@ -57,6 +58,6 @@ public interface UploadMonitor extends Manager{
             TemplateDataStoreVO vmTemplateStore, Long dataCenterId, long eventId);
 
     void createVolumeDownloadURL(Long entityId, String path, Type type,
-            Long dataCenterId, Long uploadId);
+            Long dataCenterId, Long uploadId, ImageFormat format);
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f6eb26e/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
index 2025361..7d75599 100755
--- a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
+++ b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
@@ -260,7 +260,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
 	}
 
 	@Override
-    public void createVolumeDownloadURL(Long entityId, String path, Type type, Long dataCenterId,
Long uploadId) {
+    public void createVolumeDownloadURL(Long entityId, String path, Type type, Long dataCenterId,
Long uploadId, ImageFormat format) {
 
 	    String errorString = "";
 	    boolean success = false;
@@ -278,7 +278,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
             _uploadDao.update(uploadJob.getId(), uploadJob);
 
             // Create Symlink at ssvm
-            String uuid = UUID.randomUUID().toString() + path.substring(path.length() - 4)
; // last 4 characters of the path specify the format like .vhd
+            String uuid = UUID.randomUUID().toString() + "." + format.toString().toLowerCase()
;
             DataStore secStore = this.storeMgr.getDataStore(ApiDBUtils.findUploadById(uploadId).getDataStoreId(),
DataStoreRole.Image);
             EndPoint ep = _epSelector.select(secStore);
             if( ep == null ) {


Mime
View raw message