Updated Branches:
  refs/heads/4.2 6a21a71e7 -> 734aa1d51

CLOUDSTACK-3908: fix extract path


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

Branch: refs/heads/4.2
Commit: 734aa1d510058da02ee4ffd10dc34157da3bf7e8
Parents: 6a21a71
Author: Edison Su <sudi...@gmail.com>
Authored: Mon Jul 29 16:57:23 2013 -0700
Committer: Edison Su <sudi...@gmail.com>
Committed: Mon Jul 29 16:57:44 2013 -0700

----------------------------------------------------------------------
 .../manager/VmwareStorageManagerImpl.java       |  4 +-
 .../template/HypervisorTemplateAdapter.java     | 65 --------------------
 2 files changed, 2 insertions(+), 67 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/734aa1d5/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
index 3dece6e..10b6de9 100644
--- 
a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
+++ 
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
@@ -147,12 +147,12 @@ public class VmwareStorageManagerImpl implements 
VmwareStorageManager {
             if (templateName.endsWith(".ova")) {
                 if(new File(templateName).exists())  {
                     s_logger.debug("OVA files exists. succeed. ");
-                    return templateName;
+                    return installPath;
                 } else {
                     if (new File(templateName + ".meta").exists()) {
                         ovafileName = getOVAFromMetafile(templateName + 
".meta");
                         s_logger.debug("OVA file in meta file is " + 
ovafileName);
-                        return installPath;
+                        return ovafileName;
                     }  else {
                         String msg = "Unable to find ova meta or ova file to 
prepare template (vmware)";
                         s_logger.error(msg);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/734aa1d5/server/src/com/cloud/template/HypervisorTemplateAdapter.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java 
b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
index 4b3cade..dd6cc68 100755
--- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java
+++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java
@@ -342,69 +342,4 @@ public class HypervisorTemplateAdapter extends 
TemplateAdapterBase {
 
         return profile;
     }
-
-    @Override
-    public TemplateProfile prepareExtractTemplate(ExtractTemplateCmd 
extractcmd) {
-        TemplateProfile profile = super.prepareExtractTemplate(extractcmd);
-        VMTemplateVO template = profile.getTemplate();
-        Long zoneId = profile.getZoneId();
-        Long templateId = template.getId();
-
-        // Simply return profile if non-ESX hypervisor.
-        if (template.getHypervisorType() == HypervisorType.VMware) {
-            PrepareOVAPackingCommand cmd = null;
-            String zoneName="";
-            List<DataStore> imageStores = null;
-
-            if (!template.isCrossZones()) {
-                if (zoneId == null) {
-                    throw new CloudRuntimeException("ZoneId cannot be null for 
a template that is not available across zones");
-                }
-                // Else get the list of image stores in this zone's scope.
-                DataCenterVO zone = _dcDao.findById(zoneId);
-                zoneName = zone.getName();
-                imageStores = this.storeMgr.getImageStoresByScope(new 
ZoneScope(profile.getZoneId()));
-            } else {
-                // template is available across zones. Get a list of all image 
stores.
-                imageStores = this.storeMgr.listImageStores();
-            }
-
-            if (imageStores == null || imageStores.size() == 0) {
-                throw new CloudRuntimeException("Unable to find an image store 
zone when trying to download template " + profile.getTemplate());
-            }
-
-            s_logger.debug("Attempting to mark template host refs for 
template: " + template.getName() + " as destroyed in zone: " + zoneName);
-
-            // Make sure the template is downloaded to all the necessary 
secondary storage hosts
-
-            for (DataStore store : imageStores) {
-                long storeId = store.getId();
-                List<TemplateDataStoreVO> templateStoreVOs = 
_tmpltStoreDao.listByTemplateStore(templateId, storeId);
-                for (TemplateDataStoreVO templateStoreVO : templateStoreVOs) {
-                    if (templateStoreVO.getDownloadState() == 
Status.DOWNLOAD_IN_PROGRESS) {
-                        String errorMsg = "Please specify a template that is 
not currently being downloaded.";
-                        s_logger.debug("Template: " + template.getName() + " 
is currently being downloaded to secondary storage host: " + store.getName() + 
".");
-                        throw new CloudRuntimeException(errorMsg);
-                    }
-                    String installPath = templateStoreVO.getInstallPath();
-                    if (installPath != null) {
-                        EndPoint ep = _epSelector.select(store);
-                        if (ep == null) {
-                            s_logger.warn("prepareOVAPacking 
(hyervisorTemplateAdapter): There is no secondary storage VM for secondary 
storage host " + store.getName());
-                            throw new 
CloudRuntimeException("PrepareExtractTemplate: can't locate ssvm for SecStorage 
Host.");
-                        }
-                        cmd = new PrepareOVAPackingCommand(store.getUri(), 
installPath);
-                        cmd.setContextParam("hypervisor", 
HypervisorType.VMware.toString());
-                        Answer answer = ep.sendMessage(cmd);
-
-                        if (answer == null || !answer.getResult()) {
-                            s_logger.debug("Failed to create OVA for template 
" + templateStoreVO + " due to " + ((answer == null) ? "answer is null" : 
answer.getDetails()));
-                            throw new 
CloudRuntimeException("PrepareExtractTemplate: Failed to create OVA for 
template extraction. ");
-                        }
-                    }
-                }
-            }
-        }
-        return profile;
-    }
 }

Reply via email to