cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mlsoren...@apache.org
Subject [1/3] git commit: updated refs/heads/resize-root to 4a21da6
Date Sat, 08 Mar 2014 00:20:59 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/resize-root caf9de61a -> 4a21da6b7


rootdisksize: fail earlier when template size is greater than specified rootdisksize


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/25084167
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/25084167
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/25084167

Branch: refs/heads/resize-root
Commit: 2508416789cf8d5d1070e538cef1a97ccb308276
Parents: 974fc4e
Author: Marcus Sorensen <marcus@betterservers.com>
Authored: Sun Feb 9 07:31:01 2014 -0700
Committer: Marcus Sorensen <marcus@betterservers.com>
Committed: Sun Feb 9 07:31:01 2014 -0700

----------------------------------------------------------------------
 debian/rules                                   |  2 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java | 16 ++++++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25084167/debian/rules
----------------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
index 4edf893..197e243 100755
--- a/debian/rules
+++ b/debian/rules
@@ -35,7 +35,7 @@ build: build-indep
 build-indep: build-indep-stamp
 
 build-indep-stamp: configure
-	mvn clean package -Pawsapi -DskipTests -Dsystemvm \
+	mvn -T C1.5 clean package -Pawsapi -DskipTests -Dsystemvm \
         -Dcs.replace.properties=replace.properties.tmp \
 		${ACS_BUILD_OPTS}
 	touch $@

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25084167/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 72a80a9..48166f3 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -2835,17 +2835,29 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
                     vm.setIsoId(template.getId());
                 }
                 Long rootDiskSize = null;
+                // custom root disk size, resizes base template to larger size
                 if (customParameters.containsKey("rootdisksize")) {
                     if (NumbersUtil.parseLong(customParameters.get("rootdisksize"), -1) <=
0) {
                         throw new InvalidParameterValueException("rootdisk size should be
a non zero number.");
                     }
+                    rootDiskSize = Long.parseLong(customParameters.get("rootdisksize"));
+
                     // only KVM supports rootdisksize override
                     if (hypervisor != HypervisorType.KVM) {
                         throw new InvalidParameterValueException("Hypervisor " + hypervisor
+ " does not support rootdisksize override");
                     }
 
-                    s_logger.debug("found root disk size of " + customParameters.get("rootdisksize"));
-                    rootDiskSize = Long.parseLong(customParameters.get("rootdisksize"));
+                    // rotdisksize must be larger than template
+                    VMTemplateVO templateVO = _templateDao.findById(template.getId());
+                    if (templateVO == null) {
+                        throw new InvalidParameterValueException("Unable to look up template
by id " + template.getId());
+                    }
+
+                    if ((rootDiskSize << 30) < templateVO.getSize()) {
+                        throw new InvalidParameterValueException("unsupported: rootdisksize
override is smaller than template size " + templateVO.getSize());
+                    }
+
+                    s_logger.debug("found root disk size of " + rootDiskSize);
                     customParameters.remove("rootdisksize");
                 }
 


Mime
View raw message