From b1a25cf917da1fa427e76f71c1cc19de2c4d55d0 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 19 Mar 2013 13:14:29 -0700 Subject: [PATCH 01/23] CLOUDSTACK-1065: cloudstack UI - regions menu - implement create region action. --- ui/scripts/regions.js | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 42a3e9de57c..902d3f80ed3 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -55,26 +55,34 @@ fields: { id: { label: 'label.id', validation: { required: true } }, name: { label: 'label.name', validation: { required: true } }, - endpoint: { label: 'label.endpoint', validation: { required: true } }, - userapikey: { label: 'label.api.key' }, - userapisecretkey: { label: 'label.s3.secret_key' } + endpoint: { label: 'label.endpoint', validation: { required: true } } } }, - action: function(args) { + action: function(args) { + var data = { + id: args.data.id, + name: args.data.name, + endpoint: args.data.endpoint + }; + $.ajax({ url: createURL('addRegion'), - data: args.data, - success: function(json) { - var jobID = json.addregionresponse.jobid; - - args.response.success({ _custom: { jobId: jobID }}); - $(window).trigger('cloudStack.refreshRegions'); + data: data, + success: function(json) { + var item = json.addregionresponse.region; + args.response.success({data: item}); + //$(window).trigger('cloudStack.refreshRegions'); }, error: function(json) { args.response.error(parseXMLHttpResponse(json)); } }); - } + }, + notification: { + poll: function(args) { + args.complete(); + } + } } }, dataProvider: function(args) { From c60ef79321c3e208d658838c8f89ce48716a9b54 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Tue, 19 Mar 2013 14:36:37 -0700 Subject: [PATCH 02/23] CLOUDSTACK-1608: don't support attach volume between different storage scopes --- .../subsystem/api/storage/AbstractScope.java | 30 ++++++++ .../subsystem/api/storage/ClusterScope.java | 2 +- .../subsystem/api/storage/HostScope.java | 2 +- .../engine/subsystem/api/storage/Scope.java | 1 + .../subsystem/api/storage/ZoneScope.java | 2 +- .../subsystem/api/storage/ScopeTest.java | 59 ++++++++++++++++ .../datastore/DefaultPrimaryDataStore.java | 11 +++ .../com/cloud/storage/VolumeManagerImpl.java | 69 +++++-------------- 8 files changed, 120 insertions(+), 56 deletions(-) create mode 100644 engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/AbstractScope.java create mode 100644 engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/ScopeTest.java diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/AbstractScope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/AbstractScope.java new file mode 100644 index 00000000000..c94db66b202 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/AbstractScope.java @@ -0,0 +1,30 @@ +/* + * 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; + +public abstract class AbstractScope implements Scope { + @Override + public boolean isSameScope(Scope scope) { + if (this.getScopeType() == scope.getScopeType() && this.getScopeId() == scope.getScopeId()) { + return true; + } else { + return false; + } + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java index fce7d82cb99..0f0e9581523 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java @@ -19,7 +19,7 @@ package org.apache.cloudstack.engine.subsystem.api.storage; -public class ClusterScope implements Scope { +public class ClusterScope extends AbstractScope { private ScopeType type = ScopeType.CLUSTER; private Long clusterId; private Long podId; diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java index 71d1952c625..c5e90ac894c 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java @@ -19,7 +19,7 @@ package org.apache.cloudstack.engine.subsystem.api.storage; -public class HostScope implements Scope { +public class HostScope extends AbstractScope { private ScopeType type = ScopeType.HOST; private Long hostId; public HostScope(Long hostId) { diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Scope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Scope.java index c1596d4f5f7..91d4734ef15 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Scope.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Scope.java @@ -20,5 +20,6 @@ package org.apache.cloudstack.engine.subsystem.api.storage; public interface Scope { public ScopeType getScopeType(); + public boolean isSameScope(Scope scope); public Long getScopeId(); } diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java index ac277af36de..2d3d41f22b5 100644 --- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java @@ -19,7 +19,7 @@ package org.apache.cloudstack.engine.subsystem.api.storage; -public class ZoneScope implements Scope { +public class ZoneScope extends AbstractScope { private ScopeType type = ScopeType.ZONE; private Long zoneId; diff --git a/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/ScopeTest.java b/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/ScopeTest.java new file mode 100644 index 00000000000..e3ec48c74f0 --- /dev/null +++ b/engine/api/test/org/apache/cloudstack/engine/subsystem/api/storage/ScopeTest.java @@ -0,0 +1,59 @@ +/* + * 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 static org.junit.Assert.*; +import junit.framework.Assert; + +import org.junit.Test; + +public class ScopeTest { + + @Test + public void testZoneScope() { + ZoneScope zoneScope = new ZoneScope(1L); + ZoneScope zoneScope2 = new ZoneScope(1L); + Assert.assertTrue(zoneScope.isSameScope(zoneScope2)); + + ZoneScope zoneScope3 = new ZoneScope(2L); + Assert.assertFalse(zoneScope.isSameScope(zoneScope3)); + } + + @Test + public void testClusterScope() { + ClusterScope clusterScope = new ClusterScope(1L, 1L, 1L); + ClusterScope clusterScope2 = new ClusterScope(1L, 1L, 1L); + + Assert.assertTrue(clusterScope.isSameScope(clusterScope2)); + + ClusterScope clusterScope3 = new ClusterScope(2L, 2L, 1L); + Assert.assertFalse(clusterScope.isSameScope(clusterScope3)); + } + + @Test + public void testHostScope() { + HostScope hostScope = new HostScope(1L); + HostScope hostScope2 = new HostScope(1L); + HostScope hostScope3 = new HostScope(2L); + + Assert.assertTrue(hostScope.isSameScope(hostScope2)); + Assert.assertFalse(hostScope.isSameScope(hostScope3)); + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java index fbfade6c6aa..7b8741c87c2 100644 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java @@ -29,6 +29,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; 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.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; @@ -48,9 +49,11 @@ import org.apache.log4j.Logger; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StoragePoolHostVO; import com.cloud.storage.StoragePoolStatus; import com.cloud.storage.VMTemplateStoragePoolVO; import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.StoragePoolHostDao; import com.cloud.storage.dao.VMTemplatePoolDao; import com.cloud.storage.dao.VolumeDao; import com.cloud.utils.component.ComponentContext; @@ -74,6 +77,8 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore { protected DataStoreProvider provider; @Inject VMTemplatePoolDao templatePoolDao; + @Inject + StoragePoolHostDao poolHostDao; private VolumeDao volumeDao; @@ -152,6 +157,12 @@ public class DefaultPrimaryDataStore implements PrimaryDataStore { vo.getDataCenterId()); } else if (vo.getScope() == ScopeType.ZONE) { return new ZoneScope(vo.getDataCenterId()); + } else if (vo.getScope() == ScopeType.HOST) { + List poolHosts = poolHostDao.listByPoolId(vo.getId()); + if (poolHosts.size() > 0) { + return new HostScope(poolHosts.get(0).getHostId()); + } + s_logger.debug("can't find a local storage in pool host table: " + vo.getId()); } return null; } diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java index 4951975786f..eb33bc4de26 100644 --- a/server/src/com/cloud/storage/VolumeManagerImpl.java +++ b/server/src/com/cloud/storage/VolumeManagerImpl.java @@ -48,6 +48,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManag import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.Scope; import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; @@ -1439,64 +1440,26 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager { } private boolean needMoveVolume(VolumeVO rootVolumeOfVm, VolumeInfo volume) { - StoragePoolVO vmRootVolumePool = _storagePoolDao - .findById(rootVolumeOfVm.getPoolId()); - DiskOfferingVO volumeDiskOffering = _diskOfferingDao - .findById(volume.getDiskOfferingId()); - String[] volumeTags = volumeDiskOffering.getTagsArray(); - - boolean isVolumeOnSharedPool = !volumeDiskOffering - .getUseLocalStorage(); - StoragePoolVO sourcePool = _storagePoolDao.findById(volume - .getPoolId()); - List matchingVMPools = _storagePoolDao - .findPoolsByTags(vmRootVolumePool.getDataCenterId(), - vmRootVolumePool.getPodId(), - vmRootVolumePool.getClusterId(), volumeTags - ); + DataStore storeForRootVol = this.dataStoreMgr.getPrimaryDataStore(rootVolumeOfVm.getPoolId()); + DataStore storeForDataVol = this.dataStoreMgr.getPrimaryDataStore(volume.getPoolId()); - boolean moveVolumeNeeded = true; - if (matchingVMPools.size() == 0) { - String poolType; - if (vmRootVolumePool.getClusterId() != null) { - poolType = "cluster"; - } else if (vmRootVolumePool.getPodId() != null) { - poolType = "pod"; - } else { - poolType = "zone"; - } - throw new CloudRuntimeException( - "There are no storage pools in the VM's " + poolType - + " with all of the volume's tags (" - + volumeDiskOffering.getTags() + ")."); - } else { - long sourcePoolId = sourcePool.getId(); - Long sourcePoolDcId = sourcePool.getDataCenterId(); - Long sourcePoolPodId = sourcePool.getPodId(); - Long sourcePoolClusterId = sourcePool.getClusterId(); - for (StoragePoolVO vmPool : matchingVMPools) { - long vmPoolId = vmPool.getId(); - Long vmPoolDcId = vmPool.getDataCenterId(); - Long vmPoolPodId = vmPool.getPodId(); - Long vmPoolClusterId = vmPool.getClusterId(); - - // Moving a volume is not required if storage pools belongs - // to same cluster in case of shared volume or - // identical storage pool in case of local - if (sourcePoolDcId == vmPoolDcId - && sourcePoolPodId == vmPoolPodId - && sourcePoolClusterId == vmPoolClusterId - && (isVolumeOnSharedPool || sourcePoolId == vmPoolId)) { - moveVolumeNeeded = false; - break; - } - } + Scope storeForRootStoreScope = storeForRootVol.getScope(); + if (storeForRootStoreScope == null) { + throw new CloudRuntimeException("Can't get scope of data store: " + storeForRootVol.getId()); } - return moveVolumeNeeded; + Scope storeForDataStoreScope = storeForDataVol.getScope(); + if (storeForDataStoreScope == null) { + throw new CloudRuntimeException("Can't get scope of data store: " + storeForDataVol.getId()); + } + + if (storeForRootStoreScope.getScopeType() != storeForDataStoreScope.getScopeType()) { + throw new CloudRuntimeException("Can't move volume between scope: " + storeForDataStoreScope.getScopeType() + " and " + storeForRootStoreScope.getScopeType()); + } + + return storeForRootStoreScope.isSameScope(storeForRootStoreScope); } - private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volume, Long deviceId) { String errorMsg = "Failed to attach volume: " + volume.getName() + " to VM: " + vm.getHostName(); From ba249c0e669bbdbbf26a047d0b2f1a24b9671b8d Mon Sep 17 00:00:00 2001 From: Edison Su Date: Tue, 19 Mar 2013 14:45:17 -0700 Subject: [PATCH 03/23] CLOUDSTACK-1608: enable attach a volume created on zone wide storage to a vm created on cluster or host wide storage --- server/src/com/cloud/storage/VolumeManagerImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java index eb33bc4de26..a23ea3294f1 100644 --- a/server/src/com/cloud/storage/VolumeManagerImpl.java +++ b/server/src/com/cloud/storage/VolumeManagerImpl.java @@ -1453,11 +1453,15 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager { throw new CloudRuntimeException("Can't get scope of data store: " + storeForDataVol.getId()); } + if (storeForDataStoreScope.getScopeType() == ScopeType.ZONE) { + return false; + } + if (storeForRootStoreScope.getScopeType() != storeForDataStoreScope.getScopeType()) { throw new CloudRuntimeException("Can't move volume between scope: " + storeForDataStoreScope.getScopeType() + " and " + storeForRootStoreScope.getScopeType()); } - return storeForRootStoreScope.isSameScope(storeForRootStoreScope); + return !storeForRootStoreScope.isSameScope(storeForDataStoreScope); } private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volume, Long deviceId) { From 1ea5d6c169eb470cf8c356f5ea358b2a3ee170da Mon Sep 17 00:00:00 2001 From: Edison Su Date: Tue, 19 Mar 2013 15:34:18 -0700 Subject: [PATCH 04/23] CLOUDSTACK-1641: fix NPE during migrate volume --- server/src/com/cloud/storage/VolumeManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java index a23ea3294f1..737ed0a3bac 100644 --- a/server/src/com/cloud/storage/VolumeManagerImpl.java +++ b/server/src/com/cloud/storage/VolumeManagerImpl.java @@ -2133,7 +2133,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager { + assignedPool + " assigned by deploymentPlanner"); } - VolumeTask task = new VolumeTask(VolumeTaskType.MIGRATE, vol, null); + VolumeTask task = new VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool); tasks.add(task); } } else { From 2bebb124cc0e2ab59143263de8fe1e85ba1194c2 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Tue, 19 Mar 2013 15:47:08 -0700 Subject: [PATCH 05/23] CLOUDSTACK-1729: a partical resolution for user authenticators to unblock developers who are currently working on and relying on the fix --- client/tomcatconf/componentContext.xml.in | 20 +++++++++++++++++-- .../cloud/server/ManagementServerImpl.java | 17 ++++++++-------- .../com/cloud/user/AccountManagerImpl.java | 11 +++++++--- 3 files changed, 35 insertions(+), 13 deletions(-) diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in index 7b64f49ee20..016df0a2095 100644 --- a/client/tomcatconf/componentContext.xml.in +++ b/client/tomcatconf/componentContext.xml.in @@ -36,9 +36,25 @@ --> - - + + + + + + + + + + + + + + + + + + diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 1f1f12edfc1..b689f93f8aa 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -414,13 +414,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe @Inject S3Manager _s3Mgr; -/* - @Inject - ComponentContext _forceContextRef; // create a dependency to ComponentContext so that it can be loaded beforehead - - @Inject - EventUtils _forceEventUtilsRef; -*/ private final ScheduledExecutorService _eventExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker")); private final ScheduledExecutorService _alertExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AlertChecker")); private KeystoreManager _ksMgr; @@ -429,7 +422,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe private Map _availableIdsMap; - @Inject List _userAuthenticators; + List _userAuthenticators; @Inject ClusterManager _clusterMgr; private String _hashKey = null; @@ -437,6 +430,14 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe public ManagementServerImpl() { setRunLevel(ComponentLifecycle.RUN_LEVEL_APPLICATION_MAINLOOP); } + + public List getUserAuthenticators() { + return _userAuthenticators; + } + + public void setUserAuthenticators(List authenticators) { + _userAuthenticators = authenticators; + } @Override public boolean configure(String name, Map params) diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java index be5f4f4d77d..b69f31464ba 100755 --- a/server/src/com/cloud/user/AccountManagerImpl.java +++ b/server/src/com/cloud/user/AccountManagerImpl.java @@ -48,7 +48,6 @@ import org.apache.cloudstack.api.command.admin.user.RegisterCmd; import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd; import org.apache.commons.codec.binary.Base64; import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; import com.cloud.api.ApiDBUtils; import com.cloud.api.query.dao.UserAccountJoinDao; @@ -140,7 +139,6 @@ import com.cloud.vm.dao.InstanceGroupDao; import com.cloud.vm.dao.UserVmDao; import com.cloud.vm.dao.VMInstanceDao; -@Component @Local(value = { AccountManager.class, AccountService.class }) public class AccountManagerImpl extends ManagerBase implements AccountManager, Manager { public static final Logger s_logger = Logger.getLogger(AccountManagerImpl.class); @@ -223,7 +221,6 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M private AutoScaleManager _autoscaleMgr; @Inject VolumeManager volumeMgr; - @Inject private List _userAuthenticators; private final ScheduledExecutorService _executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AccountChecker")); @@ -237,6 +234,14 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M List _securityCheckers; int _cleanupInterval; + public List getUserAuthenticators() { + return _userAuthenticators; + } + + public void setUserAuthenticators(List authenticators) { + _userAuthenticators = authenticators; + } + @Override public boolean configure(final String name, final Map params) throws ConfigurationException { _systemAccount = _accountDao.findById(AccountVO.ACCOUNT_ID_SYSTEM); From 86a2a7504693e2672552fa98b90a60f9fea30196 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 20 Mar 2013 00:26:37 +0000 Subject: [PATCH 06/23] CLOUDSTACK-1668: Fix IP conflict in VPC tier Currently, allPossibleIps return the Ip lists which include the gateway, so we need to remove gateway ip from this list. Now, for non-VPC network it works, because NetUtils.getAllIpsFromCidr return the Ip lists which do not include the first IP of the network (like 192.168.0.1). We need too add the first IP into the returned Ip list, because it can be used for VM if it is not the gateway IP (for example, VPC networks). The corresponding patch for 4.0.1 has been posted on https://reviews.apache.org/r/9923/ Signed-off-by: Chip Childers --- server/src/com/cloud/network/NetworkModelImpl.java | 5 +++++ server/src/com/cloud/network/NetworkServiceImpl.java | 5 +++++ utils/src/com/cloud/utils/net/NetUtils.java | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java index 779b9f23466..40a18c742dd 100644 --- a/server/src/com/cloud/network/NetworkModelImpl.java +++ b/server/src/com/cloud/network/NetworkModelImpl.java @@ -1644,6 +1644,11 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel { if (usedIps.size() != 0) { allPossibleIps.removeAll(usedIps); } + + String gateway = network.getGateway(); + if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway)))) + allPossibleIps.remove(NetUtils.ip2Long(gateway)); + return allPossibleIps; } diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index 52e81e5c8c8..8303b0bba3c 100755 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -2046,6 +2046,11 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { if (usedIps.size() != 0) { allPossibleIps.removeAll(usedIps); } + + String gateway = network.getGateway(); + if ((gateway != null) && (allPossibleIps.contains(NetUtils.ip2Long(gateway)))) + allPossibleIps.remove(NetUtils.ip2Long(gateway)); + return allPossibleIps; } diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java index dd40a33934d..5988dd5f337 100755 --- a/utils/src/com/cloud/utils/net/NetUtils.java +++ b/utils/src/com/cloud/utils/net/NetUtils.java @@ -632,7 +632,7 @@ public class NetUtils { Set result = new TreeSet(); long ip = ip2Long(cidr); long startNetMask = ip2Long(getCidrNetmask(size)); - long start = (ip & startNetMask) + 2; + long start = (ip & startNetMask) + 1; long end = start; end = end >> (32 - size); From 6bc12fa66d983f295c3f3ab9d300e5e57a52cf4e Mon Sep 17 00:00:00 2001 From: Min Chen Date: Tue, 19 Mar 2013 16:57:00 -0700 Subject: [PATCH 07/23] CLOUDSTACK-1511 and CLOUDSTACK-1446 --- .../com/cloud/api/query/dao/UserVmJoinDaoImpl.java | 2 ++ server/src/com/cloud/api/query/vo/UserVmJoinVO.java | 13 +++++++++++++ setup/db/db/schema-40to410.sql | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java index f561449fe2a..8b6abf8a3e4 100644 --- a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java @@ -185,6 +185,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase implem nicResponse.setGateway(userVm.getGateway()); nicResponse.setNetmask(userVm.getNetmask()); nicResponse.setNetworkid(userVm.getNetworkUuid()); + nicResponse.setNetworkName(userVm.getNetworkName()); nicResponse.setMacAddress(userVm.getMacAddress()); nicResponse.setIp6Address(userVm.getIp6Address()); nicResponse.setIp6Gateway(userVm.getIp6Gateway()); @@ -246,6 +247,7 @@ public class UserVmJoinDaoImpl extends GenericDaoBase implem nicResponse.setGateway(uvo.getGateway()); nicResponse.setNetmask(uvo.getNetmask()); nicResponse.setNetworkid(uvo.getNetworkUuid()); + nicResponse.setNetworkName(uvo.getNetworkName()); nicResponse.setMacAddress(uvo.getMacAddress()); nicResponse.setIp6Address(uvo.getIp6Address()); nicResponse.setIp6Gateway(uvo.getIp6Gateway()); diff --git a/server/src/com/cloud/api/query/vo/UserVmJoinVO.java b/server/src/com/cloud/api/query/vo/UserVmJoinVO.java index d7238224e4e..33c49cdeae9 100644 --- a/server/src/com/cloud/api/query/vo/UserVmJoinVO.java +++ b/server/src/com/cloud/api/query/vo/UserVmJoinVO.java @@ -293,6 +293,9 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { @Column(name="network_uuid") private String networkUuid; + @Column(name="network_name") + private String networkName; + @Column(name="traffic_type") @Enumerated(value=EnumType.STRING) private TrafficType trafficType; @@ -1168,6 +1171,16 @@ public class UserVmJoinVO extends BaseViewVO implements ControlledViewEntity { } + public String getNetworkName() { + return networkName; + } + + + public void setNetworkName(String networkName) { + this.networkName = networkName; + } + + public TrafficType getTrafficType() { return trafficType; } diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index 0f316a5acdd..9d51030876c 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -572,6 +572,7 @@ CREATE VIEW `cloud`.`user_vm_view` AS vpc.id vpc_id, vpc.uuid vpc_uuid, networks.uuid network_uuid, + networks.name network_name, networks.traffic_type traffic_type, networks.guest_type guest_type, user_ip_address.id public_ip_id, @@ -750,7 +751,7 @@ CREATE VIEW `cloud`.`domain_router_view` AS left join `cloud`.`networks` ON nics.network_id = networks.id left join - `cloud`.`vpc` ON networks.vpc_id = vpc.id + `cloud`.`vpc` ON domain_router.vpc_id = vpc.id left join `cloud`.`async_job` ON async_job.instance_id = vm_instance.id and async_job.instance_type = 'DomainRouter' From 4faad73d6c0f47a31c5ec8ff9270a61120d04eb2 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Tue, 19 Mar 2013 18:54:16 -0700 Subject: [PATCH 08/23] CLOUDSTACK-1729: a partical resolution for user authenticators to unblock developers who are currently working on, for non-oss version --- .../tomcatconf/nonossComponentContext.xml.in | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in index 7e3552db67e..8f8dae5b10a 100644 --- a/client/tomcatconf/nonossComponentContext.xml.in +++ b/client/tomcatconf/nonossComponentContext.xml.in @@ -37,8 +37,24 @@ --> - + + + + + + + + + + + + + + + + + From 792db8b5cc2cd2d593435457d54620768941dd61 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Sun, 10 Mar 2013 21:07:29 +0530 Subject: [PATCH 09/23] simulator: removing cyclic dependency from simulator The database creator caused a cyclic dependecny in the simulator which is removed with this commit. Additionally the simulator profile is now merged with developer profile and a test for server health is included Steps to run: $ mvn -Pdeveloper clean install $ mvn -Pdeveloper -pl developer -Ddeploydb $ mvn -Pdeveloper -pl developer -Ddeploydb-simulator $ mvn -pl client jetty:run To deploy an adv. zone and test the server health: $ mvn -Pdeveloper,marvin -Dmarvin.config=`find . -name simulator.cfg` -pl :cloud-marvin test Conflicts: pom.xml Signed-off-by: Prasanna Santhanam --- client/pom.xml | 20 +- client/tomcatconf/componentContext.xml.in | 6 +- developer/pom.xml | 240 +++++++++++++--------- pom.xml | 113 +--------- tools/apidoc/gen_toc.py | 1 + tools/marvin/pom.xml | 218 ++++++++++---------- 6 files changed, 259 insertions(+), 339 deletions(-) diff --git a/client/pom.xml b/client/pom.xml index ecf232be7ac..382706d930f 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -219,6 +219,11 @@ cloud-engine-storage-volume ${project.version} + + org.apache.cloudstack + cloud-plugin-hypervisor-simulator + ${project.version} + install @@ -481,21 +486,6 @@ - - simulator - - - simulator - - - - - org.apache.cloudstack - cloud-plugin-hypervisor-simulator - ${project.version} - - - netapp diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in index 016df0a2095..b536879044b 100644 --- a/client/tomcatconf/componentContext.xml.in +++ b/client/tomcatconf/componentContext.xml.in @@ -215,11 +215,9 @@ - @@ -318,11 +316,9 @@ - diff --git a/developer/pom.xml b/developer/pom.xml index ff47b143093..3dc276adc23 100644 --- a/developer/pom.xml +++ b/developer/pom.xml @@ -10,7 +10,7 @@ language governing permissions and limitations under the License. --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 cloud-developer Apache CloudStack Developer Tools @@ -21,25 +21,98 @@ 4.2.0-SNAPSHOT + mysql mysql-connector-java - 5.1.21 - runtime + ${cs.mysql.version} + + + commons-dbcp + commons-dbcp + ${cs.dbcp.version} + + + commons-pool + commons-pool + ${cs.pool.version} + + + org.jasypt + jasypt + ${cs.jasypt.version} + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + org.apache.cloudstack + cloud-server + ${project.version} + + + org.apache.cloudstack + cloud-plugin-hypervisor-simulator + ${project.version} + compile - - org.apache.cloudstack - cloud-plugin-hypervisor-simulator - ${project.version} - compile - install + + + org.codehaus.mojo + properties-maven-plugin + 1.0-alpha-2 + + + initialize + + read-project-properties + + + + ${basedir}/../utils/conf/db.properties + ${basedir}/../utils/conf/db.properties.override + + true + + + + + + maven-antrun-plugin + 1.7 + + + generate-resources + + run + + + + + + + + + + + + + + + + + + - + deploydb @@ -48,91 +121,10 @@ - - org.codehaus.mojo - properties-maven-plugin - 1.0-alpha-2 - - - initialize - - read-project-properties - - - - ${project.parent.basedir}/utils/conf/db.properties - ${project.parent.basedir}/utils/conf/db.properties.override - - true - - - - - - maven-antrun-plugin - 1.7 - - - generate-resources - - run - - - - - - - - - - - - - - - - - - - org.codehaus.mojo exec-maven-plugin 1.2.1 - - - - mysql - mysql-connector-java - ${cs.mysql.version} - - - commons-dbcp - commons-dbcp - ${cs.dbcp.version} - - - commons-pool - commons-pool - ${cs.pool.version} - - - org.jasypt - jasypt - ${cs.jasypt.version} - - - org.apache.cloudstack - cloud-utils - ${project.version} - - - org.apache.cloudstack - cloud-server - ${project.version} - - process-resources @@ -143,17 +135,11 @@ - false - true - - org.apache.cloudstack - cloud-server - com.cloud.upgrade.DatabaseCreator - ${project.parent.basedir}/utils/conf/db.properties - ${project.parent.basedir}/utils/conf/db.properties.override + ${basedir}/../utils/conf/db.properties + ${basedir}/../utils/conf/db.properties.override ${basedir}/target/db/create-schema.sql ${basedir}/target/db/create-schema-premium.sql @@ -181,7 +167,59 @@ catalina.home - ${project.parent.basedir}/utils + ${basedir}/../utils + + + paths.script + ${basedir}/target/db + + + + + + + + + + deploydb-simulator + + + deploydb-simulator + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + process-resources + create-schema-simulator + + java + + + + + com.cloud.upgrade.DatabaseCreator + + + ${basedir}/../utils/conf/db.properties + ${basedir}/../utils/conf/db.properties.override + + ${basedir}/target/db/create-schema-simulator.sql + ${basedir}/target/db/templates.simulator.sql + + com.cloud.upgrade.DatabaseUpgradeChecker + --database=simulator + --rootpassword=${db.root.password} + + + + catalina.home + ${basedir}/../utils paths.script @@ -194,4 +232,4 @@ - + \ No newline at end of file diff --git a/pom.xml b/pom.xml index e75c420a616..1faafb2914d 100644 --- a/pom.xml +++ b/pom.xml @@ -182,7 +182,6 @@ ${cs.junit.version} test - org.springframework spring-core @@ -222,14 +221,12 @@ 1.9.5 test - org.springframework spring-test ${org.springframework.version} test - org.aspectj aspectjrt @@ -276,7 +273,7 @@ - + @@ -509,113 +506,5 @@ vmware-base - - simulator - - - deploydb-simulator - - - - - - org.codehaus.mojo - properties-maven-plugin - 1.0-alpha-2 - - - initialize - - read-project-properties - - - - ${project.basedir}/utils/conf/db.properties - ${project.basedir}/utils/conf/db.properties.override - - true - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - - mysql - mysql-connector-java - ${cs.mysql.version} - - - commons-dbcp - commons-dbcp - ${cs.dbcp.version} - - - commons-pool - commons-pool - ${cs.pool.version} - - - org.jasypt - jasypt - ${cs.jasypt.version} - - - org.apache.cloudstack - cloud-utils - ${project.version} - - - org.apache.cloudstack - cloud-server - ${project.version} - - - - - process-resources - create-schema - - java - - - - - false - true - - org.apache.cloudstack - cloud-server - - com.cloud.upgrade.DatabaseCreator - - - ${project.basedir}/utils/conf/db.properties - ${project.basedir}/utils/conf/db.properties.override - - ${basedir}/target/db/create-schema-simulator.sql - ${basedir}/target/db/templates.simulator.sql - - com.cloud.upgrade.DatabaseUpgradeChecker - --database=simulator - --rootpassword=${db.root.password} - - - - - catalina.home - ${project.basedir}/utils - - - - - - - diff --git a/tools/apidoc/gen_toc.py b/tools/apidoc/gen_toc.py index 6292c536a9d..1fe5e1641f4 100644 --- a/tools/apidoc/gen_toc.py +++ b/tools/apidoc/gen_toc.py @@ -123,6 +123,7 @@ known_categories = { 'Pool': 'Pool', 'VPC': 'VPC', 'PrivateGateway': 'VPC', + 'Simulator': 'simulator', 'StaticRoute': 'VPC', 'Tags': 'Resource tags', 'NiciraNvpDevice': 'Nicira NVP', diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml index 80099be1ecb..8cb9ec370d5 100644 --- a/tools/marvin/pom.xml +++ b/tools/marvin/pom.xml @@ -9,112 +9,118 @@ OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - 4.0.0 - cloud-marvin - Apache CloudStack marvin - pom - - org.apache.cloudstack - cloud-tools - 4.2.0-SNAPSHOT - ../pom.xml - - - install - - - maven-antrun-plugin - 1.7 - - - clean - clean - - run - - - - - Deleting ${project.artifactId} API sources - - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - compile - compile - - exec - - - ${basedir}/marvin - python - - codegenerator.py - -s - ${basedir}/../apidoc/target/commands.xml - Generating ${project.artifactId} API classes} - - - - - package - package - - exec - - - ${exec.workingdir} - python - - setup.py - sdist - - - - + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + cloud-marvin + Apache CloudStack marvin + pom + + org.apache.cloudstack + cloud-tools + 4.2.0-SNAPSHOT + ../pom.xml + + + install + + + maven-antrun-plugin + 1.7 + + + clean + clean + + run + + + + + Deleting ${project.artifactId} API sources + + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + compile + compile + + exec + + + ${basedir}/marvin + python + + codegenerator.py + -s + ${basedir}/../apidoc/target/commands.xml + Generating ${project.artifactId} API classes} + + + + + package + package + + exec + + + ${exec.workingdir} + python + + setup.py + sdist + + + + - + - - - - marvin - - - - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - package - - exec - - - - - ${basedir}/marvin - python - - deployDataCenter.py - -i - ${user.dir}/${marvin.config} - - - - - - - + + + + marvin + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + ${basedir}/marvin + python + + deployAndRun.py + -c + ${user.dir}/${marvin.config} + -t + /tmp/t.log + -r + /tmp/r.log + -f + ${basedir}/marvin/testSetupSuccess.py + + + + + test + + exec + + + + + + + + From 02b3cd7de9438ec1cceeabd992b81995a5912981 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Sun, 10 Mar 2013 17:29:10 +0530 Subject: [PATCH 10/23] marvin logging: write to tmp to adjust for mac-osx /var/log is not available on OSX. This breaks the simulator run. --- tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg b/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg index 7c733ade256..ca794605540 100644 --- a/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg +++ b/tools/marvin/marvin/sandbox/demo/simulator/simulator.cfg @@ -112,11 +112,11 @@ "logger": [ { "name": "TestClient", - "file": "/var/log/testclient.log" + "file": "/tmp/testclient.log" }, { "name": "TestCase", - "file": "/var/log/testcase.log" + "file": "/tmp/testcase.log" } ], "globalConfig": [ From 7e91c475416f1b057974a3a1422cb22cf9931c7c Mon Sep 17 00:00:00 2001 From: radhikap Date: Wed, 20 Mar 2013 11:00:48 +0530 Subject: [PATCH 11/23] CLOUDSTACK-1308 and CLOUDSTACK-807 --- docs/en-US/changed-apicommands-4.1.xml | 25 ++++++++++++++++++------- docs/en-US/ipv6-support.xml | 10 +++++----- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/docs/en-US/changed-apicommands-4.1.xml b/docs/en-US/changed-apicommands-4.1.xml index f0045a56de3..13553fdf336 100644 --- a/docs/en-US/changed-apicommands-4.1.xml +++ b/docs/en-US/changed-apicommands-4.1.xml @@ -62,9 +62,20 @@ listNetworks - The following request parameters has been added: isPersistent - This parameter determines if the network or network offering listed by using this - offering are persistent or not. + The following request parameters have been added: + + + isPersistent + This parameter determines if the network or network offering listed are + persistent or not. + + + ip6gateway + + + ip6cidr + + @@ -104,7 +115,7 @@ CreateZoneCmd - The following parameter are added: ip6dns1, ip6dns2. + The following parameter have been added: ip6dns1, ip6dns2. @@ -113,7 +124,7 @@ listVirtualMachines - For nic responses, the following fields has been added. + For nic responses, the following fields have been added. ip6address @@ -132,7 +143,7 @@ listVlanIpRanges - For nic responses, the following fields has been added. + For nic responses, the following fields have been added. startipv6 @@ -166,7 +177,7 @@ - + addF5LoadBalancer diff --git a/docs/en-US/ipv6-support.xml b/docs/en-US/ipv6-support.xml index 22a5d7a5370..7367ec9ad80 100644 --- a/docs/en-US/ipv6-support.xml +++ b/docs/en-US/ipv6-support.xml @@ -106,14 +106,14 @@ Passwords - - The administrator cannot specify the IPv6 address of a VM. -
- Network Configuration for DHCPv6 - Use DUID-LL to get IPv6 address from DHCP server + Guest VM Configuration for DHCPv6 + For the guest VMs to get IPv6 address, run dhclient command manually on each of the VMs. + Use DUID-LL to set up dhclient. + The IPv6 address is lost when a VM is stopped and started. Therefore, use the same procedure + to get an IPv6 address when a VM is stopped and started. Set up dhclient by using DUID-LL. From 323c3211c814db8053cd050da69a05417b22cc03 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Mon, 11 Mar 2013 21:09:22 +0530 Subject: [PATCH 12/23] run the test lifecycle only when config is specified --- tools/marvin/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml index 8cb9ec370d5..a3bd5460fd5 100644 --- a/tools/marvin/pom.xml +++ b/tools/marvin/pom.xml @@ -88,6 +88,7 @@ marvin + marvin.config From de1ac4b7cd70424a204b753cb955f3ef26ddd67c Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Sun, 10 Mar 2013 11:42:48 +0530 Subject: [PATCH 13/23] jvmArgs is invalid here jvmArgs are unaffected in the jetty:run configuration. Use MAVEN_OPTS for this instead. Signed-off-by: Prasanna Santhanam --- client/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/client/pom.xml b/client/pom.xml index 382706d930f..302fe6bacbe 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -248,7 +248,6 @@ 60000 - -XX:MaxPermSize=512m -Xmx2g ${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml ${project.build.directory}/${project.build.finalName} From d7f9aa637ebc953928e3d601735bc01f6fcff828 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Wed, 13 Mar 2013 21:36:09 +0530 Subject: [PATCH 14/23] remove dependence on dsl iso No need to download the 50MB iso for every test. It is sufficient to use a dummy iso. This dummy iso was generated using mkisofs for test purposes. Signed-off-by: Prasanna Santhanam --- test/integration/component/test_project_usage.py | 2 +- test/integration/component/test_usage.py | 2 +- test/integration/component/test_volumes.py | 2 +- test/integration/smoke/test_iso.py | 4 ++-- test/integration/smoke/test_nic.py | 2 +- test/integration/smoke/test_vm_life_cycle.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/integration/component/test_project_usage.py b/test/integration/component/test_project_usage.py index 16d51068deb..9f0488d20ce 100644 --- a/test/integration/component/test_project_usage.py +++ b/test/integration/component/test_project_usage.py @@ -82,7 +82,7 @@ class Services: "iso": { "displaytext": "Test ISO", "name": "Test ISO", - "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", + "url": "http://people.apache.org/~tsp/dummy.iso", # Source URL where ISO is located "isextractable": True, "isfeatured": True, diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py index 4251eab9555..82d13e5a9ff 100644 --- a/test/integration/component/test_usage.py +++ b/test/integration/component/test_usage.py @@ -78,7 +78,7 @@ class Services: "iso": { "displaytext": "Test ISO", "name": "Test ISO", - "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", + "url": "http://people.apache.org/~tsp/dummy.iso", # Source URL where ISO is located "isextractable": True, "isfeatured": True, diff --git a/test/integration/component/test_volumes.py b/test/integration/component/test_volumes.py index 0a7813065ae..bedf6efd8b4 100644 --- a/test/integration/component/test_volumes.py +++ b/test/integration/component/test_volumes.py @@ -77,7 +77,7 @@ class Services: { "displaytext": "Test ISO", "name": "testISO", - "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", + "url": "http://people.apache.org/~tsp/dummy.iso", # Source URL where ISO is located "ostype": 'CentOS 5.3 (64-bit)', }, diff --git a/test/integration/smoke/test_iso.py b/test/integration/smoke/test_iso.py index 8228a278cc9..5bd7bb358be 100644 --- a/test/integration/smoke/test_iso.py +++ b/test/integration/smoke/test_iso.py @@ -50,7 +50,7 @@ class Services: { "displaytext": "Test ISO 1", "name": "ISO 1", - "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", + "url": "http://people.apache.org/~tsp/dummy.iso", # Source URL where ISO is located "isextractable": True, "isfeatured": True, @@ -61,7 +61,7 @@ class Services: { "displaytext": "Test ISO 2", "name": "ISO 2", - "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", + "url": "http://people.apache.org/~tsp/dummy.iso", # Source URL where ISO is located "isextractable": True, "isfeatured": True, diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py index b9dfdde8fe5..ad30122cd47 100644 --- a/test/integration/smoke/test_nic.py +++ b/test/integration/smoke/test_nic.py @@ -88,7 +88,7 @@ class Services: "iso": { "displaytext": "Test ISO", "name": "testISO", - "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", + "url": "http://people.apache.org/~tsp/dummy.iso", # Source URL where ISO is located "ostype": 'CentOS 5.3 (64-bit)', "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO diff --git a/test/integration/smoke/test_vm_life_cycle.py b/test/integration/smoke/test_vm_life_cycle.py index 8d65c00c896..0a5fbad8376 100644 --- a/test/integration/smoke/test_vm_life_cycle.py +++ b/test/integration/smoke/test_vm_life_cycle.py @@ -107,7 +107,7 @@ class Services: { "displaytext": "Test ISO", "name": "testISO", - "url": "http://iso.linuxquestions.org/download/504/1819/http/gd4.tuwien.ac.at/dsl-4.4.10.iso", + "url": "http://people.apache.org/~tsp/dummy.iso", # Source URL where ISO is located "ostype": 'CentOS 5.3 (64-bit)', "mode": 'HTTP_DOWNLOAD', # Downloading existing ISO From 4ad5d1a4f55a1eb1dc0ebf164f0fe081aeebb2d7 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 20 Mar 2013 12:42:29 +0530 Subject: [PATCH 15/23] cli: Fix nonetype issue with cachemaker and exit after printing version Signed-off-by: Rohit Yadav --- tools/cli/cloudmonkey/cachemaker.py | 6 +++++- tools/cli/cloudmonkey/cloudmonkey.py | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/cli/cloudmonkey/cachemaker.py b/tools/cli/cloudmonkey/cachemaker.py index 8ac123caa4b..a625b014d38 100644 --- a/tools/cli/cloudmonkey/cachemaker.py +++ b/tools/cli/cloudmonkey/cachemaker.py @@ -100,7 +100,11 @@ def monkeycache(apis): cache['count'] = getvalue(apis[responsekey], 'count') cache['asyncapis'] = [] - for api in getvalue(apis[responsekey], 'api'): + apilist = getvalue(apis[responsekey], 'api') + if apilist == None: + print "[monkeycache] Server response issue, no apis found" + + for api in apilist: name = getvalue(api, 'name') verb, subject = splitverbsubject(name) diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py index e94d53091ac..a95ab9eaab4 100644 --- a/tools/cli/cloudmonkey/cloudmonkey.py +++ b/tools/cli/cloudmonkey/cloudmonkey.py @@ -487,6 +487,7 @@ def main(): if options.version: print "cloudmonkey", __version__ print __description__, "(%s)" % __projecturl__ + sys.exit(0) shell = CloudMonkeyShell(sys.argv[0], options.cfile) if len(args) > 1: From 0d62549d61acf9534a7b7e7780241a217e1de20f Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Wed, 20 Mar 2013 13:14:09 +0530 Subject: [PATCH 16/23] cli: Run onecmd if any arg is passed Signed-off-by: Rohit Yadav --- tools/cli/cloudmonkey/cloudmonkey.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py index a95ab9eaab4..94006c9577a 100644 --- a/tools/cli/cloudmonkey/cloudmonkey.py +++ b/tools/cli/cloudmonkey/cloudmonkey.py @@ -490,7 +490,7 @@ def main(): sys.exit(0) shell = CloudMonkeyShell(sys.argv[0], options.cfile) - if len(args) > 1: + if len(args) > 0: shell.onecmd(' '.join(args)) else: shell.cmdloop() From 873ec27135628a81252875693d11667c18bb1589 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Wed, 20 Mar 2013 14:52:32 +0530 Subject: [PATCH 17/23] simulator: by default don't start the simulator discoverers Signed-off-by: Prasanna Santhanam --- client/tomcatconf/componentContext.xml.in | 6 ++++++ .../com/cloud/resource/SimulatorSecondaryDiscoverer.java | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in index b536879044b..2535c779368 100644 --- a/client/tomcatconf/componentContext.xml.in +++ b/client/tomcatconf/componentContext.xml.in @@ -207,6 +207,12 @@ + + diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorSecondaryDiscoverer.java b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorSecondaryDiscoverer.java index 1dd71c5c27f..3a8cf17e24b 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorSecondaryDiscoverer.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorSecondaryDiscoverer.java @@ -44,7 +44,7 @@ import com.cloud.storage.secondary.SecondaryStorageDiscoverer; import com.cloud.utils.exception.CloudRuntimeException; import org.springframework.stereotype.Component; -@Component + @Local(value=Discoverer.class) public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer implements ResourceStateAdapter, Listener { private static final Logger s_logger = Logger.getLogger(SimulatorSecondaryDiscoverer.class); From 3e68dd810e0d4df5213dd921f4b703befec55ecd Mon Sep 17 00:00:00 2001 From: Nitin Mehta Date: Wed, 20 Mar 2013 16:44:44 +0530 Subject: [PATCH 18/23] CLOUDSTACK-1738 : Adding code for StatsCollector initialization using spring framework. This was not initialized and hence stats were not colleced on vm, host and storage in CS. --- server/src/com/cloud/server/StatsCollector.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java index 76bae5b4aca..7dcf091f3e3 100755 --- a/server/src/com/cloud/server/StatsCollector.java +++ b/server/src/com/cloud/server/StatsCollector.java @@ -27,10 +27,15 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import javax.annotation.PostConstruct; import javax.inject.Inject; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; + +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.resource.ResourceManager; + import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -88,6 +93,7 @@ public class StatsCollector { @Inject private StoragePoolHostDao _storagePoolHostDao; @Inject private SecondaryStorageVmManager _ssvmMgr; @Inject private ResourceManager _resourceMgr; + @Inject private ConfigurationDao _configDao; private ConcurrentHashMap _hostStats = new ConcurrentHashMap(); private final ConcurrentHashMap _VmStats = new ConcurrentHashMap(); @@ -107,6 +113,7 @@ public class StatsCollector { } public static StatsCollector getInstance(Map configs) { + s_instance.init(configs); return s_instance; } @@ -114,6 +121,11 @@ public class StatsCollector { s_instance = this; } + @PostConstruct + private void init(){ + init(_configDao.getConfiguration()); + } + private void init(Map configs) { _executor = Executors.newScheduledThreadPool(3, new NamedThreadFactory("StatsCollector")); From dbfd31663c5a4d89b230efe97c9f61f96b220621 Mon Sep 17 00:00:00 2001 From: Sateesh Chodapuneedi Date: Wed, 20 Mar 2013 13:52:00 +0530 Subject: [PATCH 19/23] CLOUDSTACK-664 Health monitoring for NetScaler load balanced instances Fixing class names added to command list. Signed-off-by: Sateesh Chodapuneedi --- server/src/com/cloud/server/ManagementServerImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index b689f93f8aa..191157a4db8 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -2104,13 +2104,13 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe cmdList.add(QueryAsyncJobResultCmd.class); cmdList.add(AssignToLoadBalancerRuleCmd.class); cmdList.add(CreateLBStickinessPolicyCmd.class); - cmdList.add(CreateLBHealthCheckPolicyCmd .class); + cmdList.add(CreateLBHealthCheckPolicyCmd.class); cmdList.add(CreateLoadBalancerRuleCmd.class); cmdList.add(DeleteLBStickinessPolicyCmd.class); - cmdList.add(DeleteLBHealthCheckPolicyCmd .class); + cmdList.add(DeleteLBHealthCheckPolicyCmd.class); cmdList.add(DeleteLoadBalancerRuleCmd.class); cmdList.add(ListLBStickinessPoliciesCmd.class); - cmdList.add(ListLBHealthCheckPoliciesCmd .class); + cmdList.add(ListLBHealthCheckPoliciesCmd.class); cmdList.add(ListLoadBalancerRuleInstancesCmd.class); cmdList.add(ListLoadBalancerRulesCmd.class); cmdList.add(RemoveFromLoadBalancerRuleCmd.class); From 918a7c7481454e78a648389ed3173c0037fc715b Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 20 Mar 2013 11:58:17 -0700 Subject: [PATCH 20/23] CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - implement region switching action triggered by region dropdown on top menu. --- ui/scripts/cloud.core.callbacks.js | 25 +++++++++++++++++++------ ui/scripts/cloudStack.js | 9 +++++++-- ui/scripts/sharedFunctions.js | 1 + ui/scripts/ui-custom/regions.js | 4 ++-- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/ui/scripts/cloud.core.callbacks.js b/ui/scripts/cloud.core.callbacks.js index 857c247d9d1..6384f9bd006 100644 --- a/ui/scripts/cloud.core.callbacks.js +++ b/ui/scripts/cloud.core.callbacks.js @@ -52,17 +52,29 @@ Below is a sample login attempt var clientApiUrl = "/client/api"; var clientConsoleUrl = "/client/console"; -$(document).ready(function() { +$(document).ready(function() { + /* + condition 1: If window.location.href contains parameter 'loginUrl', save the parameter's value to a cookie, then reload the page without any URL parameter. + (After the page is reloaded without any URL parameter, it will fall in condition 2.) + */ + if ($.urlParam('loginUrl') != 0) { + $.cookie('loginUrl', $.urlParam('loginUrl'), { expires: 1}); + document.location.href = '/client/'; + } - var url = $.urlParam("loginUrl"); - if (url != undefined && url != null && url.length > 0) { - url = unescape(clientApiUrl+"?"+url); + /* + condition 2: If window.location.href does not contain parameter 'loginUrl' but cookie 'loginUrl' exists, + save the cookie's value to g_regionUrlParam (a global variable for switching regions), + then call login API to set g_loginResponse (a global variable for single-sign-on). + */ + else if($.cookie('loginUrl') != null) { + g_regionUrlParam = '?loginUrl=' + $.cookie('loginUrl'); $.ajax({ - url: url, + url: unescape(clientApiUrl + "?" + $.cookie('loginUrl')), dataType: "json", async: false, success: function(json) { - g_loginResponse = json.loginresponse; + g_loginResponse = json.loginresponse; }, error: function() { onLogoutCallback(); @@ -73,6 +85,7 @@ $(document).ready(function() { } }); } + }); diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index f9b5a58545c..00b06ab0e61 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -251,6 +251,9 @@ array1.push("&domain=" + encodeURIComponent("/")); } + g_regionUrlParam = '?loginUrl=' + escape("command=login" + array1.join("") + "&response=json"); + $.cookie('loginUrl', escape("command=login" + array1.join("") + "&response=json"), { expires: 1}); + $.ajax({ type: "POST", data: "command=login" + array1.join("") + "&response=json", @@ -382,8 +385,9 @@ g_domainid = null; g_timezoneoffset = null; g_timezone = null; - g_supportELB = null; - + g_supportELB = null; + g_regionUrlParam = null; + $.cookie('JSESSIONID', null); $.cookie('sessionKey', null); $.cookie('username', null); @@ -394,6 +398,7 @@ $.cookie('timezoneoffset', null); $.cookie('timezone', null); $.cookie('supportELB', null); + $.cookie('loginUrl', null); if(onLogoutCallback()) { //onLogoutCallback() will set g_loginResponse(single-sign-on variable) to null, then bypassLoginCheck() will show login screen. document.location.reload(); //when onLogoutCallback() returns true, reload the current document. diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 8bcdff91574..dbcb781a6fa 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -20,6 +20,7 @@ var g_role = null; // roles - root, domain-admin, ro-admin, user var g_username = null; var g_account = null; var g_domainid = null; +var g_regionUrlParam = null; var g_enableLogging = false; var g_timezoneoffset = null; var g_timezone = null; diff --git a/ui/scripts/ui-custom/regions.js b/ui/scripts/ui-custom/regions.js index ac52776d49f..579cdceb488 100644 --- a/ui/scripts/ui-custom/regions.js +++ b/ui/scripts/ui-custom/regions.js @@ -81,8 +81,8 @@ closeRegionSelector({ complete: function() { $('#container').prepend($('
').addClass('loading-overlay')); - - document.location.href = url; + + document.location.href = url + g_regionUrlParam; } }); }; From ae7e5b025e25e36bef8a8d9f2becfbfa5614196f Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 20 Mar 2013 14:34:37 -0700 Subject: [PATCH 21/23] CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - set current region (whose end point matches current URL) to region button and region dropdown on top menu. --- ui/scripts/regions.js | 3 +-- ui/scripts/ui-custom/regions.js | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 902d3f80ed3..79557ad595b 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -29,8 +29,7 @@ data: regions ? regions : [ { id: -1, name: '(Default)' } ], - activeRegionID: cloudStack.context.users.regionid ? - cloudStack.context.users.regionid : 1 + activeRegionID: cloudStack.context.users[0].regionid }); } }); diff --git a/ui/scripts/ui-custom/regions.js b/ui/scripts/ui-custom/regions.js index 579cdceb488..354ecee33de 100644 --- a/ui/scripts/ui-custom/regions.js +++ b/ui/scripts/ui-custom/regions.js @@ -29,23 +29,28 @@ var data = args.data; var activeRegionID = args.activeRegionID; + var currentRegion; $(data).each(function() { var region = this; var regionName = region.name; var $li = $('
  • ').append($('').html(_s(region.name))); $li.data('region-data', region); - + + if(document.location.href == region.endpoint) { + currentRegion = region; + $li.addClass('active'); + } + /* if (region.id == activeRegionID) { $li.addClass('active'); } - - $regionSwitcherButton.find('.title') - .html(regionName) - .attr('title', regionName); - - $regionList.append($li); + */ + + $regionList.append($li); }); + + $regionSwitcherButton.find('.title').html(_s(currentRegion.name)).attr('title', _s(currentRegion.name)); } } }); From 75a6e009b9d2b69c534a4a8e0d0ea1a63c10c3c5 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 20 Mar 2013 15:19:36 -0700 Subject: [PATCH 22/23] CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - remove region action - removing the region that you are currently in is not allowed. --- ui/scripts/regions.js | 12 ++++++++++-- ui/scripts/ui-custom/regions.js | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 79557ad595b..72940e18876 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -70,7 +70,7 @@ success: function(json) { var item = json.addregionresponse.region; args.response.success({data: item}); - //$(window).trigger('cloudStack.refreshRegions'); + $(window).trigger('cloudStack.refreshRegions'); }, error: function(json) { args.response.error(parseXMLHttpResponse(json)); @@ -123,7 +123,15 @@ messages: { notification: function() { return 'label.remove.region'; }, confirm: function() { return 'message.remove.region'; } - }, + }, + preAction: function(args) { + var region = args.context.regions[0]; + if(region.endpoint == document.location.href) { + cloudStack.dialog.notice({ message: _l('You can not remove the region that you are currently in.') }); + return false; + } + return true; + }, action: function(args) { var region = args.context.regions[0]; diff --git a/ui/scripts/ui-custom/regions.js b/ui/scripts/ui-custom/regions.js index 354ecee33de..474e49817cd 100644 --- a/ui/scripts/ui-custom/regions.js +++ b/ui/scripts/ui-custom/regions.js @@ -37,7 +37,7 @@ $li.data('region-data', region); - if(document.location.href == region.endpoint) { + if(region.endpoint == document.location.href) { currentRegion = region; $li.addClass('active'); } From 6cb1486f299ee2f5d761a9c4ec6bf4d2cce4963d Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 20 Mar 2013 15:39:30 -0700 Subject: [PATCH 23/23] CLOUDSTACK-1065: cloudstack UI - AWS Style Regions - implement Edit Region action, ID field shouldn't be editable since ID is the base when searching for an entry in the database. --- ui/scripts/regions.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index 72940e18876..68191c04361 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -105,9 +105,15 @@ edit: { label: 'label.edit.region', action: function(args) { + var data = { + id: args.context.regions[0].id, + name: args.data.name, + endpoint: args.data.endpoint + }; + $.ajax({ url: createURL('updateRegion'), - data: args.data, + data: data, success: function(json) { args.response.success(); $(window).trigger('cloudStack.refreshRegions'); @@ -154,11 +160,11 @@ title: 'label.details', fields: [ { - name: { label: 'label.name', isEditable: true }, + id: { label: 'label.id' } }, { - endpoint: { label: 'label.endpoint', isEditable: true }, - id: { label: 'label.id', isEditable: true } + name: { label: 'label.name', isEditable: true }, + endpoint: { label: 'label.endpoint', isEditable: true } } ], dataProvider: function(args) {