Merge branch '3.0.x' of ssh://git.cloud.com/var/lib/git/cloudstack-oss into 3.0.x

This commit is contained in:
Vijayendra Bhamidipati 2012-07-27 15:38:56 -07:00
commit 774e73dae3
4 changed files with 19 additions and 22 deletions

View File

@ -3625,7 +3625,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
s_logger.debug("Sending destroy to " + element);
}
element.destroy(network);
if (!element.destroy(network)) {
success = false;
s_logger.warn("Unable to complete destroy of the network: failed to destroy network element " + element.getName());
}
} catch (ResourceUnavailableException e) {
s_logger.warn("Unable to complete destroy of the network due to element: " + element.getName(), e);
success = false;
@ -3635,7 +3638,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
} catch (Exception e) {
s_logger.warn("Unable to complete destroy of the network due to element: " + element.getName(), e);
success = false;
}
}
}
}

View File

@ -120,18 +120,13 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager {
idList.add(new IdentityProxy(vpc, vpcId, "vpcId"));
throw new InvalidParameterValueException("The VPN gateway of VPC with specified vpcId already exists!", idList);
}
Long accountId = cmd.getEntityOwnerId();
Long domainId = cmd.getDomainId();
if (domainId == null) {
domainId = Domain.ROOT_DOMAIN;
}
//Use source NAT ip for VPC
List<IPAddressVO> ips = _ipAddressDao.listByAssociatedVpc(vpcId, true);
if (ips.size() != 1) {
throw new CloudRuntimeException("Cannot found source nat ip of vpc " + vpcId);
}
Site2SiteVpnGatewayVO gw = new Site2SiteVpnGatewayVO(accountId, domainId, ips.get(0).getId(), vpcId);
Site2SiteVpnGatewayVO gw = new Site2SiteVpnGatewayVO(owner.getAccountId(), owner.getDomainId(), ips.get(0).getId(), vpcId);
_vpnGatewayDao.persist(gw);
return gw;
}
@ -180,12 +175,7 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager {
if (_customerGatewayDao.findByName(name) != null) {
throw new InvalidParameterValueException("The customer gateway with name " + name + " already existed!", null);
}
Long accountId = cmd.getEntityOwnerId();
Long domainId = cmd.getDomainId();
if (domainId == null) {
domainId = Domain.ROOT_DOMAIN;
}
Site2SiteCustomerGatewayVO gw = new Site2SiteCustomerGatewayVO(name, accountId, domainId, gatewayIp, guestCidrList, ipsecPsk,
Site2SiteCustomerGatewayVO gw = new Site2SiteCustomerGatewayVO(name, owner.getAccountId(), owner.getDomainId(), gatewayIp, guestCidrList, ipsecPsk,
ikePolicy, espPolicy, lifetime);
_customerGatewayDao.persist(gw);
return gw;
@ -221,12 +211,7 @@ public class Site2SiteVpnManagerImpl implements Site2SiteVpnManager, Manager {
throw new InvalidParameterValueException("The vpn connection with specified customer gateway id or vpn gateway id " +
" already exists!", idList);
}
Long accountId = cmd.getEntityOwnerId();
Long domainId = cmd.getDomainId();
if (domainId == null) {
domainId = Domain.ROOT_DOMAIN;
}
Site2SiteVpnConnectionVO conn = new Site2SiteVpnConnectionVO(accountId, domainId, vpnGatewayId, customerGatewayId);
Site2SiteVpnConnectionVO conn = new Site2SiteVpnConnectionVO(owner.getAccountId(), owner.getDomainId(), vpnGatewayId, customerGatewayId);
conn.setState(State.Pending);
_vpnConnectionDao.persist(conn);
return conn;

View File

@ -126,7 +126,9 @@ import com.cloud.vm.ReservationContextImpl;
import com.cloud.vm.UserVmManager;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine.Type;
import com.cloud.vm.VirtualMachineManager;
import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.InstanceGroupDao;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao;
@ -204,6 +206,8 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
private IPAddressDao _ipAddressDao;
@Inject
private VpcManager _vpcMgr;
@Inject
private DomainRouterDao _routerDao;
private Adapters<UserAuthenticator> _userAuthenticators;
@ -676,7 +680,13 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
for (VMInstanceVO vm : vms) {
try {
try {
success = (success && _itMgr.advanceStop(vm, false, getSystemUser(), getSystemAccount()));
if (vm.getType() == Type.User) {
success = (success && _itMgr.advanceStop(_userVmDao.findById(vm.getId()), false, getSystemUser(), getSystemAccount()));
} else if (vm.getType() == Type.DomainRouter) {
success = (success && _itMgr.advanceStop(_routerDao.findById(vm.getId()), false, getSystemUser(), getSystemAccount()));
} else {
success = (success && _itMgr.advanceStop(vm, false, getSystemUser(), getSystemAccount()));
}
} catch (OperationTimedoutException ote) {
s_logger.warn("Operation for stopping vm timed out, unable to stop vm " + vm.getHostName(), ote);
success = false;

View File

@ -1020,7 +1020,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
}
VirtualMachineGuru<T> vmGuru = getVmGuru(vm);
vm = vmGuru.findById(vm.getId());
VirtualMachineProfile<T> profile = new VirtualMachineProfileImpl<T>(vm);
try {