incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alena1...@apache.org
Subject [8/50] [abbrv] Merge branch 'master' into vpc
Date Fri, 29 Jun 2012 00:45:06 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/ApiResponseHelper.java
index 094af0a,973a74e..3dcf152
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@@ -2318,10 -2307,11 +2320,11 @@@ public class ApiResponseHelper implemen
  
          boolean savedValue = SerializationContext.current().getUuidTranslation();
          SerializationContext.current().setUuidTranslation(false);
-         jobResponse.setJobResult((ResponseObject) ApiSerializerHelper.fromSerializedString(job.getResult()));
-         SerializationContext.current().setUuidTranslation(savedValue);
 -        
 +
          Object resultObject = ApiSerializerHelper.fromSerializedString(job.getResult());
+         jobResponse.setJobResult((ResponseObject) resultObject);
+         SerializationContext.current().setUuidTranslation(savedValue);
+         
          if (resultObject != null) {
              Class<?> clz = resultObject.getClass();
              if (clz.isPrimitive() || clz.getSuperclass() == Number.class || clz == String.class
|| clz == Date.class) {
@@@ -2897,7 -2887,7 +2900,8 @@@
          }
  
          response.setSpecifyIpRanges(network.getSpecifyIpRanges());
 +        response.setVpcId(network.getVpcId());
+         response.setCanUseForDeploy(ApiDBUtils.canUseForDeploy(network));
  
          response.setObjectName("network");
          return response;
@@@ -3446,128 -3403,39 +3450,161 @@@
          return ApiDispatcher.getIdentiyId(tableName, token);
      }
      
 +    
 +    @Override
 +    public VpcOfferingResponse createVpcOfferingResponse(VpcOffering offering) {
 +        VpcOfferingResponse response = new VpcOfferingResponse();
 +        response.setId(offering.getId());
 +        response.setName(offering.getName());
 +        response.setDisplayText(offering.getDisplayText());
 +        response.setIsDefault(offering.isDefault());
 +        response.setState(offering.getState().name());
 +
 +        Map<Service, Set<Provider>> serviceProviderMap = ApiDBUtils.listVpcOffServices(offering.getId());
 +        List<ServiceResponse> serviceResponses = new ArrayList<ServiceResponse>();
 +        for (Service service : serviceProviderMap.keySet()) {
 +            ServiceResponse svcRsp = new ServiceResponse();
 +            // skip gateway service
 +            if (service == Service.Gateway) {
 +                continue;
 +            }
 +            svcRsp.setName(service.getName());
 +            List<ProviderResponse> providers = new ArrayList<ProviderResponse>();
 +            for (Provider provider : serviceProviderMap.get(service)) {
 +                if (provider != null) {
 +                    ProviderResponse providerRsp = new ProviderResponse();
 +                    providerRsp.setName(provider.getName());
 +                    providers.add(providerRsp);
 +                }
 +            }
 +            svcRsp.setProviders(providers);
 +
 +            serviceResponses.add(svcRsp);
 +        }
 +        response.setServices(serviceResponses);
 +        response.setObjectName("vpcoffering");
 +        return response;
 +    }
 +    
 +    
 +    @Override
 +    public VpcResponse createVpcResponse(Vpc vpc) {
 +        VpcResponse response = new VpcResponse();
 +        response.setId(vpc.getId());
 +        response.setName(vpc.getName());
 +        response.setDisplayText(vpc.getDisplayText());
 +        response.setState(vpc.getState().name());
 +        response.setVpcOfferingId(vpc.getVpcOfferingId());
 +        response.setCidr(vpc.getCidr());
 +        response.setZoneId(vpc.getZoneId());
 +        response.setRestartRequired(vpc.isRestartRequired());
 +        response.setNetworkDomain(vpc.getNetworkDomain());
 +
 +        Map<Service, Set<Provider>> serviceProviderMap = ApiDBUtils.listVpcOffServices(vpc.getVpcOfferingId());
 +        List<ServiceResponse> serviceResponses = new ArrayList<ServiceResponse>();
 +        for (Service service : serviceProviderMap.keySet()) {
 +            ServiceResponse svcRsp = new ServiceResponse();
 +            // skip gateway service
 +            if (service == Service.Gateway) {
 +                continue;
 +            }
 +            svcRsp.setName(service.getName());
 +            List<ProviderResponse> providers = new ArrayList<ProviderResponse>();
 +            for (Provider provider : serviceProviderMap.get(service)) {
 +                if (provider != null) {
 +                    ProviderResponse providerRsp = new ProviderResponse();
 +                    providerRsp.setName(provider.getName());
 +                    providers.add(providerRsp);
 +                }
 +            }
 +            svcRsp.setProviders(providers);
 +
 +            serviceResponses.add(svcRsp);
 +        }
 +        
 +        List<NetworkResponse> networkResponses = new ArrayList<NetworkResponse>();
 +        List<? extends Network> networks = ApiDBUtils.listVpcNetworks(vpc.getId());
 +        for (Network network : networks) {
 +            NetworkResponse ntwkRsp = createNetworkResponse(network);
 +            networkResponses.add(ntwkRsp);
 +        }
 +        
 +        response.setNetworks(networkResponses);
 +        response.setServices(serviceResponses);
 +        response.setObjectName("vpcoffering");
 +        return response;
 +    }
 +
 +    @Override
 +    public PrivateGatewayResponse createPrivateGatewayResponse(PrivateGateway result) {
 +        PrivateGatewayResponse response = new PrivateGatewayResponse();
 +        response.setId(result.getId());
 +        response.setVlan(result.getVlanTag());
 +        response.setGateway(result.getGateway());
 +        response.setNetmask(result.getNetmask());
 +        response.setVpcId(result.getVpcId());
 +        response.setZoneId(result.getZoneId());
 +        DataCenter zone = ApiDBUtils.findZoneById(result.getZoneId());
 +        response.setZoneName(zone.getName());
 +        response.setAddress(result.getIp4Address());
 +        response.setPhysicalNetworkId(result.getPhysicalNetworkId());
 +        response.setObjectName("privategateway");
 +        
 +        return response;
 +    }
 +    
 +    
 +    @Override
 +    public StaticRouteResponse createStaticRouteResponse(StaticRoute result) {
 +        StaticRouteResponse response = new StaticRouteResponse();
 +        response.setId(result.getId());
 +        response.setVpcId(result.getVpcId());
 +        response.setCidr(result.getCidr());
 +        
 +        StaticRoute.State state = result.getState();
 +        String stateToSet = state.toString();
 +        if (state.equals(FirewallRule.State.Revoke)) {
 +            stateToSet = "Deleting";
 +        }
 +        response.setState(stateToSet);
 +        populateAccount(response, result.getAccountId());
 +        populateDomain(response, result.getDomainId());
 +        response.setObjectName("staticroute");
 +        
 +        return response;
 +    }
 +    
+     @Override
+     public ResourceTagResponse createResourceTagResponse(ResourceTag resourceTag) {
+         ResourceTagResponse response = new ResourceTagResponse();
+         response.setKey(resourceTag.getKey());
+         response.setValue(resourceTag.getValue());
+         response.setResourceType(resourceTag.getResourceType().toString());        
+         response.setId(ApiDBUtils.getUuid(String.valueOf(resourceTag.getResourceId()),resourceTag.getResourceType()));
+         Long accountId = resourceTag.getAccountId();
+         Long domainId = resourceTag.getDomainId();
+         if (accountId != null) {
+             Account account = ApiDBUtils.findAccountByIdIncludingRemoved(resourceTag.getAccountId());
+ 
+             if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
+                 // find the project
+                 Project project = ApiDBUtils.findProjectByProjectAccountId(account.getId());
+                 response.setProjectId(project.getId());
+                 response.setProjectName(project.getName());
+             } else {
+                 response.setAccountName(account.getAccountName());
+             }
+         }
+         
+         if (domainId != null) {
+             response.setDomainId(domainId);
+             response.setDomainName(ApiDBUtils.findDomainById(domainId).getName());
+         }
+         
+         response.setCustomer(resourceTag.getCustomer());
+         
+         response.setObjectName("tag");
+   
+         return response;
 -    }
 -    
 -    
++    }    
  }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/api/ApiServer.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/configuration/DefaultComponentLibrary.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/configuration/DefaultComponentLibrary.java
index b6a8541,3bfe84d..f407b81
--- a/server/src/com/cloud/configuration/DefaultComponentLibrary.java
+++ b/server/src/com/cloud/configuration/DefaultComponentLibrary.java
@@@ -338,12 -323,7 +332,13 @@@ public class DefaultComponentLibrary ex
          addDao("NetworkServiceMapDao", NetworkServiceMapDaoImpl.class);
          addDao("StorageNetworkIpAddressDao", StorageNetworkIpAddressDaoImpl.class);
          addDao("StorageNetworkIpRangeDao", StorageNetworkIpRangeDaoImpl.class);
 +        addDao("VpcDao", VpcDaoImpl.class);
 +        addDao("VpcOfferingDao", VpcOfferingDaoImpl.class);
 +        addDao("VpcOfferingServiceMapDao", VpcOfferingServiceMapDaoImpl.class);
 +        addDao("PrivateIpDao", PrivateIpDaoImpl.class);
 +        addDao("VpcGatewayDao", VpcGatewayDaoImpl.class);
 +        addDao("StaticRouteDao", StaticRouteDaoImpl.class);
+         addDao("TagsDao", ResourceTagsDaoImpl.class);
      }
  
      @Override
@@@ -400,9 -380,7 +395,10 @@@
          addManager("StorageNetworkManager", StorageNetworkManagerImpl.class);
          addManager("ExternalLoadBalancerUsageManager", ExternalLoadBalancerUsageManagerImpl.class);
          addManager("HA Manager", HighAvailabilityManagerImpl.class);
 +        addManager("VPC Manager", VpcManagerImpl.class);
 +        addManager("VpcVirtualRouterManager", VpcVirtualNetworkApplianceManagerImpl.class);
 +        addManager("NetworkACLManager", NetworkACLManagerImpl.class);
+         addManager("TaggedResourcesManager", TaggedResourceManagerImpl.class);
      }
  
      @Override

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/network/NetworkManager.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkManager.java
index 44652aa,2577440..cbf4cc8
--- a/server/src/com/cloud/network/NetworkManager.java
+++ b/server/src/com/cloud/network/NetworkManager.java
@@@ -154,8 -161,8 +154,10 @@@ public interface NetworkManager extend
  
      boolean destroyNetwork(long networkId, ReservationContext context);
  
-     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) throws ConcurrentOperationException,
InsufficientCapacityException, ResourceAllocationException;
 -    Network createGuestNetwork(long networkOfferingId, String name, String displayText,
String gateway, String cidr, String vlanId, String networkDomain, Account owner, boolean isSecurityGroupEnabled,
Long domainId,
 -            PhysicalNetwork physicalNetwork, long zoneId, ACLType aclType, Boolean subdomainAccess)
throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException;
++    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) 
++                    throws ConcurrentOperationException, InsufficientCapacityException,
ResourceAllocationException;
  
      /**
       * @throws ResourceAllocationException TODO

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkManagerImpl.java
index 02f79a9,1f306ab..8cc76da
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@@ -2932,20 -2548,25 +2929,26 @@@ public class NetworkManagerImpl impleme
              }
          }
  
-         // Don't allow to create network with vlan that already exists in the system
          if (vlanId != null) {
              String uri = "vlan://" + vlanId;
-             List<NetworkVO> networks = _networksDao.listBy(zoneId, uri);
-             if ((networks != null && !networks.isEmpty())) {
-             	// TBD: If zoneId and vlanId are being passed in as params, how to get the
VO object or class? Hard code
-             	// the tablename in a call to addProxyObject().
+             // For Isolated networks, don't allow to create network with vlan that already
exists in the zone
+             if (ntwkOff.getGuestType() == GuestType.Isolated) {
+                 if (_networksDao.countByZoneAndUri(zoneId, uri) > 0) {
 -                    throw new InvalidParameterValueException("Network with vlan " + vlanId
+ " already exists in zone " + zoneId);
 -                }
 +                throw new InvalidParameterValueException("Network with vlan " + vlanId +
" already exists in zone " + zoneId);
 +            }
+             } else {
+                 //don't allow to create Shared network with Vlan that already exists in
the zone for Isolated networks
+                 if (_networksDao.countByZoneUriAndGuestType(zoneId, uri, GuestType.Isolated)
> 0) {
+                     throw new InvalidParameterValueException("Isolated network with vlan
" + vlanId + " already exists " +
+                     		"in zone " + zoneId);
+                 }
 -            }
 +        }
+         }
+         
          // If networkDomain is not specified, take it from the global configuration
          if (areServicesSupportedByNetworkOffering(networkOfferingId, Service.Dns)) {
 -            Map<Network.Capability, String> dnsCapabilities = getNetworkOfferingServiceCapabilities(_configMgr.getNetworkOffering(networkOfferingId),
Service.Dns);
 +            Map<Network.Capability, String> dnsCapabilities = getNetworkOfferingServiceCapabilities
 +                    (_configMgr.getNetworkOffering(networkOfferingId), Service.Dns);
              String isUpdateDnsSupported = dnsCapabilities.get(Capability.AllowDnsSuffixModification);
              if (isUpdateDnsSupported == null || !Boolean.valueOf(isUpdateDnsSupported))
{
                  if (networkDomain != null) {
@@@ -3080,7 -2695,7 +3083,8 @@@
          boolean listAll = cmd.listAll();
          boolean isRecursive = cmd.isRecursive();
          Boolean specifyIpRanges = cmd.getSpecifyIpRanges();
 +        Long vpcId = cmd.getVpcId();
+         Boolean canUseForDeploy = cmd.canUseForDeploy();
  
          // 1) default is system to false if not specified
          // 2) reset parameter to false if it's specified by the regular user
@@@ -3226,15 -2837,40 +3230,41 @@@
                  }
              }
  
-             return supportedNetworks;
-         } else {
+             networksToReturn=supportedNetworks;
+         }
+         
+         if (canUseForDeploy != null) {
+             List<NetworkVO> networksForDeploy = new ArrayList<NetworkVO>();
+             for (NetworkVO network : networksToReturn) {
+                 if (canUseForDeploy(network) == canUseForDeploy) {
+                     networksForDeploy.add(network);
+                 }
+             }
+             
+             networksToReturn=networksForDeploy;
+         }
+         
 -        return networksToReturn;
 -    }
 +            return networksToReturn;
 +        }
+ 
+     @Override
+     public boolean canUseForDeploy(Network network) {
+         if (network.getTrafficType() != TrafficType.Guest) {
+             return false;
+         }
+         boolean hasFreeIps = true;
+         if (network.getGuestType() == GuestType.Shared) {
+             hasFreeIps = _ipAddressDao.countFreeIPsInNetwork(network.getId()) > 0;
+         } else {
+             hasFreeIps = (getAvailableIps(network, null)).size() > 0;
+         }
+        
+         return hasFreeIps;
      }
  
 -    private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO>
sb, String keyword, Long id, Boolean isSystem, Long zoneId, String guestIpType, String trafficType,
Long physicalNetworkId,
 -            String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean
specifyIpRanges) {
 +    private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO>
sb, String keyword, Long id, 
 +            Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long
physicalNetworkId,
 +            String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean
specifyIpRanges, Long vpcId) {
          SearchCriteria<NetworkVO> sc = sb.create();
  
          if (isSystem != null) {
@@@ -4758,29 -4354,15 +4788,15 @@@
  
      @Override
      @DB
 -    public String acquireGuestIpAddress(Network network, String requestedIp) {  
 +    public String acquireGuestIpAddress(Network network, String requestedIp) {
-         List<String> ips = _nicDao.listIpAddressInNetwork(network.getId());
-         String[] cidr = network.getCidr().split("/");
-         Set<Long> allPossibleIps = NetUtils.getAllIpsFromCidr(cidr[0], Integer.parseInt(cidr[1]));
-         Set<Long> usedIps = new TreeSet<Long>();
- 
          if (requestedIp != null && requestedIp.equals(network.getGateway())) {
              s_logger.warn("Requested ip address " + requestedIp + " is used as a gateway
address in network " + network);
              return null;
          }
  
-         for (String ip : ips) {
-             if (requestedIp != null && requestedIp.equals(ip)) {
-                 s_logger.warn("Requested ip address " + requestedIp + " is already in use
in network " + network);
-                 return null;
-             }
+         Set<Long> availableIps = getAvailableIps(network, requestedIp);
 -        
 +
-             usedIps.add(NetUtils.ip2Long(ip));
-         }
-         if (usedIps.size() != 0) {
-             allPossibleIps.removeAll(usedIps);
-         }
-         if (allPossibleIps.isEmpty()) {
+         if (availableIps.isEmpty()) {
              return null;
          }
  

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/network/dao/IPAddressDao.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/dao/IPAddressDao.java
index bc6d8f3,4e08643..981c6e7
--- a/server/src/com/cloud/network/dao/IPAddressDao.java
+++ b/server/src/com/cloud/network/dao/IPAddressDao.java
@@@ -54,10 -54,8 +54,10 @@@ public interface IPAddressDao extends G
  	public IPAddressVO findByIpAndDcId(long dcId, String ipAddress);
  
  	List<IPAddressVO> listByPhysicalNetworkId(long physicalNetworkId);
- 
- 	long countFreeIPs();
- 
 +	
-    List<IPAddressVO> listByAssociatedVpc(long vpcId, Boolean isSourceNat);
++	List<IPAddressVO> listByAssociatedVpc(long vpcId, Boolean isSourceNat);
  
+ 	long countFreePublicIPs();
+ 	
+ 	long countFreeIPsInNetwork(long networkId);
  }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/network/dao/IPAddressDaoImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/dao/IPAddressDaoImpl.java
index b2979b0,02615e3..eb81fb3
--- a/server/src/com/cloud/network/dao/IPAddressDaoImpl.java
+++ b/server/src/com/cloud/network/dao/IPAddressDaoImpl.java
@@@ -301,16 -300,12 +302,23 @@@ public class IPAddressDaoImpl extends G
      	sc.setJoinParameters("vlans", "vlanType", VlanType.VirtualNetwork);
          return customSearch(sc, null).get(0);       
      }
 -    
 +
      @Override
 +    public List<IPAddressVO> listByAssociatedVpc(long vpcId, Boolean isSourceNat)
{
 +        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
 +        sc.setParameters("vpcId", vpcId);
 +        
 +        if (isSourceNat != null) {
 +            sc.setParameters("sourceNat", isSourceNat);
 +        }
 +        
 +        return listBy(sc);
 +    }
++    
+     public long countFreeIPsInNetwork(long networkId) {
+         SearchCriteria<Long> sc = CountFreePublicIps.create();
+         sc.setParameters("state", State.Free);
+         sc.setParameters("networkId", networkId);
+         return customSearch(sc, null).get(0);       
+     }
  }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/network/dao/NetworkDao.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/network/dao/NetworkDaoImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/dao/NetworkDaoImpl.java
index 1d74fc1,acaece4..ae3cac8
--- a/server/src/com/cloud/network/dao/NetworkDaoImpl.java
+++ b/server/src/com/cloud/network/dao/NetworkDaoImpl.java
@@@ -120,8 -119,18 +122,18 @@@ public class NetworkDaoImpl extends Gen
          ZoneBroadcastUriSearch = createSearchBuilder();
          ZoneBroadcastUriSearch.and("dataCenterId", ZoneBroadcastUriSearch.entity().getDataCenterId(),
Op.EQ);
          ZoneBroadcastUriSearch.and("broadcastUri", ZoneBroadcastUriSearch.entity().getBroadcastUri(),
Op.EQ);
+         ZoneBroadcastUriSearch.and("guestType", ZoneBroadcastUriSearch.entity().getGuestType(),
Op.EQ);
          ZoneBroadcastUriSearch.done();
 -        
 +
+         CountByZoneAndURI = createSearchBuilder(Long.class);
+         CountByZoneAndURI.select(null, Func.COUNT, null);
+         CountByZoneAndURI.and("dataCenterId", CountByZoneAndURI.entity().getDataCenterId(),
Op.EQ);
+         CountByZoneAndURI.and("broadcastUri", CountByZoneAndURI.entity().getBroadcastUri(),
Op.EQ);
+         CountByZoneAndURI.and("guestType", CountByZoneAndURI.entity().getGuestType(), Op.EQ);
+ 
+         CountByZoneAndURI.done();
+         
+ 
          ZoneSecurityGroupSearch = createSearchBuilder();
          ZoneSecurityGroupSearch.and("dataCenterId", ZoneSecurityGroupSearch.entity().getDataCenterId(),
Op.EQ);
          SearchBuilder<NetworkServiceMapVO> join1 = _ntwkSvcMap.createSearchBuilder();
@@@ -315,8 -325,17 +329,17 @@@
          sc.setParameters("dataCenterId", zoneId);
          return search(sc, null);
      }
 -    
 +
      @Override
+     public long countByZoneUriAndGuestType(long zoneId, String broadcastUri, GuestType guestType)
{
+         SearchCriteria<Long> sc = CountByZoneAndURI.create();
+         sc.setParameters("dataCenterId", zoneId);
+         sc.setParameters("broadcastUri", broadcastUri);
+         sc.setParameters("guestType", guestType);
+         return customSearch(sc, null).get(0);
+     }
+ 
+     @Override
      public List<NetworkVO> listByZoneSecurityGroup(Long zoneId) {
          SearchCriteria<NetworkVO> sc = ZoneSecurityGroupSearch.create();
          if (zoneId != null) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/server/ConfigurationServerImpl.java
index 2917338,6b2c06d..f752d38
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@@ -583,18 -583,11 +583,11 @@@ public class ConfigurationServerImpl im
          }
          String already = _configDao.getValue("ssh.privatekey");
          String homeDir = null;
-         if (devel) {
-         	homeDir = Script.runSimpleBashScript("echo ~");
-         	if (homeDir == null) {
-         		throw new CloudRuntimeException("Cannot get home directory for account: cloud");
-         	}
-         } else {
-         	homeDir = Script.runSimpleBashScript("echo ~cloud");
+         homeDir = Script.runSimpleBashScript("echo ~" + username);
 -        if (homeDir == null) {
 +        	if (homeDir == null) {
-         		throw new CloudRuntimeException("Cannot get home directory for account: cloud");
-         	}
+             throw new CloudRuntimeException("Cannot get home directory for account: " +
username);
          }
 -
 +        
          if (s_logger.isInfoEnabled()) {
              s_logger.info("Processing updateKeyPairs");
          }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index af066ab,b33f270..839a312
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@@ -756,10 -751,11 +756,10 @@@ public class VirtualMachineManagerImpl 
                      Commands cmds = null;
                      vmGuru.finalizeVirtualMachineProfile(vmProfile, dest, ctx);
  
 -                    vmTO = hvGuru.implement(vmProfile);
 +                    VirtualMachineTO vmTO = hvGuru.implement(vmProfile);
  
                      cmds = new Commands(OnError.Stop);
-                     cmds.addCommand(new StartCommand(vmTO));
+                     cmds.addCommand(new StartCommand(vmTO, dest.getHost()));
  
                      vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx);
  

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/server/test/com/cloud/network/MockNetworkManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/setup/apidoc/gen_toc.py
----------------------------------------------------------------------
diff --cc setup/apidoc/gen_toc.py
index c544e9f,3775f9f..95ade58
--- a/setup/apidoc/gen_toc.py
+++ b/setup/apidoc/gen_toc.py
@@@ -116,9 -115,7 +116,10 @@@ known_categories = 
      'Project': 'Project',
      'Lun': 'Storage',
      'Pool': 'Pool',
 +    'VPC': 'VPC', 
 +    'PrivateGateway': 'VPC',
 +    'StaticRoute': 'VPC',
+     'Tags': 'Resource tags',
      }
  
  

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/634cd78b/setup/db/create-schema.sql
----------------------------------------------------------------------
diff --cc setup/db/create-schema.sql
index cc6b55c,afcee3f..fc5efe9
--- a/setup/db/create-schema.sql
+++ b/setup/db/create-schema.sql
@@@ -2141,121 -2133,21 +2141,138 @@@ CREATE TABLE  `cloud`.`netscaler_pod_re
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  
  
++<<<<<<< HEAD
 +CREATE TABLE `cloud`.`vpc` (
 +  `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
 +  `uuid` varchar(40) NOT NULL,
 +  `name` varchar(255) COMMENT 'vpc name',
 +  `display_text` varchar(255) COMMENT 'vpc display text',
 +  `cidr` varchar(18) COMMENT 'vpc cidr',
 +  `vpc_offering_id` bigint unsigned NOT NULL COMMENT 'vpc offering id that this vpc is created
from',
 +  `zone_id` bigint unsigned NOT NULL COMMENT 'the id of the zone this Vpc belongs to',
 +  `state` varchar(32) NOT NULL COMMENT 'state of the VP (can be Enabled and Disabled)',
 +  `domain_id` bigint unsigned NOT NULL COMMENT 'domain the vpc belongs to',
 +  `account_id` bigint unsigned NOT NULL COMMENT 'owner of this vpc',
 +  `network_domain` varchar(255) COMMENT 'network domain',
 +  `removed` datetime COMMENT 'date removed if not null',
 +  `created` datetime NOT NULL COMMENT 'date created',
 +  `restart_required` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if restart is required
for the VPC',
 +  PRIMARY KEY  (`id`),
 +  INDEX `i_vpc__removed`(`removed`),
 +  CONSTRAINT `fk_vpc__zone_id` FOREIGN KEY `fk_vpc__zone_id` (`zone_id`) REFERENCES `data_center`
(`id`) ON DELETE CASCADE,
 +  CONSTRAINT `fk_vpc__vpc_offering_id` FOREIGN KEY (`vpc_offering_id`) REFERENCES `vpc_offerings`(`id`),

 +  CONSTRAINT `fk_vpc__account_id` FOREIGN KEY `fk_vpc__account_id` (`account_id`) REFERENCES
`account`(`id`) ON DELETE CASCADE,
 +  CONSTRAINT `fk_vpc__domain_id` FOREIGN KEY `fk_vpc__domain_id` (`domain_id`) REFERENCES
`domain`(`id`) ON DELETE CASCADE
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
 +
 +CREATE TABLE `cloud`.`vpc_offerings` (
 +  `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
 +  `uuid` varchar(40) NOT NULL,
 +  `unique_name` varchar(64) UNIQUE COMMENT 'unique name of the vpc offering',
 +  `name` varchar(255) COMMENT 'vpc name',
 +  `display_text` varchar(255) COMMENT 'display text',
 +  `state` char(32) COMMENT 'state of the vpc offering that has Disabled value by default',
 +  `default` int(1) unsigned NOT NULL DEFAULT 0 COMMENT '1 if vpc offering is default',
 +  `removed` datetime COMMENT 'date removed if not null',
 +  `created` datetime NOT NULL COMMENT 'date created',
 +  `service_offering_id` bigint unsigned COMMENT 'service offering id that virtual router
is tied to',
 +  PRIMARY KEY  (`id`),
 +  INDEX `i_vpc__removed`(`removed`),
 +  CONSTRAINT `fk_vpc_offerings__service_offering_id` FOREIGN KEY `fk_vpc_offerings__service_offering_id`
(`service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
 +CREATE TABLE  `cloud`.`vpc_offering_service_map` (
 +  `id` bigint unsigned NOT NULL auto_increment,
 +  `vpc_offering_id` bigint unsigned NOT NULL COMMENT 'vpc_offering_id',
 +  `service` varchar(255) NOT NULL COMMENT 'service',
 +  `provider` varchar(255) COMMENT 'service provider',
 +  `created` datetime COMMENT 'date created',
 +  PRIMARY KEY (`id`),
 +  CONSTRAINT `fk_vpc_offering_service_map__vpc_offering_id` FOREIGN KEY(`vpc_offering_id`)
REFERENCES `vpc_offerings`(`id`) ON DELETE CASCADE,
 +  UNIQUE (`vpc_offering_id`, `service`, `provider`)
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
 +
 +CREATE TABLE `cloud`.`router_network_ref` (
 +  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
 +  `router_id` bigint unsigned NOT NULL COMMENT 'router id',
 +  `network_id` bigint unsigned NOT NULL COMMENT 'network id',
 +  `guest_type` char(32) COMMENT 'type of guest network that can be shared or isolated',
 +  PRIMARY KEY (`id`),
 +  CONSTRAINT `fk_router_network_ref__router_id` FOREIGN KEY (`router_id`) REFERENCES `domain_router`(`id`)
ON DELETE CASCADE,
 +  CONSTRAINT `fk_router_network_ref__networks_id` FOREIGN KEY (`network_id`) REFERENCES
`networks`(`id`) ON DELETE CASCADE,
 +  UNIQUE `i_router_network_ref__router_id__network_id`(`router_id`, `network_id`)
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
 +
 +CREATE TABLE `cloud`.`vpc_gateways` (
 +  `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id',
 +  `uuid` varchar(40),
 +  `ip4_address` char(40) COMMENT 'ip4 address of the gateway',
 +  `netmask` varchar(15) COMMENT 'netmask of the gateway',
 +  `gateway` varchar(15) COMMENT 'gateway',
 +  `vlan_tag` varchar(255),
 +  `type` varchar(32) COMMENT 'type of gateway; can be Public/Private/Vpn',
 +  `network_id` bigint unsigned NOT NULL COMMENT 'network id vpc gateway belongs to',
 +  `vpc_id` bigint unsigned NOT NULL COMMENT 'id of the vpc the gateway belongs to',
 +  `zone_id` bigint unsigned NOT NULL COMMENT 'id of the zone the gateway belongs to',
 +  `created` datetime COMMENT 'date created',
 +  `removed` datetime COMMENT 'date removed if not null',
 +  PRIMARY KEY (`id`),
 +  CONSTRAINT `fk_vpc_gateways__network_id` FOREIGN KEY `fk_vpc_gateways__network_id`(`network_id`)
REFERENCES `networks`(`id`),
 +  CONSTRAINT `fk_vpc_gateways__vpc_id` FOREIGN KEY `fk_vpc_gateways__vpc_id`(`vpc_id`) REFERENCES
`vpc`(`id`),
 +  CONSTRAINT `fk_vpc_gateways__zone_id` FOREIGN KEY `fk_vpc_gateways__zone_id`(`zone_id`)
REFERENCES `data_center`(`id`),
 +  CONSTRAINT `uc_vpc_gateways__uuid` UNIQUE (`uuid`),
 +  INDEX `i_vpc_gateways__removed`(`removed`)
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
 +CREATE TABLE `cloud`.`private_ip_address` (
 +  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',
 +  `ip_address` char(40) NOT NULL COMMENT 'ip address',
 +  `network_id` bigint unsigned NOT NULL COMMENT 'id of the network ip belongs to',
 +  `reservation_id` char(40) COMMENT 'reservation id',
 +  `mac_address` varchar(17) COMMENT 'mac address',
 +  `taken` datetime COMMENT 'Date taken',
 +  PRIMARY KEY (`id`),
 +  CONSTRAINT `fk_private_ip_address__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`
(`id`) ON DELETE CASCADE
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
 +
 +CREATE TABLE `cloud`.`static_routes` (
 +  `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
 +  `uuid` varchar(40),
 +  `vpc_gateway_id` bigint unsigned COMMENT 'id of the corresponding ip address',
 +  `cidr` varchar(18) COMMENT 'cidr for the static route', 
 +  `state` char(32) NOT NULL COMMENT 'current state of this rule',
 +  `vpc_id` bigint unsigned COMMENT 'vpc the firewall rule is associated with',
 +  `account_id` bigint unsigned NOT NULL COMMENT 'owner id',
 +  `domain_id` bigint unsigned NOT NULL COMMENT 'domain id',
 +  `created` datetime COMMENT 'Date created',
 +  PRIMARY KEY  (`id`),
 +  CONSTRAINT `fk_static_routes__vpc_gateway_id` FOREIGN KEY(`vpc_gateway_id`) REFERENCES
`vpc_gateways`(`id`) ON DELETE CASCADE,
 +  CONSTRAINT `fk_static_routes__vpc_id` FOREIGN KEY (`vpc_id`) REFERENCES `vpc`(`id`) ON
DELETE CASCADE,
 +  CONSTRAINT `fk_static_routes__account_id` FOREIGN KEY(`account_id`) REFERENCES `account`(`id`)
ON DELETE CASCADE,
 +  CONSTRAINT `fk_static_routes__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`)
ON DELETE CASCADE,
 +  CONSTRAINT `uc_static_routes__uuid` UNIQUE (`uuid`)
 +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 +
+ CREATE TABLE `cloud`.`resource_tags` (
+   `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
+   `uuid` varchar(40),
+   `key` varchar(255),
+   `value` varchar(255),
+   `resource_id` bigint unsigned NOT NULL,
+   `resource_type` varchar(255),
+   `customer` varchar(255),
+   `domain_id` bigint unsigned NOT NULL COMMENT 'foreign key to domain id',
+   `account_id` bigint unsigned NOT NULL COMMENT 'owner of this network',
+   PRIMARY KEY (`id`),
+   CONSTRAINT `fk_tags__account_id` FOREIGN KEY(`account_id`) REFERENCES `account`(`id`),
+   CONSTRAINT `fk_tags__domain_id` FOREIGN KEY(`domain_id`) REFERENCES `domain`(`id`),
+   UNIQUE `i_tags__resource_id__resource_type__key`(`resource_id`, `resource_type`, `key`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ 
  
  SET foreign_key_checks = 1;
 +


Mime
View raw message