[cloudstack] branch master updated: CLOUDSTACK-8599 [VMware] Successful migration was reported as failure when vCenter session timed out
This is an automated email from the ASF dual-hosted git repository. sateesh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git The following commit(s) were added to refs/heads/master by this push: new c5692ce CLOUDSTACK-8599 [VMware] Successful migration was reported as failure when vCenter session timed out c5692ce is described below commit c5692cea4ed9b44276f5feb6163ac583b91ef341 Author: Suresh Kumar Anaparti <suresh.anapa...@accelerite.com> AuthorDate: Wed May 10 08:21:07 2017 +0530 CLOUDSTACK-8599 [VMware] Successful migration was reported as failure when vCenter session timed out --- .../cloud/hypervisor/vmware/util/VmwareClient.java | 47 ++ 1 file changed, 40 insertions(+), 7 deletions(-) diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java index 96558ea..3050f0a 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/util/VmwareClient.java @@ -37,6 +37,7 @@ import com.vmware.vim25.InvalidCollectorVersionFaultMsg; import com.vmware.vim25.InvalidPropertyFaultMsg; import com.vmware.vim25.LocalizedMethodFault; import com.vmware.vim25.ManagedObjectReference; +import com.vmware.vim25.MethodFault; import com.vmware.vim25.ObjectContent; import com.vmware.vim25.ObjectSpec; import com.vmware.vim25.ObjectUpdate; @@ -46,9 +47,11 @@ import com.vmware.vim25.PropertyChangeOp; import com.vmware.vim25.PropertyFilterSpec; import com.vmware.vim25.PropertyFilterUpdate; import com.vmware.vim25.PropertySpec; +import com.vmware.vim25.RequestCanceled; import com.vmware.vim25.RuntimeFaultFaultMsg; import com.vmware.vim25.SelectionSpec; import com.vmware.vim25.ServiceContent; +import com.vmware.vim25.TaskInfo; import com.vmware.vim25.TaskInfoState; import com.vmware.vim25.TraversalSpec; import com.vmware.vim25.UpdateSet; @@ -347,16 +350,46 @@ public class VmwareClient { Object[] result = waitForValues(task, new String[] { "info.state", "info.error" }, new String[] { "state" }, new Object[][] { new Object[] { TaskInfoState.SUCCESS, TaskInfoState.ERROR } }); -if (result[0].equals(TaskInfoState.SUCCESS)) { -retVal = true; +if (result != null && result.length == 2) { //result for 2 properties: info.state, info.error +if (result[0].equals(TaskInfoState.SUCCESS)) { +retVal = true; +} +if (result[1] instanceof LocalizedMethodFault) { +throw new RuntimeException(((LocalizedMethodFault)result[1]).getLocalizedMessage()); +} } -if (result[1] instanceof LocalizedMethodFault) { -throw new RuntimeException(((LocalizedMethodFault) result[1]).getLocalizedMessage()); +} catch (WebServiceException we) { +s_logger.warn("Session to vCenter failed with: " + we.getLocalizedMessage()); + +TaskInfo taskInfo = (TaskInfo)getDynamicProperty(task, "info"); +if (!taskInfo.isCancelable()) { +s_logger.warn("vCenter task: " + taskInfo.getName() + "(" + taskInfo.getKey() + ")" + " will continue to run on vCenter because the task cannot be cancelled"); +throw new RuntimeException(we.getLocalizedMessage()); } -} catch(WebServiceException we) { -s_logger.debug("Cancelling vCenter task because task failed with " + we.getLocalizedMessage()); + +s_logger.debug("Cancelling vCenter task: " + taskInfo.getName() + "(" + taskInfo.getKey() + ")"); getService().cancelTask(task); -throw new RuntimeException("vCenter task failed due to " + we.getLocalizedMessage()); + +// Since task cancellation is asynchronous, wait for the task to be cancelled +Object[] result = waitForValues(task, new String[] {"info.state", "info.error"}, new String[] {"state"}, +new Object[][] {new Object[] {TaskInfoState.SUCCESS, TaskInfoState.ERROR}}); + +if (result != null && result.length == 2) { //result for 2 properties: info.state, info.error +if (result[0].equals(TaskInfoState.SUCCESS)) { +s_logger.warn("Failed to cancel vCenter task: " + taskInfo.getName() + "(" + taskInfo.getKey() + ")" + " and the task successfully completed"); +retVal = true; +} + +if (result[1] instanceof LocalizedMethodFault) { +MethodFault fault = ((LocalizedMeth
[cloudstack] branch master updated: CLOUDSTACK-9963 Root Disk controller value is changing while migrating VM
This is an automated email from the ASF dual-hosted git repository. sateesh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git The following commit(s) were added to refs/heads/master by this push: new 48fa206 CLOUDSTACK-9963 Root Disk controller value is changing while migrating VM 48fa206 is described below commit 48fa20698e92dc60004cbc97aa9c909f05982121 Author: vedulasantosh <vedula.sant...@accelerite.com> AuthorDate: Thu Jun 15 11:37:58 2017 +0530 CLOUDSTACK-9963 Root Disk controller value is changing while migrating VM --- .../hypervisor/vmware/resource/VmwareResource.java | 2 +- .../hypervisor/vmware/mo/VirtualMachineMO.java | 43 +++- .../hypervisor/vmware/mo/VirtualMachineMOTest.java | 120 + 3 files changed, 163 insertions(+), 2 deletions(-) diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index 142d341..b8a3495 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -1518,7 +1518,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } else if (DiskControllerType.getType(scsiDiskController) == DiskControllerType.buslogic) { vmMo.ensureBusLogicDeviceControllers(requiredNumScsiControllers, availableBusNum); } else if (DiskControllerType.getType(scsiDiskController) == DiskControllerType.lsilogic) { -vmMo.ensureScsiDeviceControllers(requiredNumScsiControllers, availableBusNum); +vmMo.ensureLsiLogicDeviceControllers(requiredNumScsiControllers, availableBusNum); } } diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java index 3cf3ad1..c7bdbcd 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java @@ -2220,7 +2220,48 @@ public class VirtualMachineMO extends BaseMO { if(devices != null && devices.size() > 0) { for(VirtualDevice device : devices) { -if(device instanceof VirtualLsiLogicController) { +if(device instanceof VirtualSCSIController) { +return device.getKey(); +} +} +} + +return -1; +} + +public void ensureLsiLogicDeviceControllers(int count, int availableBusNum) throws Exception { +int scsiControllerKey = getLsiLogicDeviceControllerKeyNoException(); +if (scsiControllerKey < 0) { +VirtualMachineConfigSpec vmConfig = new VirtualMachineConfigSpec(); + +int busNum = availableBusNum; +while (busNum < count) { +VirtualLsiLogicController scsiController = new VirtualLsiLogicController(); +scsiController.setSharedBus(VirtualSCSISharing.NO_SHARING); +scsiController.setBusNumber(busNum); +scsiController.setKey(busNum - VmwareHelper.MAX_SCSI_CONTROLLER_COUNT); +VirtualDeviceConfigSpec scsiControllerSpec = new VirtualDeviceConfigSpec(); +scsiControllerSpec.setDevice(scsiController); + scsiControllerSpec.setOperation(VirtualDeviceConfigSpecOperation.ADD); + +vmConfig.getDeviceChange().add(scsiControllerSpec); +busNum++; +} +if (configureVm(vmConfig)) { +throw new Exception("Unable to add Lsi Logic controllers to the VM " + getName()); +} else { +s_logger.info("Successfully added " + count + " LsiLogic Parallel SCSI controllers."); +} +} +} + +private int getLsiLogicDeviceControllerKeyNoException() throws Exception { +List devices = (List)_context.getVimClient(). +getDynamicProperty(_mor, "config.hardware.device"); + +if (devices != null && devices.size() > 0) { +for (VirtualDevice device : devices) { +if (device instanceof VirtualLsiLogicController) { return device.getKey(); } } diff --git a/vmware-base/test/com/cloud/hypervisor/vmware/mo/VirtualMachineMOTest.java b/vmware-base/test/com/cloud/hypervisor/vmware/mo/VirtualMachineMOTest.java new file mode 100644 index 000..0e61b59 --- /dev/null +++ b/vmware-base/test/com/cloud/hypervisor/vmware/mo/VirtualMachineMOTest.java @@ -0,0 +1,120 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// dis
[cloudstack] branch master updated: CLOUDSTACK-9992 : Failed to change cluster to managed state
This is an automated email from the ASF dual-hosted git repository. sateesh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git The following commit(s) were added to refs/heads/master by this push: new d450e1a CLOUDSTACK-9992 : Failed to change cluster to managed state d450e1a is described below commit d450e1acc0f39183e910c99abbbc8e3b98f9c2b0 Author: Nitesh Sarda <nitesh_sa...@accelerite.com> AuthorDate: Tue Jul 11 17:59:04 2017 +0530 CLOUDSTACK-9992 : Failed to change cluster to managed state --- engine/schema/src/com/cloud/host/dao/HostDaoImpl.java | 6 ++ 1 file changed, 6 insertions(+) diff --git a/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java b/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java index f12a628..309d17e 100644 --- a/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java +++ b/engine/schema/src/com/cloud/host/dao/HostDaoImpl.java @@ -377,6 +377,11 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao ClustersForHostsNotOwnedByAnyMSSearch.and("resource", ClustersForHostsNotOwnedByAnyMSSearch.entity().getResource(), SearchCriteria.Op.NNULL); ClustersForHostsNotOwnedByAnyMSSearch.and("cluster", ClustersForHostsNotOwnedByAnyMSSearch.entity().getClusterId(), SearchCriteria.Op.NNULL); ClustersForHostsNotOwnedByAnyMSSearch.and("server", ClustersForHostsNotOwnedByAnyMSSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); + +ClusterManagedSearch = _clusterDao.createSearchBuilder(); +ClusterManagedSearch.and("managed", ClusterManagedSearch.entity().getManagedState(), SearchCriteria.Op.EQ); +ClustersForHostsNotOwnedByAnyMSSearch.join("ClusterManagedSearch", ClusterManagedSearch, ClusterManagedSearch.entity().getId(), ClustersForHostsNotOwnedByAnyMSSearch.entity().getClusterId(), JoinType.INNER); + ClustersForHostsNotOwnedByAnyMSSearch.done(); AllClustersSearch = _clusterDao.createSearchBuilder(Long.class); @@ -501,6 +506,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao */ private List findClustersForHostsNotOwnedByAnyManagementServer() { SearchCriteria sc = ClustersForHostsNotOwnedByAnyMSSearch.create(); +sc.setJoinParameters("ClusterManagedSearch", "managed", Managed.ManagedState.Managed); List clusters = customSearch(sc, null); return clusters; -- To stop receiving notification emails like this one, please contact ['"commits@cloudstack.apache.org" <commits@cloudstack.apache.org>'].
[cloudstack] 04/05: CLOUDSTACK-8672 : NCC Integration with CloudStack. Marvin Integration Tests for Shared and Dedicated Workflow.
This is an automated email from the ASF dual-hosted git repository. sateesh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git commit 6535949383c31fc492ff9b1728bd0362bfdd7546 Author: Sowmya Krishnan <sowmya.krish...@accelerite.com> AuthorDate: Wed Jan 25 17:17:43 2017 +0530 CLOUDSTACK-8672 : NCC Integration with CloudStack. Marvin Integration Tests for Shared and Dedicated Workflow. --- .../component/test_ncc_integration_dedicated.py| 269 + .../component/test_ncc_integration_shared.py | 323 + tools/marvin/marvin/config/test_data.py| 48 +++ tools/marvin/marvin/lib/base.py| 21 ++ tools/marvin/marvin/lib/ncc.py | 317 5 files changed, 978 insertions(+) diff --git a/test/integration/component/test_ncc_integration_dedicated.py b/test/integration/component/test_ncc_integration_dedicated.py new file mode 100755 index 000..b02d051 --- /dev/null +++ b/test/integration/component/test_ncc_integration_dedicated.py @@ -0,0 +1,269 @@ +# 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. +""" +BVT tests for NCC integration with cloudstack +""" +#Import Local Modules +from marvin.cloudstackTestCase import cloudstackTestCase +from marvin.lib.common import get_domain, get_zone, get_template +from marvin.lib import ncc +from marvin.lib.base import (Account, + VirtualMachine, + PublicIPAddress, + LoadBalancerRule, + ServiceOffering, + NetworkOffering, + Network, + NATRule, +PhysicalNetwork, +NetworkServiceProvider, + RegisteredServicePackage) +from marvin.lib.utils import cleanup_resources +from nose.plugins.attrib import attr +import logging + + +class TestNccIntegrationDedicated(cloudstackTestCase): + +@classmethod +def setUpClass(cls): +cls.testClient = super(TestNccIntegrationDedicated, cls).getClsTestClient() +cls.api_client = cls.testClient.getApiClient() +cls.services = cls.testClient.getParsedTestDataConfig() +cls._cleanup = [] + +cls.logger = logging.getLogger('TestNccIntegrationDedicated') +cls.stream_handler = logging.StreamHandler() +cls.logger.setLevel(logging.DEBUG) +cls.logger.addHandler(cls.stream_handler) + +# Get Zone, Domain and templates +cls.domain = get_domain(cls.api_client) +cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) +cls.services['mode'] = cls.zone.networktype +cls.template = get_template( +cls.api_client, +cls.zone.id, +cls.services["ostype"] ) +ncc_ip = cls.services["NCC"]["NCCIP"] +ns_ip = cls.services["NSDedicated"]["NSIP"] +cls.debug("NS IP - Dedicated: %s" % ns_ip) + +mgmt_srv_ip = cls.config.__dict__["mgtSvr"][0].__dict__["mgtSvrIp"] +#ncc_ip = "10.102.195.215" +#ns_ip = "10.102.195.210" +cls.ns = ncc.NCC(ncc_ip, ns_ip, mgmt_srv_ip, logger=cls.logger) +cls.ns.registerCCP(cls.api_client) +cls.ns.registerNS() +cls.ns.assignNStoCSZone() +spname = cls.services["servicepackage_dedicated"]["name"] + +# Create Service package and get device group id, tenant group id and service package id +# These would be needed later for clean up + +(cls.dv_group_id, cls.tnt_group_id, cls.srv_pkg_id) = cls.ns.createServicePackages( +spname, +"NetScalerVPX", +ns_ip, +isolation_policy="dedicated") +cls.debug("Created service package in NCC") +cls.debug("dv_group, tnt_group, srv_pkg_id: %s %s %s" %(cls.dv_group_id,cls.tnt_group_id, cls.sr
[cloudstack] branch master updated (445dbe7 -> e243a31)
This is an automated email from the ASF dual-hosted git repository. sateesh pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git. from 445dbe7 Merge remote-tracking branch 'origin/4.10' new 884606f CLOUDSTACK-8672 : NCC Integration with CloudStack. new b2f7f9a CLOUDSTACK-8672 : NCC Integration with CloudStack. new b2b422c CLOUDSTACK-8672 : NCC Integration with CloudStack. new 6535949 CLOUDSTACK-8672 : NCC Integration with CloudStack. Marvin Integration Tests for Shared and Dedicated Workflow. new e243a31 CLOUDSTACK-8672 : NCC Integration with CloudStack. Improvements. The 5 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: api/src/com/cloud/agent/api/to/LoadBalancerTO.java | 71 +- api/src/com/cloud/event/EventTypes.java| 16 + api/src/com/cloud/host/Host.java | 2 +- api/src/com/cloud/network/NetworkService.java | 7 + .../com/cloud/network/VirtualRouterProvider.java | 2 +- .../com/cloud/network/router/VirtualRouter.java| 2 +- api/src/com/cloud/offering/NetworkOffering.java| 4 +- api/src/com/cloud/vm/VirtualMachine.java | 1 + .../org/apache/cloudstack/api/ApiConstants.java| 2 + .../admin/address/AcquirePodIpCmdByAdmin.java | 92 ++ .../admin/address/ReleasePodIpCmdByAdmin.java | 79 ++ .../admin/network/CreateNetworkOfferingCmd.java| 15 +- .../loadbalancer/UpdateLoadBalancerRuleCmd.java| 7 + .../user/loadbalancer/UploadSslCertCmd.java| 8 + .../api/response/AcquireIPAddressResponse.java | 286 +++ .../api/response/AcquirePodIpCmdResponse.java | 113 +++ .../cloudstack/api/response/SslCertResponse.java | 8 + .../cloudstack/api/response/SystemVmResponse.java | 25 +- .../org/apache/cloudstack/network/tls/SslCert.java | 2 +- .../api/ExternalNetworkResourceUsageCommand.java | 9 + .../api/NetScalerImplementNetworkCommand.java | 65 ++ .../api/StartupExternalLoadBalancerCommand.java| 3 + .../api/routing/HealthCheckLBConfigCommand.java| 8 +- .../service/NetworkOrchestrationService.java | 18 +- .../service/VolumeOrchestrationService.java| 6 +- .../src/com/cloud/network/IpAddressManager.java| 81 +- .../com/cloud/vm/VirtualMachineManagerImpl.java| 3 +- .../com/cloud/dc/dao/DataCenterIpAddressDao.java | 2 + .../cloud/dc/dao/DataCenterIpAddressDaoImpl.java | 13 + engine/schema/src/com/cloud/dc/dao/HostPodDao.java | 2 + .../src/com/cloud/dc/dao/HostPodDaoImpl.java | 8 + .../schema/src/com/cloud/host/dao/HostDaoImpl.java | 2 +- .../src/com/cloud/network/dao/NetworkDao.java | 2 + .../src/com/cloud/network/dao/NetworkDaoImpl.java | 16 +- .../src/com/cloud/network/dao/SslCertVO.java | 11 +- .../src/com/cloud/offerings/NetworkOfferingVO.java | 12 + .../cloud/offerings/dao/NetworkOfferingDao.java| 3 + .../offerings/dao/NetworkOfferingDaoImpl.java | 32 + .../src/com/cloud/hypervisor/guru/VMwareGuru.java | 4 + .../hypervisor/vmware/resource/VmwareResource.java | 10 + .../xenserver/resource/CitrixResourceBase.java | 16 +- .../wrapper/xenbase/CitrixStartCommandWrapper.java | 1 - plugins/network-elements/netscaler/pom.xml | 5 + .../netscaler/spring-netscaler-context.xml | 5 +- .../commands/DeleteNetscalerControlCenterCmd.java | 95 +++ .../commands/DeleteNetscalerLoadBalancerCmd.java | 2 +- .../commands/DeleteServicePackageOfferingCmd.java | 92 ++ ...BalancerCmd.java => DeployNetscalerVpxCmd.java} | 87 +- .../commands/ListNetscalerControlCenterCmd.java| 93 +++ .../commands/ListRegisteredServicePackageCmd.java | 81 ++ ...java => RegisterNetscalerControlCenterCmd.java} | 76 +- ...ncerCmd.java => RegisterServicePackageCmd.java} | 76 +- .../com/cloud/api/commands/StopNetScalerVMCmd.java | 132 +++ .../response/NetScalerServicePackageResponse.java | 73 ++ .../response/NetscalerControlCenterResponse.java | 98 +++ .../cloud/network/NetScalerControlCenterVO.java| 127 +++ .../cloud/network/NetScalerServicePackageVO.java | 105 +++ .../network/dao/NetScalerControlCenterDao.java | 15 +- .../network/dao/NetScalerControlCenterDaoImpl.java | 26 +- .../network/dao/NetScalerServicePackageDao.java| 19 +- .../dao/NetScalerServicePackageDaoImpl.java| 67 ++ .../cloud/network/element/NetscalerElement.java| 694 +--- .../NetscalerLoadBalancerElementService.java | 75 +- .../resource/NetScalerControlCenterResource.java | 924 + .../com/cloud/network/vm/NetScalerVMManager.java | 42 + .../cloud/network/vm/NetScalerVMManagerImpl.java | 448 +
[cloudstack] 05/05: CLOUDSTACK-8672 : NCC Integration with CloudStack. Improvements.
This is an automated email from the ASF dual-hosted git repository. sateesh pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cloudstack.git commit e243a31e41ed52a78325a6d7b08351dbf236bb30 Author: Nitin Kumar Maharana <nitinkumar.mahar...@accelerite.com> AuthorDate: Sun Jun 18 19:10:55 2017 +0530 CLOUDSTACK-8672 : NCC Integration with CloudStack. Improvements. --- .../admin/address/AcquirePodIpCmdByAdmin.java | 3 +- .../service/NetworkOrchestrationService.java | 18 +- .../service/VolumeOrchestrationService.java| 6 +- .../src/com/cloud/network/IpAddressManager.java| 49 +- .../offerings/dao/NetworkOfferingDaoImpl.java | 4 +- .../commands/DeleteNetscalerControlCenterCmd.java | 2 - .../commands/DeleteServicePackageOfferingCmd.java | 2 - .../api/commands/RegisterServicePackageCmd.java| 1 - .../cloud/network/NetScalerControlCenterVO.java| 1 - .../network/dao/NetScalerControlCenterDaoImpl.java | 5 - .../dao/NetScalerServicePackageDaoImpl.java| 3 - .../cloud/network/element/NetscalerElement.java| 6 - .../resource/NetScalerControlCenterResource.java | 25 +- .../com/cloud/network/vm/NetScalerVMManager.java | 15 +- .../cloud/network/vm/NetScalerVMManagerImpl.java | 662 ++--- server/src/com/cloud/alert/AlertManagerImpl.java | 14 +- .../ExternalLoadBalancerDeviceManagerImpl.java | 5 +- .../network/lb/LoadBalancingRulesManagerImpl.java | 2 +- .../cloudstack/network/ssl/CertServiceImpl.java| 3 +- .../test/com/cloud/vpc/dao/MockNetworkDaoImpl.java | 149 + 20 files changed, 399 insertions(+), 576 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java index eba41b4..fea0ca6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java +++ b/api/src/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java @@ -42,7 +42,7 @@ public class AcquirePodIpCmdByAdmin extends BaseCmd { API parameters / / -@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "the ID of the zone") +@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "the ID of the zone") private String zoneId; @Parameter(name = ApiConstants.POD_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = false, description = "Pod ID") @@ -86,7 +86,6 @@ public class AcquirePodIpCmdByAdmin extends BaseCmd { @Override public long getEntityOwnerId() { -// TODO Auto-generated method stub return CallContext.current().getCallingAccount().getAccountId(); } diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java index b59c9ca..13bfee6 100644 --- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java +++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java @@ -60,19 +60,21 @@ import com.cloud.vm.VirtualMachineProfile; * */ public interface NetworkOrchestrationService { -static final String NetworkLockTimeoutCK = "network.lock.timeout"; -static final String GuestDomainSuffixCK = "guest.domain.suffix"; -static final String NetworkThrottlingRateCK = "network.throttling.rate"; -static final String MinVRVersionCK = "minreq.sysvmtemplate.version"; +String NetworkLockTimeoutCK = "network.lock.timeout"; +String GuestDomainSuffixCK = "guest.domain.suffix"; +String NetworkThrottlingRateCK = "network.throttling.rate"; +String MinVRVersionCK = "minreq.sysvmtemplate.version"; -static final ConfigKey MinVRVersion = new ConfigKey(String.class, MinVRVersionCK, "Advanced", "4.10.0", +ConfigKey MinVRVersion = new ConfigKey(String.class, MinVRVersionCK, "Advanced", "4.10.0", "What version should the Virtual Routers report", true, ConfigKey.Scope.Zone, null); -static final ConfigKey NetworkLockTimeout = new ConfigKey(Integer.class, NetworkLockTimeoutCK, "Network", "600", +ConfigKey NetworkLockTimeout = new ConfigKey(Integer.class, NetworkLockTimeoutCK, "Network", "600", "Lock wait timeout (seconds) while implementing network", tru
[25/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/component/ComponentLifecycle.java -- diff --git a/utils/src/com/cloud/utils/component/ComponentLifecycle.java b/utils/src/com/cloud/utils/component/ComponentLifecycle.java deleted file mode 100644 index 897ddb1..000 --- a/utils/src/com/cloud/utils/component/ComponentLifecycle.java +++ /dev/null @@ -1,64 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.component; - -import java.util.Map; - -import javax.naming.ConfigurationException; - -public interface ComponentLifecycle extends Named { -public static final int RUN_LEVEL_SYSTEM_BOOTSTRAP = 0;// for system level bootstrap components -public static final int RUN_LEVEL_SYSTEM = 1;// for system level service components (i.e., DAOs) -public static final int RUN_LEVEL_FRAMEWORK_BOOTSTRAP = 2;// for framework startup checkers (i.e., DB migration check) -public static final int RUN_LEVEL_FRAMEWORK = 3;// for framework bootstrap components(i.e., clustering management components) -public static final int RUN_LEVEL_COMPONENT_BOOTSTRAP = 4;// general manager components -public static final int RUN_LEVEL_COMPONENT = 5;// regular adapters, plugin components -public static final int RUN_LEVEL_APPLICATION_MAINLOOP = 6; -public static final int MAX_RUN_LEVELS = 7; - -@Override -String getName(); - -void setName(String name); - -void setConfigParams(Mapparams); - -Map getConfigParams(); - -int getRunLevel(); - -void setRunLevel(int level); - -public boolean configure(String name, Map params) throws ConfigurationException; - -/** - * Start any background tasks. - * - * @return true if the tasks were started, false otherwise. - */ -public boolean start(); - -/** - * Stop any background tasks. - * - * @return true background tasks were stopped, false otherwise. - */ -public boolean stop(); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java -- diff --git a/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java b/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java deleted file mode 100644 index 829dc9b..000 --- a/utils/src/com/cloud/utils/component/ComponentLifecycleBase.java +++ /dev/null @@ -1,87 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.component; - -import java.util.HashMap; -import java.util.Map; - -import javax.naming.ConfigurationException; - -import org.apache.log4j.Logger; - -public class ComponentLifecycleBase implements ComponentLifecycle { -private static final Logger s_logger = Logger.getLogger(ComponentLifecycleBase.class); - -protected String _name; -protected int _runLevel; -protected Map _configParams = new HashMap (); - -public ComponentLifecycleBase() { -_name = this.getClass().getSimpleName(); -_runLevel = RUN_LEVEL_COMPONENT; -} - -@Override -public String getName() { -return _name; -} - -@Override -public
[44/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Add basic RestClient implentation based on HTTP Components 4.5 - Upgrade version of HTTP Components to 4.5 - Add helper class to create Http clients - Add helper class to build http requests - Add enum with the different Http Methods - Add constants class for HTTP related values Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8a93bb8d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8a93bb8d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8a93bb8d Branch: refs/heads/deploy-from-snapshot Commit: 8a93bb8d2dc85dc6382e373744f8e7c6a9593fb1 Parents: 6e74ef8 Author: Miguel FerreiraAuthored: Fri Aug 21 17:44:57 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 17:36:13 2015 +0200 -- pom.xml | 2 +- .../com/cloud/utils/rest/BasicRestClient.java | 118 .../com/cloud/utils/rest/HttpClientHelper.java | 71 ++ .../com/cloud/utils/rest/HttpConstants.java | 34 + .../java/com/cloud/utils/rest/HttpMethods.java | 41 ++ .../cloud/utils/rest/HttpUriRequestBuilder.java | 119 .../java/com/cloud/utils/rest/RestClient.java | 31 .../cloud/utils/rest/BasicRestClientTest.java | 106 ++ .../cloud/utils/rest/HttpClientHelperTest.java | 38 + .../cloud/utils/rest/HttpRequestMatcher.java| 141 +++ .../utils/rest/HttpUriRequestBuilderTest.java | 115 +++ .../utils/rest/HttpUriRequestQueryMatcher.java | 48 +++ 12 files changed, 863 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8a93bb8d/pom.xml -- diff --git a/pom.xml b/pom.xml index 95b90db..b5e380e 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ 18.0 18.0 6.2.0-3.1 -4.3.6 +4.5 4.4 3.1 5.1.34 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8a93bb8d/utils/src/main/java/com/cloud/utils/rest/BasicRestClient.java -- diff --git a/utils/src/main/java/com/cloud/utils/rest/BasicRestClient.java b/utils/src/main/java/com/cloud/utils/rest/BasicRestClient.java new file mode 100644 index 000..5c29155 --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/rest/BasicRestClient.java @@ -0,0 +1,118 @@ +// +// 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 com.cloud.utils.rest; + +import java.io.IOException; +import java.net.URI; + +import org.apache.http.HttpHost; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.log4j.Logger; + +public class BasicRestClient implements RestClient { + +private static final Logger s_logger = Logger.getLogger(BasicRestClient.class); + +private static final String HTTPS = HttpConstants.HTTPS; +private static final int HTTPS_PORT = HttpConstants.HTTPS_PORT; + +private final CloseableHttpClient client; +private final HttpClientContext clientContext; + +private BasicRestClient(final Builder builder) { +client = builder.client; +clientContext = builder.clientContext; +clientContext.setTargetHost(buildHttpHost(builder.host)); +} + +protected BasicRestClient(final CloseableHttpClient client, final HttpClientContext clientContex, final String host) { +this.client = client; +clientContext = clientContex; +clientContext.setTargetHost(buildHttpHost(host)); +} + +private static HttpHost buildHttpHost(final String host) { +return new HttpHost(host, HTTPS_PORT, HTTPS); +} + +@SuppressWarnings("rawtypes") +public static Builder create() { +return new Builder(); +} + +@Override +public
[43/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Code clean up in cloud-plugin-network-nvp project - Code formatting - Declare final where possible - Remove unused methods - Remove throws declarations where not needed - Remove generated comments (e.g. "TODO Auto-generated method stub") Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6e74ef8e Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6e74ef8e Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6e74ef8e Branch: refs/heads/deploy-from-snapshot Commit: 6e74ef8e40c408511e4ec247a058c3d27fb3209d Parents: 5fc953e Author: Miguel FerreiraAuthored: Sat Aug 22 20:53:28 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 17:36:12 2015 +0200 -- plugins/network-elements/nicira-nvp/pom.xml | 3 +- .../network/guru/NiciraNvpGuestNetworkGuru.java | 65 +++--- .../com/cloud/network/nicira/NiciraNvpApi.java | 71 ++ .../network/resource/NiciraNvpResource.java | 36 +-- ...figurePortForwardingRulesCommandWrapper.java | 5 +- ...ciraNvpConfigurePublicIpsCommandWrapper.java | 4 +- ...vpConfigureStaticNatRulesCommandWrapper.java | 2 +- ...aNvpFindLogicalSwitchPortCommandWrapper.java | 2 +- .../resource/NiciraNvpRequestWrapperTest.java | 4 +- .../network/resource/NiciraNvpResourceTest.java | 223 +-- 10 files changed, 190 insertions(+), 225 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e74ef8e/plugins/network-elements/nicira-nvp/pom.xml -- diff --git a/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml index 8567482..2d20ae2 100644 --- a/plugins/network-elements/nicira-nvp/pom.xml +++ b/plugins/network-elements/nicira-nvp/pom.xml @@ -18,7 +18,8 @@ under the License. --> -http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> +http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> 4.0.0 cloud-plugin-network-nvp Apache CloudStack Plugin - Network Nicira NVP http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6e74ef8e/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java index 640d8a5..975ebd1 100644 --- a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java @@ -98,14 +98,14 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { public NiciraNvpGuestNetworkGuru() { super(); -_isolationMethods = new IsolationMethod[] {IsolationMethod.STT, IsolationMethod.VXLAN}; +_isolationMethods = new IsolationMethod[] { IsolationMethod.STT, IsolationMethod.VXLAN }; } @Override protected boolean canHandle(final NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) { // This guru handles only Guest Isolated network that supports Source nat service -if (networkType == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) && offering.getGuestType() == Network.GuestType.Isolated && -isMyIsolationMethod(physicalNetwork) && ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.Connectivity)) { +if (networkType == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) && offering.getGuestType() == Network.GuestType.Isolated +&& isMyIsolationMethod(physicalNetwork) && ntwkOfferingSrvcDao.areServicesSupportedByNetworkOffering(offering.getId(), Service.Connectivity)) { return true; } else { s_logger.trace("We only take care of Guest networks of type " + GuestType.Isolated + " in zone of type " + NetworkType.Advanced); @@ -116,14 +116,14 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { @Override public Network design(final NetworkOffering offering, final DeploymentPlan plan, final Network userSpecified, final Account owner) { // Check of the isolation type of the related physical
[34/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/SingleDefaultRouteImplicitRoutingConfig.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/SingleDefaultRouteImplicitRoutingConfig.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/SingleDefaultRouteImplicitRoutingConfig.java new file mode 100644 index 000..ea5df2c --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/SingleDefaultRouteImplicitRoutingConfig.java @@ -0,0 +1,40 @@ +// +// 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 com.cloud.network.nicira; + +/** + * + */ +public class SingleDefaultRouteImplicitRoutingConfig extends RoutingConfig { +public RouterNextHop defaultRouteNextHop; +public final String type = "SingleDefaultRouteImplicitRoutingConfig"; + +public SingleDefaultRouteImplicitRoutingConfig(final RouterNextHop routerNextHop) { +defaultRouteNextHop = routerNextHop; +} + +public RouterNextHop getDefaultRouteNextHop() { +return defaultRouteNextHop; +} + +public void setDefaultRouteNextHop(final RouterNextHop defaultRouteNextHop) { +this.defaultRouteNextHop = defaultRouteNextHop; +} +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/SourceNatRule.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/SourceNatRule.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/SourceNatRule.java new file mode 100644 index 000..b95cb9a --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/SourceNatRule.java @@ -0,0 +1,119 @@ +// +// 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 com.cloud.network.nicira; + +public class SourceNatRule extends NatRule { +private String toSourceIpAddressMax; +private String toSourceIpAddressMin; +private Integer toSourcePort; + +public SourceNatRule() { +setType("SourceNatRule"); +} + +public String getToSourceIpAddressMax() { +return toSourceIpAddressMax; +} + +public void setToSourceIpAddressMax(final String toSourceIpAddressMax) { +this.toSourceIpAddressMax = toSourceIpAddressMax; +} + +public String getToSourceIpAddressMin() { +return toSourceIpAddressMin; +} + +public void setToSourceIpAddressMin(final String toSourceIpAddressMin) { +this.toSourceIpAddressMin = toSourceIpAddressMin; +} + +public Integer getToSourcePort() { +return toSourcePort; +} + +public void setToSourcePort(final Integer toSourcePort) { +this.toSourcePort = toSourcePort; +} + +@Override +public int hashCode() { +final int prime = 31; +int result = super.hashCode(); +result = prime * result + ((toSourceIpAddressMax == null) ? 0 : toSourceIpAddressMax.hashCode()); +result = prime * result + ((toSourceIpAddressMin == null) ? 0 : toSourceIpAddressMin.hashCode()); +result = prime * result + ((toSourcePort == null) ? 0 :
[45/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Delegate HTTP protocol activity in RESTServiceConnector to RestClient - All HTTP protocol activities are now handled by RestClient - This service is now only responsible for creating requests, and dispatching them to the client - Provides a Simple API for creating, updating, retrieving and deleting objects Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/de63b94f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/de63b94f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/de63b94f Branch: refs/heads/deploy-from-snapshot Commit: de63b94f2dc571e74ce5eaa68c74ed6a9edf420c Parents: 8a93bb8 Author: Miguel FerreiraAuthored: Sun Aug 23 15:11:29 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 17:36:14 2015 +0200 -- .../BasicEncodedRESTValidationStrategy.java | 66 --- .../cloud/utils/rest/RESTServiceConnector.java | 391 +++-- .../utils/rest/RESTValidationStrategy.java | 159 -- .../utils/rest/HttpUriRequestMethodMatcher.java | 44 ++ .../rest/HttpUriRequestPayloadMatcher.java | 62 +++ .../utils/rest/RESTServiceConnectorTest.java| 553 --- 6 files changed, 430 insertions(+), 845 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de63b94f/utils/src/main/java/com/cloud/utils/rest/BasicEncodedRESTValidationStrategy.java -- diff --git a/utils/src/main/java/com/cloud/utils/rest/BasicEncodedRESTValidationStrategy.java b/utils/src/main/java/com/cloud/utils/rest/BasicEncodedRESTValidationStrategy.java deleted file mode 100644 index bf001cd..000 --- a/utils/src/main/java/com/cloud/utils/rest/BasicEncodedRESTValidationStrategy.java +++ /dev/null @@ -1,66 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.rest; - -import java.io.IOException; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpMethodBase; - -/** - * Base 64 encoded authorization strategy. This implementation as opposed to - * {@link RESTValidationStrategy} doesn't do a login after auth error, but instead - * includes the encoded credentials in each request, instead of a cookie. - */ -public class BasicEncodedRESTValidationStrategy extends RESTValidationStrategy { - -public BasicEncodedRESTValidationStrategy(final String host, final String adminuser, final String adminpass) { -super(); -this.host = host; -user = adminuser; -password = adminpass; -} - -public BasicEncodedRESTValidationStrategy() { -} - -@Override -public void executeMethod(final HttpMethodBase method, final HttpClient client, -final String protocol) -throws CloudstackRESTException, HttpException, IOException { -if (host == null || host.isEmpty() || user == null || user.isEmpty() || password == null || password.isEmpty()) { -throw new CloudstackRESTException("Hostname/credentials are null or empty"); -} - -final String encodedCredentials = encodeCredentials(); -method.setRequestHeader("Authorization", "Basic " + encodedCredentials); -client.executeMethod(method); -} - -private String encodeCredentials() { -final String authString = user + ":" + password; -final byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); -final String authStringEnc = new String(authEncBytes); -return authStringEnc; -} - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/de63b94f/utils/src/main/java/com/cloud/utils/rest/RESTServiceConnector.java -- diff --git a/utils/src/main/java/com/cloud/utils/rest/RESTServiceConnector.java
[37/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/wrapper/NiciraNvpUpdateLogicalSwitchPortCommandWrapper.java -- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/wrapper/NiciraNvpUpdateLogicalSwitchPortCommandWrapper.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/wrapper/NiciraNvpUpdateLogicalSwitchPortCommandWrapper.java deleted file mode 100644 index a0d7dc2..000 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/wrapper/NiciraNvpUpdateLogicalSwitchPortCommandWrapper.java +++ /dev/null @@ -1,68 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.network.resource.wrapper; - -import static com.cloud.network.resource.NiciraNvpResource.NUM_RETRIES; - -import java.util.ArrayList; -import java.util.List; - -import com.cloud.agent.api.Answer; -import com.cloud.agent.api.UpdateLogicalSwitchPortAnswer; -import com.cloud.agent.api.UpdateLogicalSwitchPortCommand; -import com.cloud.network.nicira.NiciraNvpApi; -import com.cloud.network.nicira.NiciraNvpApiException; -import com.cloud.network.nicira.NiciraNvpTag; -import com.cloud.network.nicira.VifAttachment; -import com.cloud.network.resource.NiciraNvpResource; -import com.cloud.network.resource.NiciraNvpUtilities; -import com.cloud.network.utils.CommandRetryUtility; -import com.cloud.resource.CommandWrapper; -import com.cloud.resource.ResourceWrapper; - -@ResourceWrapper(handles = UpdateLogicalSwitchPortCommand.class) -public final class NiciraNvpUpdateLogicalSwitchPortCommandWrapper extends CommandWrapper{ - -@Override -public Answer execute(final UpdateLogicalSwitchPortCommand command, final NiciraNvpResource niciraNvpResource) { -final NiciraNvpUtilities niciraNvpUtilities = niciraNvpResource.getNiciraNvpUtilities(); - -final String logicalSwitchUuid = command.getLogicalSwitchUuid(); -final String logicalSwitchPortUuid = command.getLogicalSwitchPortUuid(); -final String attachmentUuid = command.getAttachmentUuid(); - -final NiciraNvpApi niciraNvpApi = niciraNvpResource.getNiciraNvpApi(); - -try { -// Tags set to scope cs_account and account name -final List tags = new ArrayList(); -tags.add(new NiciraNvpTag("cs_account", command.getOwnerName())); - -final VifAttachment vifAttachment = niciraNvpUtilities.createVifAttachment(attachmentUuid); - -niciraNvpApi.updateLogicalSwitchPortAttachment(logicalSwitchUuid, logicalSwitchPortUuid, vifAttachment); -return new UpdateLogicalSwitchPortAnswer(command, true, "Attachment for " + logicalSwitchPortUuid + " updated", logicalSwitchPortUuid); -} catch (final NiciraNvpApiException e) { -final CommandRetryUtility retryUtility = niciraNvpResource.getRetryUtility(); -retryUtility.addRetry(command, NUM_RETRIES); -return retryUtility.retry(command, UpdateLogicalSwitchPortAnswer.class, e); -} -} -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/com/cloud/network/utils/CommandRetryUtility.java -- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/utils/CommandRetryUtility.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/utils/CommandRetryUtility.java deleted file mode 100644 index 92c198a..000 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/utils/CommandRetryUtility.java +++ /dev/null @@ -1,89 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in
[48/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09f71533/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java -- diff --git a/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java b/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java index 1435cc5..79546a6 100644 --- a/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java +++ b/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/nicira/NiciraNvpApiTest.java @@ -19,321 +19,180 @@ package com.cloud.network.nicira; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.hasSize; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Matchers.any; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.NameValuePair; -import org.apache.commons.httpclient.methods.DeleteMethod; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.PostMethod; -import org.apache.commons.httpclient.methods.PutMethod; -import org.apache.commons.httpclient.params.HttpClientParams; -import org.junit.Before; +import org.apache.http.HttpHost; +import org.apache.http.HttpRequest; +import org.apache.http.ProtocolVersion; +import org.apache.http.StatusLine; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.protocol.HttpClientContext; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.message.BasicStatusLine; +import org.hamcrest.Matchers; import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; -import com.google.gson.Gson; -import com.google.gson.JsonParseException; -import com.cloud.utils.rest.RESTServiceConnector; -import com.cloud.utils.rest.RESTValidationStrategy; +import com.cloud.utils.rest.HttpClientHelper; +import com.cloud.utils.rest.HttpUriRequestMethodMatcher; +import com.cloud.utils.rest.HttpUriRequestPathMatcher; +import com.cloud.utils.rest.HttpUriRequestQueryMatcher; public class NiciraNvpApiTest { +private static final StatusLine HTTP_200_REPSONSE = new BasicStatusLine(new ProtocolVersion("HTTPS", 1, 1), HttpStatus.SC_OK, "OK"); +private static final StatusLine HTTP_201_REPSONSE = new BasicStatusLine(new ProtocolVersion("HTTPS", 1, 1), HttpStatus.SC_CREATED, "Created"); + protected static final String UUID = ""; protected static final String UUID2 = ""; -protected static final String UUID_SEC_PROFILE_URI = NiciraNvpApi.SEC_PROFILE_URI_PREFIX + "/"; +protected static final String UUID_SEC_PROFILE_URI = NiciraConstants.SEC_PROFILE_URI_PREFIX + "/"; protected static final String SCHEMA = "myTestSchema"; protected static final String SCHEMA2 = "myTestSchema2"; protected static final String HREF = "myTestHref"; protected static final String HREF2 = "myTestHref2"; protected static final String SEC_PROFILE_JSON_RESPONSE = -"{\"uuid\" : \"\"," -+ "\"display_name\" : \"myTestName\"," -+ "\"href\" : \"myTestHref\"," -+ "\"schema\" : \"myTestSchema\"}"; +"{\"uuid\" : \"\"," ++ "\"display_name\" : \"myTestName\"," ++ "\"href\" : \"myTestHref\"," ++ "\"schema\" : \"myTestSchema\"}"; protected static final String SEC_PROFILE_LIST_JSON_RESPONSE = "{\"results\" : [{\"uuid\" : \"\"," -+ "\"display_name\" : \"myTestName\"," -+ "\"href\" : \"myTestHref\"," -+ "\"schema\" : \"myTestSchema\"}," -+ "{ \"uuid\" : \"\"," -+ "\"display_name\" : \"myTestName2\"," -+ "\"href\" : \"myTestHref2\"," -+ "\"schema\" : \"myTestSchema2\"}]," -+ "\"result_count\": 2}"; - -NiciraNvpApi api; -HttpClient client = mock(HttpClient.class); -HttpMethod method; -String type; -
[31/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java -- diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java deleted file mode 100644 index 36e4643..000 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java +++ /dev/null @@ -1,476 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.network.guru; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.Collections; - -import org.junit.Before; -import org.junit.Test; - -import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; - -import com.cloud.agent.AgentManager; -import com.cloud.agent.api.Command; -import com.cloud.agent.api.CreateLogicalSwitchAnswer; -import com.cloud.agent.api.DeleteLogicalSwitchAnswer; -import com.cloud.dc.DataCenter; -import com.cloud.dc.DataCenter.NetworkType; -import com.cloud.dc.DataCenterVO; -import com.cloud.dc.dao.DataCenterDao; -import com.cloud.deploy.DeployDestination; -import com.cloud.deploy.DeploymentPlan; -import com.cloud.domain.Domain; -import com.cloud.exception.InsufficientVirtualNetworkCapacityException; -import com.cloud.host.HostVO; -import com.cloud.host.dao.HostDao; -import com.cloud.network.Network; -import com.cloud.network.Network.GuestType; -import com.cloud.network.Network.Service; -import com.cloud.network.Network.State; -import com.cloud.network.NetworkModel; -import com.cloud.network.NetworkProfile; -import com.cloud.network.Networks.BroadcastDomainType; -import com.cloud.network.Networks.TrafficType; -import com.cloud.network.NiciraNvpDeviceVO; -import com.cloud.network.dao.NetworkDao; -import com.cloud.network.dao.NetworkVO; -import com.cloud.network.dao.NiciraNvpDao; -import com.cloud.network.dao.PhysicalNetworkDao; -import com.cloud.network.dao.PhysicalNetworkVO; -import com.cloud.offering.NetworkOffering; -import com.cloud.offerings.dao.NetworkOfferingServiceMapDao; -import com.cloud.user.Account; -import com.cloud.vm.ReservationContext; - -public class NiciraNvpGuestNetworkGuruTest { -private static final long NETWORK_ID = 42L; -PhysicalNetworkDao physnetdao = mock(PhysicalNetworkDao.class); -NiciraNvpDao nvpdao = mock(NiciraNvpDao.class); -DataCenterDao dcdao = mock(DataCenterDao.class); -NetworkOfferingServiceMapDao nosd = mock(NetworkOfferingServiceMapDao.class); -AgentManager agentmgr = mock(AgentManager.class); -NetworkOrchestrationService netmgr = mock(NetworkOrchestrationService.class); -NetworkModel netmodel = mock(NetworkModel.class); - -HostDao hostdao = mock(HostDao.class); -NetworkDao netdao = mock(NetworkDao.class); -NiciraNvpGuestNetworkGuru guru; - -@Before -public void setUp() { -guru = new NiciraNvpGuestNetworkGuru(); -((GuestNetworkGuru)guru)._physicalNetworkDao = physnetdao; -guru.physicalNetworkDao = physnetdao; -guru.niciraNvpDao = nvpdao; -guru._dcDao = dcdao; -guru.ntwkOfferingSrvcDao = nosd; -guru.networkModel = netmodel; -guru.hostDao = hostdao; -guru.agentMgr = agentmgr; -guru.networkDao = netdao; - -final DataCenterVO dc = mock(DataCenterVO.class); -when(dc.getNetworkType()).thenReturn(NetworkType.Advanced); -when(dc.getGuestNetworkCidr()).thenReturn("10.1.1.1/24"); - -when(dcdao.findById((Long)any())).thenReturn(dc); -} - -@Test -public void testCanHandle() { -
[26/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java -- diff --git a/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java b/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java deleted file mode 100644 index 447e21b..000 --- a/utils/src/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java +++ /dev/null @@ -1,999 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.cisco.n1kv.vsm; - -import java.util.List; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.apache.log4j.Logger; -import org.w3c.dom.DOMException; -import org.w3c.dom.DOMImplementation; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.ls.DOMImplementationLS; -import org.w3c.dom.ls.LSSerializer; - -import com.cloud.utils.Pair; - -public class VsmCommand { - -private static final Logger s_logger = Logger.getLogger(VsmCommand.class); -private static final String s_namespace = "urn:ietf:params:xml:ns:netconf:base:1.0"; -private static final String s_ciscons = "http://www.cisco.com/nxos:1.0:ppm;; -private static final String s_configuremode = "__XML__MODE__exec_configure"; -private static final String s_portprofmode = "__XML__MODE_port-prof"; -private static final String s_policymapmode = "__XML__MODE_policy-map"; -private static final String s_classtypemode = "__XML__MODE_policy-map_class_type"; -private static final String s_paramvalue = "__XML__PARAM_value"; - -public enum PortProfileType { -none, vethernet, ethernet; -} - -public enum BindingType { -none, portbindingstatic, portbindingdynamic, portbindingephermal; -} - -public enum SwitchPortMode { -none, access, trunk, privatevlanhost, privatevlanpromiscuous -} - -public enum OperationType { -addvlanid, removevlanid -} - -public static String getAddPortProfile(String name, PortProfileType type, BindingType binding, SwitchPortMode mode, int vlanid, String vdc, String espName) { -try { -// Create the document and root element. -DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); -DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); -DOMImplementation domImpl = docBuilder.getDOMImplementation(); -Document doc = createDocument(domImpl); - -// Edit configuration command. -Element editConfig = doc.createElement("nf:edit-config"); -doc.getDocumentElement().appendChild(editConfig); - -// Command to get into exec configure mode. -Element target = doc.createElement("nf:target"); -Element running = doc.createElement("nf:running"); -target.appendChild(running); -editConfig.appendChild(target); - -// Command to create the port profile with the desired configuration. -Element config = doc.createElement("nf:config"); -config.appendChild(configPortProfileDetails(doc, name, type, binding, mode, vlanid, vdc, espName)); -editConfig.appendChild(config); - -return serialize(domImpl, doc); -} catch (ParserConfigurationException e) { -s_logger.error("Error while creating add port profile message : " + e.getMessage()); -return null; -} catch (DOMException e) { -s_logger.error("Error while creating add port profile message : " + e.getMessage()); -return null; -} -} - -public static String getAddPortProfile(String name, PortProfileType type, BindingType binding, SwitchPortMode mode, int vlanid) { -try { -// Create the document and root element. -DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); -DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); -DOMImplementation domImpl =
[46/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Add NSX specific RestClient implementation - Add -noverify JVM arg to surefire plugin, to allow Powermockito to de-encapsulate private methods - Add dependency on cloud-utils test-jar to use custom HttpRequest matchers Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/18e6b9ba Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/18e6b9ba Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/18e6b9ba Branch: refs/heads/deploy-from-snapshot Commit: 18e6b9ba78600fd01456d18c1f2b4c5333714dd9 Parents: de63b94 Author: Miguel FerreiraAuthored: Sat Aug 22 17:05:30 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 17:36:15 2015 +0200 -- plugins/network-elements/nicira-nvp/pom.xml | 10 + .../cloud/network/nicira/ExecutionCounter.java | 50 + .../cloud/network/nicira/NiciraRestClient.java | 202 +++ .../network/nicira/ExecutionCounterTest.java| 55 + .../network/nicira/NiciraRestClientTest.java| 172 pom.xml | 2 +- .../cloud/utils/rest/HttpStatusCodeHelper.java | 34 .../utils/rest/HttpStatusCodeHelperTest.java| 59 ++ 8 files changed, 583 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/18e6b9ba/plugins/network-elements/nicira-nvp/pom.xml -- diff --git a/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml index 2d20ae2..e74a5ae 100644 --- a/plugins/network-elements/nicira-nvp/pom.xml +++ b/plugins/network-elements/nicira-nvp/pom.xml @@ -30,6 +30,16 @@ ../../pom.xml + + + org.apache.cloudstack + cloud-utils + 4.6.0-SNAPSHOT + test-jar + test + + + src/main/java src/test/java http://git-wip-us.apache.org/repos/asf/cloudstack/blob/18e6b9ba/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/ExecutionCounter.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/ExecutionCounter.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/ExecutionCounter.java new file mode 100644 index 000..1314498 --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/ExecutionCounter.java @@ -0,0 +1,50 @@ +// +// 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 com.cloud.network.nicira; + +import java.util.concurrent.atomic.AtomicInteger; + +public class ExecutionCounter { + +private final int executionLimit; +private final AtomicInteger executionCount = new AtomicInteger(0); + +public ExecutionCounter(final int executionLimit) { +this.executionLimit = executionLimit; +} + +public ExecutionCounter resetExecutionCounter() { +executionCount.set(0); +return this; +} + +public boolean hasReachedExecutionLimit() { +return executionCount.get() >= executionLimit; +} + +public ExecutionCounter incrementExecutionCounter() { +executionCount.incrementAndGet(); +return this; +} + +public int getValue() { +return executionCount.get(); +} +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/18e6b9ba/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraRestClient.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraRestClient.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraRestClient.java new file mode 100644 index 000..6ade3a5 --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraRestClient.java @@ -0,0 +1,202 @@ +// +//
[35/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/AclRule.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/AclRule.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/AclRule.java new file mode 100644 index 000..8a4c053 --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/AclRule.java @@ -0,0 +1,209 @@ +// +// 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 com.cloud.network.nicira; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +@SuppressWarnings("serial") +public class AclRule extends AccessRule { + +public static final String ETHERTYPE_ARP = "ARP"; + +/** + * @TODO Convert this String into Enum and check the JSON communication still works + */ +protected String action; + +protected String sourceIpPrefix; + +protected String destinationIpPrefix; + +protected String sourceMacAddress; + +protected String destinationMacAddress; + +protected Integer sourcePortRangeMin; + +protected Integer destinationPortRangeMin; + +protected Integer sourcePortRangeMax; + +protected Integer destinationPortRangeMax; + +protected Integer icmpProtocolCode; + +protected Integer icmpProtocolType; + +protected int order; + + +/** + * Default constructor + */ +public AclRule() { +} + +/** + * Fully parameterized constructor + */ +public AclRule(String ethertype, int protocol, String action, String sourceMacAddress, +String destinationMacAddress, String sourceIpPrefix, String destinationIpPrefix, +Integer sourcePortRangeMin, Integer sourcePortRangeMax, +Integer destinationPortRangeMin, Integer destinationPortRangeMax, +int order, Integer icmpProtocolCode, Integer icmpProtocolType) { +this.ethertype = ethertype; +this.protocol = protocol; +this.action = action; +this.sourceMacAddress = sourceMacAddress; +this.destinationMacAddress = destinationMacAddress; +this.sourceIpPrefix = sourceIpPrefix; +this.destinationIpPrefix = destinationIpPrefix; +this.sourcePortRangeMin = sourcePortRangeMin; +this.sourcePortRangeMax = sourcePortRangeMax; +this.destinationPortRangeMin = destinationPortRangeMin; +this.destinationPortRangeMax = destinationPortRangeMax; +this.order = order; +this.icmpProtocolCode = icmpProtocolCode; +this.icmpProtocolType = icmpProtocolType; +} + + +public String getAction() { +return action; +} + +public void setAction(String action) { +this.action = action; +} + +public String getSourceIpPrefix() { +return sourceIpPrefix; +} + +public void setSourceIpPrefix(String sourceIpPrefix) { +this.sourceIpPrefix = sourceIpPrefix; +} + +public String getDestinationIpPrefix() { +return destinationIpPrefix; +} + +public void setDestinationIpPrefix(String destinationIpPrefix) { +this.destinationIpPrefix = destinationIpPrefix; +} + +public String getSourceMacAddress() { +return sourceMacAddress; +} + +public void setSourceMacAddress(String sourceMacAddress) { +this.sourceMacAddress = sourceMacAddress; +} + +public String getDestinationMacAddress() { +return destinationMacAddress; +} + +public void setDestinationMacAddress(String destinationMacAddress) { +this.destinationMacAddress = destinationMacAddress; +} + +public Integer getSourcePortRangeMin() { +return sourcePortRangeMin; +} + +public void setSourcePortRangeMin(Integer sourcePortRangeMin) { +this.sourcePortRangeMin = sourcePortRangeMin; +} + +public Integer getDestinationPortRangeMin() { +return destinationPortRangeMin; +} + +public void setDestinationPortRangeMin(Integer destinationPortRangeMin) {
[30/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java -- diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java deleted file mode 100644 index ddf2993..000 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java +++ /dev/null @@ -1,882 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.network.resource; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.atLeast; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.naming.ConfigurationException; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentMatcher; - -import com.cloud.agent.api.ConfigurePortForwardingRulesOnLogicalRouterAnswer; -import com.cloud.agent.api.ConfigurePortForwardingRulesOnLogicalRouterCommand; -import com.cloud.agent.api.ConfigurePublicIpsOnLogicalRouterAnswer; -import com.cloud.agent.api.ConfigurePublicIpsOnLogicalRouterCommand; -import com.cloud.agent.api.ConfigureStaticNatRulesOnLogicalRouterAnswer; -import com.cloud.agent.api.ConfigureStaticNatRulesOnLogicalRouterCommand; -import com.cloud.agent.api.CreateLogicalRouterAnswer; -import com.cloud.agent.api.CreateLogicalRouterCommand; -import com.cloud.agent.api.CreateLogicalSwitchAnswer; -import com.cloud.agent.api.CreateLogicalSwitchCommand; -import com.cloud.agent.api.CreateLogicalSwitchPortAnswer; -import com.cloud.agent.api.CreateLogicalSwitchPortCommand; -import com.cloud.agent.api.DeleteLogicalRouterAnswer; -import com.cloud.agent.api.DeleteLogicalRouterCommand; -import com.cloud.agent.api.DeleteLogicalSwitchAnswer; -import com.cloud.agent.api.DeleteLogicalSwitchCommand; -import com.cloud.agent.api.DeleteLogicalSwitchPortAnswer; -import com.cloud.agent.api.DeleteLogicalSwitchPortCommand; -import com.cloud.agent.api.FindLogicalSwitchPortAnswer; -import com.cloud.agent.api.FindLogicalSwitchPortCommand; -import com.cloud.agent.api.PingCommand; -import com.cloud.agent.api.StartupCommand; -import com.cloud.agent.api.UpdateLogicalSwitchPortAnswer; -import com.cloud.agent.api.UpdateLogicalSwitchPortCommand; -import com.cloud.agent.api.to.PortForwardingRuleTO; -import com.cloud.agent.api.to.StaticNatRuleTO; -import com.cloud.host.Host; -import com.cloud.network.nicira.Attachment; -import com.cloud.network.nicira.ControlClusterStatus; -import com.cloud.network.nicira.DestinationNatRule; -import com.cloud.network.nicira.LogicalRouter; -import com.cloud.network.nicira.LogicalRouterPort; -import com.cloud.network.nicira.LogicalSwitch; -import com.cloud.network.nicira.LogicalSwitchPort; -import com.cloud.network.nicira.NatRule; -import com.cloud.network.nicira.NiciraNvpApi; -import com.cloud.network.nicira.NiciraNvpApiException; -import com.cloud.network.nicira.NiciraNvpList; -import com.cloud.network.nicira.SourceNatRule; -import com.cloud.network.utils.CommandRetryUtility; - -public class NiciraNvpResourceTest { -NiciraNvpApi nvpApi = mock(NiciraNvpApi.class); -NiciraNvpResource resource; -Mapparameters; - -private CommandRetryUtility retryUtility; - -@Before -public void setUp() throws ConfigurationException { -resource = new NiciraNvpResource() { -@Override -protected NiciraNvpApi createNiciraNvpApi() { -return nvpApi; -
[40/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java -- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java deleted file mode 100644 index 6cc8f5d..000 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java +++ /dev/null @@ -1,108 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.api.commands; - -import java.util.ArrayList; -import java.util.List; - -import javax.inject.Inject; - -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ApiErrorCode; -import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.ListResponse; -import org.apache.cloudstack.api.response.PhysicalNetworkResponse; - -import com.cloud.api.response.NiciraNvpDeviceResponse; -import com.cloud.exception.InsufficientCapacityException; -import com.cloud.exception.InvalidParameterValueException; -import com.cloud.exception.ResourceAllocationException; -import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.NiciraNvpDeviceVO; -import com.cloud.network.element.NiciraNvpElementService; -import com.cloud.utils.exception.CloudRuntimeException; - -@APICommand(name = "listNiciraNvpDevices", responseObject = NiciraNvpDeviceResponse.class, description = "Lists Nicira NVP devices", -requestHasSensitiveInfo = false, responseHasSensitiveInfo = false) -public class ListNiciraNvpDevicesCmd extends BaseListCmd { -private static final String s_name = "listniciranvpdeviceresponse"; - -@Inject -protected NiciraNvpElementService niciraNvpElementService; - -/ - API parameters / -/ - -@Parameter(name = ApiConstants.PHYSICAL_NETWORK_ID, type = CommandType.UUID, entityType = PhysicalNetworkResponse.class, description = "the Physical Network ID") -private Long physicalNetworkId; - -@Parameter(name = ApiConstants.NICIRA_NVP_DEVICE_ID, type = CommandType.UUID, entityType = NiciraNvpDeviceResponse.class, description = "nicira nvp device ID") -private Long niciraNvpDeviceId; - -/ -/// Accessors /// -/ - -public Long getNiciraNvpDeviceId() { -return niciraNvpDeviceId; -} - -public Long getPhysicalNetworkId() { -return physicalNetworkId; -} - -/ -/// API Implementation/// -/ - -@Override -public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException { -try { -List niciraDevices = niciraNvpElementService.listNiciraNvpDevices(this); -ListResponse response = new ListResponse(); -List niciraDevicesResponse = new ArrayList(); - -if (niciraDevices != null && !niciraDevices.isEmpty()) { -for (NiciraNvpDeviceVO niciraDeviceVO : niciraDevices) { -NiciraNvpDeviceResponse niciraDeviceResponse = niciraNvpElementService.createNiciraNvpDeviceResponse(niciraDeviceVO); -niciraDevicesResponse.add(niciraDeviceResponse); -} -} - -response.setResponses(niciraDevicesResponse); -response.setResponseName(getCommandName()); -setResponseObject(response); -} catch (InvalidParameterValueException invalidParamExcp) { -throw new
[39/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AccessRule.java -- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AccessRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AccessRule.java deleted file mode 100644 index e614db6..000 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AccessRule.java +++ /dev/null @@ -1,58 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.network.nicira; - -import java.io.Serializable; - -import org.apache.commons.lang.builder.ReflectionToStringBuilder; -import org.apache.commons.lang.builder.ToStringStyle; - -@SuppressWarnings("serial") -public abstract class AccessRule implements Serializable { - -public static final String ETHERTYPE_IPV4 = "IPv4"; -public static final String ETHERTYPE_IPV6 = "IPv6"; - -protected String ethertype = ETHERTYPE_IPV4; - -protected int protocol; - - -public String getEthertype() { -return ethertype; -} - -public void setEthertype(String ethertype) { -this.ethertype = ethertype; -} - -public int getProtocol() { -return protocol; -} - -public void setProtocol(int protocol) { -this.protocol = protocol; -} - -@Override -public String toString() { -return ReflectionToStringBuilder.reflectionToString(this, ToStringStyle.DEFAULT_STYLE, false); -} -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Acl.java -- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Acl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Acl.java deleted file mode 100644 index 870124e..000 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Acl.java +++ /dev/null @@ -1,23 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.network.nicira; - -public class Acl extends AccessConfiguration { -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AclRule.java -- diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AclRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AclRule.java deleted file mode 100644 index 8a4c053..000 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/AclRule.java +++ /dev/null @@ -1,209 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS,
[32/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/resource/NiciraNvpRequestWrapperTest.java -- diff --git a/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/resource/NiciraNvpRequestWrapperTest.java b/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/resource/NiciraNvpRequestWrapperTest.java new file mode 100644 index 000..7fe6287 --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/resource/NiciraNvpRequestWrapperTest.java @@ -0,0 +1,255 @@ +// +// 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 com.cloud.network.resource; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.Mockito; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.ConfigurePublicIpsOnLogicalRouterCommand; +import com.cloud.agent.api.CreateLogicalSwitchCommand; +import com.cloud.agent.api.DeleteLogicalRouterCommand; +import com.cloud.agent.api.DeleteLogicalSwitchCommand; +import com.cloud.agent.api.DeleteLogicalSwitchPortCommand; +import com.cloud.agent.api.MaintainCommand; +import com.cloud.agent.api.ReadyCommand; +import com.cloud.agent.api.UpdateLogicalSwitchPortCommand; +import com.cloud.network.nicira.LogicalRouterPort; +import com.cloud.network.nicira.LogicalSwitch; +import com.cloud.network.nicira.NiciraNvpApi; +import com.cloud.network.nicira.NiciraNvpApiException; +import com.cloud.network.nicira.NiciraNvpList; +import com.cloud.network.nicira.VifAttachment; + +public class NiciraNvpRequestWrapperTest { + +@Mock +private final NiciraNvpResource niciraNvpResource = Mockito.mock(NiciraNvpResource.class); + +@Test +public void testReadyCommandWrapper() { +final ReadyCommand command = new ReadyCommand(); + +final NiciraNvpRequestWrapper wrapper = NiciraNvpRequestWrapper.getInstance(); +assertNotNull(wrapper); + +final Answer answer = wrapper.execute(command, niciraNvpResource); + +assertTrue(answer.getResult()); +} + +@Test +public void testMaintainCommandWrapper() { +final MaintainCommand command = new MaintainCommand(); + +final NiciraNvpRequestWrapper wrapper = NiciraNvpRequestWrapper.getInstance(); +assertNotNull(wrapper); + +final Answer answer = wrapper.execute(command, niciraNvpResource); + +assertTrue(answer.getResult()); +} + +@Test +public void testCreateLogicalSwitchCommandWrapper() { +final NiciraNvpApi niciraNvpApi = Mockito.mock(NiciraNvpApi.class); +final NiciraNvpUtilities niciraNvpUtilities = Mockito.mock(NiciraNvpUtilities.class); +final LogicalSwitch logicalSwitch = Mockito.mock(LogicalSwitch.class); + +final String transportUuid = "d2e05a9e-7120-4487-a5fc-414ab36d9345"; +final String transportType = "stt"; +final String name = "logicalswitch"; +final String ownerName = "owner"; + +final CreateLogicalSwitchCommand command = new CreateLogicalSwitchCommand(transportUuid, transportType, name, ownerName); + +final String truncated = "lswitch-" + command.getName(); + + when(niciraNvpResource.getNiciraNvpUtilities()).thenReturn(niciraNvpUtilities); + when(niciraNvpUtilities.createLogicalSwitch()).thenReturn(logicalSwitch); +when(niciraNvpResource.truncate("lswitch-" + command.getName(), NiciraNvpResource.NAME_MAX_LEN)).thenReturn(truncated); +when(niciraNvpResource.getNiciraNvpApi()).thenReturn(niciraNvpApi); + +try { + when(niciraNvpApi.createLogicalSwitch(logicalSwitch)).thenReturn(logicalSwitch); +when(logicalSwitch.getUuid()).thenReturn(transportUuid); +} catch (final NiciraNvpApiException e) { +fail(e.getMessage()); +} + +final
[50/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Merge pull request #737 from miguelaferreira/feature/mferreira/ncx-follow-redirects-gardened-rebase CLOUDSTACK-8758: Handle redirects in communication with NXS controller (a.k.a. Nicira NVP)When an NSX controller node is part of a cluster it will redirect API calls to the master controller. Because the ACS management server does not follow such redirects, if there is a change of master within a NSX cluster, the NSX device (a.k.a. NiciraNvp) needs to be reconfigured (via the management server DB). The goal of this PR is to enable ACS management server to follow HTTP redirects sent by NSX controllers. However, other changes were made to the cloud-utils module that provides the REST client that the NSX plugin uses. Cosmetic changes: * Upgrade maven module structure for cloud-utils and cloud-plugin-netowkr-nvp to comply with maven default * Several refactorings on both modules to consistently format the code, remove unused code, declare final when possible, remove auto generated comments, etc Other changes: * Upgrade HTTP library used in REST client to version 4.5 of Apache HTTP Components * Implement generic REST client that supports HTTP redirects * Implement NSX specific REST client * Simplify NSX api implementation * Previously existing unit tests for both the REST client and NSX api were either maintained in the same test classes, moved to new test classes (because code under tests also moved), or removed (because code under tests was also removed) * New Marvin tests for NSX controllers Testing: * Ran all unit tests present in the project * Ran Java Integration tests for NSX api targeting both a master and a slave controller * Ran new Marvin test for NSX controller * Manual inspection of logs to confirm redirection is taking place * pr/737: Use NSX specific RestClient in API implementation (NiciraNvpApi) Refactor NSX api implementation (NiciraNvpApi) Add NSX specific RestClient implementation Delegate HTTP protocol activity in RESTServiceConnector to RestClient Add basic RestClient implentation based on HTTP Components 4.5 Code clean up in cloud-plugin-network-nvp project Code clean up in cloud-utils project Refactor cloud-plugin-network-nvp project into Maven default structure Refactor cloud-utils project into Maven default structure Fix unit-test library dependencies Add Marvin test for Nicira NVP plugin Create Nicira NVP devices and enable plugin at deploy Signed-off-by: Remi BergsmaProject: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/44ba14d1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/44ba14d1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/44ba14d1 Branch: refs/heads/deploy-from-snapshot Commit: 44ba14d17ba3b8fa00cd05c97eaceed49367816c Parents: 2772e4d 09f7153 Author: Remi Bergsma Authored: Tue Aug 25 20:44:50 2015 +0200 Committer: Remi Bergsma Committed: Tue Aug 25 20:44:52 2015 +0200 -- plugins/network-elements/nicira-nvp/pom.xml | 24 +- .../META-INF/cloudstack/nvp/module.properties | 21 - .../cloudstack/nvp/spring-nvp-context.xml | 42 - ...ortForwardingRulesOnLogicalRouterAnswer.java | 35 - ...rtForwardingRulesOnLogicalRouterCommand.java | 63 - ...ConfigurePublicIpsOnLogicalRouterAnswer.java | 32 - ...onfigurePublicIpsOnLogicalRouterCommand.java | 66 - ...gureStaticNatRulesOnLogicalRouterAnswer.java | 44 - ...ureStaticNatRulesOnLogicalRouterCommand.java | 65 - .../agent/api/CreateLogicalRouterAnswer.java| 42 - .../agent/api/CreateLogicalRouterCommand.java | 116 -- .../agent/api/CreateLogicalSwitchAnswer.java| 38 - .../agent/api/CreateLogicalSwitchCommand.java | 57 - .../api/CreateLogicalSwitchPortAnswer.java | 38 - .../api/CreateLogicalSwitchPortCommand.java | 56 - .../agent/api/DeleteLogicalRouterAnswer.java| 34 - .../agent/api/DeleteLogicalRouterCommand.java | 44 - .../agent/api/DeleteLogicalSwitchAnswer.java| 32 - .../agent/api/DeleteLogicalSwitchCommand.java | 38 - .../api/DeleteLogicalSwitchPortAnswer.java | 32 - .../api/DeleteLogicalSwitchPortCommand.java | 44 - .../agent/api/FindLogicalSwitchPortAnswer.java | 38 - .../agent/api/FindLogicalSwitchPortCommand.java | 44 - .../agent/api/StartupNiciraNvpCommand.java | 30 - .../api/UpdateLogicalSwitchPortAnswer.java | 38 - .../api/UpdateLogicalSwitchPortCommand.java | 63 - .../api/commands/AddNiciraNvpDeviceCmd.java | 154 -- .../api/commands/DeleteNiciraNvpDeviceCmd.java | 112 -- .../ListNiciraNvpDeviceNetworksCmd.java | 111 -- .../api/commands/ListNiciraNvpDevicesCmd.java | 108 -- .../api/response/NiciraNvpDeviceResponse.java | 89 - .../com/cloud/network/NiciraNvpDeviceVO.java| 99 --
[42/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Code clean up in cloud-utils project - Code formatting - Remove unused methods Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5fc953ed Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5fc953ed Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5fc953ed Branch: refs/heads/deploy-from-snapshot Commit: 5fc953eda2640d1bf69b7ed0f85110b8ac2a4087 Parents: 93b0989 Author: Miguel FerreiraAuthored: Sat Aug 22 20:53:12 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 17:36:11 2015 +0200 -- .../utils/rest/CloudstackRESTException.java | 8 +- .../cloud/utils/rest/RESTServiceConnector.java | 118 +-- .../utils/rest/RESTValidationStrategy.java | 16 +-- .../utils/rest/RESTServiceConnectorTest.java| 21 ++-- 4 files changed, 73 insertions(+), 90 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5fc953ed/utils/src/main/java/com/cloud/utils/rest/CloudstackRESTException.java -- diff --git a/utils/src/main/java/com/cloud/utils/rest/CloudstackRESTException.java b/utils/src/main/java/com/cloud/utils/rest/CloudstackRESTException.java index 5985fa0..2078d57 100644 --- a/utils/src/main/java/com/cloud/utils/rest/CloudstackRESTException.java +++ b/utils/src/main/java/com/cloud/utils/rest/CloudstackRESTException.java @@ -19,19 +19,13 @@ package com.cloud.utils.rest; +@SuppressWarnings("serial") public class CloudstackRESTException extends Exception { -public CloudstackRESTException() { -} - public CloudstackRESTException(final String message) { super(message); } -public CloudstackRESTException(final Throwable cause) { -super(cause); -} - public CloudstackRESTException(final String message, final Throwable cause) { super(message, cause); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5fc953ed/utils/src/main/java/com/cloud/utils/rest/RESTServiceConnector.java -- diff --git a/utils/src/main/java/com/cloud/utils/rest/RESTServiceConnector.java b/utils/src/main/java/com/cloud/utils/rest/RESTServiceConnector.java index 6ededcb..01aca89 100644 --- a/utils/src/main/java/com/cloud/utils/rest/RESTServiceConnector.java +++ b/utils/src/main/java/com/cloud/utils/rest/RESTServiceConnector.java @@ -19,11 +19,29 @@ package com.cloud.utils.rest; -import com.google.gson.FieldNamingPolicy; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializer; -import com.google.gson.reflect.TypeToken; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.MalformedURLException; +import java.net.Socket; +import java.net.URL; +import java.net.UnknownHostException; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; + import org.apache.cloudstack.utils.security.SSLUtils; import org.apache.cloudstack.utils.security.SecureSSLSocketFactory; import org.apache.commons.httpclient.ConnectTimeoutException; @@ -46,36 +64,18 @@ import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory; import org.apache.log4j.Logger; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSocket; -import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.net.InetAddress; -import java.net.InetSocketAddress; -import java.net.MalformedURLException; -import java.net.Socket; -import java.net.URL; -import java.net.UnknownHostException; -import java.security.KeyManagementException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; +import com.google.gson.FieldNamingPolicy; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonDeserializer; +import com.google.gson.reflect.TypeToken; /** - * This abstraction
[28/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/ProcessUtil.java -- diff --git a/utils/src/com/cloud/utils/ProcessUtil.java b/utils/src/com/cloud/utils/ProcessUtil.java deleted file mode 100644 index 53137c4..000 --- a/utils/src/com/cloud/utils/ProcessUtil.java +++ /dev/null @@ -1,112 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils; - -import java.io.File; -import java.io.IOException; -import java.util.Properties; - -import javax.naming.ConfigurationException; - -import org.apache.commons.io.FileUtils; -import org.apache.log4j.Logger; - -import com.cloud.utils.exception.CloudRuntimeException; -import com.cloud.utils.script.OutputInterpreter; -import com.cloud.utils.script.Script; - -public class ProcessUtil { -private static final Logger s_logger = Logger.getLogger(ProcessUtil.class.getName()); - -// paths cannot be hardcoded -public static void pidCheck(String pidDir, String run) throws ConfigurationException { - -String dir = pidDir == null ? "/var/run" : pidDir; - -try { -final File propsFile = PropertiesUtil.findConfigFile("environment.properties"); -if (propsFile == null) { -s_logger.debug("environment.properties could not be opened"); -} else { -final Properties props = PropertiesUtil.loadFromFile(propsFile); -dir = props.getProperty("paths.pid"); -if (dir == null) { -dir = pidDir == null ? "/var/run" : pidDir; -} -} -} catch (IOException e) { -s_logger.debug("environment.properties could not be opened"); -} - -final File pidFile = new File(dir + File.separator + run); -try { -if (!pidFile.createNewFile()) { -if (!pidFile.exists()) { -throw new ConfigurationException("Unable to write to " + pidFile.getAbsolutePath() + ". Are you sure you're running as root?"); -} - -final String pidLine = FileUtils.readFileToString(pidFile).trim(); -if (pidLine.isEmpty()) { -throw new ConfigurationException("Java process is being started twice. If this is not true, remove " + pidFile.getAbsolutePath()); -} -try { -final long pid = Long.parseLong(pidLine); -final Script script = new Script("bash", 12, s_logger); -script.add("-c", "ps -p " + pid); -final String result = script.execute(); -if (result == null) { -throw new ConfigurationException("Java process is being started twice. If this is not true, remove " + pidFile.getAbsolutePath()); -} -if (!pidFile.delete()) { -throw new ConfigurationException("Java process is being started twice. If this is not true, remove " + pidFile.getAbsolutePath()); -} -if (!pidFile.createNewFile()) { -throw new ConfigurationException("Java process is being started twice. If this is not true, remove " + pidFile.getAbsolutePath()); -} -} catch (final NumberFormatException e) { -throw new ConfigurationException("Java process is being started twice. If this is not true, remove " + pidFile.getAbsolutePath()); -} -} -pidFile.deleteOnExit(); - -final Script script = new Script("bash", 12, s_logger); -script.add("-c", "echo $PPID"); -final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser(); -script.execute(parser); - -final String pid = parser.getLine(); - -FileUtils.writeStringToFile(pidFile, pid + "\n"); -} catch (final IOException e) { -throw new CloudRuntimeException("Unable to create the " + pidFile.getAbsolutePath() + ". Are you
[41/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Refactor cloud-plugin-network-nvp project into Maven default structure Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/93b0989d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/93b0989d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/93b0989d Branch: refs/heads/deploy-from-snapshot Commit: 93b0989deaf01ffae3242761174098ca5207b53c Parents: 83fd8f6 Author: Miguel FerreiraAuthored: Sat Aug 22 20:48:27 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 17:36:10 2015 +0200 -- plugins/network-elements/nicira-nvp/pom.xml | 11 +- .../META-INF/cloudstack/nvp/module.properties | 21 - .../cloudstack/nvp/spring-nvp-context.xml | 42 - ...ortForwardingRulesOnLogicalRouterAnswer.java | 35 - ...rtForwardingRulesOnLogicalRouterCommand.java | 63 -- ...ConfigurePublicIpsOnLogicalRouterAnswer.java | 32 - ...onfigurePublicIpsOnLogicalRouterCommand.java | 66 -- ...gureStaticNatRulesOnLogicalRouterAnswer.java | 44 - ...ureStaticNatRulesOnLogicalRouterCommand.java | 65 -- .../agent/api/CreateLogicalRouterAnswer.java| 42 - .../agent/api/CreateLogicalRouterCommand.java | 116 --- .../agent/api/CreateLogicalSwitchAnswer.java| 38 - .../agent/api/CreateLogicalSwitchCommand.java | 57 -- .../api/CreateLogicalSwitchPortAnswer.java | 38 - .../api/CreateLogicalSwitchPortCommand.java | 56 -- .../agent/api/DeleteLogicalRouterAnswer.java| 34 - .../agent/api/DeleteLogicalRouterCommand.java | 44 - .../agent/api/DeleteLogicalSwitchAnswer.java| 32 - .../agent/api/DeleteLogicalSwitchCommand.java | 38 - .../api/DeleteLogicalSwitchPortAnswer.java | 32 - .../api/DeleteLogicalSwitchPortCommand.java | 44 - .../agent/api/FindLogicalSwitchPortAnswer.java | 38 - .../agent/api/FindLogicalSwitchPortCommand.java | 44 - .../agent/api/StartupNiciraNvpCommand.java | 30 - .../api/UpdateLogicalSwitchPortAnswer.java | 38 - .../api/UpdateLogicalSwitchPortCommand.java | 63 -- .../api/commands/AddNiciraNvpDeviceCmd.java | 154 .../api/commands/DeleteNiciraNvpDeviceCmd.java | 112 --- .../ListNiciraNvpDeviceNetworksCmd.java | 111 --- .../api/commands/ListNiciraNvpDevicesCmd.java | 108 --- .../api/response/NiciraNvpDeviceResponse.java | 89 -- .../com/cloud/network/NiciraNvpDeviceVO.java| 99 --- .../cloud/network/NiciraNvpNicMappingVO.java| 87 -- .../cloud/network/NiciraNvpRouterMappingVO.java | 85 -- .../src/com/cloud/network/dao/NiciraNvpDao.java | 35 - .../com/cloud/network/dao/NiciraNvpDaoImpl.java | 53 -- .../network/dao/NiciraNvpNicMappingDao.java | 32 - .../network/dao/NiciraNvpNicMappingDaoImpl.java | 51 -- .../network/dao/NiciraNvpRouterMappingDao.java | 28 - .../dao/NiciraNvpRouterMappingDaoImpl.java | 51 -- .../cloud/network/element/NiciraNvpElement.java | 849 -- .../element/NiciraNvpElementService.java| 45 - .../network/guru/NiciraNvpGuestNetworkGuru.java | 256 -- .../network/nicira/AccessConfiguration.java | 44 - .../com/cloud/network/nicira/AccessRule.java| 58 -- .../src/com/cloud/network/nicira/Acl.java | 23 - .../src/com/cloud/network/nicira/AclRule.java | 209 - .../com/cloud/network/nicira/Attachment.java| 24 - .../cloud/network/nicira/BaseNiciraEntity.java | 85 -- .../network/nicira/BaseNiciraNamedEntity.java | 44 - .../network/nicira/ControlClusterStatus.java| 87 -- .../network/nicira/DestinationNatRule.java | 113 --- .../network/nicira/L3GatewayAttachment.java | 55 -- .../com/cloud/network/nicira/LogicalRouter.java | 71 -- .../cloud/network/nicira/LogicalRouterPort.java | 62 -- .../com/cloud/network/nicira/LogicalSwitch.java | 60 -- .../cloud/network/nicira/LogicalSwitchPort.java | 82 -- .../src/com/cloud/network/nicira/Match.java | 146 --- .../src/com/cloud/network/nicira/NatRule.java | 130 --- .../com/cloud/network/nicira/NiciraNvpApi.java | 658 -- .../network/nicira/NiciraNvpApiException.java | 39 - .../com/cloud/network/nicira/NiciraNvpList.java | 48 - .../com/cloud/network/nicira/NiciraNvpTag.java | 64 -- .../cloud/network/nicira/PatchAttachment.java | 41 - .../com/cloud/network/nicira/RouterNextHop.java | 40 - .../com/cloud/network/nicira/RoutingConfig.java | 24 - .../nicira/RoutingTableRoutingConfig.java | 30 - .../cloud/network/nicira/SecurityProfile.java | 24 - .../com/cloud/network/nicira/SecurityRule.java | 138 --- ...SingleDefaultRouteImplicitRoutingConfig.java | 40 - .../com/cloud/network/nicira/SourceNatRule.java | 119 --- .../network/nicira/TransportZoneBinding.java| 50 -- .../com/cloud/network/nicira/VifAttachment.java | 78 --
[36/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/NiciraNvpDeviceVO.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/NiciraNvpDeviceVO.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/NiciraNvpDeviceVO.java new file mode 100644 index 000..431e855 --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/NiciraNvpDeviceVO.java @@ -0,0 +1,99 @@ +// +// 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 com.cloud.network; + +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "external_nicira_nvp_devices") +public class NiciraNvpDeviceVO implements InternalIdentity { + +@Id +@GeneratedValue(strategy = GenerationType.IDENTITY) +@Column(name = "id") +private long id; + +@Column(name = "uuid") +private String uuid; + +@Column(name = "host_id") +private long hostId; + +@Column(name = "physical_network_id") +private long physicalNetworkId; + +@Column(name = "provider_name") +private String providerName; + +@Column(name = "device_name") +private String deviceName; + +public NiciraNvpDeviceVO() { +uuid = UUID.randomUUID().toString(); +} + +public NiciraNvpDeviceVO(final long hostId, final long physicalNetworkId, final String providerName, final String deviceName) { +super(); +this.hostId = hostId; +this.physicalNetworkId = physicalNetworkId; +this.providerName = providerName; +this.deviceName = deviceName; +uuid = UUID.randomUUID().toString(); +} + +@Override +public long getId() { +return id; +} + +public String getUuid() { +return uuid; +} + +public void setUuid(String uuid) { +this.uuid = uuid; +} + +public long getPhysicalNetworkId() { +return physicalNetworkId; +} + +public long getHostId() { +return hostId; +} + +public String getProviderName() { +return providerName; +} + +public String getDeviceName() { +return deviceName; +} + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/NiciraNvpNicMappingVO.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/NiciraNvpNicMappingVO.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/NiciraNvpNicMappingVO.java new file mode 100644 index 000..9b13780 --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/NiciraNvpNicMappingVO.java @@ -0,0 +1,87 @@ +// +// 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 com.cloud.network; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +
[33/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/utils/CommandRetryUtility.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/utils/CommandRetryUtility.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/utils/CommandRetryUtility.java new file mode 100644 index 000..92c198a --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/utils/CommandRetryUtility.java @@ -0,0 +1,89 @@ +// +// 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 com.cloud.network.utils; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.log4j.Logger; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.resource.ServerResource; + +public class CommandRetryUtility { + +private static final Logger s_logger = Logger.getLogger(CommandRetryUtility.class); + +private static final int ZERO = 0; +private static CommandRetryUtility instance; + +static { +instance = new CommandRetryUtility(); +} + +private final ConcurrentHashMapcommandsToRetry; +private ServerResource serverResource; + +private CommandRetryUtility() { +commandsToRetry = new ConcurrentHashMap (); +} + +public static CommandRetryUtility getInstance() { +return instance; +} + +public void setServerResource(final ServerResource serverResource) { +this.serverResource = serverResource; +} + +public boolean addRetry(final Command command, final int retries) { +if (commandsToRetry.containsKey(command)) { +// A retry already exists for this command, do not add it again. +// Once all retries are executed, the command will be removed from the map. +return false; +} +commandsToRetry.put(command, retries); +return true; +} + +public Answer retry(final Command command, final Class answerClass, final Exception error) { +if (commandsToRetry.containsKey(command)) { +Integer numRetries = commandsToRetry.get(command); + +if (numRetries > ZERO) { +commandsToRetry.put(command, --numRetries); + +s_logger.warn("Retrying " + command.getClass().getSimpleName() + ". Number of retries remaining: " + numRetries); + +return serverResource.executeRequest(command); +} else { +commandsToRetry.remove(command); +} +} +try { +final Constructor answerConstructor = answerClass.getConstructor(Command.class, Exception.class); +return answerConstructor.newInstance(command, error); +} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { +return Answer.createUnsupportedCommandAnswer(command); +} +} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93b0989d/plugins/network-elements/nicira-nvp/src/main/resources/META-INF/cloudstack/nvp/module.properties -- diff --git a/plugins/network-elements/nicira-nvp/src/main/resources/META-INF/cloudstack/nvp/module.properties b/plugins/network-elements/nicira-nvp/src/main/resources/META-INF/cloudstack/nvp/module.properties new file mode 100644 index 000..5085fce --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/resources/META-INF/cloudstack/nvp/module.properties @@ -0,0 +1,21 @@ +# +# 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
[49/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Use NSX specific RestClient in API implementation (NiciraNvpApi) - Simplify public API to return Lists instead of NiciraNvpLists Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/09f71533 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/09f71533 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/09f71533 Branch: refs/heads/deploy-from-snapshot Commit: 09f715337882c432e8731f81bce6490362e1cc2d Parents: c6602ee Author: Miguel FerreiraAuthored: Sat Aug 22 17:30:58 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 17:36:17 2015 +0200 -- .../cloud/network/nicira/NiciraConstants.java | 42 ++ .../com/cloud/network/nicira/NiciraNvpApi.java | 323 --- .../network/resource/NiciraNvpResource.java | 26 +- ...figurePortForwardingRulesCommandWrapper.java | 7 +- ...ciraNvpConfigurePublicIpsCommandWrapper.java | 9 +- ...vpConfigureStaticNatRulesCommandWrapper.java | 7 +- ...aNvpFindLogicalSwitchPortCommandWrapper.java | 7 +- .../cloud/network/nicira/NiciraNvpApiIT.java| 202 - .../cloud/network/nicira/NiciraNvpApiTest.java | 411 ++- .../resource/NiciraNvpRequestWrapperTest.java | 7 +- .../network/resource/NiciraNvpResourceTest.java | 72 +--- .../utils/rest/HttpUriRequestPathMatcher.java | 43 ++ 12 files changed, 539 insertions(+), 617 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09f71533/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraConstants.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraConstants.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraConstants.java new file mode 100644 index 000..31adf9d --- /dev/null +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraConstants.java @@ -0,0 +1,42 @@ +// +// 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 com.cloud.network.nicira; + +public class NiciraConstants { + +public static final String SEC_PROFILE_URI_PREFIX = "/ws.v1/security-profile"; +public static final String ACL_URI_PREFIX = "/ws.v1/acl"; +public static final String SWITCH_URI_PREFIX = "/ws.v1/lswitch"; +public static final String ROUTER_URI_PREFIX = "/ws.v1/lrouter"; +public static final String LOGIN_URL = "/ws.v1/login"; +public static final String CONTROL_CLUSTER_STATUS_URL = "/ws.v1/control-cluster/status"; + +public static final String ATTACHMENT_PATH_SEGMENT = "/attachment"; +public static final String NAT_PATH_SEGMENT = "/nat"; +public static final String LPORT_PATH_SEGMENT = "/lport"; + +public static final String ATTACHMENT_VIF_UUID_QUERY_PARAMETER_NAME = "attachment_vif_uuid"; +public static final String ATTACHMENT_VLAN_PARAMETER = "attachment_vlan"; +public static final String ATTACHMENT_GWSVC_UUID_QUERY_PARAMETER = "attachment_gwsvc_uuid"; +public static final String WILDCARD_QUERY_PARAMETER = "*"; +public static final String UUID_QUERY_PARAMETER = "uuid"; +public static final String FIELDS_QUERY_PARAMETER = "fields"; + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/09f71533/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraNvpApi.java -- diff --git a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraNvpApi.java b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraNvpApi.java index 39262b6..093d90d 100644 --- a/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraNvpApi.java +++ b/plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/nicira/NiciraNvpApi.java @@ -20,32 +20,39 @@ package com.cloud.network.nicira; import
[21/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/security/CertificateHelper.java -- diff --git a/utils/src/com/cloud/utils/security/CertificateHelper.java b/utils/src/com/cloud/utils/security/CertificateHelper.java deleted file mode 100644 index d43542f..000 --- a/utils/src/com/cloud/utils/security/CertificateHelper.java +++ /dev/null @@ -1,166 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.security; - -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.StringReader; -import java.security.Key; -import java.security.KeyFactory; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.cert.Certificate; -import java.security.cert.CertificateEncodingException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.util.ArrayList; -import java.util.List; - -import com.cloud.utils.exception.CloudRuntimeException; -import org.apache.commons.codec.binary.Base64; - -import com.cloud.utils.Ternary; -import org.bouncycastle.openssl.PEMReader; - -public class CertificateHelper { -public static byte[] buildAndSaveKeystore(String alias, String cert, String privateKey, String storePassword) throws KeyStoreException, CertificateException, -NoSuchAlgorithmException, InvalidKeySpecException, IOException { -KeyStore ks = buildKeystore(alias, cert, privateKey, storePassword); - -ByteArrayOutputStream os = new ByteArrayOutputStream(); -ks.store(os, storePassword != null ? storePassword.toCharArray() : null); -os.close(); -return os.toByteArray(); -} - -public static byte[] buildAndSaveKeystore(List> certs, String storePassword) throws KeyStoreException, NoSuchAlgorithmException, -CertificateException, IOException, InvalidKeySpecException { -KeyStore ks = KeyStore.getInstance("JKS"); -ks.load(null, storePassword != null ? storePassword.toCharArray() : null); - -//name,cert,key -for (Ternary cert : certs) { -if (cert.third() == null) { -Certificate c = buildCertificate(cert.second()); -ks.setCertificateEntry(cert.first(), c); -} else { -Certificate[] c = new Certificate[certs.size()]; -int i = certs.size(); -for (Ternary ct : certs) { -c[i - 1] = buildCertificate(ct.second()); -i--; -} -ks.setKeyEntry(cert.first(), buildPrivateKey(cert.third()), storePassword != null ? storePassword.toCharArray() : null, c); -} -} - -ByteArrayOutputStream os = new ByteArrayOutputStream(); -ks.store(os, storePassword != null ? storePassword.toCharArray() : null); -os.close(); -return os.toByteArray(); -} - -public static KeyStore loadKeystore(byte[] ksData, String storePassword) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException { -assert (ksData != null); -KeyStore ks = KeyStore.getInstance("JKS"); -ks.load(new ByteArrayInputStream(ksData), storePassword != null ? storePassword.toCharArray() : null); - -return ks; -} - -public static KeyStore buildKeystore(String alias, String cert, String privateKey, String storePassword) throws KeyStoreException, CertificateException, -NoSuchAlgorithmException, InvalidKeySpecException, IOException { - -KeyStore ks = KeyStore.getInstance("JKS"); -ks.load(null, storePassword != null ? storePassword.toCharArray() : null); -Certificate[] certs = new
[29/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Refactor cloud-utils project into Maven default structure Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/83fd8f60 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/83fd8f60 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/83fd8f60 Branch: refs/heads/deploy-from-snapshot Commit: 83fd8f60f3c503cf6fda7833b0f45c23a215f559 Parents: 3d27e9e Author: Miguel FerreiraAuthored: Sun Aug 23 16:03:11 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 14:50:33 2015 +0200 -- utils/certs/cloud.keystore | Bin 1316 -> 0 bytes utils/pom.xml | 44 +- utils/src/com/cloud/maint/Version.java | 77 - utils/src/com/cloud/utils/ActionDelegate.java | 24 - .../src/com/cloud/utils/AutoCloseableUtil.java | 36 - .../com/cloud/utils/CloudResourceBundle.java| 48 - .../com/cloud/utils/ConstantTimeComparator.java | 42 - utils/src/com/cloud/utils/DateUtil.java | 274 utils/src/com/cloud/utils/EncryptionUtil.java | 73 - utils/src/com/cloud/utils/EnumUtils.java| 58 - utils/src/com/cloud/utils/ExecutionResult.java | 46 - utils/src/com/cloud/utils/FileUtil.java | 32 - utils/src/com/cloud/utils/HttpUtils.java| 114 -- utils/src/com/cloud/utils/IteratorUtil.java | 72 - utils/src/com/cloud/utils/Journal.java | 104 -- utils/src/com/cloud/utils/LogUtils.java | 45 - utils/src/com/cloud/utils/MethodCapturer.java | 113 -- utils/src/com/cloud/utils/NumbersUtil.java | 139 -- utils/src/com/cloud/utils/Pair.java | 87 - .../src/com/cloud/utils/PasswordGenerator.java | 90 - utils/src/com/cloud/utils/Predicate.java| 24 - utils/src/com/cloud/utils/ProcessUtil.java | 112 -- utils/src/com/cloud/utils/Profiler.java | 91 - utils/src/com/cloud/utils/PropertiesUtil.java | 196 --- utils/src/com/cloud/utils/ReflectUtil.java | 213 --- utils/src/com/cloud/utils/ReflectionUse.java| 31 - utils/src/com/cloud/utils/S3Utils.java | 603 --- utils/src/com/cloud/utils/SerialVersionUID.java | 69 - utils/src/com/cloud/utils/StringUtils.java | 323 utils/src/com/cloud/utils/SwiftUtil.java| 239 --- utils/src/com/cloud/utils/Ternary.java | 85 - utils/src/com/cloud/utils/UriUtils.java | 394 - .../cloud/utils/UsernamePasswordValidator.java | 49 - utils/src/com/cloud/utils/UuidUtils.java| 34 - .../cloud/utils/backoff/BackoffAlgorithm.java | 38 - .../utils/backoff/impl/ConstantTimeBackoff.java | 102 -- .../backoff/impl/ConstantTimeBackoffMBean.java | 35 - .../utils/cisco/n1kv/vsm/NetconfHelper.java | 355 .../cloud/utils/cisco/n1kv/vsm/PolicyMap.java | 34 - .../cloud/utils/cisco/n1kv/vsm/PortProfile.java | 48 - .../cloud/utils/cisco/n1kv/vsm/VsmCommand.java | 999 --- .../utils/cisco/n1kv/vsm/VsmOkResponse.java | 44 - .../cisco/n1kv/vsm/VsmPolicyMapResponse.java| 84 - .../cisco/n1kv/vsm/VsmPortProfileResponse.java | 166 -- .../cloud/utils/cisco/n1kv/vsm/VsmResponse.java | 222 --- .../src/com/cloud/utils/component/Adapter.java | 27 - .../com/cloud/utils/component/AdapterBase.java | 40 - .../com/cloud/utils/component/AdapterList.java | 37 - .../cloud/utils/component/ComponentContext.java | 282 .../ComponentInstantiationPostProcessor.java| 149 -- .../utils/component/ComponentLifecycle.java | 64 - .../utils/component/ComponentLifecycleBase.java | 87 - .../component/ComponentMethodInterceptable.java | 27 - .../component/ComponentMethodInterceptor.java | 32 - .../utils/component/ComponentNamingPolicy.java | 65 - .../src/com/cloud/utils/component/Manager.java | 27 - .../com/cloud/utils/component/ManagerBase.java | 28 - utils/src/com/cloud/utils/component/Named.java | 26 - .../cloud/utils/component/PluggableService.java | 29 - .../src/com/cloud/utils/component/Registry.java | 51 - .../utils/component/SystemIntegrityChecker.java | 30 - .../utils/concurrency/NamedThreadFactory.java | 38 - .../com/cloud/utils/concurrency/Scheduler.java | 31 - .../utils/concurrency/SynchronizationEvent.java | 89 - .../com/cloud/utils/concurrency/TestClock.java | 161 -- .../com/cloud/utils/crypt/DBEncryptionUtil.java | 87 - .../utils/crypt/EncryptionSecretKeyChecker.java | 146 -- .../utils/crypt/EncryptionSecretKeySender.java | 65 - utils/src/com/cloud/utils/crypt/RSAHelper.java | 90 - utils/src/com/cloud/utils/db/DbProperties.java | 109 -- utils/src/com/cloud/utils/db/EntityManager.java | 84 - utils/src/com/cloud/utils/db/UUIDManager.java | 48 - .../com/cloud/utils/encoding/URLEncoder.java| 113
[17/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/component/ComponentLifecycle.java -- diff --git a/utils/src/main/java/com/cloud/utils/component/ComponentLifecycle.java b/utils/src/main/java/com/cloud/utils/component/ComponentLifecycle.java new file mode 100644 index 000..897ddb1 --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/component/ComponentLifecycle.java @@ -0,0 +1,64 @@ +// +// 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 com.cloud.utils.component; + +import java.util.Map; + +import javax.naming.ConfigurationException; + +public interface ComponentLifecycle extends Named { +public static final int RUN_LEVEL_SYSTEM_BOOTSTRAP = 0;// for system level bootstrap components +public static final int RUN_LEVEL_SYSTEM = 1;// for system level service components (i.e., DAOs) +public static final int RUN_LEVEL_FRAMEWORK_BOOTSTRAP = 2;// for framework startup checkers (i.e., DB migration check) +public static final int RUN_LEVEL_FRAMEWORK = 3;// for framework bootstrap components(i.e., clustering management components) +public static final int RUN_LEVEL_COMPONENT_BOOTSTRAP = 4;// general manager components +public static final int RUN_LEVEL_COMPONENT = 5;// regular adapters, plugin components +public static final int RUN_LEVEL_APPLICATION_MAINLOOP = 6; +public static final int MAX_RUN_LEVELS = 7; + +@Override +String getName(); + +void setName(String name); + +void setConfigParams(Mapparams); + +Map getConfigParams(); + +int getRunLevel(); + +void setRunLevel(int level); + +public boolean configure(String name, Map params) throws ConfigurationException; + +/** + * Start any background tasks. + * + * @return true if the tasks were started, false otherwise. + */ +public boolean start(); + +/** + * Stop any background tasks. + * + * @return true background tasks were stopped, false otherwise. + */ +public boolean stop(); +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/component/ComponentLifecycleBase.java -- diff --git a/utils/src/main/java/com/cloud/utils/component/ComponentLifecycleBase.java b/utils/src/main/java/com/cloud/utils/component/ComponentLifecycleBase.java new file mode 100644 index 000..829dc9b --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/component/ComponentLifecycleBase.java @@ -0,0 +1,87 @@ +// +// 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 com.cloud.utils.component; + +import java.util.HashMap; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; + +public class ComponentLifecycleBase implements ComponentLifecycle { +private static final Logger s_logger = Logger.getLogger(ComponentLifecycleBase.class); + +protected String _name; +protected int _runLevel; +protected Map _configParams = new HashMap (); + +public ComponentLifecycleBase() { +_name = this.getClass().getSimpleName(); +_runLevel = RUN_LEVEL_COMPONENT; +} + +@Override +public String
[15/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/net/NetUtils.java -- diff --git a/utils/src/main/java/com/cloud/utils/net/NetUtils.java b/utils/src/main/java/com/cloud/utils/net/NetUtils.java new file mode 100644 index 000..883129b --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/net/NetUtils.java @@ -0,0 +1,1550 @@ +// +// 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 com.cloud.utils.net; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.math.BigInteger; +import java.net.InetAddress; +import java.net.InterfaceAddress; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.net.URI; +import java.net.UnknownHostException; +import java.util.ArrayList; +import java.util.Formatter; +import java.util.List; +import java.util.Random; +import java.util.Set; +import java.util.SortedSet; +import java.util.StringTokenizer; +import java.util.TreeSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.apache.commons.lang.SystemUtils; +import org.apache.commons.net.util.SubnetUtils; +import org.apache.commons.validator.routines.InetAddressValidator; +import org.apache.log4j.Logger; + +import com.cloud.utils.IteratorUtil; +import com.cloud.utils.Pair; +import com.cloud.utils.script.Script; +import com.googlecode.ipv6.IPv6Address; +import com.googlecode.ipv6.IPv6AddressRange; +import com.googlecode.ipv6.IPv6Network; + +public class NetUtils { +protected final static Logger s_logger = Logger.getLogger(NetUtils.class); + +private static final int MAX_CIDR = 32; +private static final int RFC_3021_31_BIT_CIDR = 31; + +public final static String HTTP_PORT = "80"; +public final static String HTTPS_PORT = "443"; +public final static int VPN_PORT = 500; +public final static int VPN_NATT_PORT = 4500; +public final static int VPN_L2TP_PORT = 1701; +public final static int HAPROXY_STATS_PORT = 8081; + +public final static String UDP_PROTO = "udp"; +public final static String TCP_PROTO = "tcp"; +public final static String ANY_PROTO = "any"; +public final static String ICMP_PROTO = "icmp"; +public final static String ALL_PROTO = "all"; +public final static String HTTP_PROTO = "http"; +public final static String SSL_PROTO = "ssl"; + +public final static String ALL_CIDRS = "0.0.0.0/0"; +public final static int PORT_RANGE_MIN = 0; +public final static int PORT_RANGE_MAX = 65535; + +public final static int DEFAULT_AUTOSCALE_VM_DESTROY_TIME = 2 * 60; // Grace period before Vm is destroyed +public final static int DEFAULT_AUTOSCALE_POLICY_INTERVAL_TIME = 30; +public final static int DEFAULT_AUTOSCALE_POLICY_QUIET_TIME = 5 * 60; +private final static Random s_rand = new Random(System.currentTimeMillis()); + +public static long createSequenceBasedMacAddress(final long macAddress) { +return macAddress | 0x0600l | (long)s_rand.nextInt(32768) << 25 & 0x00fffe00l; +} + +public static String getHostName() { +try { +final InetAddress localAddr = InetAddress.getLocalHost(); +if (localAddr != null) { +return localAddr.getHostName(); +} +} catch (final UnknownHostException e) { +s_logger.warn("UnknownHostException when trying to get host name. ", e); +} +return "localhost"; +} + +public static InetAddress getLocalInetAddress() { +try { +return InetAddress.getLocalHost(); +} catch (final UnknownHostException e) { +s_logger.warn("UnknownHostException in getLocalInetAddress().", e); +return null; +} +} + +public static String resolveToIp(final String host) { +try { +final InetAddress addr = InetAddress.getByName(host); +return ipFromInetAddress(addr); +} catch (final UnknownHostException e) { +s_logger.warn("Unable to resolve " + host + " to IP due to UnknownHostException"); +return
[16/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/exception/ExceptionUtil.java -- diff --git a/utils/src/main/java/com/cloud/utils/exception/ExceptionUtil.java b/utils/src/main/java/com/cloud/utils/exception/ExceptionUtil.java new file mode 100644 index 000..351d2ab --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/exception/ExceptionUtil.java @@ -0,0 +1,54 @@ +// +// 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 com.cloud.utils.exception; + +import java.io.PrintWriter; +import java.io.StringWriter; + +public class ExceptionUtil { +public static String toString(Throwable th) { +return toString(th, true); +} + +public static String toString(Throwable th, boolean printStack) { +final StringWriter writer = new StringWriter(); +writer.append("Exception: " + th.getClass().getName() + "\n"); +writer.append("Message: "); +writer.append(th.getMessage()).append("\n"); + +if (printStack) { +writer.append("Stack: "); +th.printStackTrace(new PrintWriter(writer)); +} +return writer.toString(); +} + +@SuppressWarnings("unchecked") +public static void rethrow(Throwable t, Class clz) throws T { +if (clz.isAssignableFrom(t.getClass())) +throw (T)t; +} + +public static void rethrowRuntime(Throwable t) { +rethrow(t, RuntimeException.class); +rethrow(t, Error.class); +} + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/exception/ExecutionException.java -- diff --git a/utils/src/main/java/com/cloud/utils/exception/ExecutionException.java b/utils/src/main/java/com/cloud/utils/exception/ExecutionException.java new file mode 100644 index 000..7b3bc61 --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/exception/ExecutionException.java @@ -0,0 +1,49 @@ +// +// 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 com.cloud.utils.exception; + +import com.cloud.utils.SerialVersionUID; + +/** + * a public method. + * + */ +public class ExecutionException extends Exception { +private static final long serialVersionUID = SerialVersionUID.ExecutionException; + +protected int csErrorCode; + +public ExecutionException(String msg, Throwable cause) { +super(msg, cause); + setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName())); +} + +public ExecutionException(String msg) { +super(msg); +} + +public void setCSErrorCode(int cserrcode) { +this.csErrorCode = cserrcode; +} + +public int getCSErrorCode() { +return this.csErrorCode; +} +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/exception/HypervisorVersionChangedException.java -- diff --git a/utils/src/main/java/com/cloud/utils/exception/HypervisorVersionChangedException.java b/utils/src/main/java/com/cloud/utils/exception/HypervisorVersionChangedException.java new file mode 100644 index 000..55c273b --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/exception/HypervisorVersionChangedException.java @@ -0,0 +1,35 @@
[09/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/crypto/EncryptionSecretKeyCheckerTest.java -- diff --git a/utils/test/com/cloud/utils/crypto/EncryptionSecretKeyCheckerTest.java b/utils/test/com/cloud/utils/crypto/EncryptionSecretKeyCheckerTest.java deleted file mode 100644 index 0f3f058..000 --- a/utils/test/com/cloud/utils/crypto/EncryptionSecretKeyCheckerTest.java +++ /dev/null @@ -1,45 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.crypto; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.Properties; - -import org.junit.Assert; -import org.junit.Test; - -import com.cloud.utils.crypt.EncryptionSecretKeyChecker; -import com.cloud.utils.db.DbProperties; -import com.cloud.utils.exception.CloudRuntimeException; - -public class EncryptionSecretKeyCheckerTest { - - private EncryptionSecretKeyChecker checker = new EncryptionSecretKeyChecker(); - - @Test(expected = CloudRuntimeException.class) - public void testKeyFileDoesNotExists() throws IOException, URISyntaxException { -Assert.assertNotNull(checker); -Properties properties = DbProperties.getDbProperties(); -properties.setProperty("db.cloud.encryption.type", "file"); -checker.check(properties); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/test/com/cloud/utils/crypto/RSAHelperTest.java -- diff --git a/utils/test/com/cloud/utils/crypto/RSAHelperTest.java b/utils/test/com/cloud/utils/crypto/RSAHelperTest.java deleted file mode 100644 index 27d9d50..000 --- a/utils/test/com/cloud/utils/crypto/RSAHelperTest.java +++ /dev/null @@ -1,54 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.crypto; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import org.junit.Test; - -import com.cloud.utils.crypt.RSAHelper; - -public class RSAHelperTest { -@Test -public void testEncryptWithRSA() { -String rsaKey = -"ssh-rsa B3NzaC1yc2EDAQABAAABAQC2D2Cs0XAEqm+ajJpumIPrMpKp0CWtIW+8ZY2/MJCW" -+ "hge1eY18u9I3PPnkMVJsTOaN0wQojjw4AkKgKjNZXA9wyUq56UyN/stmipu8zifWPgxQGDRkuzzZ6buk" -+ "ef8q2Awjpo8hv5/0SRPJxQLEafESnUP+Uu/LUwk5VVC7PHzywJRUGFuzDl/uT72+6hqpL2YpC6aTl4/P" -+ "2eDvUQhCdL9dBmUSFX8ftT53W1jhsaQl7mPElVgSCtWz3IyRkogobMPrpJW/IPKEiojKIuvNoNv4CDR6" + "ybeVjHOJMb9wi62rXo+CzUsW0Y4jPOX/OykAm5vrNOhQhw0aaBcv5XVv8BRX"; -String encryptedString = RSAHelper.encryptWithSSHPublicKey(rsaKey, "content"); -assertNotNull(encryptedString); -} - -@Test -public void testEncryptWithDSA() { -String dssKey = -"ssh-dss B3NzaC1kc3MAAACBALbaewDnzZ5AcGbZno7VW1m7Si3Q+yEANXZioVupfSwOP0q9aP2iV" -+ "tyqq575JnUVZXMDR2Gr254F/qCJ0TKAvucN0gcd2XslX4jBcu1Z7s7YZf6d7fC58k0NE6/keokJNKhQO" -+ "i56iirRzSA/YFrD64mzfq6rEmai0q7GjGGP0RT1FQDO5++6JonyqnoRkV9Yl1OaEOPjVwAAAIAYA" -+ "tqtKtU/INlTIuL3wt3nyKzwPUnz3fqxP5Ger3OlRZsOahalTFt2OF5jGGmCunyBTRteOetZObr0QhUIF" -+ "4bSDr6UiYYYbH1ES0ws/t1mDIeTh3UUHV1QYACN6c07FKyKLMtB9AthiG2FMLKCEedG3NeXItuNzsuQD" -+
[23/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/net/NetUtils.java -- diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java deleted file mode 100644 index 883129b..000 --- a/utils/src/com/cloud/utils/net/NetUtils.java +++ /dev/null @@ -1,1550 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.net; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.math.BigInteger; -import java.net.InetAddress; -import java.net.InterfaceAddress; -import java.net.NetworkInterface; -import java.net.SocketException; -import java.net.URI; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.Formatter; -import java.util.List; -import java.util.Random; -import java.util.Set; -import java.util.SortedSet; -import java.util.StringTokenizer; -import java.util.TreeSet; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.commons.lang.SystemUtils; -import org.apache.commons.net.util.SubnetUtils; -import org.apache.commons.validator.routines.InetAddressValidator; -import org.apache.log4j.Logger; - -import com.cloud.utils.IteratorUtil; -import com.cloud.utils.Pair; -import com.cloud.utils.script.Script; -import com.googlecode.ipv6.IPv6Address; -import com.googlecode.ipv6.IPv6AddressRange; -import com.googlecode.ipv6.IPv6Network; - -public class NetUtils { -protected final static Logger s_logger = Logger.getLogger(NetUtils.class); - -private static final int MAX_CIDR = 32; -private static final int RFC_3021_31_BIT_CIDR = 31; - -public final static String HTTP_PORT = "80"; -public final static String HTTPS_PORT = "443"; -public final static int VPN_PORT = 500; -public final static int VPN_NATT_PORT = 4500; -public final static int VPN_L2TP_PORT = 1701; -public final static int HAPROXY_STATS_PORT = 8081; - -public final static String UDP_PROTO = "udp"; -public final static String TCP_PROTO = "tcp"; -public final static String ANY_PROTO = "any"; -public final static String ICMP_PROTO = "icmp"; -public final static String ALL_PROTO = "all"; -public final static String HTTP_PROTO = "http"; -public final static String SSL_PROTO = "ssl"; - -public final static String ALL_CIDRS = "0.0.0.0/0"; -public final static int PORT_RANGE_MIN = 0; -public final static int PORT_RANGE_MAX = 65535; - -public final static int DEFAULT_AUTOSCALE_VM_DESTROY_TIME = 2 * 60; // Grace period before Vm is destroyed -public final static int DEFAULT_AUTOSCALE_POLICY_INTERVAL_TIME = 30; -public final static int DEFAULT_AUTOSCALE_POLICY_QUIET_TIME = 5 * 60; -private final static Random s_rand = new Random(System.currentTimeMillis()); - -public static long createSequenceBasedMacAddress(final long macAddress) { -return macAddress | 0x0600l | (long)s_rand.nextInt(32768) << 25 & 0x00fffe00l; -} - -public static String getHostName() { -try { -final InetAddress localAddr = InetAddress.getLocalHost(); -if (localAddr != null) { -return localAddr.getHostName(); -} -} catch (final UnknownHostException e) { -s_logger.warn("UnknownHostException when trying to get host name. ", e); -} -return "localhost"; -} - -public static InetAddress getLocalInetAddress() { -try { -return InetAddress.getLocalHost(); -} catch (final UnknownHostException e) { -s_logger.warn("UnknownHostException in getLocalInetAddress().", e); -return null; -} -} - -public static String resolveToIp(final String host) { -try { -final InetAddress addr = InetAddress.getByName(host); -return ipFromInetAddress(addr); -} catch (final UnknownHostException e) { -s_logger.warn("Unable to resolve " + host + " to IP due to UnknownHostException"); -return null; -} -} - -public
[19/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/StringUtils.java -- diff --git a/utils/src/main/java/com/cloud/utils/StringUtils.java b/utils/src/main/java/com/cloud/utils/StringUtils.java new file mode 100644 index 000..c598be8 --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/StringUtils.java @@ -0,0 +1,323 @@ +// +// 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 com.cloud.utils; + +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import org.owasp.esapi.StringUtilities; + +public class StringUtils { +private static final char[] hexChar = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; + +private static Charset preferredACSCharset; +private static final String UTF8 = "UTF-8"; + +static { +if (isUtf8Supported()) { +preferredACSCharset = Charset.forName(UTF8); +} else { +preferredACSCharset = Charset.defaultCharset(); +} +} + +public static Charset getPreferredCharset() { +return preferredACSCharset; +} + +public static boolean isUtf8Supported() { +return Charset.isSupported(UTF8); +} + +protected static Charset getDefaultCharset() { +return Charset.defaultCharset(); +} + +public static String join(final Iterable iterable, final String delim) { +final StringBuilder sb = new StringBuilder(); +if (iterable != null) { +final Iterator iter = iterable.iterator(); +if (iter.hasNext()) { +final Object next = iter.next(); +sb.append(next.toString()); +} +while (iter.hasNext()) { +final Object next = iter.next(); +sb.append(delim + next.toString()); +} +} +return sb.toString(); +} + +public static String join(final String delimiter, final Object... components) { +return org.apache.commons.lang.StringUtils.join(components, delimiter); +} + +public static boolean isNotBlank(final String str) { +if (str != null && str.trim().length() > 0) { +return true; +} + +return false; +} + +public static String cleanupTags(String tags) { +if (tags != null) { +final String[] tokens = tags.split(","); +final StringBuilder t = new StringBuilder(); +for (int i = 0; i < tokens.length; i++) { +t.append(tokens[i].trim()).append(","); +} +t.delete(t.length() - 1, t.length()); +tags = t.toString(); +} + +return tags; +} + +/** + * @param tags + * @return List of tags + */ +public static List csvTagsToList(final String tags) { +final List tagsList = new ArrayList(); + +if (tags != null) { +final String[] tokens = tags.split(","); +for (int i = 0; i < tokens.length; i++) { +tagsList.add(tokens[i].trim()); +} +} + +return tagsList; +} + +/** + * Converts a List of tags to a comma separated list + * @param tags + * @return String containing a comma separated list of tags + */ + +public static String listToCsvTags(final List tagsList) { +final StringBuilder tags = new StringBuilder(); +if (tagsList.size() > 0) { +for (int i = 0; i < tagsList.size(); i++) { +tags.append(tagsList.get(i)); +if (i != tagsList.size() - 1) { +tags.append(','); +} +} +} + +return tags.toString(); +} + +public static String getExceptionStackInfo(final Throwable e) { +final StringBuffer sb = new StringBuffer(); + +sb.append(e.toString()).append("\n"); +final StackTraceElement[] elemnents = e.getStackTrace(); +for
[18/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java -- diff --git a/utils/src/main/java/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java b/utils/src/main/java/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java new file mode 100644 index 000..447e21b --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/cisco/n1kv/vsm/VsmCommand.java @@ -0,0 +1,999 @@ +// +// 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 com.cloud.utils.cisco.n1kv.vsm; + +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.apache.log4j.Logger; +import org.w3c.dom.DOMException; +import org.w3c.dom.DOMImplementation; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSSerializer; + +import com.cloud.utils.Pair; + +public class VsmCommand { + +private static final Logger s_logger = Logger.getLogger(VsmCommand.class); +private static final String s_namespace = "urn:ietf:params:xml:ns:netconf:base:1.0"; +private static final String s_ciscons = "http://www.cisco.com/nxos:1.0:ppm;; +private static final String s_configuremode = "__XML__MODE__exec_configure"; +private static final String s_portprofmode = "__XML__MODE_port-prof"; +private static final String s_policymapmode = "__XML__MODE_policy-map"; +private static final String s_classtypemode = "__XML__MODE_policy-map_class_type"; +private static final String s_paramvalue = "__XML__PARAM_value"; + +public enum PortProfileType { +none, vethernet, ethernet; +} + +public enum BindingType { +none, portbindingstatic, portbindingdynamic, portbindingephermal; +} + +public enum SwitchPortMode { +none, access, trunk, privatevlanhost, privatevlanpromiscuous +} + +public enum OperationType { +addvlanid, removevlanid +} + +public static String getAddPortProfile(String name, PortProfileType type, BindingType binding, SwitchPortMode mode, int vlanid, String vdc, String espName) { +try { +// Create the document and root element. +DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); +DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); +DOMImplementation domImpl = docBuilder.getDOMImplementation(); +Document doc = createDocument(domImpl); + +// Edit configuration command. +Element editConfig = doc.createElement("nf:edit-config"); +doc.getDocumentElement().appendChild(editConfig); + +// Command to get into exec configure mode. +Element target = doc.createElement("nf:target"); +Element running = doc.createElement("nf:running"); +target.appendChild(running); +editConfig.appendChild(target); + +// Command to create the port profile with the desired configuration. +Element config = doc.createElement("nf:config"); +config.appendChild(configPortProfileDetails(doc, name, type, binding, mode, vlanid, vdc, espName)); +editConfig.appendChild(config); + +return serialize(domImpl, doc); +} catch (ParserConfigurationException e) { +s_logger.error("Error while creating add port profile message : " + e.getMessage()); +return null; +} catch (DOMException e) { +s_logger.error("Error while creating add port profile message : " + e.getMessage()); +return null; +} +} + +public static String getAddPortProfile(String name, PortProfileType type, BindingType binding, SwitchPortMode mode, int vlanid) { +try { +// Create the document and root element. +DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); +DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); +
[24/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/exception/ExceptionUtil.java -- diff --git a/utils/src/com/cloud/utils/exception/ExceptionUtil.java b/utils/src/com/cloud/utils/exception/ExceptionUtil.java deleted file mode 100644 index 351d2ab..000 --- a/utils/src/com/cloud/utils/exception/ExceptionUtil.java +++ /dev/null @@ -1,54 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.exception; - -import java.io.PrintWriter; -import java.io.StringWriter; - -public class ExceptionUtil { -public static String toString(Throwable th) { -return toString(th, true); -} - -public static String toString(Throwable th, boolean printStack) { -final StringWriter writer = new StringWriter(); -writer.append("Exception: " + th.getClass().getName() + "\n"); -writer.append("Message: "); -writer.append(th.getMessage()).append("\n"); - -if (printStack) { -writer.append("Stack: "); -th.printStackTrace(new PrintWriter(writer)); -} -return writer.toString(); -} - -@SuppressWarnings("unchecked") -public static void rethrow(Throwable t, Class clz) throws T { -if (clz.isAssignableFrom(t.getClass())) -throw (T)t; -} - -public static void rethrowRuntime(Throwable t) { -rethrow(t, RuntimeException.class); -rethrow(t, Error.class); -} - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/exception/ExecutionException.java -- diff --git a/utils/src/com/cloud/utils/exception/ExecutionException.java b/utils/src/com/cloud/utils/exception/ExecutionException.java deleted file mode 100644 index 7b3bc61..000 --- a/utils/src/com/cloud/utils/exception/ExecutionException.java +++ /dev/null @@ -1,49 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.exception; - -import com.cloud.utils.SerialVersionUID; - -/** - * a public method. - * - */ -public class ExecutionException extends Exception { -private static final long serialVersionUID = SerialVersionUID.ExecutionException; - -protected int csErrorCode; - -public ExecutionException(String msg, Throwable cause) { -super(msg, cause); - setCSErrorCode(CSExceptionErrorCode.getCSErrCode(this.getClass().getName())); -} - -public ExecutionException(String msg) { -super(msg); -} - -public void setCSErrorCode(int cserrcode) { -this.csErrorCode = cserrcode; -} - -public int getCSErrorCode() { -return this.csErrorCode; -} -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java -- diff --git a/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java b/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java deleted file mode 100644 index 55c273b..000 --- a/utils/src/com/cloud/utils/exception/HypervisorVersionChangedException.java +++ /dev/null @@ -1,35 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements.
[03/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Merge pull request #734 from remibergsma/git-pr-errormsg Git PR merge script improvementsProcessed feedback from @bhaisaab and (a colleague of) @karuturi - make the help message better (I also updated Confluence) - make sure we can use it on other repo's as well (Documentation and such) Tested it and works fine for me. * pr/734: fixed hardcoded merge message location fix bug where the countdown would be on multiple lines make it work with any Apache repository mirrored on GitHub Improve error/help message in case of missing git remote Signed-off-by: Remi BergsmaProject: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a527d272 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a527d272 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a527d272 Branch: refs/heads/deploy-from-snapshot Commit: a527d27299379aefefb96aeb30c2dd4423877b1f Parents: 82df5b1 1e6df1b Author: Remi Bergsma Authored: Mon Aug 24 22:15:36 2015 +0200 Committer: Remi Bergsma Committed: Mon Aug 24 22:15:36 2015 +0200 -- tools/git/git-pr | 27 --- 1 file changed, 20 insertions(+), 7 deletions(-) --
[08/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Fix unit-test library dependencies - XML formatting - Fix license header - Reorder hamcrest, junit, mockito and powermock dependencies * Since several libraries include a subset of hamcrest classes, hamcrest should be declared first in the pom, inorder for its classes to be loaded first by the JVM - Depdend on hamcrest-all and exclude hamcrest classes from other libraries Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3d27e9ed Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3d27e9ed Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3d27e9ed Branch: refs/heads/deploy-from-snapshot Commit: 3d27e9ed1206e0ff8cef5fa850e7b012427a56ef Parents: 98dd771 Author: Miguel FerreiraAuthored: Sun Aug 23 16:11:06 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 14:50:31 2015 +0200 -- pom.xml | 165 ++- 1 file changed, 94 insertions(+), 71 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3d27e9ed/pom.xml -- diff --git a/pom.xml b/pom.xml index f5f4e61..95b90db 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,23 @@ - + http://maven.apache.org/POM/4.0.0; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd;> 4.0.0 @@ -32,7 +43,7 @@ jira https://issues.apache.org/jira/browse/CLOUDSTACK - + 3.0.4 @@ -424,14 +435,8 @@ - junit - junit - ${cs.junit.version} - test - - org.hamcrest - hamcrest-library + hamcrest-all ${cs.hamcrest.version} test @@ -440,17 +445,35 @@ mockito-all ${cs.mockito.version} test + + + hamcrest-core + org.hamcrest + + - org.powermock - powermock-module-junit4 - ${cs.powermock.version} + junit + junit + ${cs.junit.version} + test + + + hamcrest-core + org.hamcrest + + + + + org.powermock + powermock-module-junit4 + ${cs.powermock.version} - org.powermock - powermock-api-mockito - ${cs.powermock.version} - test + org.powermock + powermock-api-mockito + ${cs.powermock.version} + test org.springframework @@ -485,13 +508,13 @@ org.apache.maven.plugins maven-checkstyle-plugin - - - cloudstack-checkstyle - none - false - - + + +cloudstack-checkstyle +none +false + + com.mycila @@ -570,9 +593,9 @@ true LICENSE.header - XML_STYLE -   DOUBLESLASH_STYLE -   SEMICOLON_STYLE + XML_STYLE + DOUBLESLASH_STYLE + SEMICOLON_STYLE false @@ -627,8 +650,8 @@ - + org.eclipse.m2e lifecycle-mapping @@ -646,7 +669,7 @@ - + @@ -659,7 +682,7 @@ - + @@ -682,12 +705,12 @@ gmaven-plugin [1.3,) -compile -testCompile + compile + testCompile - + @@ -841,7 +864,7 @@ tools/ngui/static/js/lib/* **/.checkstyle scripts/installer/windows/acs_license.rtf - **/*.md + **/*.md @@ -943,9 +966,9 @@ false - - cloud-pmd.xml - + + cloud-pmd.xml + @@ -986,18 +1009,18 @@ - org.apache.maven.plugins - maven-javadoc-plugin - ${cs.javadoc.version} -
[14/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/nio/NioClient.java -- diff --git a/utils/src/main/java/com/cloud/utils/nio/NioClient.java b/utils/src/main/java/com/cloud/utils/nio/NioClient.java new file mode 100644 index 000..2f742f9 --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/nio/NioClient.java @@ -0,0 +1,125 @@ +// +// 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 com.cloud.utils.nio; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.SocketChannel; +import java.security.GeneralSecurityException; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLEngine; + +import org.apache.log4j.Logger; + +import org.apache.cloudstack.utils.security.SSLUtils; + +public class NioClient extends NioConnection { +private static final Logger s_logger = Logger.getLogger(NioClient.class); + +protected String _host; +protected String _bindAddress; +protected SocketChannel _clientConnection; + +public NioClient(String name, String host, int port, int workers, HandlerFactory factory) { +super(name, port, workers, factory); +_host = host; +} + +public void setBindAddress(String ipAddress) { +_bindAddress = ipAddress; +} + +@Override +protected void init() throws IOException { +_selector = Selector.open(); +Task task = null; + +try { +_clientConnection = SocketChannel.open(); +_clientConnection.configureBlocking(true); +s_logger.info("Connecting to " + _host + ":" + _port); + +if (_bindAddress != null) { +s_logger.info("Binding outbound interface at " + _bindAddress); + +InetSocketAddress bindAddr = new InetSocketAddress(_bindAddress, 0); +_clientConnection.socket().bind(bindAddr); +} + +InetSocketAddress peerAddr = new InetSocketAddress(_host, _port); +_clientConnection.connect(peerAddr); + +SSLEngine sslEngine = null; +// Begin SSL handshake in BLOCKING mode +_clientConnection.configureBlocking(true); + +SSLContext sslContext = Link.initSSLContext(true); +sslEngine = sslContext.createSSLEngine(_host, _port); +sslEngine.setUseClientMode(true); + sslEngine.setEnabledProtocols(SSLUtils.getSupportedProtocols(sslEngine.getEnabledProtocols())); + +Link.doHandshake(_clientConnection, sslEngine, true); +s_logger.info("SSL: Handshake done"); +s_logger.info("Connected to " + _host + ":" + _port); + +_clientConnection.configureBlocking(false); +Link link = new Link(peerAddr, this); +link.setSSLEngine(sslEngine); +SelectionKey key = _clientConnection.register(_selector, SelectionKey.OP_READ); +link.setKey(key); +key.attach(link); +// Notice we've already connected due to the handshake, so let's get the +// remaining task done +task = _factory.create(Task.Type.CONNECT, link, null); +} catch (GeneralSecurityException e) { +_selector.close(); +throw new IOException("Failed to initialise security", e); +} catch (IOException e) { +_selector.close(); +throw e; +} + +_executor.execute(task); +} + +@Override +protected void registerLink(InetSocketAddress saddr, Link link) { +// don't do anything. +} + +@Override +protected void unregisterLink(InetSocketAddress saddr) { +// don't do anything. +} + +@Override +public void cleanUp() throws IOException { +super.cleanUp(); +if (_clientConnection != null) { +_clientConnection.close(); +} +s_logger.info("NioClient connection closed"); + +} + +}
[10/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/java/com/cloud/utils/testcase/NioTest.java -- diff --git a/utils/src/test/java/com/cloud/utils/testcase/NioTest.java b/utils/src/test/java/com/cloud/utils/testcase/NioTest.java new file mode 100644 index 000..fc16684 --- /dev/null +++ b/utils/src/test/java/com/cloud/utils/testcase/NioTest.java @@ -0,0 +1,216 @@ +// +// 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 com.cloud.utils.testcase; + +import java.nio.channels.ClosedChannelException; +import java.util.Random; + +import junit.framework.TestCase; + +import org.apache.log4j.Logger; +import org.junit.Assert; + +import com.cloud.utils.nio.HandlerFactory; +import com.cloud.utils.nio.Link; +import com.cloud.utils.nio.NioClient; +import com.cloud.utils.nio.NioServer; +import com.cloud.utils.nio.Task; +import com.cloud.utils.nio.Task.Type; + +/** + * + * + * + * + */ + +public class NioTest extends TestCase { + +private static final Logger s_logger = Logger.getLogger(NioTest.class); + +private NioServer _server; +private NioClient _client; + +private Link _clientLink; + +private int _testCount; +private int _completedCount; + +private boolean isTestsDone() { +boolean result; +synchronized (this) { +result = (_testCount == _completedCount); +} +return result; +} + +private void getOneMoreTest() { +synchronized (this) { +_testCount++; +} +} + +private void oneMoreTestDone() { +synchronized (this) { +_completedCount++; +} +} + +@Override +public void setUp() { +s_logger.info("Test"); + +_testCount = 0; +_completedCount = 0; + +_server = new NioServer("NioTestServer", , 5, new NioTestServer()); +_server.start(); + +_client = new NioClient("NioTestServer", "127.0.0.1", , 5, new NioTestClient()); +_client.start(); + +while (_clientLink == null) { +try { +s_logger.debug("Link is not up! Waiting ..."); +Thread.sleep(1000); +} catch (InterruptedException e) { +// TODO Auto-generated catch block +e.printStackTrace(); +} +} +} + +@Override +public void tearDown() { +while (!isTestsDone()) { +try { +s_logger.debug(this._completedCount + "/" + this._testCount + " tests done. Waiting for completion"); +Thread.sleep(1000); +} catch (InterruptedException e) { +// TODO Auto-generated catch block +e.printStackTrace(); +} +} +stopClient(); +stopServer(); +} + +protected void stopClient() { +_client.stop(); +s_logger.info("Client stopped."); +} + +protected void stopServer() { +_server.stop(); +s_logger.info("Server stopped."); +} + +protected void setClientLink(Link link) { +_clientLink = link; +} + +Random randomGenerator = new Random(); + +byte[] _testBytes; + +public void testConnection() { +_testBytes = new byte[100]; +randomGenerator.nextBytes(_testBytes); +try { +getOneMoreTest(); +_clientLink.send(_testBytes); +s_logger.info("Client: Data sent"); +getOneMoreTest(); +_clientLink.send(_testBytes); +s_logger.info("Client: Data sent"); +} catch (ClosedChannelException e) { +// TODO Auto-generated catch block +e.printStackTrace(); +} +} + +protected void doServerProcess(byte[] data) { +oneMoreTestDone(); +Assert.assertArrayEquals(_testBytes, data); +s_logger.info("Verify done."); +} + +public class NioTestClient implements HandlerFactory { + +@Override +public Task create(Type type, Link link, byte[] data) { +return new NioTestClientHandler(type, link, data); +} + +public class
[22/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/nio/NioClient.java -- diff --git a/utils/src/com/cloud/utils/nio/NioClient.java b/utils/src/com/cloud/utils/nio/NioClient.java deleted file mode 100644 index 2f742f9..000 --- a/utils/src/com/cloud/utils/nio/NioClient.java +++ /dev/null @@ -1,125 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils.nio; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.nio.channels.SocketChannel; -import java.security.GeneralSecurityException; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLEngine; - -import org.apache.log4j.Logger; - -import org.apache.cloudstack.utils.security.SSLUtils; - -public class NioClient extends NioConnection { -private static final Logger s_logger = Logger.getLogger(NioClient.class); - -protected String _host; -protected String _bindAddress; -protected SocketChannel _clientConnection; - -public NioClient(String name, String host, int port, int workers, HandlerFactory factory) { -super(name, port, workers, factory); -_host = host; -} - -public void setBindAddress(String ipAddress) { -_bindAddress = ipAddress; -} - -@Override -protected void init() throws IOException { -_selector = Selector.open(); -Task task = null; - -try { -_clientConnection = SocketChannel.open(); -_clientConnection.configureBlocking(true); -s_logger.info("Connecting to " + _host + ":" + _port); - -if (_bindAddress != null) { -s_logger.info("Binding outbound interface at " + _bindAddress); - -InetSocketAddress bindAddr = new InetSocketAddress(_bindAddress, 0); -_clientConnection.socket().bind(bindAddr); -} - -InetSocketAddress peerAddr = new InetSocketAddress(_host, _port); -_clientConnection.connect(peerAddr); - -SSLEngine sslEngine = null; -// Begin SSL handshake in BLOCKING mode -_clientConnection.configureBlocking(true); - -SSLContext sslContext = Link.initSSLContext(true); -sslEngine = sslContext.createSSLEngine(_host, _port); -sslEngine.setUseClientMode(true); - sslEngine.setEnabledProtocols(SSLUtils.getSupportedProtocols(sslEngine.getEnabledProtocols())); - -Link.doHandshake(_clientConnection, sslEngine, true); -s_logger.info("SSL: Handshake done"); -s_logger.info("Connected to " + _host + ":" + _port); - -_clientConnection.configureBlocking(false); -Link link = new Link(peerAddr, this); -link.setSSLEngine(sslEngine); -SelectionKey key = _clientConnection.register(_selector, SelectionKey.OP_READ); -link.setKey(key); -key.attach(link); -// Notice we've already connected due to the handshake, so let's get the -// remaining task done -task = _factory.create(Task.Type.CONNECT, link, null); -} catch (GeneralSecurityException e) { -_selector.close(); -throw new IOException("Failed to initialise security", e); -} catch (IOException e) { -_selector.close(); -throw e; -} - -_executor.execute(task); -} - -@Override -protected void registerLink(InetSocketAddress saddr, Link link) { -// don't do anything. -} - -@Override -protected void unregisterLink(InetSocketAddress saddr) { -// don't do anything. -} - -@Override -public void cleanUp() throws IOException { -super.cleanUp(); -if (_clientConnection != null) { -_clientConnection.close(); -} -s_logger.info("NioClient connection closed"); - -} - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/nio/NioConnection.java
[27/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/com/cloud/utils/UriUtils.java -- diff --git a/utils/src/com/cloud/utils/UriUtils.java b/utils/src/com/cloud/utils/UriUtils.java deleted file mode 100644 index 631c629..000 --- a/utils/src/com/cloud/utils/UriUtils.java +++ /dev/null @@ -1,394 +0,0 @@ -// -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -// - -package com.cloud.utils; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.Inet6Address; -import java.net.InetAddress; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; -import java.net.UnknownHostException; -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import java.util.StringTokenizer; - -import javax.net.ssl.HttpsURLConnection; - -import org.apache.commons.httpclient.Credentials; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpException; -import org.apache.commons.httpclient.HttpStatus; -import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; -import org.apache.commons.httpclient.UsernamePasswordCredentials; -import org.apache.commons.httpclient.auth.AuthScope; -import org.apache.commons.httpclient.methods.GetMethod; -import org.apache.commons.httpclient.methods.HeadMethod; -import org.apache.commons.httpclient.util.URIUtil; -import org.apache.http.NameValuePair; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.client.utils.URLEncodedUtils; - -import org.apache.http.message.BasicNameValuePair; -import org.apache.log4j.Logger; - -import com.cloud.utils.crypt.DBEncryptionUtil; -import com.cloud.utils.exception.CloudRuntimeException; - -public class UriUtils { - -public static final Logger s_logger = Logger.getLogger(UriUtils.class.getName()); - -public static String formNfsUri(String host, String path) { -try { -URI uri = new URI("nfs", host, path, null); -return uri.toString(); -} catch (URISyntaxException e) { -throw new CloudRuntimeException("Unable to form nfs URI: " + host + " - " + path); -} -} - -public static String formIscsiUri(String host, String iqn, Integer lun) { -try { -String path = iqn; -if (lun != null) { -path += "/" + lun.toString(); -} -URI uri = new URI("iscsi", host, path, null); -return uri.toString(); -} catch (URISyntaxException e) { -throw new CloudRuntimeException("Unable to form iscsi URI: " + host + " - " + iqn + " - " + lun); -} -} - -public static String formFileUri(String path) { -File file = new File(path); - -return file.toURI().toString(); -} - -// a simple URI component helper (Note: it does not deal with URI paramemeter area) -public static String encodeURIComponent(String url) { -int schemeTail = url.indexOf("://"); - -int pathStart = 0; -if (schemeTail > 0) -pathStart = url.indexOf('/', schemeTail + 3); -else -pathStart = url.indexOf('/'); - -if (pathStart > 0) { -String[] tokens = url.substring(pathStart + 1).split("/"); -StringBuilder sb = new StringBuilder(url.substring(0, pathStart)); -for (String token : tokens) { -sb.append("/").append(URLEncoder.encode(token)); -} - -return sb.toString(); -} - -// no need to do URL component encoding -return url; -} - -public static String getCifsUriParametersProblems(URI uri) { -if (!UriUtils.hostAndPathPresent(uri)) { -String errMsg = "cifs URI missing host and/or path. Make sure it's of the format cifs://hostname/path"; -s_logger.warn(errMsg); -return errMsg; -} -return null; -} - -public static boolean hostAndPathPresent(URI uri) { -return !(uri.getHost() == null || uri.getHost().trim().isEmpty() ||
[04/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Merge pull request #731 from remibergsma/centos7-kvm CLOUDSTACK-8443: Support CentOS 7 as KVM hypervisorThis adds support for CentOS 7 as a KVM hypervisor. As discussed in the Jira issue, the root cause of the issue was the `cloudstack-setup-agent` script that added this line to `/etc/libvirt/qemu.conf`: `cgroup_controllers=["cpu"]` On CentOS 6 this 'works', but since by default no cgroups are mounted, this setting is ignored by `libvirtd`. On CentOS 7 is does not work, because the `cpu` and `cpuacct` are 'co-mounted'. This simpy means you cannot use one without the order. The config line above instructs `libvirtd` to only use the `cpu` cgroup, which it can't. There was code added to make sure the `cpu` cgroup was not co-mounted. It did this with a shell script, but after a reboot it was gone. It wasn't reliable and not even a solution at all. I went ahead and removed the code, because the co-mounted cgroups work fine. The real issue was the config line we put in `/etc/libvirt/qemu.conf` so much better to fix that instead. The default for `libvirtd` is to use only cgroups that are mounted. When you remove the 'cgroup_controllers' line, the default kicks in. According to the `qemu.conf` file, the default is: `cgroup_controllers = ["cpu", "devices", "memory", "blkio", "cpuacct", "net_cls"]` Then again, if it's not mounted, it's not used. So, that's a nice way to control it. This works just fine for both RHEL/CentOS 6 and RHEL/CentOS 7. Along the debugging, I came across some small issues here and there which I also fixed in this PR. If you test this, be sure to build RPMs from this branch and install those on the KVM hypervisor. At Schuberg Philis we run KVM hypervisors on CentOS 7 for months with these fixes. Now I took the time to fix the issues in CloudStack, rather than work around them. @bhaisaab @karuturi could you please review this? Thanks! Please note: The next step is to fix CLOUDSTACK-8625 (Systemd profile for KVM Agent) as currently a sysvinit script is still used. Although it works, we do not have any systemd benefits. As it is a separate issue, I'll try to address it in a separate PR. * pr/731: CLOUDSTACK-8443: detect CentOS 7.x as RHEL 7 alike CLOUDSTACK-8443: mention the correct logfile CLOUDSTACK-8443: display the right hypervisor type CLOUDSTACK-8443: don't try to fix co-mounted cgroups Signed-off-by: Remi BergsmaProject: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c0fde9a1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c0fde9a1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c0fde9a1 Branch: refs/heads/deploy-from-snapshot Commit: c0fde9a12bf32d0d4009792d05b1648f7c6ea419 Parents: a527d27 0a320c1 Author: Remi Bergsma Authored: Tue Aug 25 10:32:27 2015 +0200 Committer: Remi Bergsma Committed: Tue Aug 25 10:32:27 2015 +0200 -- agent/bindir/cloud-setup-agent.in | 2 +- .../kvm/resource/LibvirtComputingResource.java | 23 - python/lib/cloud_utils.py | 19 --- python/lib/cloudutils/serviceConfig.py | 7 ++- python/lib/cloudutils/utilities.py | 2 +- scripts/vm/hypervisor/kvm/setup-cgroups.sh | 52 6 files changed, 5 insertions(+), 100 deletions(-) --
[06/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Create Nicira NVP devices and enable plugin at deploy Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/abb824e3 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/abb824e3 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/abb824e3 Branch: refs/heads/deploy-from-snapshot Commit: abb824e3db0625b435fa55b49496e41efbcbc894 Parents: 2772e4d Author: Miguel FerreiraAuthored: Wed Aug 5 16:03:28 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 14:50:29 2015 +0200 -- tools/marvin/marvin/deployDataCenter.py | 112 +++ 1 file changed, 62 insertions(+), 50 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/abb824e3/tools/marvin/marvin/deployDataCenter.py -- diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py index 4fcd696..3dd5667 100644 --- a/tools/marvin/marvin/deployDataCenter.py +++ b/tools/marvin/marvin/deployDataCenter.py @@ -534,7 +534,7 @@ class DeployDataCenters(object): netprov.physicalnetworkid = phynetwrk.id result = self.__apiClient.addNetworkServiceProvider(netprov) self.enableProvider(result.id) -elif provider.name in ['Netscaler', 'JuniperSRX', 'F5BigIp']: +elif provider.name in ['Netscaler', 'JuniperSRX', 'F5BigIp', 'NiciraNvp']: netprov = addNetworkServiceProvider.\ addNetworkServiceProviderCmd() netprov.name = provider.name @@ -548,55 +548,67 @@ class DeployDataCenters(object): self.__addToCleanUp( "NetworkServiceProvider", result.id) -for device in provider.devices: -if provider.name == 'Netscaler': -dev = addNetscalerLoadBalancer.\ -addNetscalerLoadBalancerCmd() -dev.username = device.username -dev.password = device.password -dev.networkdevicetype = device.networkdevicetype -dev.url = configGenerator.getDeviceUrl(device) -dev.physicalnetworkid = phynetwrk.id -ret = self.__apiClient.addNetscalerLoadBalancer( -dev) -if ret.id: +if provider.devices is not None: +for device in provider.devices: +if provider.name == 'Netscaler': +dev = addNetscalerLoadBalancer.\ +addNetscalerLoadBalancerCmd() +dev.username = device.username +dev.password = device.password +dev.networkdevicetype = device.networkdevicetype +dev.url = configGenerator.getDeviceUrl(device) +dev.physicalnetworkid = phynetwrk.id +ret = self.__apiClient.addNetscalerLoadBalancer( +dev) +if ret.id: +self.__tcRunLogger.\ +debug(" AddNetScalerLB " + "Successful=") +self.__addToCleanUp( +"NetscalerLoadBalancer", +ret.id) +elif provider.name == 'JuniperSRX': +dev = addSrxFirewall.addSrxFirewallCmd() +dev.username = device.username +dev.password = device.password +dev.networkdevicetype = device.networkdevicetype +dev.url = configGenerator.getDeviceUrl(device) +dev.physicalnetworkid = phynetwrk.id +ret = self.__apiClient.addSrxFirewall(dev) +if ret.id: +self.__tcRunLogger.\ +debug(" AddSrx " + "Successful=") +self.__addToCleanUp("SrxFirewall", ret.id) +elif provider.name == 'F5BigIp': +dev =
[13/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java -- diff --git a/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java b/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java new file mode 100644 index 000..d43542f --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/security/CertificateHelper.java @@ -0,0 +1,166 @@ +// +// 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 com.cloud.utils.security; + +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.StringReader; +import java.security.Key; +import java.security.KeyFactory; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.security.cert.Certificate; +import java.security.cert.CertificateEncodingException; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.ArrayList; +import java.util.List; + +import com.cloud.utils.exception.CloudRuntimeException; +import org.apache.commons.codec.binary.Base64; + +import com.cloud.utils.Ternary; +import org.bouncycastle.openssl.PEMReader; + +public class CertificateHelper { +public static byte[] buildAndSaveKeystore(String alias, String cert, String privateKey, String storePassword) throws KeyStoreException, CertificateException, +NoSuchAlgorithmException, InvalidKeySpecException, IOException { +KeyStore ks = buildKeystore(alias, cert, privateKey, storePassword); + +ByteArrayOutputStream os = new ByteArrayOutputStream(); +ks.store(os, storePassword != null ? storePassword.toCharArray() : null); +os.close(); +return os.toByteArray(); +} + +public static byte[] buildAndSaveKeystore(List> certs, String storePassword) throws KeyStoreException, NoSuchAlgorithmException, +CertificateException, IOException, InvalidKeySpecException { +KeyStore ks = KeyStore.getInstance("JKS"); +ks.load(null, storePassword != null ? storePassword.toCharArray() : null); + +//name,cert,key +for (Ternary cert : certs) { +if (cert.third() == null) { +Certificate c = buildCertificate(cert.second()); +ks.setCertificateEntry(cert.first(), c); +} else { +Certificate[] c = new Certificate[certs.size()]; +int i = certs.size(); +for (Ternary ct : certs) { +c[i - 1] = buildCertificate(ct.second()); +i--; +} +ks.setKeyEntry(cert.first(), buildPrivateKey(cert.third()), storePassword != null ? storePassword.toCharArray() : null, c); +} +} + +ByteArrayOutputStream os = new ByteArrayOutputStream(); +ks.store(os, storePassword != null ? storePassword.toCharArray() : null); +os.close(); +return os.toByteArray(); +} + +public static KeyStore loadKeystore(byte[] ksData, String storePassword) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException { +assert (ksData != null); +KeyStore ks = KeyStore.getInstance("JKS"); +ks.load(new ByteArrayInputStream(ksData), storePassword != null ? storePassword.toCharArray() : null); + +return ks; +} + +public static KeyStore buildKeystore(String alias, String cert, String privateKey, String storePassword) throws KeyStoreException, CertificateException, +NoSuchAlgorithmException, InvalidKeySpecException, IOException { + +KeyStore ks = KeyStore.getInstance("JKS"); +ks.load(null, storePassword != null ? storePassword.toCharArray() : null); +
[07/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Add Marvin test for Nicira NVP plugin Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/98dd7717 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/98dd7717 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/98dd7717 Branch: refs/heads/deploy-from-snapshot Commit: 98dd7717026d3da6c034140fbadb06eb88eaf41d Parents: abb824e Author: Miguel FerreiraAuthored: Fri Aug 21 17:39:02 2015 +0200 Committer: Miguel Ferreira Committed: Tue Aug 25 14:50:30 2015 +0200 -- .../integration/smoke/test_nicira_controller.py | 310 +++ tools/marvin/marvin/cloudstackTestCase.py | 4 + tools/marvin/marvin/lib/base.py | 46 +++ 3 files changed, 360 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98dd7717/test/integration/smoke/test_nicira_controller.py -- diff --git a/test/integration/smoke/test_nicira_controller.py b/test/integration/smoke/test_nicira_controller.py new file mode 100644 index 000..229612d --- /dev/null +++ b/test/integration/smoke/test_nicira_controller.py @@ -0,0 +1,310 @@ +#!/usr/bin/env python +# 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. + +import requests +from marvin.cloudstackTestCase import cloudstackTestCase +from marvin.lib.utils import cleanup_resources +from marvin.lib.base import ( +PhysicalNetwork, +NetworkOffering, +NiciraNvp, +ServiceOffering, +Network, +VirtualMachine +) +from marvin.lib.common import (get_domain, get_zone, get_template) +from nose.plugins.attrib import attr +from marvin.codes import (FAILED, PASS) +import time + +class TestNiciraContoller(cloudstackTestCase): + +@classmethod +def setUpClass(cls): +test_case = super(TestNiciraContoller, cls) + +test_client= test_case.getClsTestClient() +cls.config = test_case.getClsConfig() +cls.api_client = test_client.getApiClient() + +cls.physical_networks = cls.config.zones[0].physical_networks +cls.nicira_hosts = cls.config.niciraNvp.hosts + +cls.physical_network_id = cls.get_nicira_enabled_physical_network_id(cls.physical_networks) + +cls.network_offerring_services = { +'name': 'NiciraEnabledNetwork', +'displaytext': 'NiciraEnabledNetwork', +'guestiptype': 'Isolated', +'supportedservices': 'SourceNat,Firewall,PortForwarding,Connectivity', +'traffictype': 'GUEST', +'availability': 'Optional', +'serviceProviderList': { +'SourceNat': 'VirtualRouter', +'Firewall': 'VirtualRouter', +'PortForwarding': 'VirtualRouter', +'Connectivity': 'NiciraNvp' +} +} + +cls.network_offering = NetworkOffering.create(cls.api_client, cls.network_offerring_services) +cls.network_offering.update(cls.api_client, state='Enabled') + +cls.nicira_credentials = { +'username': 'admin', +'password': 'admin' +} + +cls.nicira_master_controller = cls.determine_master_controller( +cls.nicira_hosts, +cls.nicira_credentials +) + +cls.transport_zone_uuid = cls.get_transport_zone_from_controller( +cls.nicira_master_controller, +cls.nicira_credentials +) + +cls.domain = get_domain(cls.api_client) +cls.zone = get_zone(cls.api_client, test_client.getZoneForTests()) + +template = get_template( +cls.api_client, +cls.zone.id +) +if template == FAILED: +raise Exception("get_template() failed to return template with description %s" % cls.services['ostype']) + +cls.vm_services = { +'mode': cls.zone.networktype, +'small': { +'zoneid':
[11/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/test/java/com/cloud/utils/StringUtilsTest.java -- diff --git a/utils/src/test/java/com/cloud/utils/StringUtilsTest.java b/utils/src/test/java/com/cloud/utils/StringUtilsTest.java new file mode 100644 index 000..3619ede --- /dev/null +++ b/utils/src/test/java/com/cloud/utils/StringUtilsTest.java @@ -0,0 +1,253 @@ +// +// 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 com.cloud.utils; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; + +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; + +import org.junit.Test; + +public class StringUtilsTest { + +@Test +public void testGetPreferredCharset() { +final boolean ifUtf8Supported = StringUtils.isUtf8Supported(); +if (ifUtf8Supported) { +assertEquals(StringUtils.getPreferredCharset(), Charset.forName("UTF-8")); +} else { +assertNotEquals(StringUtils.getPreferredCharset(), Charset.forName("UTF-8")); +} +} + +@Test +public void testGetDefaultCharset() { +// Is this test irrelevant? Is wrapping the Charset.defaultCharset() too much? +// This test was added in order to cover the new StringUtils.getDefaultCharset(). +// One cannot be sure that StringUtils.getPreferredCharset() will always be +// equals to Charset.defaultCharset() +assertEquals(StringUtils.getDefaultCharset(), Charset.defaultCharset()); +} + +@Test +public void testCleanPasswordFromJsonObjectAtEnd() { +final String input = "{\"foo\":\"bar\",\"password\":\"test\"}"; +//TODO: It would be nice to clean up the regex in question to not +//have to return the trailing comma in the expected string below +final String expected = "{\"foo\":\"bar\",}"; +final String result = StringUtils.cleanString(input); +assertEquals(result, expected); +} + +@Test +public void testCleanPasswordFromJsonObjectInMiddle() { +final String input = "{\"foo\":\"bar\",\"password\":\"test\",\"test\":\"blah\"}"; +final String expected = "{\"foo\":\"bar\",\"test\":\"blah\"}"; +final String result = StringUtils.cleanString(input); +assertEquals(result, expected); +} + +@Test +public void testCleanPasswordFromJsonObjectAlone() { +final String input = "{\"password\":\"test\"}"; +final String expected = "{}"; +final String result = StringUtils.cleanString(input); +assertEquals(result, expected); +} + +@Test +public void testCleanPasswordFromJsonObjectAtStart() { +final String input = "{\"password\":\"test\",\"test\":\"blah\"}"; +final String expected = "{\"test\":\"blah\"}"; +final String result = StringUtils.cleanString(input); +assertEquals(result, expected); +} + +@Test +public void testCleanPasswordFromJsonObjectWithMultiplePasswords() { +final String input = "{\"description\":\"foo\"}],\"password\":\"bar\",\"nic\":[{\"password\":\"bar2\",\"id\":\"1\"}]}"; +final String expected = "{\"description\":\"foo\"}],\"nic\":[{\"id\":\"1\"}]}"; +final String result = StringUtils.cleanString(input); +assertEquals(result, expected); +} + +@Test +public void testCleanPasswordFromRequestString() { +final String input = "username=foo=bar=foobar"; +final String expected = "username=foo=foobar"; +final String result = StringUtils.cleanString(input); +assertEquals(result, expected); +} + +@Test +public void testCleanPasswordFromEncodedRequestString() { +final String input = "name=SS1=SMB=5a60af2b-3025-4f2a-9ecc-8e33bf2b94e3=cifs%3A%2F%2F10.102.192.150%2FSMB-Share%2Fsowmya%2Fsecondary%3Fuser%3Dsowmya%26password%3DX%40123%26domain%3DBLR"; +final String expected = "name=SS1=SMB=5a60af2b-3025-4f2a-9ecc-8e33bf2b94e3=cifs%3A%2F%2F10.102.192.150%2FSMB-Share%2Fsowmya%2Fsecondary%3Fuser%3Dsowmya%26domain%3DBLR"; +final String result
[20/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/com/cloud/utils/HttpUtils.java -- diff --git a/utils/src/main/java/com/cloud/utils/HttpUtils.java b/utils/src/main/java/com/cloud/utils/HttpUtils.java new file mode 100644 index 000..d2e844a --- /dev/null +++ b/utils/src/main/java/com/cloud/utils/HttpUtils.java @@ -0,0 +1,114 @@ +// +// 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 com.cloud.utils; + +import org.apache.log4j.Logger; + +import javax.servlet.http.Cookie; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.io.IOException; +import java.util.Map; + +public class HttpUtils { + +public static final Logger s_logger = Logger.getLogger(HttpUtils.class); + +public static final String UTF_8 = "UTF-8"; +public static final String RESPONSE_TYPE_JSON = "json"; +public static final String RESPONSE_TYPE_XML = "xml"; +public static final String JSON_CONTENT_TYPE = "application/json; charset=UTF-8"; +public static final String XML_CONTENT_TYPE = "text/xml; charset=UTF-8"; + +public static void addSecurityHeaders(final HttpServletResponse resp) { +if (resp.containsHeader("X-Content-Type-Options")) { +resp.setHeader("X-Content-Type-Options", "nosniff"); +} +else { +resp.addHeader("X-Content-Type-Options", "nosniff"); +} +if (resp.containsHeader("X-XSS-Protection")) { +resp.setHeader("X-XSS-Protection", "1;mode=block"); +} +else { +resp.addHeader("X-XSS-Protection", "1;mode=block"); +} +} + +public static void writeHttpResponse(final HttpServletResponse resp, final String response, + final Integer responseCode, final String responseType, final String jsonContentType) { +try { +if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { +if (jsonContentType != null && !jsonContentType.isEmpty()) { +resp.setContentType(jsonContentType); +} else { +resp.setContentType(JSON_CONTENT_TYPE); +} +} else if (RESPONSE_TYPE_XML.equalsIgnoreCase(responseType)){ +resp.setContentType(XML_CONTENT_TYPE); +} +if (responseCode != null) { +resp.setStatus(responseCode); +} +addSecurityHeaders(resp); +resp.getWriter().print(response); +} catch (final IOException ioex) { +if (s_logger.isTraceEnabled()) { +s_logger.trace("Exception writing http response: " + ioex); +} +} catch (final Exception ex) { +if (!(ex instanceof IllegalStateException)) { +s_logger.error("Unknown exception writing http response", ex); +} +} +} + +public static String findCookie(final Cookie[] cookies, final String key) { +if (cookies == null || key == null || key.isEmpty()) { +return null; +} +for (Cookie cookie: cookies) { +if (cookie != null && cookie.getName().equals(key)) { +return cookie.getValue(); +} +} +return null; +} + +public static boolean validateSessionKey(final HttpSession session, final Mapparams, final Cookie[] cookies, final String sessionKeyString) { +if (session == null || sessionKeyString == null) { +return false; +} +final String sessionKey = (String) session.getAttribute(sessionKeyString); +final String sessionKeyFromCookie = HttpUtils.findCookie(cookies, sessionKeyString); +String[] sessionKeyFromParams = null; +if (params != null) { +sessionKeyFromParams = (String[]) params.get(sessionKeyString); +} +if ((sessionKey == null) +|| (sessionKeyFromParams == null && sessionKeyFromCookie == null) +|| (sessionKeyFromParams != null && !sessionKey.equals(sessionKeyFromParams[0])) +
[05/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Merge pull request #738 from michaelandersen/vpc_defaultroute_fix CLOUDSTACK-8685: Fix for missing defaultroute on VPC router https://issues.apache.org/jira/browse/CLOUDSTACK-8685 Refactored CsRoute and CsAddress to: - add methods to add and verify the defaultroute - renamed methods flush, add, and routeTable to flush_table, add_route, add_table respectively. Added some suboptimal unit tests to TestCsRoutes * pr/738: Fixed defaultroute on VPC routers in CsRoute and CsAddress Refactored CsRoute pep8 cleanup Signed-off-by: Remi BergsmaProject: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2772e4da Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2772e4da Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2772e4da Branch: refs/heads/deploy-from-snapshot Commit: 2772e4da82fb36a10d401fa5b072bfefeb5c0913 Parents: c0fde9a a9eb4ba Author: Remi Bergsma Authored: Tue Aug 25 10:37:26 2015 +0200 Committer: Remi Bergsma Committed: Tue Aug 25 10:37:27 2015 +0200 -- .../debian/config/opt/cloud/bin/cs/CsAddress.py | 178 +-- .../config/opt/cloud/bin/cs/CsRedundant.py | 59 +++--- .../debian/config/opt/cloud/bin/cs/CsRoute.py | 64 +-- .../debian/config/opt/cloud/bin/master.py | 2 +- systemvm/test/python/TestCsRoute.py | 17 +- 5 files changed, 229 insertions(+), 91 deletions(-) --
[02/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
fixed hardcoded merge message location This would be empty if run from another directory, resulting in a merge message with only a 'signed-off by' line. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1e6df1b7 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1e6df1b7 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1e6df1b7 Branch: refs/heads/deploy-from-snapshot Commit: 1e6df1b77500dff40c24245227658f7c85c1835c Parents: 9a24109 Author: Remi BergsmaAuthored: Mon Aug 24 16:16:16 2015 +0200 Committer: Remi Bergsma Committed: Mon Aug 24 16:16:16 2015 +0200 -- tools/git/git-pr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1e6df1b7/tools/git/git-pr -- diff --git a/tools/git/git-pr b/tools/git/git-pr index 2e0b275..2bd58f6 100755 --- a/tools/git/git-pr +++ b/tools/git/git-pr @@ -217,7 +217,7 @@ echo "INFO: # Do the actual merge git fetch ${github_remote} pull/${prId}/head:pr/${prId} -git merge --no-ff --log -m "$(cat .git-tmp-message.txt)" pr/${prId} +git merge --no-ff --log -m "$(cat ${tmpMessageFile})" pr/${prId} if [ $? -eq 0 ]; then git commit --amend -s --allow-empty-message -m '' else
[01/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
Repository: cloudstack Updated Branches: refs/heads/deploy-from-snapshot 6c3c9ea91 -> 44ba14d17 fix bug where the countdown would be on multiple lines Example of problem: ATTENTION: Merging pull request #731 from remibergsma/centos7-kvm into 'master' branch in 5 seconds. CTRL+c to abort.. -n 5 -n 4 -n 3 -n 2 -n 1 -n 0 Should be compatible with more environments if printf is used instead. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9a24109f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9a24109f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9a24109f Branch: refs/heads/deploy-from-snapshot Commit: 9a24109f9545b024e916b297a403bdd299ecba11 Parents: fed5c2b Author: Remi BergsmaAuthored: Mon Aug 24 13:42:48 2015 +0200 Committer: Remi Bergsma Committed: Mon Aug 24 16:00:48 2015 +0200 -- tools/git/git-pr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a24109f/tools/git/git-pr -- diff --git a/tools/git/git-pr b/tools/git/git-pr index 49eee79..2e0b275 100755 --- a/tools/git/git-pr +++ b/tools/git/git-pr @@ -207,10 +207,11 @@ echo "${prTitle}${prBody}" >> ${tmpMessageFile} echo "ATTENTION: Merging pull request #${prId} from ${prOriginBranch} into '${currentBranch}' branch in 5 seconds. CTRL+c to abort.." sec=5 while [ $sec -ge 0 ]; do - echo -n "${sec} " + printf "${sec} " sec=$((sec-1)) sleep 1 done +echo echo "INFO: Executing the merge now.. Git output below:" echo "INFO: ***"
[12/50] [abbrv] git commit: updated refs/heads/deploy-from-snapshot to 44ba14d
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83fd8f60/utils/src/main/java/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java -- diff --git a/utils/src/main/java/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java b/utils/src/main/java/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java new file mode 100644 index 000..5ff5819 --- /dev/null +++ b/utils/src/main/java/org/apache/commons/httpclient/contrib/ssl/EasySSLProtocolSocketFactory.java @@ -0,0 +1,210 @@ +// +// 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.commons.httpclient.contrib.ssl; + +import org.apache.cloudstack.utils.security.SSLUtils; +import org.apache.commons.httpclient.ConnectTimeoutException; +import org.apache.commons.httpclient.HttpClientError; +import org.apache.commons.httpclient.params.HttpConnectionParams; +import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import javax.net.SocketFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSocket; +import javax.net.ssl.TrustManager; +import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.UnknownHostException; + +/** + * + * EasySSLProtocolSocketFactory can be used to create SSL {@link Socket}s + * that accept self-signed certificates. + * + * + * This socket factory SHOULD NOT be used for productive systems + * due to security reasons, unless it is a concious decision and + * you are perfectly aware of security implications of accepting + * self-signed certificates + * + * + * + * Example of using custom protocol socket factory for a specific host: + * + * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); + * + * URI uri = new URI("https://localhost/;, true); + * // use relative url only + * GetMethod httpget = new GetMethod(uri.getPathQuery()); + * HostConfiguration hc = new HostConfiguration(); + * hc.setHost(uri.getHost(), uri.getPort(), easyhttps); + * HttpClient client = new HttpClient(); + * client.executeMethod(hc, httpget); + * + * + * + * Example of using custom protocol socket factory per default instead of the standard one: + * + * Protocol easyhttps = new Protocol("https", new EasySSLProtocolSocketFactory(), 443); + * Protocol.registerProtocol("https", easyhttps); + * + * HttpClient client = new HttpClient(); + * GetMethod httpget = new GetMethod("https://localhost/;); + * client.executeMethod(httpget); + * + * + * + * @author mailto:oleg -at- ural.ru">Oleg Kalnichevski + * + * + * DISCLAIMER: HttpClient developers DO NOT actively support this component. + * The component is provided as a reference material, which may be inappropriate + * for use without additional customization. + * + */ + +public class EasySSLProtocolSocketFactory implements ProtocolSocketFactory { + +/** Log object for this class. */ +private static final Log LOG = LogFactory.getLog(EasySSLProtocolSocketFactory.class); + +private SSLContext sslcontext = null; + +/** + * Constructor for EasySSLProtocolSocketFactory. + */ +public EasySSLProtocolSocketFactory() { +super(); +} + +private static SSLContext createEasySSLContext() { +try { +SSLContext context = SSLUtils.getSSLContext(); +context.init(null, new TrustManager[] {new EasyX509TrustManager(null)}, null); +return context; +} catch (Exception e) { +LOG.error(e.getMessage(), e); +throw new HttpClientError(e.toString()); +} +} + +private SSLContext getSSLContext() { +if (sslcontext == null) { +sslcontext = createEasySSLContext(); +} +return sslcontext; +} + +/** + * @see ProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int) + */ +@Override +public Socket
Git Push Summary
Repository: cloudstack Updated Branches: refs/heads/deploy-from-snapshot [created] 6c3c9ea91
git commit: updated refs/heads/master to 5e41a83
Repository: cloudstack Updated Branches: refs/heads/master 8f1e0510c - 5e41a830a This closes #373 CLOUDSTACK-3317 - DVS does not support management\storage network Added support for Management and Storage Network traffic over VMware DVS in CloudStack deployments. Also added support for storage VLAN over dvPortGroup. Signed-off-by: Sateesh Chodapuneedi sate...@apache.org CLOUDSTACK-3317 - DVS does not support management\storage network Use non-zero dvport count while updating dvportgroups of system traffic. Updated configuration compare logic to avoid update dvportgroup operation unless required. This would help improve speed in vm/network deployment as the update calls would reduce. Also improved logging. Signed-off-by: Sateesh Chodapuneedi sate...@apache.org Adding unit tests in class HypervisorHostHelperTest Signed-off-by: Sateesh Chodapuneedi sate...@apache.org Added license header to new file being added to repo/branch. Signed-off-by: Sateesh Chodapuneedi sate...@apache.org Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5e41a830 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5e41a830 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5e41a830 Branch: refs/heads/master Commit: 5e41a830a5eded33afc6bdc2be4572e2fd2a1f2a Parents: 8f1e051 Author: Sateesh Chodapuneedi sate...@apache.org Authored: Tue Jun 2 04:45:08 2015 +0530 Committer: Sateesh Chodapuneedi sate...@apache.org Committed: Wed Jun 10 02:07:40 2015 +0530 -- .../vmware/VmwareServerDiscoverer.java | 10 +- .../vmware/manager/VmwareManagerImpl.java | 33 +- .../vmware/resource/VmwareResource.java | 37 +- .../com/cloud/network/VmwareTrafficLabel.java | 3 +- .../com/cloud/hypervisor/vmware/mo/HostMO.java | 27 +- .../vmware/mo/HypervisorHostHelper.java | 132 - .../vmware/mo/HypervisorHostHelperTest.java | 560 +++ 7 files changed, 751 insertions(+), 51 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e41a830/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java -- diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java index d0d676f..1a8f8da 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java @@ -268,14 +268,6 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer throw new InvalidParameterValueException(msg); } } -} else { -// Distributed virtual switch is not supported in Basic zone for now. -// Private / Management network traffic is not yet supported over distributed virtual switch. -if (guestTrafficLabelObj.getVirtualSwitchType() != VirtualSwitchType.StandardVirtualSwitch) { -String msg = Detected that Guest traffic is over Distributed virtual switch in Basic zone. Only Standard vSwitch is supported in Basic zone.; -s_logger.error(msg); -throw new DiscoveredWithErrorException(msg); -} } privateTrafficLabel = _netmgr.getDefaultManagementTrafficLabel(dcId, HypervisorType.VMware); @@ -414,7 +406,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer } catch (DiscoveredWithErrorException e) { throw e; } catch (Exception e) { -s_logger.warn(Unable to connect to Vmware vSphere server. service address: + url.getHost()); +s_logger.warn(Unable to connect to Vmware vSphere server. service address: + url.getHost() + . + e); return null; } finally { if (context != null) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e41a830/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java -- diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java index e852948..5b85c29 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java @@ -92,13 +92,16 @@ import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO; import
[2/2] git commit: updated refs/heads/vmware-disk-controllers to a4cc987
CLOUDSTACK-4787 Allow selection of scsi controller type in vSphere commit #7 So far only 1 controller (scsi or ide) is supported in Cloudstack for ide or scsi, this is existing limitation. Added support for 2nd IDE controller. Support adding IDE virtual disk to VM. Also added check if VM is running as IDE virtual disk cannot be attached to VM if VM is runnning.If user detaches a virtual disk on lower unit number of controller, then subsequent attach operation should find free unit number on the controller and attach the virtual disk there. commit #6 Let the controllers of existing VMs continue without flip, current busInfo retrieved from chain_info field of volume record from database would be preferred over controller settings from all configuration settings. commit #5 Editing global configuration param vmware.root.disk.controller osdefault value results in loss of previous root disk controller type. Hence root disk's controller type for legacy VMs is unknow post that modificaiton by user. If VM is stop/start then we could get this infromation from bus info of existing volume. But if user resets VM and then try to start VM. The existing bus info would be lost. Hence existing disk info is not available to depend on. Using lsilogic or generic scsi controller for ROOT disk of legacy VMs if reset. commit #4 Avoid adding additional (1) scsi controllers to system vms. While attaching volume to legacy VM don't use osdefault optoin which applicable only for VM created with the option enabled, use legacy data disk controller type (lsilogic) commit #3 If root disk's controller type is scsi and data disk controller type condenses to any of scsi sub-types then data disk controller type would fall back to root disk controller itself. This ensures data volumes would be accessible in all cases as controller of root volume would be reliable and it means VM has the supported controller. It also avoids mix of scsi controller sub-types in a user instance. Also translating disk controller type scsi to lsilogic. commit #2 Support auto detection of recommended virtual disk controller type for specific guest OS. commit #1 Support granual controller types. Add support for controller types in template registration as well. Fix white spaces. Removed stale HEAD merge lines Removed tail of merge lines Fixed VmwareResource, removing storage commands that moved to VmwareStorageProcessor. removed stale code of controller that is present in processor Fixed check style errors. Fixed injection. Tested with Linux and windows templates. Unable to run iso based tests due to few bugs in register iso area. Signed-off-by: Sateesh Chodapuneedi sate...@apache.org Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a4cc987a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a4cc987a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a4cc987a Branch: refs/heads/vmware-disk-controllers Commit: a4cc987a6f66f20c434942956fffe5951df09e43 Parents: 06d4458 Author: Sateesh Chodapuneedi sate...@apache.org Authored: Wed Jan 14 08:13:10 2015 +0530 Committer: Sateesh Chodapuneedi sate...@apache.org Committed: Wed Jan 14 08:13:10 2015 +0530 -- api/src/com/cloud/vm/VmDetailConstants.java | 1 + .../storage/command/AttachCommand.java | 16 + .../com/cloud/hypervisor/guru/VMwareGuru.java | 7 + .../vmware/manager/VmwareManager.java | 1 + .../vmware/manager/VmwareManagerImpl.java | 8 + .../vmware/resource/VmwareResource.java | 207 +++- .../resource/VmwareStorageProcessor.java| 62 ++- .../com/cloud/storage/VolumeApiServiceImpl.java | 6 + server/src/com/cloud/vm/UserVmManagerImpl.java | 9 + .../cloud/hypervisor/vmware/mo/ClusterMO.java | 35 +- .../vmware/mo/DiskControllerType.java | 31 +- .../com/cloud/hypervisor/vmware/mo/HostMO.java | 17 +- .../vmware/mo/HypervisorHostHelper.java | 112 +++- .../vmware/mo/ScsiDiskControllerType.java | 24 + .../hypervisor/vmware/mo/VirtualMachineMO.java | 522 ++- .../hypervisor/vmware/mo/VmdkAdapterType.java | 48 ++ .../vmware/mo/VmdkFileDescriptor.java | 70 +++ .../vmware/mo/VmwareHypervisorHost.java | 5 +- .../hypervisor/vmware/util/VmwareHelper.java| 24 + 19 files changed, 1142 insertions(+), 63 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a4cc987a/api/src/com/cloud/vm/VmDetailConstants.java -- diff --git a/api/src/com/cloud/vm/VmDetailConstants.java b
[1/2] git commit: updated refs/heads/vmware-disk-controllers to a4cc987
Repository: cloudstack Updated Branches: refs/heads/vmware-disk-controllers 06d4458d0 - a4cc987a6 http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a4cc987a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java -- diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java index 5f180e1..35878d6 100644 --- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java +++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java @@ -55,12 +55,15 @@ import com.vmware.vim25.OptionValue; import com.vmware.vim25.OvfCreateDescriptorParams; import com.vmware.vim25.OvfCreateDescriptorResult; import com.vmware.vim25.OvfFile; +import com.vmware.vim25.ParaVirtualSCSIController; import com.vmware.vim25.PropertyFilterSpec; import com.vmware.vim25.PropertySpec; import com.vmware.vim25.TraversalSpec; +import com.vmware.vim25.VirtualBusLogicController; import com.vmware.vim25.VirtualCdrom; import com.vmware.vim25.VirtualCdromIsoBackingInfo; import com.vmware.vim25.VirtualCdromRemotePassthroughBackingInfo; +import com.vmware.vim25.VirtualController; import com.vmware.vim25.VirtualDevice; import com.vmware.vim25.VirtualDeviceBackingInfo; import com.vmware.vim25.VirtualDeviceConfigSpec; @@ -80,6 +83,7 @@ import com.vmware.vim25.VirtualEthernetCardDistributedVirtualPortBackingInfo; import com.vmware.vim25.VirtualHardwareOption; import com.vmware.vim25.VirtualIDEController; import com.vmware.vim25.VirtualLsiLogicController; +import com.vmware.vim25.VirtualLsiLogicSASController; import com.vmware.vim25.VirtualMachineCloneSpec; import com.vmware.vim25.VirtualMachineConfigInfo; import com.vmware.vim25.VirtualMachineConfigOption; @@ -97,7 +101,6 @@ import com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator; import com.vmware.vim25.VirtualMachineRuntimeInfo; import com.vmware.vim25.VirtualMachineSnapshotInfo; import com.vmware.vim25.VirtualMachineSnapshotTree; -import com.vmware.vim25.VirtualPCIController; import com.vmware.vim25.VirtualSCSIController; import com.vmware.vim25.VirtualSCSISharing; @@ -1083,6 +1086,130 @@ public class VirtualMachineMO extends BaseMO { s_logger.trace(vCenter API trace - createDisk() done(successfully)); } +public void updateVmdkAdapter(String vmdkFileName, String newAdapterType) throws Exception { +PairVmdkFileDescriptor, byte[] vmdkInfo = getVmdkFileInfo(vmdkFileName); +VmdkFileDescriptor vmdkFileDescriptor = vmdkInfo.first(); +boolean isVmfsSparseFile = vmdkFileDescriptor.isVmfsSparseFile(); +if (!isVmfsSparseFile) { +String currentAdapterType = vmdkFileDescriptor.getAdapterType(); +if (!currentAdapterType.equalsIgnoreCase(newAdapterType)) { +s_logger.info(Updating adapter type to + newAdapterType + for VMDK file + vmdkFileName); +PairDatacenterMO, String dcInfo = getOwnerDatacenter(); +byte[] newVmdkContent = vmdkFileDescriptor.changeVmdkAdapterType(vmdkInfo.second(), newAdapterType); +String vmdkUploadUrl = getContext().composeDatastoreBrowseUrl(dcInfo.first().getName(), vmdkFileName); +getContext().uploadResourceContent(vmdkUploadUrl, newVmdkContent); +s_logger.info(Updated VMDK file + vmdkFileName); +} +} +} + +public void updateAdapterTypeIfRequired(String vmdkFileName) throws Exception { +// Validate existing adapter type of VMDK file. Update it with a supported adapter type if validation fails. +PairVmdkFileDescriptor, byte[] vmdkInfo = getVmdkFileInfo(vmdkFileName); +VmdkFileDescriptor vmdkFileDescriptor = vmdkInfo.first(); + +boolean isVmfsSparseFile = vmdkFileDescriptor.isVmfsSparseFile(); +if (!isVmfsSparseFile) { +String currentAdapterTypeStr = vmdkFileDescriptor.getAdapterType(); +if (s_logger.isTraceEnabled()) { +s_logger.trace(Detected adapter type + currentAdapterTypeStr + for VMDK file + vmdkFileName); +} +VmdkAdapterType currentAdapterType = VmdkAdapterType.getType(currentAdapterTypeStr); +if (currentAdapterType == VmdkAdapterType.none) { +// Value of currentAdapterType can be VmdkAdapterType.none only if adapter type of vmdk is set to either +// lsisas1068 (SAS controller) or pvscsi (Vmware Paravirtual) only. Valid adapter type for those controllers is lsilogic. +// Hence use adapter type lsilogic. Other adapter types ide, lsilogic, buslogic are valid and does not need to be modified. +VmdkAdapterType newAdapterType = VmdkAdapterType.lsilogic; +s_logger.debug(Updating adapter type to + newAdapterType + from +
[3/7] git commit: updated refs/heads/vmware-disk-controllers to 06d4458
CLOUDSTACK-8035: Generate and store X509Cert and reuse this for SAML The fix generates X509Certificate if missing from DB and uses that for eternity. SAML SP metadata remains same since it's using the same X509 certificate and it remains same after restarts. The certificate is serialized, base64 encoded and stored in the keystore table under a specific name. For reading, it's retrieved, base64 decoded and deserialized. Signed-off-by: Rohit Yadav rohit.ya...@shapeblue.com (cherry picked from commit 43587143811b222ca131b0e1237f9e99cd94694d) Signed-off-by: Rohit Yadav rohit.ya...@shapeblue.com Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/aaf6a34c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/aaf6a34c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/aaf6a34c Branch: refs/heads/vmware-disk-controllers Commit: aaf6a34c54a88e92b03696c91f4fcc1ddc472559 Parents: 173710d Author: Rohit Yadav rohit.ya...@shapeblue.com Authored: Mon Jan 12 16:44:23 2015 +0530 Committer: Rohit Yadav rohit.ya...@shapeblue.com Committed: Mon Jan 12 16:49:49 2015 +0530 -- .../cloudstack/saml/SAML2AuthManagerImpl.java | 39 .../apache/cloudstack/utils/auth/SAMLUtils.java | 3 +- 2 files changed, 34 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aaf6a34c/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java -- diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java index 3178f31..f175081 100644 --- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2AuthManagerImpl.java @@ -27,6 +27,7 @@ import org.apache.cloudstack.framework.security.keystore.KeystoreDao; import org.apache.cloudstack.framework.security.keystore.KeystoreVO; import org.apache.cloudstack.utils.auth.SAMLUtils; import org.apache.log4j.Logger; +import org.apache.commons.codec.binary.Base64; import org.opensaml.DefaultBootstrap; import org.opensaml.common.xml.SAMLConstants; import org.opensaml.saml2.metadata.EntityDescriptor; @@ -45,6 +46,12 @@ import org.springframework.stereotype.Component; import javax.ejb.Local; import javax.inject.Inject; import javax.xml.stream.FactoryConfigurationError; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutput; +import java.io.ObjectOutputStream; import java.security.InvalidKeyException; import java.security.KeyPair; import java.security.NoSuchAlgorithmException; @@ -94,12 +101,12 @@ public class SAML2AuthManagerImpl extends AdapterBase implements SAML2AuthManage } private boolean setup() { -KeystoreVO keyStoreVO = _ksDao.findByName(SAMLUtils.CERTIFICATE_NAME); +KeystoreVO keyStoreVO = _ksDao.findByName(SAMLUtils.SAMLSP_KEYPAIR); if (keyStoreVO == null) { try { KeyPair keyPair = SAMLUtils.generateRandomKeyPair(); -_ksDao.save(SAMLUtils.CERTIFICATE_NAME, SAMLUtils.savePrivateKey(keyPair.getPrivate()), SAMLUtils.savePublicKey(keyPair.getPublic()), saml-sp); -keyStoreVO = _ksDao.findByName(SAMLUtils.CERTIFICATE_NAME); +_ksDao.save(SAMLUtils.SAMLSP_KEYPAIR, SAMLUtils.savePrivateKey(keyPair.getPrivate()), SAMLUtils.savePublicKey(keyPair.getPublic()), samlsp-keypair); +keyStoreVO = _ksDao.findByName(SAMLUtils.SAMLSP_KEYPAIR); } catch (NoSuchProviderException | NoSuchAlgorithmException e) { s_logger.error(Unable to create and save SAML keypair); } @@ -110,10 +117,28 @@ public class SAML2AuthManagerImpl extends AdapterBase implements SAML2AuthManage PublicKey publicKey = SAMLUtils.loadPublicKey(keyStoreVO.getKey()); if (privateKey != null publicKey != null) { spKeyPair = new KeyPair(publicKey, privateKey); -try { -spX509Key = SAMLUtils.generateRandomX509Certificate(spKeyPair); -} catch (NoSuchAlgorithmException | NoSuchProviderException | CertificateEncodingException | SignatureException | InvalidKeyException e) { -s_logger.error(SAML Plugin won't be able to use X509 signed authentication); +KeystoreVO x509VO = _ksDao.findByName(SAMLUtils.SAMLSP_X509CERT); +if (x509VO == null) { +try { +
[1/7] git commit: updated refs/heads/vmware-disk-controllers to 06d4458
Repository: cloudstack Updated Branches: refs/heads/vmware-disk-controllers 1a8fe8258 - 06d4458d0 CLOUDSTACK-8034: Hash user IDs for SAML authentication The User table's UUID column is restricted to 40 chars only, since we don't know how long the nameID/userID of a SAML authenticated user will be - the fix hashes that user ID and takes a substring of length 40 chars. For hashing, SHA256 is used which returns a 64 char length string. - Fix tests, add test cases - Improve checkSAMLUser method - Use SHA256 one way hashing to create unique UUID for SAML users Signed-off-by: Rohit Yadav rohit.ya...@shapeblue.com (cherry picked from commit b2b496288d164fead2c089fb48319e1988b03ce8) Signed-off-by: Rohit Yadav rohit.ya...@shapeblue.com Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0b94f254 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0b94f254 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0b94f254 Branch: refs/heads/vmware-disk-controllers Commit: 0b94f254e86e241ab77ddbf0531d43510deadb95 Parents: 1a8fe82 Author: Rohit Yadav rohit.ya...@shapeblue.com Authored: Mon Jan 12 13:33:57 2015 +0530 Committer: Rohit Yadav rohit.ya...@shapeblue.com Committed: Mon Jan 12 13:37:51 2015 +0530 -- .../cloudstack/saml/SAML2UserAuthenticator.java | 2 +- .../cloudstack/SAML2UserAuthenticatorTest.java | 26 +++- .../apache/cloudstack/utils/auth/SAMLUtils.java | 18 ++ .../cloudstack/utils/auth/SAMLUtilsTest.java| 10 ++-- 4 files changed, 42 insertions(+), 14 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0b94f254/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2UserAuthenticator.java -- diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2UserAuthenticator.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2UserAuthenticator.java index e623fc2..31a93a4 100644 --- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2UserAuthenticator.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/saml/SAML2UserAuthenticator.java @@ -48,7 +48,7 @@ public class SAML2UserAuthenticator extends DefaultUserAuthenticator { return new PairBoolean, ActionOnFailedAuthentication(false, null); } else { User user = _userDao.getUser(userAccount.getId()); -if (user != null SAMLUtils.checkSAMLUserId(user.getUuid()) +if (user != null SAMLUtils.checkSAMLUser(user.getUuid(), username) requestParameters != null requestParameters.containsKey(SAMLUtils.SAML_RESPONSE)) { return new PairBoolean, ActionOnFailedAuthentication(true, null); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0b94f254/plugins/user-authenticators/saml2/test/org/apache/cloudstack/SAML2UserAuthenticatorTest.java -- diff --git a/plugins/user-authenticators/saml2/test/org/apache/cloudstack/SAML2UserAuthenticatorTest.java b/plugins/user-authenticators/saml2/test/org/apache/cloudstack/SAML2UserAuthenticatorTest.java index 29fb496..83792c6 100644 --- a/plugins/user-authenticators/saml2/test/org/apache/cloudstack/SAML2UserAuthenticatorTest.java +++ b/plugins/user-authenticators/saml2/test/org/apache/cloudstack/SAML2UserAuthenticatorTest.java @@ -73,14 +73,28 @@ public class SAML2UserAuthenticatorTest { Mockito.when(userAccountDao.getUserAccount(Mockito.anyString(), Mockito.anyLong())).thenReturn(account); Mockito.when(userDao.getUser(Mockito.anyLong())).thenReturn(user); +PairBoolean, ActionOnFailedAuthentication pair; +MapString, Object[] params = new HashMapString, Object[](); + // When there is no SAMLRequest in params -PairBoolean, ActionOnFailedAuthentication pair1 = authenticator.authenticate(SAMLUtils.createSAMLId(user1234), random, 1l, null); -Assert.assertFalse(pair1.first()); +pair = authenticator.authenticate(someUID, random, 1l, params); +Assert.assertFalse(pair.first()); -// When there is SAMLRequest in params -MapString, Object[] params = new HashMapString, Object[](); +// When there is SAMLRequest in params and user is same as the mocked one params.put(SAMLUtils.SAML_RESPONSE, new Object[]{}); -PairBoolean, ActionOnFailedAuthentication pair2 = authenticator.authenticate(SAMLUtils.createSAMLId(user1234), random, 1l, params); -Assert.assertTrue(pair2.first()); +pair = authenticator.authenticate(someUID, random, 1l, params); +
[7/7] git commit: updated refs/heads/vmware-disk-controllers to 06d4458
CID-1256275 regression: resource leak in systemvm update code Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/06d4458d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/06d4458d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/06d4458d Branch: refs/heads/vmware-disk-controllers Commit: 06d4458d0a9de5be7a7bf590678eb4b03989e9a1 Parents: 9239f93 Author: Daan Hoogland d...@onecht.net Authored: Mon Jan 12 20:40:01 2015 +0100 Committer: Daan Hoogland d...@onecht.net Committed: Mon Jan 12 20:40:01 2015 +0100 -- .../com/cloud/upgrade/dao/Upgrade442to450.java | 242 ++- 1 file changed, 128 insertions(+), 114 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/06d4458d/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java -- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java index 86c2439..191e022 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade442to450.java @@ -175,132 +175,146 @@ public class Upgrade442to450 implements DbUpgrade { } private void updateSystemVmTemplates(Connection conn) { -PreparedStatement pstmt = null; -ResultSet rs = null; s_logger.debug(Updating System Vm template IDs); -try{ -//Get all hypervisors in use -SetHypervisor.HypervisorType hypervisorsListInUse = new HashSetHypervisor.HypervisorType(); -try { -pstmt = conn.prepareStatement(select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null); -rs = pstmt.executeQuery(); -while(rs.next()){ -switch (Hypervisor.HypervisorType.getType(rs.getString(1))) { -case XenServer: hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer); -break; -case KVM: hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM); -break; -case VMware: hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware); -break; -case Hyperv: hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv); -break; -case LXC: hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC); -break; -default: // no action on cases Any, BareMetal, None, Ovm, Parralels, Simulator and VirtualBox: -break; -} +//Get all hypervisors in use +SetHypervisor.HypervisorType hypervisorsListInUse = new HashSetHypervisor.HypervisorType(); +try (PreparedStatement pstmt = conn.prepareStatement(select distinct(hypervisor_type) from `cloud`.`cluster` where removed is null); + ResultSet rs = pstmt.executeQuery() + ) { +while(rs.next()){ +switch (Hypervisor.HypervisorType.getType(rs.getString(1))) { +case XenServer: hypervisorsListInUse.add(Hypervisor.HypervisorType.XenServer); +break; +case KVM: hypervisorsListInUse.add(Hypervisor.HypervisorType.KVM); +break; +case VMware: hypervisorsListInUse.add(Hypervisor.HypervisorType.VMware); +break; +case Hyperv: hypervisorsListInUse.add(Hypervisor.HypervisorType.Hyperv); +break; +case LXC: hypervisorsListInUse.add(Hypervisor.HypervisorType.LXC); +break; +default: // no action on cases Any, BareMetal, None, Ovm, Parralels, Simulator and VirtualBox: +break; } -} catch (SQLException e) { -throw new CloudRuntimeException(Error while listing hypervisors in use, e); } +} catch (SQLException e) { +s_logger.error(updateSystemVmTemplates:Exception while getting hypervisor types from clusters: +e.getMessage()); +throw new CloudRuntimeException(updateSystemVmTemplates:Exception while getting hypervisor types from clusters, e); +} -MapHypervisor.HypervisorType, String NewTemplateNameList = new HashMapHypervisor.HypervisorType, String(){ -{ put(Hypervisor.HypervisorType.XenServer, systemvm-xenserver-4.5); -put(Hypervisor.HypervisorType.VMware, systemvm-vmware-4.5); -
[6/7] git commit: updated refs/heads/vmware-disk-controllers to 06d4458
CID-1257434 try with resource Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9239f93a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9239f93a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9239f93a Branch: refs/heads/vmware-disk-controllers Commit: 9239f93a7d16b1b36b0a9a72edfeec72f366b0af Parents: 1a7f76a Author: Daan Hoogland d...@onecht.net Authored: Mon Jan 12 15:09:16 2015 +0100 Committer: Daan Hoogland d...@onecht.net Committed: Mon Jan 12 20:37:21 2015 +0100 -- .../cloudstack/storage/resource/NfsSecondaryStorageResource.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9239f93a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java -- diff --git a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java index 55f80e1..1b3dc83 100644 --- a/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java +++ b/services/secondary-storage/server/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java @@ -739,8 +739,8 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S metaFile.delete(); uniqDir.delete(); String md5sum = null; -try { -md5sum = DigestUtils.md5Hex(new FileInputStream(file)); +try (FileInputStream fs = new FileInputStream(file)){ +md5sum = DigestUtils.md5Hex(fs); } catch (IOException e) { s_logger.debug(Failed to get md5sum: + file.getAbsoluteFile()); }
[2/7] git commit: updated refs/heads/vmware-disk-controllers to 06d4458
CLOUDSTACK-8037: URL encode cookie values with UTF8 as per version 1 As per Version 1 cookies, certain characters are now allowed such as space, colons etc but they should be url encoded using UTF8 encoding. The frontend has a cookie value unboxing method that removes any double quotes that are added. As per the doc http://download.oracle.com/javase/6/docs/api/java/net/URLEncoder.html values are application/x-www-form-urlencoded and as per http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 whitespaces are encoded as +, therefore '+' are replaced by %20 (whitespace). Signed-off-by: Rohit Yadav rohit.ya...@shapeblue.com (cherry picked from commit 734bd70173c36508f0fc13a30c3aa8006814c019) Signed-off-by: Rohit Yadav rohit.ya...@shapeblue.com Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/173710d5 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/173710d5 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/173710d5 Branch: refs/heads/vmware-disk-controllers Commit: 173710d5b48d1a34996f15c3ff1bd80938639b94 Parents: 0b94f25 Author: Rohit Yadav rohit.ya...@shapeblue.com Authored: Mon Jan 12 13:56:25 2015 +0530 Committer: Rohit Yadav rohit.ya...@shapeblue.com Committed: Mon Jan 12 14:03:09 2015 +0530 -- .../api/command/SAML2LoginAPIAuthenticatorCmd.java | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/173710d5/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java -- diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java index 913c1ae..e1ccc02 100644 --- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java @@ -270,14 +270,14 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthent try { if (_apiServer.verifyUser(user.getId())) { LoginCmdResponse loginResponse = (LoginCmdResponse) _apiServer.loginUser(session, username, user.getPassword(), domainId, null, remoteAddress, params); -resp.addCookie(new Cookie(userid, loginResponse.getUserId())); -resp.addCookie(new Cookie(domainid, loginResponse.getDomainId())); -resp.addCookie(new Cookie(role, loginResponse.getType())); +resp.addCookie(new Cookie(userid, URLEncoder.encode(loginResponse.getUserId(), HttpUtils.UTF_8))); +resp.addCookie(new Cookie(domainid, URLEncoder.encode(loginResponse.getDomainId(), HttpUtils.UTF_8))); +resp.addCookie(new Cookie(role, URLEncoder.encode(loginResponse.getType(), HttpUtils.UTF_8))); resp.addCookie(new Cookie(username, URLEncoder.encode(loginResponse.getUsername(), HttpUtils.UTF_8))); resp.addCookie(new Cookie(sessionKey, URLEncoder.encode(loginResponse.getSessionKey(), HttpUtils.UTF_8))); resp.addCookie(new Cookie(account, URLEncoder.encode(loginResponse.getAccount(), HttpUtils.UTF_8))); resp.addCookie(new Cookie(timezone, URLEncoder.encode(loginResponse.getTimeZone(), HttpUtils.UTF_8))); -resp.addCookie(new Cookie(userfullname, loginResponse.getFirstName() + %20 + loginResponse.getLastName())); +resp.addCookie(new Cookie(userfullname, URLEncoder.encode(loginResponse.getFirstName() + + loginResponse.getLastName(), HttpUtils.UTF_8).replace(+, %20))); resp.sendRedirect(_configDao.getValue(Config.SAMLCloudStackRedirectionUrl.key())); return ApiResponseSerializer.toSerializedString(loginResponse, responseType);
[5/7] git commit: updated refs/heads/vmware-disk-controllers to 06d4458
CLOUDSTACK-8037: Fix attribute detection, tested to work with onelogin.com Signed-off-by: Rohit Yadav rohit.ya...@shapeblue.com (cherry picked from commit 23de431f96e1dad8a21055ac98926c428e83c775) Signed-off-by: Rohit Yadav rohit.ya...@shapeblue.com Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1a7f76ac Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1a7f76ac Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1a7f76ac Branch: refs/heads/vmware-disk-controllers Commit: 1a7f76ac77b05eec796637f96b4ceca3f1c7af33 Parents: b528047 Author: Rohit Yadav rohit.ya...@shapeblue.com Authored: Mon Jan 12 18:55:52 2015 +0530 Committer: Rohit Yadav rohit.ya...@shapeblue.com Committed: Mon Jan 12 19:41:10 2015 +0530 -- .../command/SAML2LoginAPIAuthenticatorCmd.java | 37 +++- 1 file changed, 21 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1a7f76ac/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java -- diff --git a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java index e1ccc02..6e86d23 100644 --- a/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java +++ b/plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java @@ -240,22 +240,27 @@ public class SAML2LoginAPIAuthenticatorCmd extends BaseCmd implements APIAuthent } } -AttributeStatement attributeStatement = assertion.getAttributeStatements().get(0); -ListAttribute attributes = attributeStatement.getAttributes(); - -// Try capturing standard LDAP attributes -for (Attribute attribute: attributes) { -String attributeName = attribute.getName(); -String attributeValue = attribute.getAttributeValues().get(0).getDOM().getTextContent(); -if (attributeName.equalsIgnoreCase(uid) uniqueUserId == null) { -username = attributeValue; -uniqueUserId = SAMLUtils.createSAMLId(username); -} else if (attributeName.equalsIgnoreCase(givenName)) { -firstName = attributeValue; -} else if (attributeName.equalsIgnoreCase((sn))) { -lastName = attributeValue; -} else if (attributeName.equalsIgnoreCase(mail)) { -email = attributeValue; +ListAttributeStatement attributeStatements = assertion.getAttributeStatements(); +if (attributeStatements != null attributeStatements.size() 0) { +for (AttributeStatement attributeStatement: attributeStatements) { +if (attributeStatement == null) { +continue; +} +// Try capturing standard LDAP attributes +for (Attribute attribute: attributeStatement.getAttributes()) { +String attributeName = attribute.getName(); +String attributeValue = attribute.getAttributeValues().get(0).getDOM().getTextContent(); +if (attributeName.equalsIgnoreCase(uid) uniqueUserId == null) { +username = attributeValue; +uniqueUserId = SAMLUtils.createSAMLId(username); +} else if (attributeName.equalsIgnoreCase(givenName)) { +firstName = attributeValue; +} else if (attributeName.equalsIgnoreCase((sn))) { +lastName = attributeValue; +} else if (attributeName.equalsIgnoreCase(mail)) { +email = attributeValue; +} +} } }
[4/7] git commit: updated refs/heads/vmware-disk-controllers to 06d4458
CLOUDSTACK-8146: Resource count of primary storage does not consider the detached volumes Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b528047f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b528047f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b528047f Branch: refs/heads/vmware-disk-controllers Commit: b528047fb6f1c199e5e1cfe991a10b72a2b32a49 Parents: aaf6a34 Author: Wei Zhou w.z...@tech.leaseweb.com Authored: Mon Jan 12 12:25:28 2015 +0100 Committer: Wei Zhou w.z...@tech.leaseweb.com Committed: Mon Jan 12 12:25:28 2015 +0100 -- .../com/cloud/storage/dao/VolumeDaoImpl.java| 21 +--- 1 file changed, 18 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b528047f/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java -- diff --git a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java index 24de717..61cce8d 100644 --- a/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java +++ b/engine/schema/src/com/cloud/storage/dao/VolumeDaoImpl.java @@ -65,6 +65,7 @@ public class VolumeDaoImpl extends GenericDaoBaseVolumeVO, Long implements Vol protected final SearchBuilderVolumeVO AllFieldsSearch; protected GenericSearchBuilderVolumeVO, Long CountByAccount; protected GenericSearchBuilderVolumeVO, SumCount primaryStorageSearch; +protected GenericSearchBuilderVolumeVO, SumCount primaryStorageSearch2; protected GenericSearchBuilderVolumeVO, SumCount secondaryStorageSearch; @Inject ResourceTagDao _tagsDao; @@ -367,7 +368,6 @@ public class VolumeDaoImpl extends GenericDaoBaseVolumeVO, Long implements Vol primaryStorageSearch = createSearchBuilder(SumCount.class); primaryStorageSearch.select(sum, Func.SUM, primaryStorageSearch.entity().getSize()); primaryStorageSearch.and(accountId, primaryStorageSearch.entity().getAccountId(), Op.EQ); -primaryStorageSearch.and(virtualRouterVmIds, primaryStorageSearch.entity().getInstanceId(), Op.NIN); primaryStorageSearch.and().op(path, primaryStorageSearch.entity().getPath(), Op.NNULL); primaryStorageSearch.or(states, primaryStorageSearch.entity().getState(), Op.IN); primaryStorageSearch.cp(); @@ -375,6 +375,18 @@ public class VolumeDaoImpl extends GenericDaoBaseVolumeVO, Long implements Vol primaryStorageSearch.and(isRemoved, primaryStorageSearch.entity().getRemoved(), Op.NULL); primaryStorageSearch.done(); +primaryStorageSearch2 = createSearchBuilder(SumCount.class); +primaryStorageSearch2.select(sum, Func.SUM, primaryStorageSearch2.entity().getSize()); +primaryStorageSearch2.and(accountId, primaryStorageSearch2.entity().getAccountId(), Op.EQ); +primaryStorageSearch2.and().op(instanceId, primaryStorageSearch2.entity().getInstanceId(), Op.NULL); +primaryStorageSearch2.or(virtualRouterVmIds, primaryStorageSearch2.entity().getInstanceId(), Op.NIN); +primaryStorageSearch2.cp(); +primaryStorageSearch2.and().op(path, primaryStorageSearch2.entity().getPath(), Op.NNULL); +primaryStorageSearch2.or(states, primaryStorageSearch2.entity().getState(), Op.IN); +primaryStorageSearch2.cp(); +primaryStorageSearch2.and(displayVolume, primaryStorageSearch2.entity().isDisplayVolume(), Op.EQ); +primaryStorageSearch2.and(isRemoved, primaryStorageSearch2.entity().getRemoved(), Op.NULL); + secondaryStorageSearch = createSearchBuilder(SumCount.class); secondaryStorageSearch.select(sum, Func.SUM, secondaryStorageSearch.entity().getSize()); secondaryStorageSearch.and(accountId, secondaryStorageSearch.entity().getAccountId(), Op.EQ); @@ -405,11 +417,14 @@ public class VolumeDaoImpl extends GenericDaoBaseVolumeVO, Long implements Vol @Override public long primaryStorageUsedForAccount(long accountId, ListLong virtualRouters) { -SearchCriteriaSumCount sc = primaryStorageSearch.create(); -sc.setParameters(accountId, accountId); +SearchCriteriaSumCount sc; if (!virtualRouters.isEmpty()) { +sc = primaryStorageSearch2.create(); sc.setParameters(virtualRouterVmIds, virtualRouters.toArray(new Object[virtualRouters.size()])); +} else { +sc = primaryStorageSearch.create(); } +sc.setParameters(accountId, accountId); sc.setParameters(states, State.Allocated); sc.setParameters(displayVolume, 1); ListSumCount storageSpace = customSearch(sc, null);
[3/3] git commit: updated refs/heads/vmware-disk-controllers to 1a8fe82
no extranous log4j files Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1a8fe825 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1a8fe825 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1a8fe825 Branch: refs/heads/vmware-disk-controllers Commit: 1a8fe825801865e35ea43e79bcf4d6dc606ecf1d Parents: 4b67a48 Author: Daan Hoogland d...@onecht.net Authored: Thu Jan 8 17:36:17 2015 +0100 Committer: Daan Hoogland d...@onecht.net Committed: Thu Jan 8 17:36:17 2015 +0100 -- plugins/hypervisors/hyperv/conf/log4j-cloud.xml | 93 plugins/hypervisors/hyperv/conf/log4j.xml | 93 2 files changed, 186 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1a8fe825/plugins/hypervisors/hyperv/conf/log4j-cloud.xml -- diff --git a/plugins/hypervisors/hyperv/conf/log4j-cloud.xml b/plugins/hypervisors/hyperv/conf/log4j-cloud.xml deleted file mode 100644 index 1e97ce9..000 --- a/plugins/hypervisors/hyperv/conf/log4j-cloud.xml +++ /dev/null @@ -1,93 +0,0 @@ -?xml version=1.0 encoding=UTF-8? -!-- -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. --- -!DOCTYPE log4j:configuration SYSTEM log4j.dtd - -log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/; debug=false - - !-- = -- - !-- Preserve messages in a local file -- - !-- = -- - - !-- A time/date based rolling appender -- - appender name=FILE class=org.apache.log4j.rolling.RollingFileAppender - param name=Append value=true/ - param name=Threshold value=TRACE/ - rollingPolicy class=org.apache.log4j.rolling.TimeBasedRollingPolicy -param name=FileNamePattern value=log/@AGENTLOG@.%d{-MM-dd}.gz/ -param name=ActiveFileName value=log/@AGENTLOG@/ - /rollingPolicy - layout class=org.apache.log4j.EnhancedPatternLayout - param name=ConversionPattern value=%d{ISO8601} %-5p [%c{3}] (%t:%x) %m%n/ - /layout - /appender - - !-- == -- - !-- Append messages to the console -- - !-- == -- - - appender name=CONSOLE class=org.apache.log4j.ConsoleAppender - param name=Target value=System.out/ - param name=Threshold value=TRACE/ - - layout class=org.apache.log4j.PatternLayout - param name=ConversionPattern value=%d{ISO8601}{GMT} %-5p [%c{3}] (%t:%x) %m%n/ - /layout - /appender - - !-- -- - !-- Limit categories -- - !-- -- - - category name=com.cloud - priority value=TRACE/ - /category - - category name=com.cloud.agent.metrics - priority value=TRACE/ - /category - - category name=com.cloud.agent.resource.computing.ComputingResource$StorageMonitorTask - priority value=TRACE/ - /category - - !-- Limit the org.apache category to TRACE as its DEBUG is verbose -- - category name=org.apache - priority value=TRACE/ - /category - - category name=org - priority value=TRACE/ - /category - - category name=net - priority value=TRACE/ - /category - - !-- === -- - !-- Setup the Root category -- - !-- === -- - - root - level value=TRACE/ - appender-ref ref=CONSOLE/ - appender-ref ref=FILE/ - /root - -/log4j:configuration http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1a8fe825/plugins/hypervisors/hyperv/conf/log4j.xml -- diff --git a/plugins/hypervisors/hyperv/conf/log4j.xml b/plugins/hypervisors/hyperv/conf/log4j.xml deleted file mode 100644 index 1e97ce9..000 --- a/plugins/hypervisors/hyperv/conf/log4j.xml +++ /dev/null @@ -1,93 +0,0 @@ -?xml version=1.0 encoding=UTF-8? -!-- -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
[2/3] git commit: updated refs/heads/vmware-disk-controllers to 1a8fe82
CLOUDSTACK-3439. [VMWARE] While preparing for migration, include dynamically created nics in case of VMware too. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4b67a481 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4b67a481 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4b67a481 Branch: refs/heads/vmware-disk-controllers Commit: 4b67a48144402a3a43d51c869456d9268873b1b1 Parents: 82fa918 Author: Likitha Shetty likitha.she...@citrix.com Authored: Mon Jan 5 11:35:43 2015 +0530 Committer: Likitha Shetty likitha.she...@citrix.com Committed: Thu Jan 8 09:50:19 2015 +0530 -- .../cloudstack/engine/orchestration/NetworkOrchestrator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4b67a481/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java -- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index 9feaa80..0c7b3ed 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -1377,7 +1377,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra @Override public void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest) { -if(vm.getType().equals(VirtualMachine.Type.DomainRouter) vm.getHypervisorType().equals(HypervisorType.KVM)){ +if(vm.getType().equals(VirtualMachine.Type.DomainRouter) (vm.getHypervisorType().equals(HypervisorType.KVM) || vm.getHypervisorType().equals(HypervisorType.VMware))) { //Include nics hot plugged and not stored in DB prepareAllNicsForMigration(vm, dest); return;
[1/3] git commit: updated refs/heads/vmware-disk-controllers to 1a8fe82
Repository: cloudstack Updated Branches: refs/heads/vmware-disk-controllers 85bd96c6b - 1a8fe8258 UI validation: Fix asterisk showing up on non-required fields Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/82fa9184 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/82fa9184 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/82fa9184 Branch: refs/heads/vmware-disk-controllers Commit: 82fa9184bfe5f59443a101e1008d57ce77cce53a Parents: 85bd96c Author: Brian Federle brian.fede...@citrix.com Authored: Wed Jan 7 08:46:59 2015 -0800 Committer: Brian Federle brian.fede...@citrix.com Committed: Wed Jan 7 08:49:27 2015 -0800 -- ui/scripts/ui/dialog.js | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/82fa9184/ui/scripts/ui/dialog.js -- diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index e5ac14b..051759f 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -193,11 +193,12 @@ ); // red asterisk -var $astersikSpan = $('span').addClass('field-required').html('*'); -$name.find('label').prepend($astersikSpan); +var $asterisk = $('span').addClass('field-required').html('*'); -if (field.validation == null || field.validation.required == false) { -$astersikSpan.hide(); +$name.find('label').prepend($asterisk); + +if (field.validation == null || !field.validation.required) { +$asterisk.hide(); } // Tooltip description
[01/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Repository: cloudstack Updated Branches: refs/heads/vmware-disk-controllers e8a54f471 - 85bd96c6b CID-1114613 dead code removed Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/682c3af7 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/682c3af7 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/682c3af7 Branch: refs/heads/vmware-disk-controllers Commit: 682c3af710ef002d49153f6e8b9db273378ab78d Parents: e8a54f4 Author: Daan Hoogland d...@onecht.net Authored: Tue Jan 6 16:38:41 2015 +0100 Committer: Daan Hoogland d...@onecht.net Committed: Tue Jan 6 16:38:41 2015 +0100 -- .../src/com/cloud/deploy/ImplicitDedicationPlanner.java| 2 -- 1 file changed, 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/682c3af7/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java -- diff --git a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java index bc3ff0a..9500cac 100644 --- a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java +++ b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java @@ -308,8 +308,6 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy // But the host where system vms are running is marked as shared and still be part of empty Hosts. // The scenario will fail where actual Empty hosts and uservms not running host. return PlannerResourceUsage.Dedicated; -} else if (!preferred) { -return PlannerResourceUsage.Dedicated; } else { if (!allOtherHosts.isEmpty() (hostsToAvoid == null || !hostsToAvoid.containsAll(allOtherHosts))) { return PlannerResourceUsage.Shared;
[05/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Skip older records which generate negative duration usage Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/84c25f70 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/84c25f70 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/84c25f70 Branch: refs/heads/vmware-disk-controllers Commit: 84c25f7025ca0eb22c8229d9e9cb7e987cbe Parents: 4ac96d6 Author: Kishan Kavala kis...@apache.org Authored: Thu Nov 20 17:34:44 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 11:49:50 2015 +0530 -- usage/src/com/cloud/usage/parser/IPAddressUsageParser.java | 5 + usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java | 5 + .../src/com/cloud/usage/parser/NetworkOfferingUsageParser.java | 5 + usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java | 5 + usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java | 5 + usage/src/com/cloud/usage/parser/StorageUsageParser.java| 5 + usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java | 5 + usage/src/com/cloud/usage/parser/VPNUserUsageParser.java| 5 + usage/src/com/cloud/usage/parser/VolumeUsageParser.java | 5 + 9 files changed, 45 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java -- diff --git a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java index adeff01..feee16b 100644 --- a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java +++ b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java @@ -101,6 +101,11 @@ public class IPAddressUsageParser { IpAssignDate = startDate; } +if (IpAssignDate.after(endDate)) { +//Ignore records created after endDate +continue; +} + long currentDuration = (IpReleaseDeleteDate.getTime() - IpAssignDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge) updateIpUsageData(usageMap, key, usageIp.getId(), currentDuration); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java -- diff --git a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java index 1b813b7..31ff97d 100644 --- a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java +++ b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java @@ -98,6 +98,11 @@ public class LoadBalancerUsageParser { lbCreateDate = startDate; } +if (lbCreateDate.after(endDate)) { +//Ignore records created after endDate +continue; +} + long currentDuration = (lbDeleteDate.getTime() - lbCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge) updateLBUsageData(usageMap, key, usageLB.getId(), currentDuration); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java -- diff --git a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java index 4a5a1d2..e54cd53 100644 --- a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java +++ b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java @@ -99,6 +99,11 @@ public class NetworkOfferingUsageParser { noCreateDate = startDate; } +if (noCreateDate.after(endDate)) { +//Ignore records created after endDate +continue; +} + long currentDuration = (noDeleteDate.getTime() - noCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge) updateNOUsageData(usageMap, key, usageNO.getVmInstanceId(), currentDuration); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java -- diff --git a/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
[14/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
While deploying Vm with DataDisk in LXC, if the rbd image mapping on the host fails, deploy Vm should fail Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/85bd96c6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/85bd96c6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/85bd96c6 Branch: refs/heads/vmware-disk-controllers Commit: 85bd96c6b28922702dca8014edf9b922a7462eee Parents: f767adf Author: Kishan Kavala kis...@apache.org Authored: Mon Nov 24 16:03:23 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 15:09:57 2015 +0530 -- .../cloud/hypervisor/kvm/resource/LibvirtComputingResource.java| 2 ++ 1 file changed, 2 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85bd96c6/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java -- diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index c80ccc3..9ae7a17 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -4030,6 +4030,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv diskdef.defBlockBasedDisk(device, devId, DiskDef.diskBus.VIRTIO); diskdef.setQemuDriver(false); vm.getDevices().addDevice(diskdef); +} else { +throw new InternalErrorException(Error while mapping RBD device on host); } } }
[10/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Network Id for direct-network should not be included in usage record response. Direct network stats have network_id = 0. Ignore network with id = 0 in usage record Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/01a325b2 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/01a325b2 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/01a325b2 Branch: refs/heads/vmware-disk-controllers Commit: 01a325b2bfde3f82faca1361cfab3f66ee78a524 Parents: 30ab4d3 Author: Kishan Kavala kis...@apache.org Authored: Mon Nov 24 11:35:36 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 14:17:30 2015 +0530 -- server/src/com/cloud/api/ApiResponseHelper.java | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01a325b2/server/src/com/cloud/api/ApiResponseHelper.java -- diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index dd55486..4726c24 100644 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -3169,9 +3169,11 @@ public class ApiResponseHelper implements ResponseGenerator { } } //Network ID -NetworkVO network = _entityMgr.findByIdIncludingRemoved(NetworkVO.class, usageRecord.getNetworkId().toString()); -if (network != null) { -usageRecResponse.setNetworkId(network.getUuid()); +if((usageRecord.getNetworkId() != null) (usageRecord.getNetworkId() != 0)) { +NetworkVO network = _entityMgr.findByIdIncludingRemoved(NetworkVO.class, usageRecord.getNetworkId().toString()); +if (network != null) { +usageRecResponse.setNetworkId(network.getUuid()); +} } } else if (usageRecord.getUsageType() == UsageTypes.VM_DISK_IO_READ || usageRecord.getUsageType() == UsageTypes.VM_DISK_IO_WRITE
[07/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
For volumes created from template, do not log offering ID in VOLUME.CREATE in usage_event. Moved offering type to DiskOffering interface Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9eb8d538 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9eb8d538 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9eb8d538 Branch: refs/heads/vmware-disk-controllers Commit: 9eb8d538dd196f27e5194dd2e657afffdb9347eb Parents: 42cecbb Author: Kishan Kavala kis...@apache.org Authored: Fri Nov 21 14:33:39 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 12:31:41 2015 +0530 -- api/src/com/cloud/offering/DiskOffering.java | 6 ++ .../cloudstack/engine/orchestration/VolumeOrchestrator.java| 4 +++- engine/schema/src/com/cloud/storage/DiskOfferingVO.java| 3 --- .../schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java | 2 +- server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/api/src/com/cloud/offering/DiskOffering.java -- diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/com/cloud/offering/DiskOffering.java index 928f713..c2069c2 100644 --- a/api/src/com/cloud/offering/DiskOffering.java +++ b/api/src/com/cloud/offering/DiskOffering.java @@ -34,6 +34,10 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId Inactive, Active, } +public enum Type { +Disk, Service +}; + State getState(); public enum DiskCacheMode { @@ -114,4 +118,6 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId DiskCacheMode getCacheMode(); void setCacheMode(DiskCacheMode cacheMode); + +Type getType(); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java -- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index 1b87ccf..396a49c 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -712,7 +712,9 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati Long offeringId = null; -offeringId = offering.getId(); +if (offering.getType() == DiskOffering.Type.Disk) { +offeringId = offering.getId(); +} UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(), offeringId, vol.getTemplateId(), size, Volume.class.getName(), vol.getUuid(), vol.isDisplayVolume()); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/engine/schema/src/com/cloud/storage/DiskOfferingVO.java -- diff --git a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java index 74f65ab..5de7f98 100644 --- a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java +++ b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java @@ -44,9 +44,6 @@ import com.cloud.utils.db.GenericDao; @Inheritance(strategy = InheritanceType.JOINED) @DiscriminatorColumn(name = type, discriminatorType = DiscriminatorType.STRING, length = 32) public class DiskOfferingVO implements DiskOffering { -public enum Type { -Disk, Service -}; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java -- diff --git a/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java index 818a5b5..ba84062 100644 --- a/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java +++ b/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java @@ -25,7 +25,7 @@ import javax.persistence.EntityExistsException; import org.springframework.stereotype.Component; import com.cloud.storage.DiskOfferingVO; -import com.cloud.storage.DiskOfferingVO.Type; +import
[11/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Increased SSL handshake timeout to 30 seconds Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dc17e4ef Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dc17e4ef Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dc17e4ef Branch: refs/heads/vmware-disk-controllers Commit: dc17e4ef39e8422a4e86eb0d2976ae3b4e380867 Parents: 01a325b Author: Kishan Kavala kis...@cloud.com Authored: Wed Apr 16 23:55:26 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 14:27:51 2015 +0530 -- utils/src/com/cloud/utils/nio/Link.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dc17e4ef/utils/src/com/cloud/utils/nio/Link.java -- diff --git a/utils/src/com/cloud/utils/nio/Link.java b/utils/src/com/cloud/utils/nio/Link.java index a15b8a4..0127ec7 100644 --- a/utils/src/com/cloud/utils/nio/Link.java +++ b/utils/src/com/cloud/utils/nio/Link.java @@ -465,7 +465,7 @@ public class Link { ByteBuffer out_pkgBuf = ByteBuffer.allocate(sslSession.getPacketBufferSize() + 40); ByteBuffer out_appBuf = ByteBuffer.allocate(sslSession.getApplicationBufferSize() + 40); int count; -ch.socket().setSoTimeout(10 * 1000); +ch.socket().setSoTimeout(30 * 1000); InputStream inStream = ch.socket().getInputStream(); // Use readCh to make sure the timeout on reading is working ReadableByteChannel readCh = Channels.newChannel(inStream);
[13/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Bug-Id: CLOUDSTACK-3439: Include dynamically created nics in Prepare for migration command in KVM Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f767adfe Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f767adfe Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f767adfe Branch: refs/heads/vmware-disk-controllers Commit: f767adfe71dda82c45cf376ba71518e2ad84cc98 Parents: a520309 Author: Kishan Kavala kis...@apache.org Authored: Wed Jan 7 14:52:42 2015 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 14:52:42 2015 +0530 -- api/src/com/cloud/vm/NicProfile.java| 8 ++ .../service/NetworkOrchestrationService.java| 2 + .../com/cloud/vm/VirtualMachineManagerImpl.java | 1 + .../orchestration/NetworkOrchestrator.java | 86 .../src/com/cloud/network/dao/IPAddressDao.java | 1 + .../com/cloud/network/dao/IPAddressDaoImpl.java | 7 ++ .../cloud/hypervisor/HypervisorGuruBase.java| 4 + .../com/cloud/vpc/MockNetworkManagerImpl.java | 5 ++ 8 files changed, 114 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/api/src/com/cloud/vm/NicProfile.java -- diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/com/cloud/vm/NicProfile.java index 4dd7f68..e9e9dc5 100644 --- a/api/src/com/cloud/vm/NicProfile.java +++ b/api/src/com/cloud/vm/NicProfile.java @@ -70,6 +70,10 @@ public class NicProfile implements InternalIdentity, Serializable { return name; } +public void setName(String name) { +this.name = name; +} + public String getDns2() { return dns2; } @@ -371,4 +375,8 @@ public class NicProfile implements InternalIdentity, Serializable { this.ip6Dns2 = ip6Dns2; } +public void setNetworId(long networkId){ +this.networkId = networkId; +} + } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java -- diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java index b2108ac..5412ee4 100644 --- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java +++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java @@ -217,4 +217,6 @@ public interface NetworkOrchestrationService { void removeDhcpServiceInSubnet(Nic nic); boolean resourceCountNeedsUpdate(NetworkOffering ntwkOff, ACLType aclType); + +void prepareAllNicsForMigration(VirtualMachineProfile vm, DeployDestination dest); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java -- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index 8accebe..ca60529 100644 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -3284,6 +3284,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm); _networkMgr.prepareNicForMigration(profile, dest); + volumeMgr.prepareForMigration(profile, dest); VirtualMachineTO to = toVmTO(profile); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java -- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index 4e42750..9feaa80 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -37,6 +37,7 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.network.Networks; import org.apache.log4j.Logger; import org.apache.cloudstack.acl.ControlledEntity.ACLType; import org.apache.cloudstack.context.CallContext; @@
[04/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Trigger user stats aggregation job at midnight in usage aggregation timezone Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4ac96d63 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4ac96d63 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4ac96d63 Branch: refs/heads/vmware-disk-controllers Commit: 4ac96d637c9efe0db50dd707dd161426aeb54a13 Parents: bc235ed Author: Kishan Kavala kis...@apache.org Authored: Thu Nov 20 17:08:17 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 11:17:24 2015 +0530 -- .../VirtualNetworkApplianceManagerImpl.java | 25 +--- 1 file changed, 17 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ac96d63/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java -- diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index c505755..c9590fe 100644 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -651,34 +651,36 @@ Configurable, StateListenerState, VirtualMachine.Event, VirtualMachine { s_logger.debug(router.stats.interval - + _routerStatsInterval + so not scheduling the router stats thread); } -// Schedule Network stats update task +//Schedule Network stats update task +//Network stats aggregation should align with aggregation range +//For daily aggregation, update stats at the end of the day +//For hourly aggregation, update stats at the end of the hour final TimeZone usageTimezone = TimeZone.getTimeZone(_usageTimeZone); final Calendar cal = Calendar.getInstance(usageTimezone); cal.setTime(new Date()); -long endDate = 0; +//aggDate is the time in millis when the aggregation should happen +long aggDate = 0; final int HOURLY_TIME = 60; final int DAILY_TIME = 60 * 24; if (_usageAggregationRange == DAILY_TIME) { -cal.roll(Calendar.DAY_OF_YEAR, false); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.roll(Calendar.DAY_OF_YEAR, true); cal.add(Calendar.MILLISECOND, -1); -endDate = cal.getTime().getTime(); +aggDate = cal.getTime().getTime(); _dailyOrHourly = true; } else if (_usageAggregationRange == HOURLY_TIME) { -cal.roll(Calendar.HOUR_OF_DAY, false); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.roll(Calendar.HOUR_OF_DAY, true); cal.add(Calendar.MILLISECOND, -1); -endDate = cal.getTime().getTime(); +aggDate = cal.getTime().getTime(); _dailyOrHourly = true; } else { -endDate = cal.getTime().getTime(); +aggDate = cal.getTime().getTime(); _dailyOrHourly = false; } @@ -687,7 +689,14 @@ Configurable, StateListenerState, VirtualMachine.Event, VirtualMachine { _usageAggregationRange = UsageUtils.USAGE_AGGREGATION_RANGE_MIN; } -_networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), endDate - System.currentTimeMillis(), _usageAggregationRange * 60 * 1000, +// We cannot schedule a job at specific time. Provide initial delay instead, from current time, so that the job runs at desired time +long initialDelay = aggDate - System.currentTimeMillis(); + +if( initialDelay 0){ +s_logger.warn(Initial delay for network usage stats update task is incorrect. Stats update task will run immediately); +} + +_networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), initialDelay, (_usageAggregationRange * 60 * 1000), TimeUnit.MILLISECONDS); if (_routerCheckInterval 0) {
[12/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Bug-Id: CLOUDSTACK-7395: reverted 0560254c04425705530a23a93002daede4b6dc3c partially. Allow multiple networks with LB service Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a5203091 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a5203091 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a5203091 Branch: refs/heads/vmware-disk-controllers Commit: a5203091902f2be033663358b8d5083b6488b879 Parents: dc17e4e Author: Kishan Kavala kis...@apache.org Authored: Mon Dec 15 17:18:09 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 14:33:31 2015 +0530 -- server/src/com/cloud/network/vpc/VpcManagerImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5203091/server/src/com/cloud/network/vpc/VpcManagerImpl.java -- diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java index fbb94c7..6bc75e4 100644 --- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java +++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java @@ -1309,9 +1309,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis continue; } else { NetworkOffering otherOff = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); -//throw only if networks have different offerings with public lb support -if (_ntwkModel.areServicesSupportedInNetwork(network.getId(), Service.Lb) otherOff.getPublicLb() - guestNtwkOff.getId() != otherOff.getId()) { +if (_ntwkModel.areServicesSupportedInNetwork(network.getId(), Service.Lb) otherOff.getPublicLb()) { throw new InvalidParameterValueException(Public LB service is already supported + by network + network + in VPC + vpc); } }
[03/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
CLOUDSTACK-5485. Cannot process more than 5 concurrent snapshots. Number of threads on SSVM agent for connection with MS (Agent-NioClient) should be configurable using global config 'workers'. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bc235ed5 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bc235ed5 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bc235ed5 Branch: refs/heads/vmware-disk-controllers Commit: bc235ed5eb0f88c3c62542a3e06bdc28c7b49eac Parents: 3cba1c4 Author: Likitha Shetty likitha.she...@citrix.com Authored: Tue Jan 6 15:33:47 2015 +0530 Committer: Likitha Shetty likitha.she...@citrix.com Committed: Wed Jan 7 09:41:24 2015 +0530 -- agent/src/com/cloud/agent/AgentShell.java | 3 +++ .../cloudstack/secondarystorage/SecondaryStorageManagerImpl.java | 2 ++ 2 files changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc235ed5/agent/src/com/cloud/agent/AgentShell.java -- diff --git a/agent/src/com/cloud/agent/AgentShell.java b/agent/src/com/cloud/agent/AgentShell.java index 34e73ed..7f83476 100644 --- a/agent/src/com/cloud/agent/AgentShell.java +++ b/agent/src/com/cloud/agent/AgentShell.java @@ -229,6 +229,9 @@ public class AgentShell implements IAgentShell, Daemon { } _workers = NumberUtils.toInt(workers, 5); +if (_workers = 0) { +_workers = 5; +} if (host == null) { host = getProperty(null, host); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc235ed5/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java -- diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java index ccf3dcd..9883932 100644 --- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java +++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java @@ -1052,6 +1052,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar buf.append( guid=).append(profile.getVirtualMachine().getHostName()); +buf.append( workers=).append(_configDao.getValue(workers)); + if (_configDao.isPremium()) { s_logger.debug(VmWare hypervisor configured, telling the ssvm to load the PremiumSecondaryStorageResource); buf.append( resource=com.cloud.storage.resource.PremiumSecondaryStorageResource);
[08/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Close transaction while fetching recent events Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/438f90a2 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/438f90a2 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/438f90a2 Branch: refs/heads/vmware-disk-controllers Commit: 438f90a2627c4a7408f02fc4b59be7eb566443be Parents: 9eb8d53 Author: Kishan Kavala kis...@apache.org Authored: Fri Nov 21 15:14:26 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 14:14:44 2015 +0530 -- engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/438f90a2/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java -- diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java index 4e35bf5..1739254 100644 --- a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java +++ b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java @@ -124,6 +124,8 @@ public class UsageEventDaoImpl extends GenericDaoBaseUsageEventVO, Long implem txn.rollback(); s_logger.error(error copying events from cloud db to usage db, ex); throw new CloudRuntimeException(ex.getMessage()); +} finally { +txn.close(); } // Copy event details from cloud db to usage db @@ -150,6 +152,8 @@ public class UsageEventDaoImpl extends GenericDaoBaseUsageEventVO, Long implem txn.rollback(); s_logger.error(error copying event details from cloud db to usage db, ex); throw new CloudRuntimeException(ex.getMessage()); +} finally { +txn.close(); } return findRecentEvents(endDate);
[02/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
CID-1114614 dead code removed Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3cba1c41 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3cba1c41 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3cba1c41 Branch: refs/heads/vmware-disk-controllers Commit: 3cba1c41fbcbae6612940714ad9e2e2a7ce4d7bf Parents: 682c3af Author: Daan Hoogland d...@onecht.net Authored: Tue Jan 6 16:47:32 2015 +0100 Committer: Daan Hoogland d...@onecht.net Committed: Tue Jan 6 16:47:32 2015 +0100 -- server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java | 3 --- 1 file changed, 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cba1c41/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java -- diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java index f9a1586..3c0188d 100644 --- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java +++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java @@ -266,9 +266,6 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc Integer pskLength = _pskLength; if (pskLength != null (pskLength 8 || pskLength 256)) { throw new ConfigurationException(Remote Access VPN: IPSec preshared key length should be between 8 and 256); -} else if (pskLength == null) { -s_logger.warn(Remote Access VPN configuration missing Preshared Key Length -- ignoring); -return; } String[] range = ipRange.split(-);
[06/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
Network offering usage event should be logged for UserVms only Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/42cecbb0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/42cecbb0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/42cecbb0 Branch: refs/heads/vmware-disk-controllers Commit: 42cecbb000416978a7edcef5d8c664dac4b52277 Parents: 84c25f7 Author: Kishan Kavala kis...@apache.org Authored: Fri Nov 21 12:10:50 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 12:29:11 2015 +0530 -- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/42cecbb0/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java -- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index e9cd79c..8accebe 100644 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -2925,8 +2925,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.debug(Nic is plugged successfully for vm + vm + in network + network + . Vm is a part of network now); long isDefault = (nic.isDefaultNic()) ? 1 : 0; // insert nic's Id into DB as resource_name - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), vmVO.getDataCenterId(), vmVO.getId(), -Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid(), vm.isDisplay()); +if(VirtualMachine.Type.User.equals(vmVO.getType())) { +//Log usage event for user Vms only + UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), vmVO.getDataCenterId(), vmVO.getId(), +Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid(), vm.isDisplay()); +} return nic; } else { s_logger.warn(Failed to plug nic to the vm + vm + in network + network);
[09/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c
For Vm snapshot delete event, check for null size and set it as zero Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/30ab4d3d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/30ab4d3d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/30ab4d3d Branch: refs/heads/vmware-disk-controllers Commit: 30ab4d3d6623af3c6075a9dbee4f474932008bf5 Parents: 438f90a Author: Kishan Kavala kis...@apache.org Authored: Mon Nov 24 11:28:56 2014 +0530 Committer: Kishan Kavala kis...@apache.org Committed: Wed Jan 7 14:15:59 2015 +0530 -- usage/src/com/cloud/usage/UsageManagerImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30ab4d3d/usage/src/com/cloud/usage/UsageManagerImpl.java -- diff --git a/usage/src/com/cloud/usage/UsageManagerImpl.java b/usage/src/com/cloud/usage/UsageManagerImpl.java index 8429c60..5453be9 100644 --- a/usage/src/com/cloud/usage/UsageManagerImpl.java +++ b/usage/src/com/cloud/usage/UsageManagerImpl.java @@ -1726,7 +1726,8 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna Long offeringId = event.getOfferingId(); Long zoneId = event.getZoneId(); Long accountId = event.getAccountId(); -long size = event.getSize(); +//Size could be null for VM snapshot delete events +long size = (event.getSize() == null) ? 0 : event.getSize(); Date created = event.getCreateDate(); Account acct = _accountDao.findByIdIncludingRemoved(event.getAccountId()); Long domainId = acct.getDomainId();
[02/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-8136. [VMware] Create VM snapshot fails if a previous attempt to take the snapshot failed. While looking for an ongoing VM snapshot task, check the task status to identify if the task is still running. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/25a4f0dc Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/25a4f0dc Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/25a4f0dc Branch: refs/heads/vmware-disk-controllers Commit: 25a4f0dc530951e87fe357313dc983cb75aa8972 Parents: 13bdc1c Author: Likitha Shetty likitha.she...@citrix.com Authored: Tue Dec 30 14:16:00 2014 +0530 Committer: Likitha Shetty likitha.she...@citrix.com Committed: Tue Dec 30 14:19:48 2014 +0530 -- .../hypervisor/vmware/manager/VmwareStorageManagerImpl.java | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25a4f0dc/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java -- diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java index 1981303..3aec7a4 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java @@ -37,6 +37,7 @@ import com.vmware.vim25.HostDatastoreBrowserSearchResults; import com.vmware.vim25.HostDatastoreBrowserSearchSpec; import com.vmware.vim25.ManagedObjectReference; import com.vmware.vim25.TaskInfo; +import com.vmware.vim25.TaskInfoState; import com.vmware.vim25.VirtualDisk; import org.apache.cloudstack.storage.to.TemplateObjectTO; @@ -1181,8 +1182,10 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { TaskInfo info = (TaskInfo)(context.getVimClient().getDynamicProperty(taskMor, info)); if (info.getEntityName().equals(cmd.getVmName()) info.getName().equalsIgnoreCase(CreateSnapshot_Task)) { -s_logger.debug(There is already a VM snapshot task running, wait for it); -context.getVimClient().waitForTask(taskMor); +if (!(info.getState().equals(TaskInfoState.SUCCESS) || info.getState().equals(TaskInfoState.ERROR))) { +s_logger.debug(There is already a VM snapshot task running, wait for it); +context.getVimClient().waitForTask(taskMor); +} } }
[10/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_tags.py -- diff --git a/test/integration/component/test_tags.py b/test/integration/component/test_tags.py index 2b05fbb..e323578 100644 --- a/test/integration/component/test_tags.py +++ b/test/integration/component/test_tags.py @@ -16,7 +16,7 @@ # under the License. P1 tests for tags -#Import Local Modules +# Import Local Modules from nose.plugins.attrib import attr from marvin.cloudstackTestCase import cloudstackTestCase from marvin.lib.utils import cleanup_resources @@ -43,147 +43,149 @@ from marvin.lib.common import (get_zone, from marvin.codes import FAILED import time + class Services: + Test tags Services def __init__(self): self.services = { -domain: { - name: Domain, -}, -project: { -name: Project, -displaytext: Test project, -}, -account: { -email: administra...@clogeny.com, -firstname: Test, -lastname: User, -username: test, -# Random characters are appended for unique -# username -password: password, - }, - user: { -email: u...@clogeny.com, -firstname: User, -lastname: User, -username: User, -# Random characters are appended for unique -# username -password: password, - }, -other_user: { -email: otheru...@clogeny.com, -firstname: Other, -lastname: User, -username: User, -# Random characters are appended for unique -# username -password: password, - }, - service_offering: { -name: Tiny Instance, -displaytext: Tiny Instance, -cpunumber: 1, -cpuspeed: 100, -# in MHz -memory: 128, -# In MBs -}, -disk_offering: { -displaytext: Tiny Disk Offering, -name: Tiny Disk Offering, -disksize: 1 -}, -volume: { - diskname: Test Volume, -}, -virtual_machine: { -displayname: TestVM, -username: root, -password: password, -ssh_port: 22, -hypervisor: 'XenServer', -privateport: 22, -publicport: 22, -protocol: 'TCP', -}, -template: { -displaytext: Cent OS Template, -name: Cent OS Template, -ostype: 'CentOS 5.3 (64-bit)', -templatefilter: 'self', -}, -iso: -{ -displaytext: Dummy ISO, -name: Dummy ISO, -url: http://people.apache.org/~tsp/dummy.iso;, -# Source URL where ISO is located -isextractable: True, -isfeatured: True, -ispublic: False, -ostype: 'CentOS 5.3 (64-bit)', -mode: 'HTTP_DOWNLOAD', -# Used in Extract template, value must be HTTP_DOWNLOAD -}, -network_offering: { -name:
[17/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSATCK-8138: Fixed VmSnapshot revert issue in test_escalations_instances.py Signed-off-by: SrikanteswaraRao Talluri tall...@apache.org Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/22d65654 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/22d65654 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/22d65654 Branch: refs/heads/vmware-disk-controllers Commit: 22d6565434e31a8c65953a9eb1b8bfeea1c0f1d0 Parents: eae9f0f Author: Gaurav Aradhye gaurav.arad...@clogeny.com Authored: Wed Dec 31 15:19:22 2014 +0530 Committer: SrikanteswaraRao Talluri tall...@apache.org Committed: Mon Jan 5 18:42:07 2015 +0530 -- test/integration/component/test_escalations_instances.py | 3 --- 1 file changed, 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/22d65654/test/integration/component/test_escalations_instances.py -- diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py index 15eb6f1..ddae154 100644 --- a/test/integration/component/test_escalations_instances.py +++ b/test/integration/component/test_escalations_instances.py @@ -2622,9 +2622,6 @@ class TestInstances(cloudstackTestCase): Latest snapshot taken is not marked as current ) -# Stop Virtual machine befor reverting VM to a snapshot taken without memory -vm_created.stop(self.userapiclient) - # Reverting the VM to Snapshot 1 VmSnapshot.revertToSnapshot( self.userapiclient,
[18/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CID-1261669 added comment to clarify false positive Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/54e5f28a Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/54e5f28a Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/54e5f28a Branch: refs/heads/vmware-disk-controllers Commit: 54e5f28acec2e665a56b2c60a98d6eb8b045f5f1 Parents: 22d6565 Author: Daan Hoogland d...@onecht.net Authored: Mon Jan 5 15:43:51 2015 +0100 Committer: Daan Hoogland d...@onecht.net Committed: Mon Jan 5 15:43:51 2015 +0100 -- .../com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java | 1 + 1 file changed, 1 insertion(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/54e5f28a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java -- diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index f01153f..ccf4626 100644 --- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -4244,6 +4244,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (cpuInfo.get(socket_count) != null) { _host.cpuSockets = Integer.parseInt(cpuInfo.get(socket_count)); } +// would hcs be null we would have thrown an exception on condition (_host.cpus = 0) by now for (final HostCpu hc : hcs) { _host.speed = hc.getSpeed(conn).intValue(); break;
[04/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-8141: UI use Project view Infrastructure zone physical network Public traffic type do not pass projectId to listNetworks API. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b64fa34c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b64fa34c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b64fa34c Branch: refs/heads/vmware-disk-controllers Commit: b64fa34ce901f88a944f9f104310a8f53a827f0f Parents: 61154b9 Author: Jessica Wang jessicaw...@apache.org Authored: Fri Jan 2 11:33:57 2015 -0800 Committer: Jessica Wang jessicaw...@apache.org Committed: Fri Jan 2 11:35:31 2015 -0800 -- ui/scripts/system.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b64fa34c/ui/scripts/system.js -- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index ad40ec1..88d0a78 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -601,7 +601,9 @@ dataProvider: function (args) { $.ajax({ -url: createURL(listNetworkslistAll=truetrafficType=PublicisSystem=truezoneId= + selectedZoneObj.id), +url: createURL(listNetworkslistAll=truetrafficType=PublicisSystem=truezoneId= + selectedZoneObj.id, { +ignoreProject: true +}), dataType: json, async: false, success: function (json) {
[13/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-8130: Fixed test_escalations_templates.py - Removed test case dependency on each other Signed-off-by: SrikanteswaraRao Talluri tall...@apache.org Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/17da2e9c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/17da2e9c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/17da2e9c Branch: refs/heads/vmware-disk-controllers Commit: 17da2e9ce9894b67c32306fb36d02786d34ad0d0 Parents: 214d63e Author: Ashutosh K ashut...@clogeny.com Authored: Fri Dec 26 12:24:29 2014 +0530 Committer: SrikanteswaraRao Talluri tall...@apache.org Committed: Mon Jan 5 18:05:17 2015 +0530 -- .../component/test_escalations_templates.py | 1001 +- 1 file changed, 509 insertions(+), 492 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/17da2e9c/test/integration/component/test_escalations_templates.py -- diff --git a/test/integration/component/test_escalations_templates.py b/test/integration/component/test_escalations_templates.py index 3dc24c1..a7787c7 100644 --- a/test/integration/component/test_escalations_templates.py +++ b/test/integration/component/test_escalations_templates.py @@ -16,15 +16,23 @@ # under the License. # Import Local Modules -from marvin.cloudstackTestCase import * -from marvin.cloudstackAPI import * -from marvin.lib.utils import * -from marvin.lib.base import * -from marvin.lib.common import * +from marvin.cloudstackTestCase import cloudstackTestCase, unittest +from marvin.lib.utils import (cleanup_resources, + validateList) +from marvin.lib.base import (Account, + Zone, + Template, + Hypervisor) +from marvin.lib.common import (get_domain, + get_zone, + get_template, + list_os_types, + get_builtin_template_info) from marvin.codes import PASS from nose.plugins.attrib import attr import time + class TestTemplates(cloudstackTestCase): @classmethod @@ -36,23 +44,21 @@ class TestTemplates(cloudstackTestCase): cls.services = cls.testClient.getParsedTestDataConfig() # Get Domain, Zone, Template cls.domain = get_domain(cls.api_client) -cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) +cls.zone = get_zone( +cls.api_client, +cls.testClient.getZoneForTests()) cls.template = get_template( -cls.api_client, -cls.zone.id, -cls.services[ostype] -) +cls.api_client, +cls.zone.id, +cls.services[ostype] +) cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services['mode'] = cls.zone.networktype -cls.account = Account.create( -cls.api_client, -cls.services[account], -domainid=cls.domain.id -) -# Getting authentication for user in newly created Account -cls.user = cls.account.user[0] -cls.userapiclient = cls.testClient.getUserApiClient(cls.user.username, cls.domain.name) -cls._cleanup.append(cls.account) + +builtin_info = get_builtin_template_info(cls.api_client, cls.zone.id) +cls.services[privatetemplate][url] = builtin_info[0] +cls.services[privatetemplate][hypervisor] = builtin_info[1] +cls.services[privatetemplate][format] = builtin_info[2] except Exception as e: cls.tearDownClass() raise Exception(Warning: Exception in setup : %s % e) @@ -62,6 +68,17 @@ class TestTemplates(cloudstackTestCase): self.apiClient = self.testClient.getApiClient() self.cleanup = [] +self.account = Account.create( +self.apiClient, +self.services[account], +domainid=self.domain.id +) +# Getting authentication for user in newly created Account +self.user = self.account.user[0] +self.userapiclient = self.testClient.getUserApiClient( +self.user.username, +self.domain.name) +self.cleanup.append(self.account) def tearDown(self): # Clean up, terminate the created resources @@ -102,10 +119,9 @@ class TestTemplates(cloudstackTestCase):
[22/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-8140: CS fails to start after secstorage/consoleproxy.service.offering is set to uuid Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/84c44b63 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/84c44b63 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/84c44b63 Branch: refs/heads/vmware-disk-controllers Commit: 84c44b63140e8acf2336549040bda9c0a8f2ff66 Parents: 2c9cc1e Author: Wei Zhou w.z...@tech.leaseweb.com Authored: Tue Jan 6 10:23:44 2015 +0100 Committer: Wei Zhou w.z...@tech.leaseweb.com Committed: Tue Jan 6 10:23:44 2015 +0100 -- server/src/com/cloud/configuration/Config.java | 6 +++--- .../consoleproxy/ConsoleProxyManagerImpl.java | 18 -- .../SecondaryStorageManagerImpl.java| 20 +--- setup/db/db/schema-442to450.sql | 2 ++ 4 files changed, 26 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c44b63/server/src/com/cloud/configuration/Config.java -- diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index af4da6a..f9e9bdd 100644 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -1804,7 +1804,7 @@ public enum Config { ConsoleProxyServiceOffering( Advanced, ManagementServer.class, -Long.class, +String.class, consoleproxy.service.offering, null, Uuid of the service offering used by console proxy; if NULL - system offering will be used, @@ -1812,10 +1812,10 @@ public enum Config { SecondaryStorageServiceOffering( Advanced, ManagementServer.class, -Long.class, +String.class, secstorage.service.offering, null, -Service offering used by secondary storage; if NULL - system offering will be used, +Uuid of the service offering used by secondary storage; if NULL - system offering will be used, null), HaTag(Advanced, ManagementServer.class, String.class, ha.tag, null, HA tag defining that the host marked with this tag can be used for HA purposes only, null), ImplicitHostTags( http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c44b63/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java -- diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index 65930aa..bb64fa3 100644 --- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -91,7 +91,6 @@ import com.cloud.network.dao.IPAddressVO; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkVO; import com.cloud.network.rules.RulesManager; -import com.cloud.offering.DiskOffering; import com.cloud.offering.NetworkOffering; import com.cloud.offering.ServiceOffering; import com.cloud.offerings.dao.NetworkOfferingDao; @@ -105,7 +104,6 @@ import com.cloud.storage.Storage; import com.cloud.storage.StoragePoolStatus; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; import com.cloud.storage.VMTemplateVO; -import com.cloud.storage.dao.DiskOfferingDao; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.user.Account; import com.cloud.user.AccountManager; @@ -196,8 +194,6 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy @Inject private ServiceOfferingDao _offeringDao; @Inject -private DiskOfferingDao _diskOfferingDao; -@Inject private NetworkOfferingDao _networkOfferingDao; @Inject private PrimaryDataStoreDao _storagePoolDao; @@ -1267,13 +1263,15 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy //check if there is a default service offering configured String cpvmSrvcOffIdStr = configs.get(Config.ConsoleProxyServiceOffering.key()); if (cpvmSrvcOffIdStr != null) { -DiskOffering diskOffering = _diskOfferingDao.findByUuid(cpvmSrvcOffIdStr); -if (diskOffering == null) { -diskOffering = _diskOfferingDao.findById(Long.parseLong(cpvmSrvcOffIdStr)); +_serviceOffering = _offeringDao.findByUuid(cpvmSrvcOffIdStr); +if (_serviceOffering == null) { +try { +_serviceOffering = _offeringDao.findById(Long.parseLong(cpvmSrvcOffIdStr)); +} catch (NumberFormatException ex) {
[20/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CID-1261670 added null check Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5251fb2d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5251fb2d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5251fb2d Branch: refs/heads/vmware-disk-controllers Commit: 5251fb2dc33bc2f5a3e04fe8928ee0e8645b6647 Parents: 251e88c Author: Daan Hoogland d...@onecht.net Authored: Mon Jan 5 16:01:13 2015 +0100 Committer: Daan Hoogland d...@onecht.net Committed: Mon Jan 5 16:01:13 2015 +0100 -- .../cloudstack/storage/motion/AncientDataMotionStrategy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5251fb2d/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java -- diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java index 203cfa4..17ab00e 100644 --- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java +++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java @@ -190,7 +190,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy { // for template, we want to leave it on cache for performance reason if ((answer == null || !answer.getResult()) srcForCopy.getRefCount() 2) { // cache object created by this copy, not already there -s_logger.warn(Copy may not be handled correctly by agent(id: + ep.getId() + ). + +s_logger.warn(Copy may not be handled correctly by agent(id: + (ep != null ? ep.getId() : \unspecified\) + ). + Delete + cacheType + cache(id: + cacheId + , uuid: + cacheUuid + )); cacheMgr.deleteCacheObject(srcForCopy);
[11/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_snapshots.py -- diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py index 4bb2dcf..5b8cdc7 100644 --- a/test/integration/component/test_snapshots.py +++ b/test/integration/component/test_snapshots.py @@ -16,142 +16,143 @@ # under the License. P1 tests for Snapshots -#Import Local Modules -from nose.plugins.attrib import attr -from marvin.cloudstackTestCase import cloudstackTestCase - -from marvin.lib.base import (Snapshot, - Template, - VirtualMachine, - Account, - ServiceOffering, - DiskOffering, - Volume) - -from marvin.lib.common import (get_domain, - get_zone, - get_template, - list_events, - list_volumes, - list_snapshots, - list_templates, - list_virtual_machines, - ) - -from marvin.lib.utils import(cleanup_resources, - format_volume_to_ext3, - random_gen, - is_snapshot_on_nfs, - get_hypervisor_type) - -from marvin.cloudstackAPI importdetachVolume -import time +# Import Local Modules +from nose.plugins.attrib import attr +from marvin.cloudstackTestCase import cloudstackTestCase + +from marvin.lib.base import (Snapshot, + Template, + VirtualMachine, + Account, + ServiceOffering, + DiskOffering, + Volume) + +from marvin.lib.common import (get_domain, + get_zone, + get_template, + list_events, + list_volumes, + list_snapshots, + list_templates, + list_virtual_machines, + ) +from marvin.lib.utils import (cleanup_resources, + format_volume_to_ext3, + random_gen, + is_snapshot_on_nfs, + get_hypervisor_type) + +from marvin.cloudstackAPI import detachVolume +import time class Services: + Test Snapshots Services def __init__(self): self.services = { -account: { -email: t...@test.com, -firstname: Test, -lastname: User, -username: test, -# Random characters are appended for unique -# username -password: password, - }, - service_offering: { -name: Tiny Instance, -displaytext: Tiny Instance, -cpunumber: 1, -cpuspeed: 200,# in MHz +account: { +email: t...@test.com, +firstname: Test, +lastname: User, +username: test, +# Random characters are appended for unique +# username +password: password, +}, +service_offering: { +name: Tiny Instance, +displaytext: Tiny Instance, +cpunumber: 1, +cpuspeed: 200,# in MHz memory: 256, # In MBs +}, +disk_offering: { +displaytext: Small Disk, +name: Small Disk, +disksize: 1 +}, +server_with_disk: +{ +displayname: Test VM -With Disk, +username: root, +password: password, +ssh_port: 22, +hypervisor: 'XenServer', +privateport: 22, +publicport: 22, +
[24/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
Seems we are hitting bug MCHECKSTYLE-250 Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eb9fba4f Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eb9fba4f Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eb9fba4f Branch: refs/heads/vmware-disk-controllers Commit: eb9fba4feaded3cb18e64e44f7d601e82653f39b Parents: ec32ea3 Author: Hugo Trippaers htrippa...@schubergphilis.com Authored: Tue Jan 6 14:03:34 2015 +0100 Committer: Hugo Trippaers htrippa...@schubergphilis.com Committed: Tue Jan 6 14:03:34 2015 +0100 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eb9fba4f/pom.xml -- diff --git a/pom.xml b/pom.xml index d3694bc..66fe7f7 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ cs.target.dirtarget/cs.target.dir cs.daemon.version1.0.15/cs.daemon.version cs.jna.version4.0.0/cs.jna.version -cs.checkstyle.version2.13/cs.checkstyle.version +cs.checkstyle.version2.11/cs.checkstyle.version cs.mycila.license.version2.7/cs.mycila.license.version cs.findbugs.version3.0.0/cs.findbugs.version cs.javadoc.version2.10.1/cs.javadoc.version
[12/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-8124: Skipping snapshot tests on hyperv hypervisor Signed-off-by: SrikanteswaraRao Talluri tall...@apache.org Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/214d63ee Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/214d63ee Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/214d63ee Branch: refs/heads/vmware-disk-controllers Commit: 214d63ee1eb393168c2f91a646a775cdaeb5cae8 Parents: 7f10e6f Author: Gaurav Aradhye gaurav.arad...@clogeny.com Authored: Wed Dec 24 16:30:28 2014 +0530 Committer: SrikanteswaraRao Talluri tall...@apache.org Committed: Mon Jan 5 18:04:37 2015 +0530 -- .../component/test_project_limits.py|6 +- .../component/test_ps_domain_limits.py | 480 +-- test/integration/component/test_ps_limits.py|4 +- .../component/test_resource_limits.py | 11 +- test/integration/component/test_snapshots.py| 1504 +- test/integration/component/test_ss_limits.py|4 + test/integration/component/test_tags.py | 2774 +- test/integration/component/test_templates.py|5 +- test/integration/component/test_usage.py| 1469 +- 9 files changed, 3240 insertions(+), 3017 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_project_limits.py -- diff --git a/test/integration/component/test_project_limits.py b/test/integration/component/test_project_limits.py index d4fb92d..adae047 100644 --- a/test/integration/component/test_project_limits.py +++ b/test/integration/component/test_project_limits.py @@ -18,7 +18,7 @@ #Import Local Modules from nose.plugins.attrib import attr -from marvin.cloudstackTestCase import cloudstackTestCase +from marvin.cloudstackTestCase import cloudstackTestCase,unittest #from marvin.cloudstackAPI import * from marvin.lib.utils import (cleanup_resources, validateList) @@ -522,7 +522,7 @@ class TestResourceLimitsProject(cloudstackTestCase): def setUpClass(cls): cls.testClient = super(TestResourceLimitsProject, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() - +cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services = Services().services cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests()) cls.services['mode'] = cls.zone.networktype @@ -758,6 +758,8 @@ class TestResourceLimitsProject(cloudstackTestCase): # 5. Try to create another snapshot in this project. It should give #user an appropriate error and an alert should be generated. +if self.hypervisor.lower() in ['hyperv']: +raise self.skipTest(Snapshots feature is not supported on Hyper-V) self.debug( Updating snapshot resource limits for project: %s % self.project.id) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_ps_domain_limits.py -- diff --git a/test/integration/component/test_ps_domain_limits.py b/test/integration/component/test_ps_domain_limits.py index 268174f..f9aa023 100644 --- a/test/integration/component/test_ps_domain_limits.py +++ b/test/integration/component/test_ps_domain_limits.py @@ -46,25 +46,29 @@ from marvin.codes import (PASS, FAILED, RESOURCE_PRIMARY_STORAGE) + class TestMultipleChildDomain(cloudstackTestCase): @classmethod def setUpClass(cls): cloudstackTestClient = super(TestMultipleChildDomain, - cls).getClsTestClient() + cls).getClsTestClient() cls.api_client = cloudstackTestClient.getApiClient() +cls.hypervisor = cloudstackTestClient.getHypervisorInfo() # Fill services from the external config file cls.services = cloudstackTestClient.getParsedTestDataConfig() # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) -cls.zone = get_zone(cls.api_client, cloudstackTestClient.getZoneForTests()) +cls.zone = get_zone( +cls.api_client, +cloudstackTestClient.getZoneForTests()) cls.services[mode] = cls.zone.networktype cls.template = get_template( -cls.api_client, -cls.zone.id, -cls.services[ostype] -) +cls.api_client, +cls.zone.id, +cls.services[ostype] +
[07/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-8063: list secondary Ips information on non-default nics in VM response Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/93429443 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/93429443 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/93429443 Branch: refs/heads/vmware-disk-controllers Commit: 93429443d50eabd5c6e73a412b8935120e13c42d Parents: 48aa7e1 Author: Wei Zhou w.z...@tech.leaseweb.com Authored: Mon Jan 5 11:22:14 2015 +0100 Committer: Wei Zhou w.z...@tech.leaseweb.com Committed: Mon Jan 5 11:22:14 2015 +0100 -- .../src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java | 12 1 file changed, 12 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93429443/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java -- diff --git a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java index 8ea142a..890b4bc 100644 --- a/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/UserVmJoinDaoImpl.java @@ -358,6 +358,18 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseUserVmJoinVO, Long implem nicResponse.setType(uvo.getGuestType().toString()); } nicResponse.setIsDefault(uvo.isDefaultNic()); +ListNicSecondaryIpVO secondaryIps = ApiDBUtils.findNicSecondaryIps(uvo.getNicId()); +if (secondaryIps != null) { +ListNicSecondaryIpResponse ipList = new ArrayListNicSecondaryIpResponse(); +for (NicSecondaryIpVO ip : secondaryIps) { +NicSecondaryIpResponse ipRes = new NicSecondaryIpResponse(); +ipRes.setId(ip.getUuid()); +ipRes.setIpAddr(ip.getIp4Address()); +ipList.add(ipRes); +} +nicResponse.setSecondaryIps(ipList); +} + nicResponse.setObjectName(nic); userVmData.addNic(nicResponse); }
[19/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CID-1261671 added null check Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/251e88c4 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/251e88c4 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/251e88c4 Branch: refs/heads/vmware-disk-controllers Commit: 251e88c4015093fad723c13b496065d6434871cc Parents: 54e5f28 Author: Daan Hoogland d...@onecht.net Authored: Mon Jan 5 15:55:33 2015 +0100 Committer: Daan Hoogland d...@onecht.net Committed: Mon Jan 5 15:55:33 2015 +0100 -- engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java | 5 + 1 file changed, 5 insertions(+) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/251e88c4/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java -- diff --git a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java index 4c4fe86..223172e 100644 --- a/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java +++ b/engine/schema/src/com/cloud/domain/dao/DomainDaoImpl.java @@ -150,6 +150,11 @@ public class DomainDaoImpl extends GenericDaoBaseDomainVO, Long implements Dom if (id != null id.longValue() == Domain.ROOT_DOMAIN) { s_logger.error(Can not remove domain + id + as it is ROOT domain); return false; +} else { +if(id == null) { +s_logger.error(Can not remove domain without id.); +return false; +} } DomainVO domain = findById(id);
[14/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-8132: Fixed issue related to secondary storage count of template Signed-off-by: SrikanteswaraRao Talluri tall...@apache.org Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f938a5e1 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f938a5e1 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f938a5e1 Branch: refs/heads/vmware-disk-controllers Commit: f938a5e1c352971aa61e75a60935c735c3d3920c Parents: 17da2e9 Author: Ashutosh K ashut...@clogeny.com Authored: Mon Dec 29 03:34:37 2014 -0800 Committer: SrikanteswaraRao Talluri tall...@apache.org Committed: Mon Jan 5 18:30:16 2015 +0530 -- test/integration/component/test_ss_limits.py | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f938a5e1/test/integration/component/test_ss_limits.py -- diff --git a/test/integration/component/test_ss_limits.py b/test/integration/component/test_ss_limits.py index 22ab99c..32201d8 100644 --- a/test/integration/component/test_ss_limits.py +++ b/test/integration/component/test_ss_limits.py @@ -127,7 +127,7 @@ class TestSecondaryStorageLimits(cloudstackTestCase): except Exception as e: return [FAIL, e] return [PASS, None] - + @data(ROOT_DOMAIN_ADMIN, CHILD_DOMAIN_ADMIN) @attr(tags = [advanced], required_hardware=true) def test_01_register_template(self, value): @@ -144,24 +144,28 @@ class TestSecondaryStorageLimits(cloudstackTestCase): response = self.setupAccount(value) self.assertEqual(response[0], PASS, response[1]) +apiclient = self.testClient.getUserApiClient( +UserName=self.account.name, +DomainName=self.account.domain) + builtin_info = get_builtin_template_info(self.apiclient, self.zone.id) self.services[template_2][url] = builtin_info[0] self.services[template_2][hypervisor] = builtin_info[1] self.services[template_2][format] = builtin_info[2] try: -template = Template.register(self.apiclient, +template = Template.register(apiclient, self.services[template_2], zoneid=self.zone.id, account=self.account.name, domainid=self.account.domainid, hypervisor=self.hypervisor) -template.download(self.apiclient) +template.download(apiclient) except Exception as e: self.fail(Failed to register template: %s % e) -templates = Template.list(self.apiclient, +templates = Template.list(apiclient, templatefilter=\ self.services[template_2][templatefilter], id=template.id) @@ -171,19 +175,19 @@ class TestSecondaryStorageLimits(cloudstackTestCase): templateSize = (templates[0].size / (1024**3)) expectedCount = templateSize response = matchResourceCount( -self.apiclient, expectedCount, +apiclient, expectedCount, RESOURCE_SECONDARY_STORAGE, accountid=self.account.id) self.assertEqual(response[0], PASS, response[1]) try: -template.delete(self.apiclient) +template.delete(apiclient) except Exception as e: self.fail(Failed to delete template: %s % e) expectedCount = 0 response = matchResourceCount( -self.apiclient, expectedCount, +apiclient, expectedCount, RESOURCE_SECONDARY_STORAGE, accountid=self.account.id) self.assertEqual(response[0], PASS, response[1])
[09/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_templates.py -- diff --git a/test/integration/component/test_templates.py b/test/integration/component/test_templates.py index 753e71a..06b8c5f 100644 --- a/test/integration/component/test_templates.py +++ b/test/integration/component/test_templates.py @@ -284,7 +284,7 @@ class TestTemplates(cloudstackTestCase): cls.testClient = super(TestTemplates, cls).getClsTestClient() cls.api_client = cls.testClient.getApiClient() - +cls.hypervisor = cls.testClient.getHypervisorInfo() cls.services = Services().services # Get Zone, Domain and templates cls.domain = get_domain(cls.api_client) @@ -495,6 +495,9 @@ class TestTemplates(cloudstackTestCase): # 4. Deploy Virtual machine using this template # 5. VM should be in running state +if self.hypervisor.lower() in ['hyperv']: +self.skipTest(Snapshots feature is not supported on Hyper-V) + userapiclient = self.testClient.getUserApiClient( UserName=self.account.name, DomainName=self.account.domain) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/214d63ee/test/integration/component/test_usage.py -- diff --git a/test/integration/component/test_usage.py b/test/integration/component/test_usage.py index 58cfbed..262a371 100644 --- a/test/integration/component/test_usage.py +++ b/test/integration/component/test_usage.py @@ -16,7 +16,7 @@ # under the License. P1 tests for Snapshots -#Import Local Modules +# Import Local Modules from nose.plugins.attrib import attr from marvin.cloudstackTestCase import cloudstackTestCase, unittest from marvin.cloudstackAPI import deleteVolume @@ -39,84 +39,86 @@ from marvin.lib.common import (get_zone, get_domain, get_template) + class Services: + Test Snapshots Services def __init__(self): self.services = { -account: { -email: t...@test.com, -firstname: Test, -lastname: User, -username: test, -# Random characters are appended for unique -# username -password: password, - }, - service_offering: { -name: Tiny Instance, -displaytext: Tiny Instance, -cpunumber: 1, -cpuspeed: 100, # in MHz -memory: 128, # In MBs -}, -disk_offering: { -displaytext: Small, -name: Small, -disksize: 1 -}, -volume: { - diskname: TestDiskServ, - }, -server: { -displayname: TestVM, -username: root, -password: password, -ssh_port: 22, -hypervisor: 'XenServer', -privateport: 22, -publicport: 22, -protocol: 'TCP', -}, -templates: { -displaytext: 'Template', -name: 'Template', -ostype: 'CentOS 5.3 (64-bit)', -templatefilter: 'self', -url: http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.qcow2.bz2; -}, -iso: { - displaytext: Test ISO, - name: Test ISO, - url: http://people.apache.org/~tsp/dummy.iso;, - # Source URL where ISO is located - isextractable: True, - isfeatured: True, - ispublic: True, - ostype: 'CentOS 5.3 (64-bit)', -}, -lbrule: { -
[05/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-7383: UI Instances menu detail view TakeSnapshot action should be hidden when VM's hypervisor is LXC. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7fe1ed9d Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7fe1ed9d Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7fe1ed9d Branch: refs/heads/vmware-disk-controllers Commit: 7fe1ed9dc81a92312cb273dc464d5f6d4259af05 Parents: b64fa34 Author: Jessica Wang jessicaw...@apache.org Authored: Fri Jan 2 14:06:28 2015 -0800 Committer: Jessica Wang jessicaw...@apache.org Committed: Fri Jan 2 14:12:15 2015 -0800 -- ui/scripts/instances.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7fe1ed9d/ui/scripts/instances.js -- diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index d439c66..9ed0e16 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -2435,7 +2435,7 @@ allowedActions.push(restart); if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true) - || (jsonObj.hypervisor != 'LXC')) { +(jsonObj.hypervisor != 'LXC')) { allowedActions.push(snapshot); } @@ -2469,7 +2469,7 @@ allowedActions.push(reinstall); if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true) - || (jsonObj.hypervisor != 'LXC')) { +(jsonObj.hypervisor != 'LXC')) { allowedActions.push(snapshot); }
[23/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
Housekeeping, properly declare required maven version and update build plugin versions to recent versions Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ec32ea30 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ec32ea30 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ec32ea30 Branch: refs/heads/vmware-disk-controllers Commit: ec32ea30f7b3e5351e661786955d9fa0929047bd Parents: 84c44b6 Author: Hugo Trippaers htrippa...@schubergphilis.com Authored: Tue Jan 6 11:58:58 2015 +0100 Committer: Hugo Trippaers htrippa...@schubergphilis.com Committed: Tue Jan 6 11:58:58 2015 +0100 -- plugins/hypervisors/hyperv/pom.xml | 3 -- plugins/user-authenticators/ldap/pom.xml | 2 +- pom.xml | 40 ++- tools/checkstyle/pom.xml | 8 +- 4 files changed, 35 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec32ea30/plugins/hypervisors/hyperv/pom.xml -- diff --git a/plugins/hypervisors/hyperv/pom.xml b/plugins/hypervisors/hyperv/pom.xml index 9e658f6..e09fb43 100644 --- a/plugins/hypervisors/hyperv/pom.xml +++ b/plugins/hypervisors/hyperv/pom.xml @@ -70,7 +70,6 @@ plugin groupIdorg.codehaus.mojo/groupId artifactIdexec-maven-plugin/artifactId -version1.2.1/version configuration executablejava/executable mainClasscom.cloud.agent.AgentShell/mainClass @@ -124,7 +123,6 @@ plugin groupIdorg.codehaus.mojo/groupId artifactIdexec-maven-plugin/artifactId -version1.2.1/version executions execution phasecompile/phase @@ -144,7 +142,6 @@ plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-surefire-plugin/artifactId -version2.12/version configuration excludes excludenone/exclude http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec32ea30/plugins/user-authenticators/ldap/pom.xml -- diff --git a/plugins/user-authenticators/ldap/pom.xml b/plugins/user-authenticators/ldap/pom.xml index 22cdeb7..d24a5be 100644 --- a/plugins/user-authenticators/ldap/pom.xml +++ b/plugins/user-authenticators/ldap/pom.xml @@ -24,7 +24,7 @@ plugin groupIdorg.codehaus.gmaven/groupId artifactIdgmaven-plugin/artifactId -version1.3/version +version1.5/version configuration providerSelection1.7/providerSelection /configuration http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec32ea30/pom.xml -- diff --git a/pom.xml b/pom.xml index e63769e..d3694bc 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,10 @@ systemjira/system urlhttps://issues.apache.org/jira/browse/CLOUDSTACK/url /issueManagement + + prerequisites +maven3.0.4/maven + /prerequisites properties cs.jdk.version1.7/cs.jdk.version @@ -92,10 +96,10 @@ cs.target.dirtarget/cs.target.dir cs.daemon.version1.0.15/cs.daemon.version cs.jna.version4.0.0/cs.jna.version -cs.checkstyle.version2.11/cs.checkstyle.version -cs.mycila.license.version2.5/cs.mycila.license.version -cs.findbugs.version2.5.3/cs.findbugs.version -cs.javadoc.version2.9.1/cs.javadoc.version +cs.checkstyle.version2.13/cs.checkstyle.version +cs.mycila.license.version2.7/cs.mycila.license.version +cs.findbugs.version3.0.0/cs.findbugs.version +cs.javadoc.version2.10.1/cs.javadoc.version cs.opensaml.version2.6.1/cs.opensaml.version /properties @@ -612,7 +616,7 @@ plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-release-plugin/artifactId - version2.2.1/version + version2.5.1/version executions execution iddefault/id @@ -695,12 +699,12 @@ plugin groupIdorg.apache.tomcat.maven/groupId artifactIdtomcat7-maven-plugin/artifactId - version2.0/version + version2.2/version /plugin plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-antrun-plugin/artifactId - version1.7/version + version1.8/version /plugin plugin groupIdorg.apache.rat/groupId @@ -837,7 +841,7 @@ plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId - version2.5.1/version + version3.2/version configuration
[16/25] git commit: updated refs/heads/vmware-disk-controllers to e8a54f4
CLOUDSTACK-8137: Fixed cleanup issue in sec group tests in test_escalations_instances.py Signed-off-by: SrikanteswaraRao Talluri tall...@apache.org Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/eae9f0f0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/eae9f0f0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/eae9f0f0 Branch: refs/heads/vmware-disk-controllers Commit: eae9f0f0b0904a9dad025d4278b5e9b4fdf02b5e Parents: 1ee4188 Author: k...@clogeny.com k...@clogeny.com Authored: Tue Dec 30 15:04:38 2014 +0530 Committer: SrikanteswaraRao Talluri tall...@apache.org Committed: Mon Jan 5 18:32:30 2015 +0530 -- test/integration/component/test_escalations_instances.py | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/eae9f0f0/test/integration/component/test_escalations_instances.py -- diff --git a/test/integration/component/test_escalations_instances.py b/test/integration/component/test_escalations_instances.py index b089ed5..15eb6f1 100644 --- a/test/integration/component/test_escalations_instances.py +++ b/test/integration/component/test_escalations_instances.py @@ -3652,7 +3652,6 @@ class TestInstances(cloudstackTestCase): security_group, Security Group creation failed ) -self.cleanup.append(security_group) security_groups_list_size = security_groups_list_size + 1 # Listing the networks again