diff --git a/api/src/com/cloud/api/commands/ListS3sCmd.java b/api/src/com/cloud/api/commands/ListS3sCmd.java index 507053dd89f..d536cfcf80a 100644 --- a/api/src/com/cloud/api/commands/ListS3sCmd.java +++ b/api/src/com/cloud/api/commands/ListS3sCmd.java @@ -18,15 +18,11 @@ */ package com.cloud.api.commands; -import static com.cloud.api.ApiConstants.ID; -import static com.cloud.api.BaseCmd.CommandType.LONG; - import java.util.ArrayList; import java.util.List; import com.cloud.api.BaseListCmd; import com.cloud.api.Implementation; -import com.cloud.api.Parameter; import com.cloud.api.ServerApiException; import com.cloud.api.response.ListResponse; import com.cloud.api.response.S3Response; @@ -42,9 +38,6 @@ public final class ListS3sCmd extends BaseListCmd { private static final String COMMAND_NAME = "lists3sresponse"; - @Parameter(name = ID, type = LONG, required = true, description = "The ID of the S3") - private Long id; - @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, @@ -74,39 +67,9 @@ public final class ListS3sCmd extends BaseListCmd { } - @Override - public boolean equals(final Object thatObject) { - - if (this == thatObject) { - return true; - } - - if (thatObject == null || getClass() != thatObject.getClass()) { - return false; - } - - final ListS3sCmd thatListS3sCmd = (ListS3sCmd) thatObject; - - if (this.id != null ? !this.id.equals(thatListS3sCmd.id) : thatListS3sCmd.id != null) { - return false; - } - - return true; - - } - - @Override - public int hashCode() { - return this.id != null ? this.id.hashCode() : 0; - } - @Override public String getCommandName() { return COMMAND_NAME; } - public Long getId() { - return this.id; - } - } diff --git a/awsapi/pom.xml b/awsapi/pom.xml index 2e426550afa..06c9d7e058a 100644 --- a/awsapi/pom.xml +++ b/awsapi/pom.xml @@ -47,6 +47,12 @@ axis2-webapp war ${cs.axis2.version} + + + xerces + xercesImpl + + org.apache.ws.commons.axiom @@ -123,6 +129,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + @@ -139,6 +149,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + @@ -151,6 +165,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + @@ -163,6 +181,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + @@ -175,6 +197,10 @@ org.apache.xalan xalan + + org.opensaml + opensaml + diff --git a/build/package.xml b/build/package.xml index 09ed939c6d7..3efdd7dda05 100755 --- a/build/package.xml +++ b/build/package.xml @@ -217,6 +217,10 @@ + + + + diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index e55017ce5ea..27e0c2fc3cf 100755 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -260,7 +260,7 @@ migrateVolume=com.cloud.api.commands.MigrateVolumeCmd;15 #### use that key...the key is stored in the db associated w/ #### the userId...every request to the developer API should be #### checked against the key -registerUserKeys=com.cloud.api.commands.RegisterCmd;1 +registerUserKeys=com.cloud.api.commands.RegisterCmd;15 ### async-query command queryAsyncJobResult=com.cloud.api.commands.QueryAsyncJobResultCmd;15 diff --git a/docs/en-US/changing-secondary-storage-servers.xml b/docs/en-US/changing-secondary-storage-servers.xml index 62ad65015a3..a628eec9b39 100644 --- a/docs/en-US/changing-secondary-storage-servers.xml +++ b/docs/en-US/changing-secondary-storage-servers.xml @@ -22,7 +22,7 @@ under the License. --> -
+
Changing Secondary Storage Servers You can change the secondary storage NFS mount. Perform the following steps to do so: diff --git a/docs/en-US/changing-secondary-storage-serversp.xml b/docs/en-US/changing-secondary-storage-serversp.xml deleted file mode 100644 index 62ad65015a3..00000000000 --- a/docs/en-US/changing-secondary-storage-serversp.xml +++ /dev/null @@ -1,36 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - - -
- Changing Secondary Storage Servers - You can change the secondary storage NFS mount. Perform the following steps to do so: - - Stop all running Management Servers. - Wait 30 minutes. This allows any writes to secondary storage to complete. - Copy all files from the old secondary storage mount to the new. - Use the procedure above to change the IP address for secondary storage if required. - Start the Management Server. - -
- diff --git a/docs/en-US/configure-xenserver-dom-memory.xml b/docs/en-US/configure-xenserver-dom-memory.xml deleted file mode 100644 index 0a02d3e3818..00000000000 --- a/docs/en-US/configure-xenserver-dom-memory.xml +++ /dev/null @@ -1,29 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - - -
- Configure XenServer dom0 Memory - Configure the XenServer dom0 settings to allocate more memory to dom0. This can enable XenServer to handle larger numbers of virtual machines. We recommend 2940 MB of RAM for XenServer dom0. For instructions on how to do this, see Citrix Knowledgebase Article.The article refers to XenServer 5.6, but the same information applies to XenServer 6 -
- diff --git a/plugins/hypervisors/vmware/pom.xml b/plugins/hypervisors/vmware/pom.xml index 0aa6340c866..d990e89b388 100644 --- a/plugins/hypervisors/vmware/pom.xml +++ b/plugins/hypervisors/vmware/pom.xml @@ -36,19 +36,19 @@ com.cloud.com.vmware vmware-vim25 ${cs.vmware.api.version} - provided + compile com.cloud.com.vmware vmware-vim ${cs.vmware.api.version} - provided + compile com.cloud.com.vmware vmware-apputils ${cs.vmware.api.version} - provided + compile org.apache.axis diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java index b1e9af2fd52..0a7d042a96d 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java @@ -173,7 +173,7 @@ public class NiciraNvpElement extends AdapterBase implements return Provider.NiciraNvp; } - private boolean canHandle(Network network, Service service) { + protected boolean canHandle(Network network, Service service) { s_logger.debug("Checking if NiciraNvpElement can handle service " + service.getName() + " on network " + network.getDisplayText()); if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) { @@ -845,6 +845,7 @@ public class NiciraNvpElement extends AdapterBase implements ConfigurePublicIpsOnLogicalRouterCommand cmd = new ConfigurePublicIpsOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), niciraNvpHost.getDetail("l3gatewayserviceuuid"), cidrs); ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); + //FIXME answer can be null if the host is down return answer.getResult(); } else { diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java index 1046a5a96b7..99be680a5c6 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java @@ -29,6 +29,7 @@ import com.cloud.agent.api.CreateLogicalSwitchAnswer; import com.cloud.agent.api.CreateLogicalSwitchCommand; import com.cloud.agent.api.DeleteLogicalSwitchAnswer; import com.cloud.agent.api.DeleteLogicalSwitchCommand; +import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.dao.DataCenterDao; import com.cloud.deploy.DeployDestination; @@ -119,8 +120,9 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { Network userSpecified, Account owner) { // Check of the isolation type of the related physical network is STT PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId()); - if (physnet == null || physnet.getIsolationMethods() == null || !physnet.getIsolationMethods().contains("STT")) { - s_logger.debug("Refusing to design this network, the physical isolation type is not STT"); + DataCenter dc = _dcDao.findById(plan.getDataCenterId()); + if (!canHandle(offering,dc.getNetworkType(),physnet)) { + s_logger.debug("Refusing to design this network"); return null; } @@ -199,6 +201,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { s_logger.info("Implemented OK, network linked to = " + implemented.getBroadcastUri().toString()); } catch (URISyntaxException e) { s_logger.error("Unable to store logical switch id in broadcast uri, uuid = " + implemented.getUuid(), e); + return null; } return implemented; diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java index 3e8e0285bfe..039c174be2d 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java @@ -84,7 +84,7 @@ public class NiciraNvpApi { protected HttpMethod createMethod(String type, String uri) throws NiciraNvpApiException { String url; try { - url = new URL(_protocol, _host, "/ws.v1/login").toString(); + url = new URL(_protocol, _host, uri).toString(); } catch (MalformedURLException e) { s_logger.error("Unable to build Nicira API URL", e); throw new NiciraNvpApiException("Unable to build Nicira API URL", e); diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java new file mode 100644 index 00000000000..acfd3bcdb9e --- /dev/null +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.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.element; + +import java.util.Collections; + +import javax.naming.ConfigurationException; + +import org.junit.Before; +import org.junit.Test; + +import com.cloud.deploy.DeployDestination; +import com.cloud.domain.Domain; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.Network; +import com.cloud.network.Network.GuestType; +import com.cloud.network.Network.Provider; +import com.cloud.network.Network.Service; +import com.cloud.network.NetworkManager; +import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.Networks.TrafficType; +import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.offering.NetworkOffering; +import com.cloud.resource.ResourceManager; +import com.cloud.user.Account; +import com.cloud.vm.ReservationContext; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +public class NiciraNvpElementTest { + + NiciraNvpElement _element = new NiciraNvpElement(); + NetworkManager _networkManager = mock(NetworkManager.class); + NetworkServiceMapDao _ntwkSrvcDao = mock (NetworkServiceMapDao.class); + + @Before + public void setUp() throws ConfigurationException { + _element._resourceMgr = mock(ResourceManager.class); + _element._networkManager = _networkManager; + _element._ntwkSrvcDao = _ntwkSrvcDao; + + // Standard responses + when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true); + + _element.configure("NiciraNvpTestElement", Collections. emptyMap()); + } + + @Test + public void canHandleTest() { + Network net = mock(Network.class); + when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); + when(net.getId()).thenReturn(42L); + + when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true); + // Golden path + assertTrue(_element.canHandle(net, Service.Connectivity)); + + when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Vlan); + // Only broadcastdomaintype lswitch is supported + assertFalse(_element.canHandle(net, Service.Connectivity)); + + when(net.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); + when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(false); + // No nvp provider in the network + assertFalse(_element.canHandle(net, Service.Connectivity)); + + when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(false); + when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true); + // NVP provider does not provide Connectivity for this network + assertFalse(_element.canHandle(net, Service.Connectivity)); + + when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true); + // Only service Connectivity is supported + assertFalse(_element.canHandle(net, Service.Dhcp)); + + } + + @Test + public void implementTest() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + Network network = mock(Network.class); + when(network.getBroadcastDomainType()).thenReturn(BroadcastDomainType.Lswitch); + when(network.getId()).thenReturn(42L); + + NetworkOffering offering = mock(NetworkOffering.class); + when(offering.getId()).thenReturn(42L); + when(offering.getTrafficType()).thenReturn(TrafficType.Guest); + when(offering.getGuestType()).thenReturn(GuestType.Isolated); + + DeployDestination dest = mock(DeployDestination.class); + + Domain dom = mock(Domain.class); + when(dom.getName()).thenReturn("domain"); + Account acc = mock(Account.class); + when(acc.getAccountName()).thenReturn("accountname"); + ReservationContext context = mock(ReservationContext.class); + when(context.getDomain()).thenReturn(dom); + when(context.getAccount()).thenReturn(acc); + + //assertTrue(_element.implement(network, offering, dest, context)); + } + +} 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 index f8d9652da60..e37b2f42105 100644 --- 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 @@ -272,12 +272,126 @@ public class NiciraNvpGuestNetworkGuruTest { CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); when(answer.getResult()).thenReturn(true); + when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer); Network implementednetwork = guru.implement(network, offering, dest, res); assertTrue(implementednetwork != null); verify(agentmgr, times(1)).easySend(eq(42L), (Command)any()); } + + @Test + public void testImplementWithCidr() throws InsufficientVirtualNetworkCapcityException { + PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + when(physnetdao.findById((Long) any())).thenReturn(physnet); + when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" })); + when(physnet.getId()).thenReturn(42L); + + NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device })); + when(device.getId()).thenReturn(1L); + + NetworkOffering offering = mock(NetworkOffering.class); + when(offering.getId()).thenReturn(42L); + when(offering.getTrafficType()).thenReturn(TrafficType.Guest); + when(offering.getGuestType()).thenReturn(GuestType.Isolated); + + when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false); + + DeploymentPlan plan = mock(DeploymentPlan.class); + + NetworkVO network = mock(NetworkVO.class); + when(network.getName()).thenReturn("testnetwork"); + when(network.getState()).thenReturn(State.Implementing); + when(network.getGateway()).thenReturn("10.1.1.1"); + when(network.getCidr()).thenReturn("10.1.1.0/24"); + + + DeployDestination dest = mock(DeployDestination.class); + + DataCenter dc = mock(DataCenter.class); + when(dest.getDataCenter()).thenReturn(dc); + + HostVO niciraHost = mock(HostVO.class); + when(hostdao.findById(anyLong())).thenReturn(niciraHost); + when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa"); + when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); + when(niciraHost.getId()).thenReturn(42L); + + when(netmgr.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); + Domain dom = mock(Domain.class); + when(dom.getName()).thenReturn("domain"); + Account acc = mock(Account.class); + when(acc.getAccountName()).thenReturn("accountname"); + ReservationContext res = mock(ReservationContext.class); + when(res.getDomain()).thenReturn(dom); + when(res.getAccount()).thenReturn(acc); + + CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); + when(answer.getResult()).thenReturn(true); + when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); + when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer); + + Network implementednetwork = guru.implement(network, offering, dest, res); + assertTrue(implementednetwork != null); + assertTrue(implementednetwork.getCidr().equals("10.1.1.0/24")); + assertTrue(implementednetwork.getGateway().equals("10.1.1.1")); + verify(agentmgr, times(1)).easySend(eq(42L), (Command)any()); + } + + @Test + public void testImplementURIException() throws InsufficientVirtualNetworkCapcityException { + PhysicalNetworkVO physnet = mock(PhysicalNetworkVO.class); + when(physnetdao.findById((Long) any())).thenReturn(physnet); + when(physnet.getIsolationMethods()).thenReturn(Arrays.asList(new String[] { "STT" })); + when(physnet.getId()).thenReturn(42L); + + NiciraNvpDeviceVO device = mock(NiciraNvpDeviceVO.class); + when(nvpdao.listByPhysicalNetwork(42L)).thenReturn(Arrays.asList(new NiciraNvpDeviceVO[] { device })); + when(device.getId()).thenReturn(1L); + + NetworkOffering offering = mock(NetworkOffering.class); + when(offering.getId()).thenReturn(42L); + when(offering.getTrafficType()).thenReturn(TrafficType.Guest); + when(offering.getGuestType()).thenReturn(GuestType.Isolated); + + when(nosd.areServicesSupportedByNetworkOffering(42L, Service.Connectivity)).thenReturn(false); + + DeploymentPlan plan = mock(DeploymentPlan.class); + + NetworkVO network = mock(NetworkVO.class); + when(network.getName()).thenReturn("testnetwork"); + when(network.getState()).thenReturn(State.Implementing); + + DeployDestination dest = mock(DeployDestination.class); + + DataCenter dc = mock(DataCenter.class); + when(dest.getDataCenter()).thenReturn(dc); + + HostVO niciraHost = mock(HostVO.class); + when(hostdao.findById(anyLong())).thenReturn(niciraHost); + when(niciraHost.getDetail("transportzoneuuid")).thenReturn("aaaa"); + when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); + when(niciraHost.getId()).thenReturn(42L); + + when(netmgr.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); + Domain dom = mock(Domain.class); + when(dom.getName()).thenReturn("domain"); + Account acc = mock(Account.class); + when(acc.getAccountName()).thenReturn("accountname"); + ReservationContext res = mock(ReservationContext.class); + when(res.getDomain()).thenReturn(dom); + when(res.getAccount()).thenReturn(acc); + + CreateLogicalSwitchAnswer answer = mock(CreateLogicalSwitchAnswer.class); + when(answer.getResult()).thenReturn(true); + //when(answer.getLogicalSwitchUuid()).thenReturn("aaaaa"); + when(agentmgr.easySend(eq(42L), (Command)any())).thenReturn(answer); + + Network implementednetwork = guru.implement(network, offering, dest, res); + assertTrue(implementednetwork == null); + verify(agentmgr, times(1)).easySend(eq(42L), (Command)any()); + } @Test public void testShutdown() throws InsufficientVirtualNetworkCapcityException, URISyntaxException { diff --git a/scripts/vm/network/vnet/modifyvlan.sh b/scripts/vm/network/vnet/modifyvlan.sh index 5577825ea54..8ed3905a579 100755 --- a/scripts/vm/network/vnet/modifyvlan.sh +++ b/scripts/vm/network/vnet/modifyvlan.sh @@ -67,6 +67,8 @@ addVlan() { return 2 fi fi + + brctl setfd $vlanBr 0 fi #pif is eslaved into vlanBr? diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 2d7dfe290a6..c7a5d64ac7e 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -16,35 +16,110 @@ // under the License. package com.cloud.configuration; +import java.net.URI; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.directory.InitialDirContext; + +import org.apache.log4j.Logger; + import com.cloud.acl.SecurityChecker; import com.cloud.alert.AlertManager; import com.cloud.api.ApiConstants.LDAPParams; import com.cloud.api.ApiDBUtils; -import com.cloud.api.commands.*; +import com.cloud.api.commands.CreateDiskOfferingCmd; +import com.cloud.api.commands.CreateNetworkOfferingCmd; +import com.cloud.api.commands.CreateServiceOfferingCmd; +import com.cloud.api.commands.CreateVlanIpRangeCmd; +import com.cloud.api.commands.CreateZoneCmd; +import com.cloud.api.commands.DeleteDiskOfferingCmd; +import com.cloud.api.commands.DeleteNetworkOfferingCmd; +import com.cloud.api.commands.DeletePodCmd; +import com.cloud.api.commands.DeleteServiceOfferingCmd; +import com.cloud.api.commands.DeleteVlanIpRangeCmd; +import com.cloud.api.commands.DeleteZoneCmd; +import com.cloud.api.commands.LDAPConfigCmd; +import com.cloud.api.commands.LDAPRemoveCmd; +import com.cloud.api.commands.ListNetworkOfferingsCmd; +import com.cloud.api.commands.UpdateCfgCmd; +import com.cloud.api.commands.UpdateDiskOfferingCmd; +import com.cloud.api.commands.UpdateNetworkOfferingCmd; +import com.cloud.api.commands.UpdatePodCmd; +import com.cloud.api.commands.UpdateServiceOfferingCmd; +import com.cloud.api.commands.UpdateZoneCmd; import com.cloud.capacity.dao.CapacityDao; import com.cloud.configuration.Resource.ResourceType; import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.dc.*; +import com.cloud.dc.AccountVlanMapVO; +import com.cloud.dc.ClusterVO; +import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.dc.DataCenterIpAddressVO; +import com.cloud.dc.DataCenterLinkLocalIpAddressVO; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.HostPodVO; +import com.cloud.dc.Pod; +import com.cloud.dc.PodVlanMapVO; +import com.cloud.dc.Vlan; import com.cloud.dc.Vlan.VlanType; -import com.cloud.dc.dao.*; +import com.cloud.dc.VlanVO; +import com.cloud.dc.dao.AccountVlanMapDao; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.DataCenterIpAddressDao; +import com.cloud.dc.dao.DataCenterLinkLocalIpAddressDaoImpl; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.dc.dao.PodVlanMapDao; +import com.cloud.dc.dao.VlanDao; import com.cloud.deploy.DataCenterDeployment; import com.cloud.domain.Domain; import com.cloud.domain.DomainVO; import com.cloud.domain.dao.DomainDao; import com.cloud.event.ActionEvent; import com.cloud.event.EventTypes; -import com.cloud.exception.*; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.PermissionDeniedException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.HostVO; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.network.*; +import com.cloud.network.IPAddressVO; +import com.cloud.network.Network; import com.cloud.network.Network.Capability; import com.cloud.network.Network.GuestType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; +import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkVO; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.TrafficType; -import com.cloud.network.dao.*; +import com.cloud.network.PhysicalNetwork; +import com.cloud.network.PhysicalNetworkVO; +import com.cloud.network.dao.FirewallRulesDao; +import com.cloud.network.dao.IPAddressDao; +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao; +import com.cloud.network.dao.PhysicalNetworkTrafficTypeVO; import com.cloud.network.vpc.VpcManager; import com.cloud.offering.DiskOffering; import com.cloud.offering.NetworkOffering; @@ -69,7 +144,12 @@ import com.cloud.storage.s3.S3Manager; import com.cloud.storage.secondary.SecondaryStorageVmManager; import com.cloud.storage.swift.SwiftManager; import com.cloud.test.IPRangeConfig; -import com.cloud.user.*; +import com.cloud.user.Account; +import com.cloud.user.AccountManager; +import com.cloud.user.AccountVO; +import com.cloud.user.ResourceLimitService; +import com.cloud.user.User; +import com.cloud.user.UserContext; import com.cloud.user.dao.AccountDao; import com.cloud.utils.NumbersUtil; import com.cloud.utils.StringUtils; @@ -85,20 +165,8 @@ import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.vm.VirtualMachine; import com.cloud.vm.dao.NicDao; -import edu.emory.mathcs.backport.java.util.Arrays; -import org.apache.log4j.Logger; -import javax.ejb.Local; -import javax.naming.ConfigurationException; -import javax.naming.Context; -import javax.naming.NamingException; -import javax.naming.directory.DirContext; -import javax.naming.directory.InitialDirContext; -import java.net.URI; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.*; +import edu.emory.mathcs.backport.java.util.Arrays; @Local(value = { ConfigurationManager.class, ConfigurationService.class }) public class ConfigurationManagerImpl implements ConfigurationManager, ConfigurationService { diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java index 2a8a092b835..91b95f953cc 100755 --- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java +++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java @@ -153,25 +153,7 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur } protected abstract boolean canHandle(NetworkOffering offering, final NetworkType networkType, PhysicalNetwork physicalNetwork); -/* protected boolean canHandle(NetworkOffering offering, final NetworkType networkType, final List isolationMethods) { - // This guru handles only Guest Isolated network that supports Source nat service -<<<<<<< HEAD - if (dc.getNetworkType() == NetworkType.Advanced && isMyTrafficType(offering.getTrafficType()) - && offering.getGuestType() == Network.GuestType.Isolated && !offering.isSystemOnly()) { -======= - if (networkType == NetworkType.Advanced - && isMyTrafficType(offering.getTrafficType()) - && offering.getGuestType() == Network.GuestType.Isolated - && isMyIsolationMethod(isolationMethods)) { ->>>>>>> master - return true; - } else { - s_logger.trace("We only take care of non-system Guest networks of type " + GuestType.Isolated + " in zone of type " - + NetworkType.Advanced); - return false; - } - } -*/ + @Override public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) { DataCenter dc = _dcDao.findById(plan.getDataCenterId()); diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java index 117be5797b0..500c067fbb7 100755 --- a/server/src/com/cloud/server/ManagementServerImpl.java +++ b/server/src/com/cloud/server/ManagementServerImpl.java @@ -203,6 +203,7 @@ import com.cloud.storage.dao.StoragePoolDao; import com.cloud.storage.dao.UploadDao; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.s3.S3Manager; import com.cloud.storage.secondary.SecondaryStorageVmManager; import com.cloud.storage.snapshot.SnapshotManager; import com.cloud.storage.swift.SwiftManager; @@ -292,6 +293,7 @@ public class ManagementServerImpl implements ManagementServer { private final ConsoleProxyManager _consoleProxyMgr; private final SecondaryStorageVmManager _secStorageVmMgr; private final SwiftManager _swiftMgr; + private final S3Manager _s3Mgr; private final ServiceOfferingDao _offeringsDao; private final DiskOfferingDao _diskOfferingDao; private final VMTemplateDao _templateDao; @@ -370,6 +372,7 @@ public class ManagementServerImpl implements ManagementServer { _consoleProxyMgr = locator.getManager(ConsoleProxyManager.class); _secStorageVmMgr = locator.getManager(SecondaryStorageVmManager.class); _swiftMgr = locator.getManager(SwiftManager.class); + _s3Mgr = locator.getManager(S3Manager.class); _storageMgr = locator.getManager(StorageManager.class); _publicIpAddressDao = locator.getDao(IPAddressDao.class); _consoleProxyDao = locator.getDao(ConsoleProxyDao.class); @@ -1399,6 +1402,29 @@ public class ManagementServerImpl implements ManagementServer { } templateZonePairSet.add(new Pair(template.getId(), zoneId)); } + } else if (_s3Mgr.isS3Enabled()) { + if (template == null) { + templateZonePairSet = _templateDao.searchSwiftTemplates(name, keyword, templateFilter, isIso, + hypers, bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr, + permittedAccounts, caller, tags); + Set> templateZonePairSet2 = new HashSet>(); + templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, + bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr, + permittedAccounts, caller, listProjectResourcesCriteria, tags); + + for (Pair tmpltPair : templateZonePairSet2) { + if (!templateZonePairSet.contains(new Pair(tmpltPair.first(), -1L))) { + templateZonePairSet.add(tmpltPair); + } + } + } else { + // if template is not public, perform permission check here + if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + Account owner = _accountMgr.getAccount(template.getAccountId()); + _accountMgr.checkAccess(caller, null, true, owner); + } + templateZonePairSet.add(new Pair(template.getId(), zoneId)); + } } else { if (template == null) { templateZonePairSet = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, diff --git a/server/src/com/cloud/storage/dao/VMTemplateDao.java b/server/src/com/cloud/storage/dao/VMTemplateDao.java index 1284ba103cf..a043a2c6079 100755 --- a/server/src/com/cloud/storage/dao/VMTemplateDao.java +++ b/server/src/com/cloud/storage/dao/VMTemplateDao.java @@ -58,6 +58,10 @@ public interface VMTemplateDao extends GenericDao { boolean isIso, List hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex, Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List permittedAccounts, Account caller, Map tags); + public Set> searchS3Templates(String name, String keyword, TemplateFilter templateFilter, + boolean isIso, List hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex, + Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List permittedAccounts, Account caller, Map tags); + public long addTemplateToZone(VMTemplateVO tmplt, long zoneId); public List listAllInZone(long dataCenterId); diff --git a/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java index 5c71f1bdb0c..7ef9c9fc9d9 100755 --- a/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java +++ b/server/src/com/cloud/storage/dao/VMTemplateDaoImpl.java @@ -16,6 +16,9 @@ // under the License. package com.cloud.storage.dao; +import static com.cloud.utils.StringUtils.*; +import static com.cloud.utils.db.DbUtil.*; + import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -93,6 +96,9 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem private final String SELECT_TEMPLATE_SWIFT_REF = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " + "t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t"; + private final String SELECT_TEMPLATE_S3_REF = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, " + + "t.checksum, t.display_text, t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type FROM vm_template t"; + private static final String SELECT_S3_CANDIDATE_TEMPLATES = "SELECT t.id, t.unique_name, t.name, t.public, t.featured, " + "t.type, t.hvm, t.bits, t.url, t.format, t.created, t.account_id, t.checksum, t.display_text, " + "t.enable_password, t.guest_os_id, t.bootable, t.prepopulate, t.cross_zones, t.hypervisor_type " + @@ -931,4 +937,138 @@ public class VMTemplateDaoImpl extends GenericDaoBase implem return executeList(SELECT_S3_CANDIDATE_TEMPLATES, new Object[] {}); } + @Override + public Set> searchS3Templates(final String name, + final String keyword, final TemplateFilter templateFilter, + final boolean isIso, final List hypers, + final Boolean bootable, final DomainVO domain, final Long pageSize, + final Long startIndex, final Long zoneId, + final HypervisorType hyperType, final boolean onlyReady, + final boolean showDomr, final List permittedAccounts, + final Account caller, final Map tags) { + + final String permittedAccountsStr = join(",", permittedAccounts); + + final Transaction txn = Transaction.currentTxn(); + txn.start(); + + Set> templateZonePairList = new HashSet>(); + PreparedStatement pstmt = null; + ResultSet rs = null; + try { + + final StringBuilder joinClause = new StringBuilder(); + final StringBuilder whereClause = new StringBuilder(" WHERE t.removed IS NULL"); + + if (isIso) { + whereClause.append(" AND t.format = 'ISO'"); + if (!hyperType.equals(HypervisorType.None)) { + joinClause.append(" INNER JOIN guest_os guestOS on (guestOS.id = t.guest_os_id) INNER JOIN guest_os_hypervisor goh on ( goh.guest_os_id = guestOS.id) "); + whereClause.append(" AND goh.hypervisor_type = '"); + whereClause.append(hyperType); + whereClause.append("'"); + } + } else { + whereClause.append(" AND t.format <> 'ISO'"); + if (hypers.isEmpty()) { + return templateZonePairList; + } else { + final StringBuilder relatedHypers = new StringBuilder(); + for (HypervisorType hyper : hypers) { + relatedHypers.append("'"); + relatedHypers.append(hyper.toString()); + relatedHypers.append("'"); + relatedHypers.append(","); + } + relatedHypers.setLength(relatedHypers.length() - 1); + whereClause.append(" AND t.hypervisor_type IN ("); + whereClause.append(relatedHypers); + whereClause.append(")"); + } + } + + joinClause.append(" INNER JOIN template_s3_ref tsr on (t.id = tsr.template_id)"); + + whereClause.append("AND t.name LIKE \"%"); + whereClause.append(keyword == null ? keyword : name); + whereClause.append("%\""); + + if (bootable != null) { + whereClause.append(" AND t.bootable = "); + whereClause.append(bootable); + } + + if (!showDomr) { + whereClause.append(" AND t.type != '"); + whereClause.append(Storage.TemplateType.SYSTEM); + whereClause.append("'"); + } + + if (templateFilter == TemplateFilter.featured) { + whereClause.append(" AND t.public = 1 AND t.featured = 1"); + } else if ((templateFilter == TemplateFilter.self || templateFilter == TemplateFilter.selfexecutable) + && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + if (caller.getType() == Account.ACCOUNT_TYPE_DOMAIN_ADMIN + || caller.getType() == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) { + joinClause.append(" INNER JOIN account a on (t.account_id = a.id) INNER JOIN domain d on (a.domain_id = d.id)"); + whereClause.append(" AND d.path LIKE '"); + whereClause.append(domain.getPath()); + whereClause.append("%'"); + } else { + whereClause.append(" AND t.account_id IN ("); + whereClause.append(permittedAccountsStr); + whereClause.append(")"); + } + } else if (templateFilter == TemplateFilter.sharedexecutable + && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + if (caller.getType() == Account.ACCOUNT_TYPE_NORMAL) { + joinClause.append(" LEFT JOIN launch_permission lp ON t.id = lp.template_id WHERE (t.account_id IN ("); + joinClause.append(permittedAccountsStr); + joinClause.append(") OR lp.account_id IN ("); + joinClause.append(permittedAccountsStr); + joinClause.append("))"); + } else { + joinClause.append(" INNER JOIN account a on (t.account_id = a.id) "); + } + } else if (templateFilter == TemplateFilter.executable + && !permittedAccounts.isEmpty()) { + whereClause.append(" AND (t.public = 1 OR t.account_id IN ("); + whereClause.append(permittedAccountsStr); + whereClause.append("))"); + } else if (templateFilter == TemplateFilter.community) { + whereClause.append(" AND t.public = 1 AND t.featured = 0"); + } else if (templateFilter == TemplateFilter.all + && caller.getType() == Account.ACCOUNT_TYPE_ADMIN) { + } else if (caller.getType() != Account.ACCOUNT_TYPE_ADMIN) { + return templateZonePairList; + } + + final StringBuilder sql = new StringBuilder(SELECT_TEMPLATE_S3_REF); + sql.append(joinClause); + sql.append(whereClause); + sql.append(getOrderByLimit(pageSize, startIndex)); + + pstmt = txn.prepareStatement(sql.toString()); + rs = pstmt.executeQuery(); + while (rs.next()) { + final Pair templateZonePair = new Pair( + rs.getLong(1), -1L); + templateZonePairList.add(templateZonePair); + } + txn.commit(); + } catch (Exception e) { + s_logger.warn("Error listing S3 templates", e); + if (txn != null) { + txn.rollback(); + } + } finally { + closeResources(pstmt, rs); + if (txn != null) { + txn.close(); + } + } + + return templateZonePairList; + } + } diff --git a/server/src/com/cloud/storage/s3/S3ManagerImpl.java b/server/src/com/cloud/storage/s3/S3ManagerImpl.java index 6b072540c66..0da11ffa590 100644 --- a/server/src/com/cloud/storage/s3/S3ManagerImpl.java +++ b/server/src/com/cloud/storage/s3/S3ManagerImpl.java @@ -27,7 +27,6 @@ import static com.cloud.utils.S3Utils.checkClientOptions; import static com.cloud.utils.S3Utils.doesBucketExist; import static com.cloud.utils.StringUtils.join; import static com.cloud.utils.db.GlobalLock.executeWithNoWaitLock; -import static com.cloud.utils.db.SearchCriteria.Op.EQ; import static java.lang.Boolean.TRUE; import static java.lang.String.format; import static java.util.Arrays.asList; @@ -433,10 +432,6 @@ public class S3ManagerImpl implements S3Manager { cmd.getStartIndex(), cmd.getPageSizeVal()); final SearchCriteria criteria = this.s3Dao.createSearchCriteria(); - if (cmd.getId() != null) { - criteria.addAnd(ID_COLUMN_NAME, EQ, cmd.getId()); - } - return this.s3Dao.search(criteria, filter); } diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index 73289bca35b..b09ebb94fea 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -60,3 +60,8 @@ ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network','DEFAULT','NetworkManager','network.dhcp.nondefaultnetwork.setgateway.guestos','Windows','The guest OS\'s name start with this fields would result in DHCP server response gateway information even when the network it\'s on is not default network. Names are separated by comma.'); +ALTER TABLE `sync_queue` ADD `queue_size` SMALLINT NOT NULL DEFAULT '0' COMMENT 'number of items being processed by the queue'; + +ALTER TABLE `sync_queue` ADD `queue_size_limit` SMALLINT NOT NULL DEFAULT '1' COMMENT 'max number of items the queue can process concurrently'; + +ALTER TABLE `sync_queue_item` ADD `queue_proc_time` DATETIME NOT NULL COMMENT 'when processing started for the item' AFTER `queue_proc_number`; diff --git a/test/integration/component/test_snapshots.py b/test/integration/component/test_snapshots.py index 8659f14309a..825b8c6877e 100644 --- a/test/integration/component/test_snapshots.py +++ b/test/integration/component/test_snapshots.py @@ -582,7 +582,7 @@ class TestSnapshots(cloudstackTestCase): return @attr(speed = "slow") - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "xen"]) def test_03_volume_from_snapshot(self): """Create volumes from snapshots """ @@ -995,7 +995,7 @@ class TestSnapshots(cloudstackTestCase): return @attr(speed = "slow") - @attr(tags = ["advanced", "advancedns", "smoke"]) + @attr(tags = ["advanced", "advancedns", "smoke", "xen"]) def test_07_template_from_snapshot(self): """Create Template from snapshot """ @@ -1901,7 +1901,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase): return @attr(speed = "slow") - @attr(tags = ["advanced", "advancedns"]) + @attr(tags = ["advanced", "advancedns", "xen"]) def test_03_snapshot_detachedDisk(self): """Test snapshot from detached disk """ diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index 8c4e3251690..e8b861eedb2 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -46,7 +46,6 @@ class cloudConnection(object): self.auth = False else: self.auth = True - self.retries = 5 self.asyncTimeout = asyncTimeout diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py index 11fbce997dd..d494beb6444 100644 --- a/tools/marvin/marvin/configGenerator.py +++ b/tools/marvin/marvin/configGenerator.py @@ -180,6 +180,17 @@ class secondaryStorage(): def __init__(self): self.url = None +class s3(): + def __init__(self): + self.accesskey = None + self.secretkey = None + self.bucket = None + self.endpoint = None + self.sockettimeout = None + self.connectiontimeout = None + self.maxerrorrety = None + self.usehttps = None + class netscaler(): def __init__(self, hostname=None, username='nsroot', password='nsroot'): self.hostname = hostname diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py index ba124cbced4..0d5f3bdc659 100644 --- a/tools/marvin/marvin/deployDataCenter.py +++ b/tools/marvin/marvin/deployDataCenter.py @@ -399,9 +399,11 @@ class deployDataCenters(): logging=self.testClientLogger) """config database""" - #dbSvr = self.config.dbSvr - #self.testClient.dbConfigure(dbSvr.dbSvr, dbSvr.port, dbSvr.user, \ - # dbSvr.passwd, dbSvr.db) + dbSvr = self.config.dbSvr + if dbSvr is not None: + self.testClient.dbConfigure(dbSvr.dbSvr, dbSvr.port, dbSvr.user, \ + dbSvr.passwd, dbSvr.db) + self.apiClient = self.testClient.getApiClient() def updateConfiguration(self, globalCfg): diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index ba741a4f063..de8149fe877 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -1282,6 +1282,7 @@ } else { if(isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) { allowedActions.push("changePassword"); + allowedActions.push("generateKeys"); } } return allowedActions; diff --git a/utils/src/com/cloud/utils/db/DbUtil.java b/utils/src/com/cloud/utils/db/DbUtil.java index feef7b3b236..da0efbbe8cb 100755 --- a/utils/src/com/cloud/utils/db/DbUtil.java +++ b/utils/src/com/cloud/utils/db/DbUtil.java @@ -23,6 +23,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Statement; import java.util.HashMap; import java.util.Map; @@ -280,4 +281,62 @@ public class DbUtil { } return false; } + + public static void closeResources(final Connection connection, + final Statement statement, final ResultSet resultSet) { + + closeResultSet(resultSet); + closeStatement(statement); + closeConnection(connection); + + } + + public static void closeResources(final Statement statement, final ResultSet resultSet) { + + closeResources(null, statement, resultSet); + + } + + public static void closeResultSet(final ResultSet resultSet) { + + try { + + if (resultSet != null) { + resultSet.close(); + } + + } catch (Exception e) { + s_logger.warn("Ignored exception while closing result set.",e); + } + + } + + public static void closeStatement(final Statement statement) { + + try { + + if (statement != null) { + statement.close(); + } + + } catch (Exception e) { + s_logger.warn("Ignored exception while closing statement.",e); + } + + } + + public static void closeConnection(final Connection connection) { + + try { + + if (connection != null) { + connection.close(); + } + + } catch (Exception e) { + s_logger.warn("Ignored exception while close connection.",e); + } + + } + } diff --git a/vmware-base/pom.xml b/vmware-base/pom.xml index 9b119e5156a..bd536fb574a 100644 --- a/vmware-base/pom.xml +++ b/vmware-base/pom.xml @@ -41,19 +41,19 @@ com.cloud.com.vmware vmware-vim25 ${cs.vmware.api.version} - provided + compile com.cloud.com.vmware vmware-vim ${cs.vmware.api.version} - provided + compile com.cloud.com.vmware vmware-apputils ${cs.vmware.api.version} - provided + compile org.apache.axis