cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/object_store to 8d08f9b
Date Thu, 23 May 2013 19:08:26 GMT
Updated Branches:
  refs/heads/object_store 4611b515d -> 8d08f9b74


CLOUDSTACK-2655: use ssvm public IP to construct extract url.

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

Branch: refs/heads/object_store
Commit: 8d08f9b74bbf9bd08ccaa988ec5f458786cbfb72
Parents: 4611b51
Author: Min Chen <min.chen@citrix.com>
Authored: Thu May 23 12:05:58 2013 -0700
Committer: Min Chen <min.chen@citrix.com>
Committed: Thu May 23 12:05:58 2013 -0700

----------------------------------------------------------------------
 .../engine/subsystem/api/storage/EndPoint.java     |    1 +
 .../cloudstack/storage/test/SnapshotTest.java      |   24 +++++++-------
 .../apache/cloudstack/storage/test/VolumeTest.java |    2 +-
 .../cloudstack/storage/test/VolumeTestVmware.java  |    4 +-
 .../cloudstack/storage/test/volumeServiceTest.java |   10 +++---
 .../cloudstack/storage/LocalHostEndpoint.java      |    7 ++++
 .../cloudstack/storage/RemoteHostEndPoint.java     |   13 ++++++--
 .../storage/endpoint/DefaultEndPointSelector.java  |    8 ++--
 .../cloud/storage/upload/UploadMonitorImpl.java    |    2 +-
 9 files changed, 43 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.java
b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.java
index 34cb139..904ee98 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.java
@@ -24,6 +24,7 @@ import com.cloud.agent.api.Command;
 public interface EndPoint {
     public long getId();
     public String getHostAddr();
+    public String getPublicAddr();
 	public Answer sendMessage(Command cmd);
 	public void sendMessageAsync(Command cmd, AsyncCompletionCallback<Answer> callback);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/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 9b6204d..503b8d3 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
@@ -266,12 +266,12 @@ public class SnapshotTest extends CloudStackTestNGBase {
         hosts.add(this.host);
         Mockito.when(resourceMgr.listAllUpAndEnabledHosts((Type) Mockito.any(), Mockito.anyLong(),
Mockito.anyLong(), Mockito.anyLong())).thenReturn(hosts);
 
-        remoteEp = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(), this.host.getPrivateIpAddress());
+        remoteEp = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(), this.host.getPrivateIpAddress(),
this.host.getPublicIpAddress());
         Mockito.when(epSelector.select(Mockito.any(DataObject.class), Mockito.any(DataObject.class))).thenReturn(remoteEp);
         Mockito.when(epSelector.select(Mockito.any(DataObject.class))).thenReturn(remoteEp);
         Mockito.when(epSelector.select(Mockito.any(DataStore.class))).thenReturn(remoteEp);
         Mockito.when(hyGuruMgr.getGuruProcessedCommandTargetHost(Mockito.anyLong(), Mockito.any(Command.class))).thenReturn(this.host.getId());
-        
+
     }
 
     public DataStore createPrimaryDataStore() {
@@ -333,7 +333,7 @@ public class SnapshotTest extends CloudStackTestNGBase {
     }
 
     private VolumeVO createVolume(Long templateId, long dataStoreId) {
-    	
+
         VolumeVO volume = new VolumeVO(Volume.Type.DATADISK, UUID.randomUUID().toString(),
this.dcId, 1L, 1L, 1L, 1000);
         volume.setDataCenterId(this.dcId);
         volume.setPoolId(dataStoreId);
@@ -376,18 +376,18 @@ public class SnapshotTest extends CloudStackTestNGBase {
             }
         }
         AssertJUnit.assertNotNull(newSnapshot);
-        
+
         LocalHostEndpoint ep = new MockLocalHostEndPoint();
         ep.setResource(new MockLocalNfsSecondaryStorageResource());
         Mockito.when(epSelector.select(Mockito.any(DataStore.class))).thenReturn(ep);
-        
+
         //delete snapshot
         for (SnapshotStrategy strategy : this.snapshotStrategies) {
             if (strategy.canHandle(snapshot)) {
             	strategy.deleteSnapshot(newSnapshot.getId());
             }
         }
-        
+
         Mockito.when(epSelector.select(Mockito.any(DataStore.class))).thenReturn(remoteEp);
     }
 
@@ -412,7 +412,7 @@ public class SnapshotTest extends CloudStackTestNGBase {
         image = imageDataDao.persist(image);
         return image;
     }
-    
+
     @Test
     public void createVolumeFromSnapshot() {
         VolumeInfo vol = createCopyBaseImage();
@@ -432,7 +432,7 @@ public class SnapshotTest extends CloudStackTestNGBase {
         VolumeInfo newVol = this.volFactory.getVolume(volVO.getId());
         this.volumeService.createVolumeFromSnapshot(newVol, newVol.getDataStore(), snapshot);
     }
-    
+
     @Test
     public void deleteSnapshot() {
     	VolumeInfo vol = createCopyBaseImage();
@@ -445,14 +445,14 @@ public class SnapshotTest extends CloudStackTestNGBase {
             }
         }
         AssertJUnit.assertNotNull(newSnapshot);
-        
+
         //create another snapshot
         for (SnapshotStrategy strategy : this.snapshotStrategies) {
             if (strategy.canHandle(snapshot)) {
             	strategy.deleteSnapshot(newSnapshot.getId());
             }
         }
-        
+
     }
 
     @Test
@@ -477,6 +477,6 @@ public class SnapshotTest extends CloudStackTestNGBase {
         DataStore imageStore = this.dataStoreMgr.getImageStore(this.dcId);
         this.imageService.createTemplateFromSnapshotAsync(snapshot, tmpl, imageStore);
     }
-    
-   
+
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/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 ab3475f..187d1f5 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
@@ -247,7 +247,7 @@ public class VolumeTest extends CloudStackTestNGBase {
         hosts.add(this.host);
         Mockito.when(resourceMgr.listAllUpAndEnabledHosts((Type) Mockito.any(), Mockito.anyLong(),
Mockito.anyLong(), Mockito.anyLong())).thenReturn(hosts);
 
-        RemoteHostEndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(),
this.host.getPrivateIpAddress());
+        RemoteHostEndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(),
this.host.getPrivateIpAddress(), this.host.getPublicIpAddress());
         Mockito.when(epSelector.select(Mockito.any(DataObject.class), Mockito.any(DataObject.class))).thenReturn(ep);
         Mockito.when(epSelector.select(Mockito.any(DataObject.class))).thenReturn(ep);
         Mockito.when(epSelector.select(Mockito.any(DataStore.class))).thenReturn(ep);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/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 bd597c2..9d5555a 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
@@ -167,7 +167,7 @@ public class VolumeTestVmware extends CloudStackTestNGBase {
             cluster.setManagedState(ManagedState.Managed);
             cluster = clusterDao.persist(cluster);
             clusterId = cluster.getId();
-            
+
             //setup vcenter
             ClusterDetailsVO clusterDetailVO = new ClusterDetailsVO(cluster.getId(), "url",
null);
             this.clusterDetailsDao.persist(clusterDetailVO);
@@ -253,7 +253,7 @@ public class VolumeTestVmware extends CloudStackTestNGBase {
         hosts.add(this.host);
         Mockito.when(resourceMgr.listAllUpAndEnabledHosts((Type) Mockito.any(), Mockito.anyLong(),
Mockito.anyLong(), Mockito.anyLong())).thenReturn(hosts);
 
-        RemoteHostEndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(),
this.host.getPrivateIpAddress());
+        RemoteHostEndPoint ep = RemoteHostEndPoint.getHypervisorHostEndPoint(this.host.getId(),
this.host.getPrivateIpAddress(), this.host.getPublicIpAddress());
         Mockito.when(epSelector.select(Mockito.any(DataObject.class), Mockito.any(DataObject.class))).thenReturn(ep);
         Mockito.when(epSelector.select(Mockito.any(DataObject.class))).thenReturn(ep);
         Mockito.when(epSelector.select(Mockito.any(DataStore.class))).thenReturn(ep);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/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 b43a107..243d3b2 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
@@ -128,7 +128,7 @@ public class volumeServiceTest extends CloudStackTestNGBase {
     @Test(priority = -1)
 	public void setUp() {
         ComponentContext.initComponentsLifeCycle();
-  
+
         host = hostDao.findByGuid(this.getHostGuid());
         if (host != null) {
             dcId = host.getDataCenterId();
@@ -170,7 +170,7 @@ public class volumeServiceTest extends CloudStackTestNGBase {
 		host.setClusterId(cluster.getId());
 
 		host = hostDao.persist(host);
-		
+
 		imageStore = new ImageStoreVO();
 		imageStore.setName("test");
 		imageStore.setDataCenterId(dcId);
@@ -194,7 +194,7 @@ public class volumeServiceTest extends CloudStackTestNGBase {
         Mockito.when(hostDao.findHypervisorHostInCluster(Mockito.anyLong())).thenReturn(results);
         List<EndPoint> eps = new ArrayList<EndPoint>();
         eps.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(),
-                host.getPrivateIpAddress()));
+                host.getPrivateIpAddress(), host.getPublicIpAddress()));
         Mockito.when(selector.selectAll(Mockito.any(DataStore.class))).thenReturn(eps);
         Mockito.when(selector.select(Mockito.any(DataObject.class))).thenReturn(eps.get(0));
         Mockito.when(selector.select(Mockito.any(DataObject.class), Mockito.any(DataObject.class))).thenReturn(eps.get(0));
@@ -219,10 +219,10 @@ public class volumeServiceTest extends CloudStackTestNGBase {
 		image.setCrossZones(true);
 		image.setExtractable(true);
 
-		
+
 		//image.setImageDataStoreId(storeId);
 		image = imageDataDao.persist(image);
-		
+
 
 		return image;
 	}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java b/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
index 3267de8..1d21b06 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java
@@ -33,6 +33,7 @@ import com.cloud.agent.api.storage.DownloadAnswer;
 import com.cloud.resource.ServerResource;
 import com.cloud.storage.VMTemplateStorageResourceAssoc;
 import com.cloud.storage.download.DownloadListener;
+import com.cloud.utils.net.NetUtils;
 
 public class LocalHostEndpoint implements EndPoint {
 	private ScheduledExecutorService executor;
@@ -53,6 +54,12 @@ public class LocalHostEndpoint implements EndPoint {
         return "127.0.0.0";
     }
 
+
+    @Override
+    public String getPublicAddr() {
+        return NetUtils.getDefaultHostIp();
+    }
+
     @Override
 	public Answer sendMessage(Command cmd) {
 		if ((cmd instanceof CopyCommand) || (cmd instanceof DownloadCommand)) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/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 0e88b65..5b0debb 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/RemoteHostEndPoint.java
@@ -49,6 +49,7 @@ public class RemoteHostEndPoint implements EndPoint {
     private static final Logger s_logger = Logger.getLogger(RemoteHostEndPoint.class);
     private  long hostId;
     private  String hostAddress;
+    private  String publicAddress;
     @Inject
     AgentManager agentMgr;
     @Inject
@@ -61,14 +62,15 @@ public class RemoteHostEndPoint implements EndPoint {
     	executor = Executors.newScheduledThreadPool(10);
     }
 
-    private void configure(long hostId, String hostAddress) {
+    private void configure(long hostId, String hostAddress, String publicAddress) {
         this.hostId = hostId;
         this.hostAddress = hostAddress;
+        this.publicAddress = publicAddress;
     }
 
-    public static RemoteHostEndPoint getHypervisorHostEndPoint(long hostId, String hostAddress)
{
+    public static RemoteHostEndPoint getHypervisorHostEndPoint(long hostId, String hostAddress,
String publicAddress) {
         RemoteHostEndPoint ep = ComponentContext.inject(RemoteHostEndPoint.class);
-        ep.configure(hostId, hostAddress);
+        ep.configure(hostId, hostAddress, publicAddress);
         return ep;
     }
 
@@ -77,6 +79,11 @@ public class RemoteHostEndPoint implements EndPoint {
         return this.hostAddress;
     }
 
+
+    public String getPublicAddr() {
+        return this.publicAddress;
+    }
+
     @Override
     public long getId() {
         return this.hostId;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/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 2b698fb..9acc1d7 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java
@@ -144,7 +144,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
         }
 
         return RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(),
-                host.getPrivateIpAddress());
+                host.getPrivateIpAddress(), host.getPublicIpAddress());
     }
 
     protected EndPoint findEndPointForImageMove(DataStore srcStore,
@@ -204,7 +204,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
         }
         Collections.shuffle(ssAHosts);
         HostVO host = ssAHosts.get(0);
-        return RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress());
+        return RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(), host.getPrivateIpAddress(),
host.getPublicIpAddress());
     }
 
     private List<HostVO> listUpAndConnectingSecondaryStorageVmHost(Long dcId) {
@@ -243,7 +243,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
         if (store.getScope().getScopeType() == ScopeType.HOST) {
             HostVO host = hostDao.findById(store.getScope().getScopeId());
             endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(),
-                    host.getPrivateIpAddress()));
+                    host.getPrivateIpAddress(), host.getPublicIpAddress()));
         } else if (store.getScope().getScopeType() == ScopeType.CLUSTER) {
             SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
             sc.addAnd(sc.getEntity().getClusterId(), Op.EQ, store.getScope().getScopeId());
@@ -251,7 +251,7 @@ public class DefaultEndPointSelector implements EndPointSelector {
             List<HostVO> hosts = sc.find();
             for (HostVO host : hosts) {
                 endPoints.add(RemoteHostEndPoint.getHypervisorHostEndPoint(host.getId(),
-                        host.getPrivateIpAddress()));
+                        host.getPrivateIpAddress(), host.getPublicIpAddress()));
             }
 
         } else {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d08f9b7/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 9e6cfea..2025361 100755
--- a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
+++ b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
@@ -239,7 +239,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor
{
             }
 
     	    //Construct actual URL locally now that the symlink exists at SSVM
-            String extractURL = generateCopyUrl(ep.getHostAddr(), uuid);
+            String extractURL = generateCopyUrl(ep.getPublicAddr(), uuid);
             UploadVO vo = _uploadDao.createForUpdate();
             vo.setLastUpdated(new Date());
             vo.setUploadUrl(extractURL);


Mime
View raw message