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/4.3 to 43c3b8d
Date Thu, 21 Nov 2013 00:32:28 GMT
Updated Branches:
  refs/heads/4.3 e03088a3f -> 43c3b8dcb


CS-18582: if EIP is used, extract volume and template returns wrong public ip address. If
remote agent is ssvm agent, then looking up public ip address from ssvm table


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

Branch: refs/heads/4.3
Commit: 43c3b8dcbd71d0c7c974f3e473f3c8c4e0664056
Parents: e03088a
Author: Edison Su <sudison@gmail.com>
Authored: Wed Nov 20 16:31:33 2013 -0800
Committer: Edison Su <sudison@gmail.com>
Committed: Wed Nov 20 16:31:33 2013 -0800

----------------------------------------------------------------------
 .../cloudstack/storage/test/SnapshotTest.java   |  3 +--
 .../cloudstack/storage/test/VolumeTest.java     |  3 +--
 .../storage/test/VolumeTestVmware.java          |  3 +--
 .../storage/test/volumeServiceTest.java         |  3 +--
 .../cloudstack/storage/RemoteHostEndPoint.java  | 23 +++++++++++++++-----
 .../endpoint/DefaultEndPointSelector.java       | 12 ++++------
 6 files changed, 25 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43c3b8dc/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java
index 550a6bf..b1b614b 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/SnapshotTest.java
@@ -276,8 +276,7 @@ public class SnapshotTest extends CloudStackTestNGBase {
                 resourceMgr.listAllUpAndEnabledHosts((Type) Matchers.any(), Matchers.anyLong(),
Matchers.anyLong(),
                         Matchers.anyLong())).thenReturn(hosts);
 
-        remoteEp = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(), this.host.getPrivateIpAddress(),
-                this.host.getPublicIpAddress());
+        remoteEp = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host);
         Mockito.when(epSelector.select(Matchers.any(DataObject.class), Matchers.any(DataObject.class))).thenReturn(
                 remoteEp);
         Mockito.when(epSelector.select(Matchers.any(DataObject.class))).thenReturn(remoteEp);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43c3b8dc/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTest.java
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTest.java
index cbfafc9..fcba047 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTest.java
@@ -255,8 +255,7 @@ public class VolumeTest extends CloudStackTestNGBase {
                 resourceMgr.listAllUpAndEnabledHosts((Type) Matchers.any(), Matchers.anyLong(),
Matchers.anyLong(),
                         Matchers.anyLong())).thenReturn(hosts);
 
-        RemoteHostEndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(),
-                this.host.getPrivateIpAddress(), this.host.getPublicIpAddress());
+        RemoteHostEndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host);
         Mockito.when(epSelector.select(Matchers.any(DataObject.class), Matchers.any(DataObject.class))).thenReturn(ep);
         Mockito.when(epSelector.select(Matchers.any(DataObject.class))).thenReturn(ep);
         Mockito.when(epSelector.select(Matchers.any(DataStore.class))).thenReturn(ep);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43c3b8dc/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTestVmware.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTestVmware.java
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTestVmware.java
index be9dd19..32805f4 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTestVmware.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/VolumeTestVmware.java
@@ -257,8 +257,7 @@ public class VolumeTestVmware extends CloudStackTestNGBase {
                 resourceMgr.listAllUpAndEnabledHosts((Type) Matchers.any(), Matchers.anyLong(),
Matchers.anyLong(),
                         Matchers.anyLong())).thenReturn(hosts);
 
-        RemoteHostEndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(),
-                this.host.getPrivateIpAddress(), this.host.getPublicIpAddress());
+        RemoteHostEndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host);
         Mockito.when(epSelector.select(Matchers.any(DataObject.class), Matchers.any(DataObject.class))).thenReturn(ep);
         Mockito.when(epSelector.select(Matchers.any(DataObject.class))).thenReturn(ep);
         Mockito.when(epSelector.select(Matchers.any(DataStore.class))).thenReturn(ep);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43c3b8dc/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
index 08de7f3..4195d05 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java
@@ -194,8 +194,7 @@ public class volumeServiceTest extends CloudStackTestNGBase {
         Mockito.when(hostDao.findById(Matchers.anyLong())).thenReturn(host);
         Mockito.when(hostDao.findHypervisorHostInCluster(Matchers.anyLong())).thenReturn(results);
         List<EndPoint> eps = new ArrayList<EndPoint>();
-        eps.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress(),
-                host.getPublicIpAddress()));
+        eps.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
         Mockito.when(selector.selectAll(Matchers.any(DataStore.class))).thenReturn(eps);
         Mockito.when(selector.select(Matchers.any(DataObject.class))).thenReturn(eps.get(0));
         Mockito.when(selector.select(Matchers.any(DataObject.class), Matchers.any(DataObject.class))).thenReturn(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43c3b8dc/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java b/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
index 3cae2b9..3788272 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
@@ -24,6 +24,8 @@ import java.util.concurrent.TimeUnit;
 
 import javax.inject.Inject;
 
+import com.cloud.vm.SecondaryStorageVmVO;
+import com.cloud.vm.dao.SecondaryStorageVmDao;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.managed.context.ManagedContextRunnable;
@@ -56,21 +58,30 @@ public class RemoteHostEndPoint implements EndPoint {
     AgentManager agentMgr;
     @Inject
     protected HypervisorGuruManager _hvGuruMgr;
+    @Inject
+    protected SecondaryStorageVmDao vmDao;
     private ScheduledExecutorService executor;
 
     public RemoteHostEndPoint() {
         executor = Executors.newScheduledThreadPool(10, new NamedThreadFactory("RemoteHostEndPoint"));
     }
 
-    private void configure(long hostId, String hostAddress, String publicAddress) {
-        this.hostId = hostId;
-        this.hostAddress = hostAddress;
-        this.publicAddress = publicAddress;
+    private void configure(Host host) {
+        this.hostId = host.getId();
+        this.hostAddress = host.getPrivateIpAddress();
+        this.publicAddress = host.getPublicIpAddress();
+        if (Host.Type.SecondaryStorageVM == host.getType()) {
+            String vmName = host.getName();
+            SecondaryStorageVmVO ssvm = vmDao.findByInstanceName(vmName);
+            if (ssvm != null) {
+                this.publicAddress = ssvm.getPublicIpAddress();
+            }
+        }
     }
 
-    public static RemoteHostEndPoint getHypervisorHostEndPoint(long hostId, String hostAddress,
String publicAddress) {
+    public static RemoteHostEndPoint getHypervisorHostEndPoint(Host host) {
         RemoteHostEndPoint ep = ComponentContext.inject(RemoteHostEndPoint.class);
-        ep.configure(hostId, hostAddress, publicAddress);
+        ep.configure(host);
         return ep;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/43c3b8dc/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
index ce83790..6155ae9 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
@@ -141,8 +141,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
             return null;
         }
 
-        return RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress(),
-                host.getPublicIpAddress());
+        return RemoteHostEndPoint.getHypervisorHostEndPoint(host);
     }
 
     protected EndPoint findEndPointForImageMove(DataStore srcStore, DataStore destStore)
{
@@ -225,8 +224,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
         }
         Collections.shuffle(ssAHosts);
         HostVO host = ssAHosts.get(0);
-        return RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress(),
-                host.getPublicIpAddress());
+        return RemoteHostEndPoint.getHypervisorHostEndPoint(host);
     }
 
     private List<HostVO> listUpAndConnectingSecondaryStorageVmHost(Long dcId) {
@@ -279,16 +277,14 @@ public class DefaultEndPointSelector implements EndPointSelector {
         List<EndPoint> endPoints = new ArrayList<EndPoint>();
         if (store.getScope().getScopeType() == ScopeType.HOST) {
             HostVO host = hostDao.findById(store.getScope().getScopeId());
-            endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress(),
-                    host.getPublicIpAddress()));
+            endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
         } else if (store.getScope().getScopeType() == ScopeType.CLUSTER) {
             QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
             sc.and(sc.entity().getClusterId(), Op.EQ, store.getScope().getScopeId());
             sc.and(sc.entity().getStatus(), Op.EQ, Status.Up);
             List<HostVO> hosts = sc.list();
             for (HostVO host : hosts) {
-                endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(),
host.getPrivateIpAddress(),
-                        host.getPublicIpAddress()));
+                endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host));
             }
 
         } else {


Mime
View raw message