mirror of https://github.com/apache/cloudstack.git
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
1577c0a0dc
|
|
@ -64,7 +64,7 @@ public interface NetworkService {
|
|||
|
||||
Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
|
||||
|
||||
boolean deleteNetwork(long networkId);
|
||||
boolean deleteNetwork(long networkId, boolean forced);
|
||||
|
||||
boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ public class DeleteNetworkCmd extends BaseAsyncCmd {
|
|||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the ID of the network")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force delete a network." +
|
||||
" Network will be marked as 'Destroy' even when commands to shutdown and cleanup to the backend fails.")
|
||||
private Boolean forced;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -53,6 +57,10 @@ public class DeleteNetworkCmd extends BaseAsyncCmd {
|
|||
return id;
|
||||
}
|
||||
|
||||
public boolean isForced() {
|
||||
return (forced != null) ? forced : false;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -65,7 +73,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd {
|
|||
@Override
|
||||
public void execute() {
|
||||
CallContext.current().setEventDetails("Network Id: " + id);
|
||||
boolean result = _networkService.deleteNetwork(id);
|
||||
boolean result = _networkService.deleteNetwork(id, isForced());
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
|
|
|||
|
|
@ -418,49 +418,6 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<!--
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId> org.apache.maven.plugins </groupId>
|
||||
<artifactId> maven-antrun-plugin </artifactId>
|
||||
<versionRange>[1.7,)</versionRange>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore/>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<versionRange>[2.0,)</versionRange>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<execute/>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
-->
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
|
|
|||
|
|
@ -562,36 +562,6 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!--This plugin's configuration is used to store Eclipse m2e settings only.
|
||||
It has no influence on the Maven build itself. -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId> org.apache.maven.plugins </groupId>
|
||||
<artifactId> maven-antrun-plugin </artifactId>
|
||||
<versionRange>[1.7,)</versionRange>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore/>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public interface NetworkOrchestrationService {
|
|||
|
||||
boolean shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements);
|
||||
|
||||
boolean destroyNetwork(long networkId, ReservationContext context);
|
||||
boolean destroyNetwork(long networkId, ReservationContext context, boolean forced);
|
||||
|
||||
Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway, String cidr, String vlanId, String networkDomain, Account owner,
|
||||
Long domainId, PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr,
|
||||
|
|
|
|||
|
|
@ -2068,7 +2068,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
|
||||
@Override
|
||||
@DB
|
||||
public boolean destroyNetwork(long networkId, final ReservationContext context) {
|
||||
public boolean destroyNetwork(long networkId, final ReservationContext context, boolean forced) {
|
||||
final Account callerAccount = context.getAccount();
|
||||
|
||||
NetworkVO network = _networksDao.findById(networkId);
|
||||
|
|
@ -2111,7 +2111,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
|
||||
// get updated state for the network
|
||||
network = _networksDao.findById(networkId);
|
||||
if (network.getState() != Network.State.Allocated && network.getState() != Network.State.Setup) {
|
||||
if (network.getState() != Network.State.Allocated && network.getState() != Network.State.Setup && !forced) {
|
||||
s_logger.debug("Network is not not in the correct state to be destroyed: " + network.getState());
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class VmwareContextFactory {
|
|||
} else {
|
||||
// Validate current context and verify if vCenter session timeout value of the context matches the timeout value set by Admin
|
||||
if (!context.validate() || (context.getVimClient().getVcenterSessionTimeout() != s_vmwareMgr.getVcenterSessionTimeout())) {
|
||||
s_logger.info("Validation of the context faild. dispose and create a new one");
|
||||
s_logger.info("Validation of the context failed, dispose and create a new one");
|
||||
context.close();
|
||||
context = create(vCenterAddress, vCenterUserName, vCenterPassword);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6896,10 +6896,16 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
|
||||
@Override
|
||||
public VmwareContext getServiceContext(Command cmd) {
|
||||
if (s_serviceContext.get() != null)
|
||||
return s_serviceContext.get();
|
||||
|
||||
VmwareContext context = null;
|
||||
if(s_serviceContext.get() != null) {
|
||||
context = s_serviceContext.get();
|
||||
if (context.validate()) {
|
||||
return context;
|
||||
} else {
|
||||
s_logger.info("Validation of the context failed, dispose and use a new one");
|
||||
invalidateServiceContext(context);
|
||||
}
|
||||
}
|
||||
try {
|
||||
context = VmwareContextFactory.getContext(_vCenterAddress, _username, _password);
|
||||
s_serviceContext.set(context);
|
||||
|
|
|
|||
|
|
@ -214,18 +214,23 @@ public class VmwareSecondaryStorageResourceHandler implements SecondaryStorageRe
|
|||
_resource.ensureOutgoingRuleForAddress(vCenterAddress);
|
||||
|
||||
VmwareContext context = currentContext.get();
|
||||
if (context == null) {
|
||||
if (context != null) {
|
||||
if(!context.validate()) {
|
||||
invalidateServiceContext(context);
|
||||
context = null;
|
||||
} else {
|
||||
context.registerStockObject("serviceconsole", cmd.getContextParam("serviceconsole"));
|
||||
context.registerStockObject("manageportgroup", cmd.getContextParam("manageportgroup"));
|
||||
context.registerStockObject("noderuninfo", cmd.getContextParam("noderuninfo"));
|
||||
}
|
||||
}
|
||||
if(context == null) {
|
||||
s_logger.info("Open new VmwareContext. vCenter: " + vCenterAddress + ", user: " + username + ", password: " +
|
||||
StringUtils.getMaskedPasswordForDisplay(password));
|
||||
StringUtils.getMaskedPasswordForDisplay(password));
|
||||
VmwareSecondaryStorageContextFactory.setVcenterSessionTimeout(vCenterSessionTimeout);
|
||||
context = VmwareSecondaryStorageContextFactory.getContext(vCenterAddress, username, password);
|
||||
}
|
||||
|
||||
if (context != null) {
|
||||
context.registerStockObject("serviceconsole", cmd.getContextParam("serviceconsole"));
|
||||
context.registerStockObject("manageportgroup", cmd.getContextParam("manageportgroup"));
|
||||
context.registerStockObject("noderuninfo", cmd.getContextParam("noderuninfo"));
|
||||
}
|
||||
currentContext.set(context);
|
||||
return context;
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ public class NetworkProviderTest extends TestCase {
|
|||
List<? extends Network> list = _networkService.getIsolatedNetworksOwnedByAccountInZone(zone.getId(), system);
|
||||
for (Network net : list) {
|
||||
s_logger.debug("Delete network " + net.getName());
|
||||
_networkService.deleteNetwork(net.getId());
|
||||
_networkService.deleteNetwork(net.getId(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,39 +90,6 @@
|
|||
</plugin>
|
||||
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>
|
||||
org.codehaus.gmaven
|
||||
</groupId>
|
||||
<artifactId>
|
||||
gmaven-plugin
|
||||
</artifactId>
|
||||
<versionRange>[1.3,)</versionRange>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>testCompile</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
<dependencies>
|
||||
<!-- Mandatory dependencies for using Spock -->
|
||||
|
|
|
|||
27
pom.xml
27
pom.xml
|
|
@ -560,6 +560,33 @@
|
|||
<ignore />
|
||||
</action>
|
||||
</pluginExecution>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>com.mycila.maven-license-plugin</groupId>
|
||||
<artifactId>maven-license-plugin</artifactId>
|
||||
<versionRange>[1.9.0,)</versionRange>
|
||||
<goals>
|
||||
<goal>format</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.codehaus.gmaven</groupId>
|
||||
<artifactId>gmaven-plugin</artifactId>
|
||||
<versionRange>[1.3,)</versionRange>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>testCompile</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<ignore></ignore>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -760,7 +760,11 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
|
|||
|
||||
@Override
|
||||
public Long fetchDomainId(String domainUUID) {
|
||||
return _domainMgr.getDomain(domainUUID).getId();
|
||||
Domain domain = _domainMgr.getDomain(domainUUID);
|
||||
if (domain != null)
|
||||
return domain.getId();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1762,7 +1762,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_DELETE, eventDescription = "deleting network", async = true)
|
||||
public boolean deleteNetwork(long networkId) {
|
||||
public boolean deleteNetwork(long networkId, boolean forced) {
|
||||
|
||||
Account caller = CallContext.current().getCallingAccount();
|
||||
|
||||
|
|
@ -1788,10 +1788,14 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
// Perform permission check
|
||||
_accountMgr.checkAccess(caller, null, true, network);
|
||||
|
||||
if (forced && !_accountMgr.isRootAdmin(caller.getType())) {
|
||||
throw new InvalidParameterValueException("Delete network with 'forced' option can only be called by root admins");
|
||||
}
|
||||
|
||||
User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
|
||||
ReservationContext context = new ReservationContextImpl(null, null, callerUser, owner);
|
||||
|
||||
return _networkMgr.destroyNetwork(networkId, context);
|
||||
return _networkMgr.destroyNetwork(networkId, context, forced);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1565,7 +1565,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
|
|||
User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
|
||||
Account owner = _accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM);
|
||||
ReservationContext context = new ReservationContextImpl(null, null, callerUser, owner);
|
||||
_ntwkMgr.destroyNetwork(networkId, context);
|
||||
_ntwkMgr.destroyNetwork(networkId, context, false);
|
||||
s_logger.debug("Deleted private network id=" + networkId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||
|
||||
ReservationContext context = new ReservationContextImpl(null, null, getActiveUser(callerUserId), caller);
|
||||
|
||||
if (!_networkMgr.destroyNetwork(network.getId(), context)) {
|
||||
if (!_networkMgr.destroyNetwork(network.getId(), context, false)) {
|
||||
s_logger.warn("Unable to destroy network " + network + " as a part of account id=" + accountId + " cleanup.");
|
||||
accountCleanupNeeded = true;
|
||||
networksDeleted = false;
|
||||
|
|
|
|||
|
|
@ -395,8 +395,7 @@ public class DomainManagerImpl extends ManagerBase implements DomainManager, Dom
|
|||
ReservationContext context = new ReservationContextImpl(null, null, _accountMgr.getActiveUser(ctx.getCallingUserId()), ctx.getCallingAccount());
|
||||
for (Long networkId : networkIds) {
|
||||
s_logger.debug("Deleting network id=" + networkId + " as a part of domain id=" + domainId + " cleanup");
|
||||
|
||||
if (!_networkMgr.destroyNetwork(networkId, context)) {
|
||||
if (!_networkMgr.destroyNetwork(networkId, context, false)) {
|
||||
s_logger.warn("Unable to destroy network id=" + networkId + " as a part of domain id=" + domainId + " cleanup.");
|
||||
networksDeleted = false;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches
|
|||
* @see com.cloud.network.NetworkService#deleteNetwork(long)
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteNetwork(long networkId) {
|
||||
public boolean deleteNetwork(long networkId, boolean forced) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
|
@ -597,7 +597,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches
|
|||
* @see com.cloud.network.NetworkManager#destroyNetwork(long, com.cloud.vm.ReservationContext)
|
||||
*/
|
||||
@Override
|
||||
public boolean destroyNetwork(long networkId, ReservationContext context) {
|
||||
public boolean destroyNetwork(long networkId, ReservationContext context, boolean forced) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -18,13 +18,31 @@
|
|||
""" Component tests VM life cycle in VPC network functionality
|
||||
"""
|
||||
#Import Local Modules
|
||||
import marvin
|
||||
from nose.plugins.attrib import attr
|
||||
from marvin.cloudstackTestCase import *
|
||||
from marvin.cloudstackAPI import *
|
||||
from marvin.integration.lib.utils import *
|
||||
from marvin.integration.lib.base import *
|
||||
from marvin.integration.lib.common import *
|
||||
from marvin.cloudstackTestCase import cloudstackTestCase, unittest
|
||||
from marvin.integration.lib.utils import cleanup_resources, validateList
|
||||
from marvin.integration.lib.base import (VirtualMachine,
|
||||
NATRule,
|
||||
LoadBalancerRule,
|
||||
StaticNATRule,
|
||||
PublicIPAddress,
|
||||
VPC,
|
||||
VpcOffering,
|
||||
Network,
|
||||
NetworkOffering,
|
||||
NetworkACL,
|
||||
Router,
|
||||
Account,
|
||||
ServiceOffering,
|
||||
Host)
|
||||
from marvin.integration.lib.common import (get_domain,
|
||||
get_zone,
|
||||
get_template,
|
||||
get_free_vlan,
|
||||
wait_for_cleanup,
|
||||
list_virtual_machines,
|
||||
list_hosts)
|
||||
|
||||
from marvin.codes import PASS
|
||||
|
||||
import time
|
||||
|
|
@ -644,6 +662,13 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
|
|||
True,
|
||||
"List LB rules shall return a valid list"
|
||||
)
|
||||
|
||||
#Recover the instances so that they don't get expunged before runing next test case in the suite
|
||||
try:
|
||||
self.vm_1.recover(self.apiclient)
|
||||
self.vm_2.recover(self.apiclient)
|
||||
except Exception as e:
|
||||
self.fail("Failed to recover the virtual instances, %s" % e)
|
||||
return
|
||||
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
|
|
@ -690,6 +715,11 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
|
|||
# works as expected.
|
||||
# 3. Make sure that we are able to access google.com from this user Vm
|
||||
|
||||
vm_list = VirtualMachine.list(self.apiclient, id=self.vm_1.id)
|
||||
self.assertEqual(validateList(vm_list)[0], PASS, "vm list validation failed, vm list is %s" % vm_list)
|
||||
|
||||
vm_hostid = vm_list[0].hostid
|
||||
|
||||
self.debug("Checking if the host is available for migration?")
|
||||
hosts = Host.list(
|
||||
self.apiclient,
|
||||
|
|
@ -707,7 +737,7 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
|
|||
"No host available for migration. Test requires atleast 2 hosts")
|
||||
|
||||
# Remove the host of current VM from the hosts list
|
||||
hosts[:] = [host for host in hosts if host.id != self.vm_1.hostid]
|
||||
hosts[:] = [host for host in hosts if host.id != vm_hostid]
|
||||
|
||||
host = hosts[0]
|
||||
|
||||
|
|
@ -847,17 +877,17 @@ class TestVMLifeCycleVPC(cloudstackTestCase):
|
|||
# Check if the network rules still exists after Vm stop
|
||||
self.debug("Checking if NAT rules existed")
|
||||
with self.assertRaises(Exception):
|
||||
nat_rules = NATRule.list(
|
||||
self.apiclient,
|
||||
id=self.nat_rule.id,
|
||||
listall=True
|
||||
)
|
||||
NATRule.list(
|
||||
self.apiclient,
|
||||
id=self.nat_rule.id,
|
||||
listall=True
|
||||
)
|
||||
|
||||
lb_rules = LoadBalancerRule.list(
|
||||
self.apiclient,
|
||||
id=self.lb_rule.id,
|
||||
listall=True
|
||||
)
|
||||
LoadBalancerRule.list(
|
||||
self.apiclient,
|
||||
id=self.lb_rule.id,
|
||||
listall=True
|
||||
)
|
||||
return
|
||||
|
||||
class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
|
||||
|
|
@ -1651,17 +1681,17 @@ class TestVMLifeCycleSharedNwVPC(cloudstackTestCase):
|
|||
# Check if the network rules still exists after Vm expunged
|
||||
self.debug("Checking if NAT rules existed ")
|
||||
with self.assertRaises(Exception):
|
||||
nat_rules = NATRule.list(
|
||||
self.apiclient,
|
||||
id=self.nat_rule.id,
|
||||
listall=True
|
||||
)
|
||||
NATRule.list(
|
||||
self.apiclient,
|
||||
id=self.nat_rule.id,
|
||||
listall=True
|
||||
)
|
||||
|
||||
lb_rules = LoadBalancerRule.list(
|
||||
self.apiclient,
|
||||
id=self.lb_rule.id,
|
||||
listall=True
|
||||
)
|
||||
LoadBalancerRule.list(
|
||||
self.apiclient,
|
||||
id=self.lb_rule.id,
|
||||
listall=True
|
||||
)
|
||||
return
|
||||
|
||||
class TestVMLifeCycleBothIsolated(cloudstackTestCase):
|
||||
|
|
@ -2687,17 +2717,17 @@ class TestVMLifeCycleStoppedVPCVR(cloudstackTestCase):
|
|||
# Check if the network rules still exists after Vm expunged
|
||||
self.debug("Checking if NAT rules existed ")
|
||||
with self.assertRaises(Exception):
|
||||
nat_rules = NATRule.list(
|
||||
self.apiclient,
|
||||
id=self.nat_rule.id,
|
||||
listall=True
|
||||
)
|
||||
NATRule.list(
|
||||
self.apiclient,
|
||||
id=self.nat_rule.id,
|
||||
listall=True
|
||||
)
|
||||
|
||||
lb_rules = LoadBalancerRule.list(
|
||||
self.apiclient,
|
||||
id=self.lb_rule.id,
|
||||
listall=True
|
||||
)
|
||||
LoadBalancerRule.list(
|
||||
self.apiclient,
|
||||
id=self.lb_rule.id,
|
||||
listall=True
|
||||
)
|
||||
return
|
||||
|
||||
class TestVMLifeCycleDiffHosts(cloudstackTestCase):
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@
|
|||
"memory": 128
|
||||
},
|
||||
"isolated_network_offering": {
|
||||
"name": "Network offering-DA services",
|
||||
"displaytext": "Network offering-DA services",
|
||||
"name": "Isolated Network offering",
|
||||
"displaytext": "Isolated Network offering",
|
||||
"guestiptype": "Isolated",
|
||||
"supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat",
|
||||
"traffictype": "GUEST",
|
||||
|
|
@ -75,8 +75,8 @@
|
|||
"protocol": "TCP"
|
||||
},
|
||||
"shared_network": {
|
||||
"name": "MySharedNetwork - Test",
|
||||
"displaytext": "MySharedNetwork",
|
||||
"name": "Test Shared Network",
|
||||
"displaytext": "Test Shared Network",
|
||||
"vlan" : "",
|
||||
"gateway" :"",
|
||||
"netmask" :"",
|
||||
|
|
@ -86,8 +86,8 @@
|
|||
"scope":"all"
|
||||
},
|
||||
"shared_network_offering_sg": {
|
||||
"name": "MySharedOffering-sg",
|
||||
"displaytext": "MySharedOffering-sg",
|
||||
"name": "SharedNwOffering-sg",
|
||||
"displaytext": "SharedNwOffering-sg",
|
||||
"guestiptype": "Shared",
|
||||
"supportedservices": "Dhcp,Dns,UserData,SecurityGroup",
|
||||
"specifyVlan" : "False",
|
||||
|
|
@ -103,7 +103,7 @@
|
|||
"shared_network_sg": {
|
||||
"name": "Shared-Network-SG-Test",
|
||||
"displaytext": "Shared-Network_SG-Test",
|
||||
"networkofferingid":"1",
|
||||
"networkofferingid":"",
|
||||
"vlan" : "",
|
||||
"gateway" :"",
|
||||
"netmask" :"255.255.255.0",
|
||||
|
|
@ -123,8 +123,8 @@
|
|||
"cidr": "10.0.0.1/24"
|
||||
},
|
||||
"shared_network_offering": {
|
||||
"name": "MySharedOffering",
|
||||
"displaytext": "MySharedOffering",
|
||||
"name": "SharedNwOffering",
|
||||
"displaytext": "SharedNwOffering",
|
||||
"guestiptype": "Shared",
|
||||
"supportedservices": "Dhcp,Dns,UserData",
|
||||
"specifyVlan" : "False",
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
"ingress_rule": {
|
||||
"protocol": "TCP",
|
||||
"startport": "22",
|
||||
"endport": "22",
|
||||
"endport": "80",
|
||||
"cidrlist": "0.0.0.0/0"
|
||||
},
|
||||
"ostype": "CentOS 5.3 (64-bit)",
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import java.util.Map;
|
|||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
import javax.net.ssl.SSLSession;
|
||||
import javax.xml.ws.soap.SOAPFaultException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -638,16 +639,18 @@ public class VmwareContext {
|
|||
public void close() {
|
||||
clearStockObjects();
|
||||
try {
|
||||
s_logger.info("Disconnecting VMware session");
|
||||
_vimClient.disconnect();
|
||||
} catch(SOAPFaultException sfe) {
|
||||
s_logger.debug("Tried to disconnect a session that is no longer valid");
|
||||
} catch (Exception e) {
|
||||
s_logger.warn("Unexpected exception: ", e);
|
||||
} finally {
|
||||
if (_pool != null) {
|
||||
_pool.unregisterOutstandingContext(this);
|
||||
}
|
||||
unregisterOutstandingContext();
|
||||
}
|
||||
|
||||
if (_pool != null) {
|
||||
_pool.unregisterOutstandingContext(this);
|
||||
}
|
||||
|
||||
unregisterOutstandingContext();
|
||||
}
|
||||
|
||||
public static class TrustAllManager implements javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager {
|
||||
|
|
|
|||
Loading…
Reference in New Issue