cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [49/50] [abbrv] Merge from master
Date Tue, 18 Jun 2013 03:07:14 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index ab66bb0,8da5176..81eebe4
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@@ -3168,9 -3185,16 +3178,16 @@@ public class VirtualNetworkApplianceMan
                  String vlanId = ipAddr.getVlanTag();
                  String vlanGateway = ipAddr.getGateway();
                  String vlanNetmask = ipAddr.getNetmask();
-                 String vifMacAddress = ipAddr.getMacAddress();
+                 String vifMacAddress = null;
+                 // For non-source nat IP, set the mac to be something based on first public
nic's MAC
+                 // We cannot depends on first ip because we need to deal with first ip of
other nics
+                 if (!ipAddr.isSourceNat() && ipAddr.getVlanId() != 0) {
+                 	vifMacAddress = NetUtils.generateMacOnIncrease(baseMac, ipAddr.getVlanId());
+                 } else {
+                 	vifMacAddress = ipAddr.getMacAddress();
+                 }
  
 -                IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(),
add, firstIP, 
 +                IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(),
add, firstIP,
                          sourceNat, vlanId, vlanGateway, vlanNetmask, vifMacAddress, networkRate,
ipAddr.isOneToOneNat());
  
                  ip.setTrafficType(network.getTrafficType());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/server/ManagementServerImpl.java
index 52d573d,dea761d..2c20bc6
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@@ -965,32 -1006,12 +968,12 @@@ public class ManagementServerImpl exten
          Object hypervisorType = cmd.getHypervisorType();
          Object clusterType = cmd.getClusterType();
          Object allocationState = cmd.getAllocationState();
-         String zoneType = cmd.getZoneType();
          String keyword = cmd.getKeyword();
-         zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(),
zoneId);
--
-         
-     	Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(),
cmd.getPageSizeVal());
-         
-         SearchBuilder<ClusterVO> sb = _clusterDao.createSearchBuilder();
-         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-         sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
-         sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-         sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
-         sb.and("clusterType", sb.entity().getClusterType(), SearchCriteria.Op.EQ);
-         sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
-         
-         if(zoneType != null) {
-             SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-             zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
-             sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(),
JoinBuilder.JoinType.INNER);
-         }
 -        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(),
zoneId);
 -
 +        
++        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(),
zoneId);
 +        
-         SearchCriteria<ClusterVO> sc = sb.create();
          if (id != null) {
-             sc.setParameters("id", id);
+             sc.addAnd("id", SearchCriteria.Op.EQ, id);
          }
  
          if (name != null) {
@@@ -1436,24 -1456,9 +1418,9 @@@
          Long zoneId = cmd.getZoneId();
          Object keyword = cmd.getKeyword();
          Object allocationState = cmd.getAllocationState();
-         String zoneType = cmd.getZoneType();
-         zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(),
zoneId);
  
-     	
-     	Filter searchFilter = new Filter(HostPodVO.class, "dataCenterId", true, cmd.getStartIndex(),
cmd.getPageSizeVal());
-         SearchBuilder<HostPodVO> sb = _hostPodDao.createSearchBuilder();
-         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-         sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
-         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-         sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
-         
-         if(zoneType != null) {
-             SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-             zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
-             sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(),
JoinBuilder.JoinType.INNER);
-         }
 -        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(),
zoneId);
 -
++        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(),
zoneId);
 +               
-         SearchCriteria<HostPodVO> sc = sb.create();
          if (keyword != null) {
              SearchCriteria<HostPodVO> ssc = _hostPodDao.createSearchCriteria();
              ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
@@@ -3072,8 -3077,7 +3035,7 @@@
      @Override
      public Pair<List<? extends VirtualMachine>, Integer> searchForSystemVm(ListSystemVMsCmd
cmd) {
          String type = cmd.getSystemVmType();
 -        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(),
cmd.getZoneId());
 +        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(),
cmd.getZoneId());
-         String zoneType = cmd.getZoneType();
          Long id = cmd.getId();
          String name = cmd.getSystemVmName();
          String state = cmd.getState();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 6e218f8,c720169..0c78c4c
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@@ -572,10 -571,10 +571,10 @@@ public class SnapshotManagerImpl extend
          String keyword = cmd.getKeyword();
          String snapshotTypeStr = cmd.getSnapshotType();
          String intervalTypeStr = cmd.getIntervalType();
-         String zoneType = cmd.getZoneType();
          Map<String, String> tags = cmd.getTags();
+         Long zoneId = cmd.getZoneId();
          
 -        Account caller = UserContext.current().getCaller();
 +        Account caller = CallContext.current().getCallingAccount();
          List<Long> permittedAccounts = new ArrayList<Long>();
  
          // Verify parameters
@@@ -602,25 -601,20 +601,20 @@@
          sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
          sb.and("snapshotTypeEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.IN);
          sb.and("snapshotTypeNEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.NEQ);
+         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
          
          if (tags != null && !tags.isEmpty()) {
 -        SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
 -        for (int count=0; count < tags.size(); count++) {
 -            tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(),
SearchCriteria.Op.EQ);
 -            tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(),
SearchCriteria.Op.EQ);
 -            tagSearch.cp();
 -        }
 -        tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
 -        sb.groupBy(sb.entity().getId());
 -        sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(),
JoinBuilder.JoinType.INNER);
 -    }
 +            SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
 +            for (int count=0; count < tags.size(); count++) {
 +                tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(),
SearchCriteria.Op.EQ);
 +                tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(),
SearchCriteria.Op.EQ);
 +                tagSearch.cp();
 +            }
 +            tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
 +            sb.groupBy(sb.entity().getId());
 +            sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(),
JoinBuilder.JoinType.INNER);
 +        }
  
-         if(zoneType != null) {
-             SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-             zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
   
-             sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(),
JoinBuilder.JoinType.INNER);
-         }
-         
          SearchCriteria<SnapshotVO> sc = sb.create();
          _accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts,
listProjectResourcesCriteria);
  
@@@ -638,10 -632,10 +632,10 @@@
              }
          }
  
-         if(zoneType != null) {
-             sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);          
+         if (zoneId != null) {
+             sc.setParameters("dataCenterId", zoneId);
          }
 -
 +        
          if (name != null) {
              sc.setParameters("name", "%" + name + "%");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index 1902b3a,4696bb5..3f9d533
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@@ -57,6 -55,8 +56,7 @@@ import com.cloud.user.User
  import com.cloud.utils.DateUtil;
  import com.cloud.utils.DateUtil.IntervalType;
  import com.cloud.utils.NumbersUtil;
 -
+ import com.cloud.utils.component.ComponentContext;
  import com.cloud.utils.component.ManagerBase;
  import com.cloud.utils.concurrency.TestClock;
  import com.cloud.utils.db.DB;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/vm/UserVmManagerImpl.java
index d37ef95,e8ea024..32ba298
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@@ -3407,6 -3393,10 +3379,10 @@@ public class UserVmManagerImpl extends 
  
      @Override
      public void collectVmDiskStatistics (UserVmVO userVm) {
+         // support KVM and XenServer only
+         if (!userVm.getHypervisorType().equals(HypervisorType.XenServer)
+                 && !userVm.getHypervisorType().equals(HypervisorType.KVM))
 -            return;        
++            return;
      	// Collect vm disk statistics from host before stopping Vm
      	long hostId = userVm.getHostId();
      	List<String> vmNames = new ArrayList<String>();
@@@ -3905,8 -3895,12 +3881,11 @@@
                              + " already has max Running VMs(count includes system VMs),
cannot migrate to this host");
          }
  
-         collectVmDiskStatistics(vm);
+         UserVmVO uservm = _vmDao.findById(vmId);
+         if (uservm != null) {
+             collectVmDiskStatistics(uservm);
+         }
 -        VMInstanceVO migratedVm = _itMgr.migrate(vm, srcHostId, dest);
 -        return migratedVm;
 +        return _itMgr.migrate(vm.getUuid(), srcHostId, dest);
      }
  
      private boolean checkIfHostIsDedicated(HostVO host) {
@@@ -4634,4 -4684,24 +4605,23 @@@
          if (vm.getState() == State.Running)
              collectVmDiskStatistics(vm);
      }
+     
+     private void encryptAndStorePassword(UserVmVO vm, String password) {
+         String sshPublicKey = vm.getDetail("SSH.PublicKey");
+         if (sshPublicKey != null && !sshPublicKey.equals("")
+                 && password != null && !password.equals("saved_password"))
{
+             if (!sshPublicKey.startsWith("ssh-rsa")) {
+                 s_logger.warn("Only RSA public keys can be used to encrypt a vm password.");
+                 return;
+             }
+             String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(
+                     sshPublicKey, password);
+             if (encryptedPasswd == null) {
+                 throw new CloudRuntimeException("Error encrypting password");
+             }
+ 
+             vm.setDetail("Encrypted.Password", encryptedPasswd);
+             _vmDao.saveDetails(vm);
+         }
+     }
 -
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------


Mime
View raw message