cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 31ec419
Date Fri, 01 Nov 2013 22:31:07 GMT
Updated Branches:
  refs/heads/master b6576d7c9 -> 31ec4191c


Don't use cast to PrimarydataStoreTO on the resource code


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

Branch: refs/heads/master
Commit: 7c99b889260f6bae06afe6ee793858387f3acec8
Parents: b6576d7
Author: Edison Su <sudison@gmail.com>
Authored: Fri Nov 1 15:13:16 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Fri Nov 1 15:13:16 2013 -0700

----------------------------------------------------------------------
 api/src/com/cloud/agent/api/to/DataStoreTO.java |  5 ++-
 api/src/com/cloud/agent/api/to/NfsTO.java       |  1 +
 .../cloudstack/storage/to/ImageStoreTO.java     |  5 +++
 .../storage/to/PrimaryDataStoreTO.java          | 10 ++++-
 .../subsystem/api/storage/PrimaryDataStore.java | 43 ++++++++++++++++++++
 .../storage/snapshot/SnapshotServiceImpl.java   |  2 +-
 .../storage/datastore/PrimaryDataStore.java     | 43 --------------------
 .../PrimaryDataStoreProviderManager.java        |  1 +
 .../volume/TemplateOnPrimaryDataStoreInfo.java  |  2 +-
 engine/storage/storage.ucls                     |  2 +-
 .../storage/datastore/PrimaryDataStoreImpl.java | 16 +-------
 .../PrimaryDataStoreProviderManagerImpl.java    |  2 +-
 .../storage/volume/VolumeServiceImpl.java       |  2 +-
 .../resource/VmwareStorageProcessor.java        | 29 ++++++-------
 14 files changed, 83 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/api/src/com/cloud/agent/api/to/DataStoreTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/DataStoreTO.java b/api/src/com/cloud/agent/api/to/DataStoreTO.java
index b79ba7d..199740d 100644
--- a/api/src/com/cloud/agent/api/to/DataStoreTO.java
+++ b/api/src/com/cloud/agent/api/to/DataStoreTO.java
@@ -21,6 +21,7 @@ package com.cloud.agent.api.to;
 import com.cloud.storage.DataStoreRole;
 
 public interface DataStoreTO {
-    public DataStoreRole getRole();
-    public String getUuid();
+    DataStoreRole getRole();
+    String getUuid();
+    String getUrl();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/api/src/com/cloud/agent/api/to/NfsTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/NfsTO.java b/api/src/com/cloud/agent/api/to/NfsTO.java
index 54683c7..ee6c3e3 100644
--- a/api/src/com/cloud/agent/api/to/NfsTO.java
+++ b/api/src/com/cloud/agent/api/to/NfsTO.java
@@ -39,6 +39,7 @@ public class NfsTO implements DataStoreTO {
 
     }
 
+    @Override
     public String getUrl() {
         return _url;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/core/src/org/apache/cloudstack/storage/to/ImageStoreTO.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/to/ImageStoreTO.java b/core/src/org/apache/cloudstack/storage/to/ImageStoreTO.java
index ec6c240..c9bcf5b 100644
--- a/core/src/org/apache/cloudstack/storage/to/ImageStoreTO.java
+++ b/core/src/org/apache/cloudstack/storage/to/ImageStoreTO.java
@@ -83,6 +83,11 @@ public class ImageStoreTO implements DataStoreTO {
         return uuid;
     }
 
+    @Override
+    public String getUrl() {
+        return getUri();
+    }
+
     public void setUuid(String uuid) {
         this.uuid = uuid;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/core/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java b/core/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
index 91d78a4..3141c3f 100644
--- a/core/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
+++ b/core/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java
@@ -16,6 +16,7 @@
 // under the License.
 package org.apache.cloudstack.storage.to;
 
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 
 import com.cloud.agent.api.to.DataStoreTO;
@@ -31,8 +32,9 @@ public class PrimaryDataStoreTO implements DataStoreTO {
     private String host;
     private String path;
     private int port;
+    private final String url;
 
-    public PrimaryDataStoreTO(PrimaryDataStoreInfo dataStore) {
+    public PrimaryDataStoreTO(PrimaryDataStore dataStore) {
         this.uuid = dataStore.getUuid();
         this.name = dataStore.getName();
         this.id = dataStore.getId();
@@ -40,6 +42,7 @@ public class PrimaryDataStoreTO implements DataStoreTO {
         this.setHost(dataStore.getHostAddress());
         this.setPath(dataStore.getPath());
         this.setPort(dataStore.getPort());
+        this.url = dataStore.getUri();
     }
 
     public long getId() {
@@ -51,6 +54,11 @@ public class PrimaryDataStoreTO implements DataStoreTO {
         return this.uuid;
     }
 
+    @Override
+    public String getUrl() {
+        return this.url;
+    }
+
     public String getName() {
         return this.name;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStore.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStore.java
b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStore.java
new file mode 100644
index 0000000..b4d7cb9
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStore.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cloudstack.engine.subsystem.api.storage;
+
+import java.util.List;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
+
+public interface PrimaryDataStore extends DataStore, PrimaryDataStoreInfo {
+    VolumeInfo getVolume(long id);
+
+    List<VolumeInfo> getVolumes();
+
+    boolean exists(DataObject data);
+
+    TemplateInfo getTemplate(long templateId);
+
+    SnapshotInfo getSnapshot(long snapshotId);
+
+    DiskFormat getDefaultDiskType();
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
index 0799721..9b73bea 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
@@ -40,7 +40,7 @@ import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcContext;
 import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.command.CopyCmdAnswer;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
 import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
 import org.apache.log4j.Logger;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
deleted file mode 100644
index d8b2a73..0000000
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cloudstack.storage.datastore;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
-
-public interface PrimaryDataStore extends DataStore, PrimaryDataStoreInfo {
-    VolumeInfo getVolume(long id);
-
-    List<VolumeInfo> getVolumes();
-
-    boolean exists(DataObject data);
-
-    TemplateInfo getTemplate(long templateId);
-
-    SnapshotInfo getSnapshot(long snapshotId);
-
-    DiskFormat getDefaultDiskType();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreProviderManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreProviderManager.java
b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreProviderManager.java
index 8613668..bb7911d 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreProviderManager.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreProviderManager.java
@@ -19,6 +19,7 @@
 package org.apache.cloudstack.storage.datastore;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
 
 public interface PrimaryDataStoreProviderManager {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
index b8d0857..5026f3e 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java
@@ -19,7 +19,7 @@
 package org.apache.cloudstack.storage.volume;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
 
 public interface TemplateOnPrimaryDataStoreInfo {
     public String getPath();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/storage/storage.ucls
----------------------------------------------------------------------
diff --git a/engine/storage/storage.ucls b/engine/storage/storage.ucls
index 23a7b21..4de955d 100644
--- a/engine/storage/storage.ucls
+++ b/engine/storage/storage.ucls
@@ -103,7 +103,7 @@
     </display>  
   </class>  
   <interface id="9" corner="BOTTOM_RIGHT" language="java" 
-    name="org.apache.cloudstack.storage.datastore.PrimaryDataStore" project="cloud-engine-storage"

+    name="org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore" project="cloud-engine-storage"
     file="/cloud-engine-storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java"
binary="false">    
     <position height="-1" width="-1" x="770" y="-4"/>    
     <display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
visibility="true">      

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
index 2d99c9b..cb502e9 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreImpl.java
@@ -23,23 +23,9 @@ import java.util.List;
 
 import javax.inject.Inject;
 
+import org.apache.cloudstack.engine.subsystem.api.storage.*;
 import org.apache.log4j.Logger;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
-import org.apache.cloudstack.engine.subsystem.api.storage.HostScope;
-import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle;
-import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
index db14f6d..81919ec 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
@@ -29,7 +29,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManag
 import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStoreImpl;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 870363a..2337858 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -76,7 +76,7 @@ import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.command.CopyCmdAnswer;
 import org.apache.cloudstack.storage.command.DeleteCommand;
-import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager;
 import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7c99b889/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
index 70a8769..fbbbc13 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -37,7 +37,6 @@ import org.apache.cloudstack.storage.command.DeleteCommand;
 import org.apache.cloudstack.storage.command.DettachCommand;
 import org.apache.cloudstack.storage.command.ForgetObjectCmd;
 import org.apache.cloudstack.storage.command.IntroduceObjectCmd;
-import org.apache.cloudstack.storage.to.PrimaryDataStoreTO;
 import org.apache.cloudstack.storage.to.SnapshotObjectTO;
 import org.apache.cloudstack.storage.to.TemplateObjectTO;
 import org.apache.cloudstack.storage.to.VolumeObjectTO;
@@ -194,7 +193,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
         NfsTO nfsImageStore = (NfsTO)srcStore;
         DataTO destData = cmd.getDestTO();
         DataStoreTO destStore = destData.getDataStore();
-        PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)destStore;
+        DataStoreTO primaryStore = destStore;
         String secondaryStorageUrl = nfsImageStore.getUrl();
         assert (secondaryStorageUrl != null);
 
@@ -310,8 +309,8 @@ public class VmwareStorageProcessor implements StorageProcessor {
         TemplateObjectTO template = (TemplateObjectTO)srcData;
         DataTO destData = cmd.getDestTO();
         VolumeObjectTO volume = (VolumeObjectTO)destData;
-        PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)volume.getDataStore();
-        PrimaryDataStoreTO srcStore = (PrimaryDataStoreTO)template.getDataStore();
+        DataStoreTO primaryStore = volume.getDataStore();
+        DataStoreTO srcStore = template.getDataStore();
 
         try {
             VmwareContext context = hostService.getServiceContext(null);
@@ -450,20 +449,22 @@ public class VmwareStorageProcessor implements StorageProcessor {
         try {
 
             NfsTO srcStore = (NfsTO)srcVolume.getDataStore();
-            PrimaryDataStoreTO destStore = (PrimaryDataStoreTO)destVolume.getDataStore();
+            DataStoreTO destStore = destVolume.getDataStore();
 
             VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd);
             String uuid = destStore.getUuid();
 
             ManagedObjectReference morDatastore = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,
uuid);
             if (morDatastore == null) {
+                URI uri = new URI(destStore.getUrl());
+
                 morDatastore = hyperHost.mountDatastore(
                         false,
-                        destStore.getHost(), 0, destStore.getPath(),
+                        uri.getHost(), 0, uri.getPath(),
                         destStore.getUuid().replace("-", ""));
 
                 if (morDatastore == null) {
-                    throw new Exception("Unable to mount storage pool on host. storeUrl:
" + destStore.getHost() + ":/" + destStore.getPath());
+                    throw new Exception("Unable to mount storage pool on host. storeUrl:
" + uri.getHost() + ":/" + uri.getPath());
                 }
             }
 
@@ -551,7 +552,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
 
         VmwareContext context = hostService.getServiceContext(cmd);
         try {
-            PrimaryDataStoreTO primaryStorage = (PrimaryDataStoreTO)srcVolume.getDataStore();
+            DataStoreTO primaryStorage = srcVolume.getDataStore();
             NfsTO destStore = (NfsTO)destVolume.getDataStore();
             VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd);
 
@@ -998,7 +999,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
     @Override
     public Answer backupSnapshot(CopyCommand cmd) {
         SnapshotObjectTO srcSnapshot = (SnapshotObjectTO)cmd.getSrcTO();
-        PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)srcSnapshot.getDataStore();
+        DataStoreTO primaryStore = srcSnapshot.getDataStore();
         SnapshotObjectTO destSnapshot = (SnapshotObjectTO)cmd.getDestTO();
         DataStoreTO destStore = destSnapshot.getDataStore();
         if (!(destStore instanceof NfsTO)) {
@@ -1180,7 +1181,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
 
     private Answer attachVolume(Command cmd, DiskTO disk, boolean isAttach, boolean isManaged,
String vmName, String iScsiName, String storageHost, int storagePort) {
         VolumeObjectTO volumeTO = (VolumeObjectTO)disk.getData();
-        PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)volumeTO.getDataStore();
+        DataStoreTO primaryStore = volumeTO.getDataStore();
         try {
             VmwareHypervisorHost hyperHost = hostService.getHyperHost(hostService.getServiceContext(null),
null);
             VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName);
@@ -1382,7 +1383,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
     public Answer createVolume(CreateObjectCommand cmd) {
 
         VolumeObjectTO volume = (VolumeObjectTO)cmd.getData();
-        PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO)volume.getDataStore();
+        DataStoreTO primaryStore = volume.getDataStore();
 
         try {
             VmwareContext context = hostService.getServiceContext(null);
@@ -1459,11 +1460,11 @@ public class VmwareStorageProcessor implements StorageProcessor {
             VmwareContext context = hostService.getServiceContext(null);
             VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, null);
             VolumeObjectTO vol = (VolumeObjectTO)cmd.getData();
-            PrimaryDataStoreTO store = (PrimaryDataStoreTO)vol.getDataStore();
+            DataStoreTO store = vol.getDataStore();
 
             ManagedObjectReference morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,
store.getUuid());
             if (morDs == null) {
-                String msg = "Unable to find datastore based on volume mount point " + store.getPath();
+                String msg = "Unable to find datastore based on volume mount point " + store.getUuid();
                 s_logger.error(msg);
                 throw new Exception(msg);
             }
@@ -1674,7 +1675,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
         DataTO srcData = cmd.getSrcTO();
         SnapshotObjectTO snapshot = (SnapshotObjectTO)srcData;
         DataTO destData = cmd.getDestTO();
-        PrimaryDataStoreTO pool = (PrimaryDataStoreTO)destData.getDataStore();
+        DataStoreTO pool = destData.getDataStore();
         DataStoreTO imageStore = srcData.getDataStore();
 
 


Mime
View raw message