mirror of https://github.com/apache/cloudstack.git
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-cloudstack
This commit is contained in:
commit
42d9c3fbb1
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,12 @@
|
|||
<artifactId>axis2-webapp</artifactId>
|
||||
<type>war</type>
|
||||
<version>${cs.axis2.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.ws.commons.axiom</groupId>
|
||||
|
|
@ -123,6 +129,10 @@
|
|||
<groupId>org.apache.xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -139,6 +149,10 @@
|
|||
<groupId>org.apache.xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -151,6 +165,10 @@
|
|||
<groupId>org.apache.xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -163,6 +181,10 @@
|
|||
<groupId>org.apache.xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -175,6 +197,10 @@
|
|||
<groupId>org.apache.xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.opensaml</groupId>
|
||||
<artifactId>opensaml</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -217,6 +217,10 @@
|
|||
<include name="discovery-*.jar" />
|
||||
<include name="wsdl4j-*.jar" />
|
||||
<include name="ejb-api-3.0.jar" />
|
||||
<include name="aws-java-sdk-1.3.21.1.jar" />
|
||||
<include name="httpclient-4.1.jar" />
|
||||
<include name="httpcore-4.1.jar" />
|
||||
<include name="commons-lang-2.1.jar" />
|
||||
</zipfileset>
|
||||
<zipfileset dir="${jar.dir}">
|
||||
<include name="${agent.jar}" />
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
under the License.
|
||||
-->
|
||||
|
||||
<section id="changing-secondary-storage-serversp">
|
||||
<section id="changing-secondary-storage-servers">
|
||||
<title>Changing Secondary Storage Servers</title>
|
||||
<para>You can change the secondary storage NFS mount. Perform the following steps to do so:</para>
|
||||
<orderedlist>
|
||||
|
|
|
|||
|
|
@ -1,36 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<section id="changing-secondary-storage-serversp">
|
||||
<title>Changing Secondary Storage Servers</title>
|
||||
<para>You can change the secondary storage NFS mount. Perform the following steps to do so:</para>
|
||||
<orderedlist>
|
||||
<listitem><para>Stop all running Management Servers.</para></listitem>
|
||||
<listitem><para>Wait 30 minutes. This allows any writes to secondary storage to complete.</para></listitem>
|
||||
<listitem><para>Copy all files from the old secondary storage mount to the new.</para></listitem>
|
||||
<listitem><para>Use the procedure above to change the IP address for secondary storage if required.</para></listitem>
|
||||
<listitem><para>Start the Management Server.</para></listitem>
|
||||
</orderedlist>
|
||||
</section>
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
||||
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
|
||||
%BOOK_ENTITIES;
|
||||
]>
|
||||
|
||||
<!-- 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.
|
||||
-->
|
||||
|
||||
<section id="configure-xenserver-dom0-memory">
|
||||
<title>Configure XenServer dom0 Memory</title>
|
||||
<para>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 <ulink url="http://support.citrix.com/article/CTX126531">Citrix Knowledgebase Article</ulink>.The article refers to XenServer 5.6, but the same information applies to XenServer 6</para>
|
||||
</section>
|
||||
|
||||
|
|
@ -36,19 +36,19 @@
|
|||
<groupId>com.cloud.com.vmware</groupId>
|
||||
<artifactId>vmware-vim25</artifactId>
|
||||
<version>${cs.vmware.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cloud.com.vmware</groupId>
|
||||
<artifactId>vmware-vim</artifactId>
|
||||
<version>${cs.vmware.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cloud.com.vmware</groupId>
|
||||
<artifactId>vmware-apputils</artifactId>
|
||||
<version>${cs.vmware.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis</groupId>
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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.<String, Object> 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ addVlan() {
|
|||
return 2
|
||||
fi
|
||||
fi
|
||||
|
||||
brctl setfd $vlanBr 0
|
||||
fi
|
||||
|
||||
#pif is eslaved into vlanBr?
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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<String> 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());
|
||||
|
|
|
|||
|
|
@ -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<Long, Long>(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<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long, Long>>();
|
||||
templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers,
|
||||
bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr,
|
||||
permittedAccounts, caller, listProjectResourcesCriteria, tags);
|
||||
|
||||
for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
|
||||
if (!templateZonePairSet.contains(new Pair<Long, Long>(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<Long, Long>(template.getId(), zoneId));
|
||||
}
|
||||
} else {
|
||||
if (template == null) {
|
||||
templateZonePairSet = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers,
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long> {
|
|||
boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,
|
||||
Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account> permittedAccounts, Account caller, Map<String, String> tags);
|
||||
|
||||
public Set<Pair<Long, Long>> searchS3Templates(String name, String keyword, TemplateFilter templateFilter,
|
||||
boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,
|
||||
Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account> permittedAccounts, Account caller, Map<String, String> tags);
|
||||
|
||||
public long addTemplateToZone(VMTemplateVO tmplt, long zoneId);
|
||||
public List<VMTemplateVO> listAllInZone(long dataCenterId);
|
||||
|
||||
|
|
|
|||
|
|
@ -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<VMTemplateVO, Long> 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<VMTemplateVO, Long> implem
|
|||
return executeList(SELECT_S3_CANDIDATE_TEMPLATES, new Object[] {});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Pair<Long, Long>> searchS3Templates(final String name,
|
||||
final String keyword, final TemplateFilter templateFilter,
|
||||
final boolean isIso, final List<HypervisorType> 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<Account> permittedAccounts,
|
||||
final Account caller, final Map<String, String> tags) {
|
||||
|
||||
final String permittedAccountsStr = join(",", permittedAccounts);
|
||||
|
||||
final Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
Set<Pair<Long, Long>> templateZonePairList = new HashSet<Pair<Long, Long>>();
|
||||
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<Long, Long> templateZonePair = new Pair<Long, Long>(
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<S3VO> criteria = this.s3Dao.createSearchCriteria();
|
||||
|
||||
if (cmd.getId() != null) {
|
||||
criteria.addAnd(ID_COLUMN_NAME, EQ, cmd.getId());
|
||||
}
|
||||
|
||||
return this.s3Dao.search(criteria, filter);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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`;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ class cloudConnection(object):
|
|||
self.auth = False
|
||||
else:
|
||||
self.auth = True
|
||||
|
||||
self.retries = 5
|
||||
self.asyncTimeout = asyncTimeout
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -1282,6 +1282,7 @@
|
|||
} else {
|
||||
if(isSelfOrChildDomainUser(jsonObj.username, jsonObj.accounttype, jsonObj.domainid, jsonObj.iscallerchilddomain)) {
|
||||
allowedActions.push("changePassword");
|
||||
allowedActions.push("generateKeys");
|
||||
}
|
||||
}
|
||||
return allowedActions;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,19 +41,19 @@
|
|||
<groupId>com.cloud.com.vmware</groupId>
|
||||
<artifactId>vmware-vim25</artifactId>
|
||||
<version>${cs.vmware.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cloud.com.vmware</groupId>
|
||||
<artifactId>vmware-vim</artifactId>
|
||||
<version>${cs.vmware.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.cloud.com.vmware</groupId>
|
||||
<artifactId>vmware-apputils</artifactId>
|
||||
<version>${cs.vmware.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.axis</groupId>
|
||||
|
|
|
|||
Loading…
Reference in New Issue