You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2013/10/29 23:21:19 UTC

[1/2] git commit: updated refs/heads/master to 5bcd828

Updated Branches:
  refs/heads/master 8a37f40c0 -> 5bcd8280f


fixed m2eclipse error


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

Branch: refs/heads/master
Commit: 5bcd8280fdd1e9039a6bf6c4c4fd43b8b49f938e
Parents: 4f8781f
Author: Anthony Xu <an...@citrix.com>
Authored: Tue Oct 29 15:19:15 2013 -0700
Committer: Anthony Xu <an...@citrix.com>
Committed: Tue Oct 29 15:20:49 2013 -0700

----------------------------------------------------------------------
 agent/pom.xml                            | 139 +++++++++++++-------------
 plugins/hypervisors/kvm/pom.xml          |  62 ++++++------
 plugins/user-authenticators/ldap/pom.xml | 128 ++++++++++++------------
 usage/pom.xml                            | 138 ++++++++++++-------------
 4 files changed, 237 insertions(+), 230 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5bcd8280/agent/pom.xml
----------------------------------------------------------------------
diff --git a/agent/pom.xml b/agent/pom.xml
index 1413322..ec1ddde 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -46,74 +46,75 @@
     </dependency>    
   </dependencies>
   <build>
-    <plugins>
-      <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>generate-resource</id>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <target>
-                <copy
-                  todir="${basedir}/target/transformed">
-                  <fileset dir="${basedir}/conf">
-                    <include name="agent.properties" />
-                  </fileset>
-                </copy>
-                <copy overwrite="true"
-                  todir="${basedir}/target/transformed">
-                  <fileset dir="${basedir}/conf">
-                    <include name="*.in" />
-                  </fileset>
-                  <globmapper from="*.in" to="*" />
-                  <filterchain>
-                    <filterreader
-                      classname="org.apache.tools.ant.filters.ReplaceTokens">
-                      <param type="propertiesfile"
-                        value="${cs.replace.properties}" />
-                    </filterreader>
-                  </filterchain>
-                </copy>
-                <copy overwrite="true"
-                  todir="${basedir}/target/transformed">
-                  <fileset dir="${basedir}/bindir">
-                    <include name="*.in" />
-                  </fileset>
-                  <globmapper from="*.in" to="*" />
-                  <filterchain>
-                    <filterreader
-                      classname="org.apache.tools.ant.filters.ReplaceTokens">
-                      <param type="propertiesfile"
-                        value="${cs.replace.properties}" />
-                    </filterreader>
-                  </filterchain>
-                </copy>
-              </target>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
-            <goals>
-              <goal>copy-dependencies</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
-              <includeScope>runtime</includeScope>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-antrun-plugin</artifactId>
+          <executions>
+            <execution>
+              <id>generate-resource</id>
+              <phase>generate-resources</phase>
+              <goals>
+                <goal>run</goal>
+              </goals>
+              <configuration>
+                <target>
+                  <copy todir="${basedir}/target/transformed">
+                    <fileset dir="${basedir}/conf">
+                      <include name="agent.properties" />
+                    </fileset>
+                  </copy>
+                  <copy overwrite="true"
+                    todir="${basedir}/target/transformed">
+                    <fileset dir="${basedir}/conf">
+                      <include name="*.in" />
+                    </fileset>
+                    <globmapper from="*.in" to="*" />
+                    <filterchain>
+                      <filterreader
+                        classname="org.apache.tools.ant.filters.ReplaceTokens">
+                        <param type="propertiesfile"
+                          value="${cs.replace.properties}" />
+                      </filterreader>
+                    </filterchain>
+                  </copy>
+                  <copy overwrite="true"
+                    todir="${basedir}/target/transformed">
+                    <fileset dir="${basedir}/bindir">
+                      <include name="*.in" />
+                    </fileset>
+                    <globmapper from="*.in" to="*" />
+                    <filterchain>
+                      <filterreader
+                        classname="org.apache.tools.ant.filters.ReplaceTokens">
+                        <param type="propertiesfile"
+                           value="${cs.replace.properties}" />
+                      </filterreader>
+                    </filterchain>
+                  </copy>
+                </target>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <executions>
+            <execution>
+              <id>copy-dependencies</id>
+              <phase>package</phase>
+              <goals>
+                <goal>copy-dependencies</goal>
+              </goals>
+              <configuration>
+                <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
+                <includeScope>runtime</includeScope>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
   </build>
 </project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5bcd8280/plugins/hypervisors/kvm/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml
index e279621..0c0001f 100644
--- a/plugins/hypervisors/kvm/pom.xml
+++ b/plugins/hypervisors/kvm/pom.xml
@@ -58,35 +58,37 @@
     <defaultGoal>install</defaultGoal>
     <sourceDirectory>src</sourceDirectory>
     <testSourceDirectory>test</testSourceDirectory>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <version>2.5.1</version>
-        <executions>
-          <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
-            <goals>
-              <goal>copy-dependencies</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
-              <includeScope>runtime</includeScope>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.14</version>
-        <configuration>
-          <excludes>
-            <exclude>**/Qemu*.java</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <version>2.5.1</version>
+          <executions>
+            <execution>
+              <id>copy-dependencies</id>
+              <phase>package</phase>
+              <goals>
+                <goal>copy-dependencies</goal>
+              </goals>
+              <configuration>
+                <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
+                <includeScope>runtime</includeScope>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.14</version>
+          <configuration>
+            <excludes>
+              <exclude>**/Qemu*.java</exclude>
+            </excludes>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
   </build>
 </project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5bcd8280/plugins/user-authenticators/ldap/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/pom.xml b/plugins/user-authenticators/ldap/pom.xml
index 1f9dea0..5ecb45c 100644
--- a/plugins/user-authenticators/ldap/pom.xml
+++ b/plugins/user-authenticators/ldap/pom.xml
@@ -20,76 +20,78 @@
   </parent>
 
   <build>
-    <plugins>
-      <plugin>
-        <groupId>org.codehaus.gmaven</groupId>
-        <artifactId>gmaven-plugin</artifactId>
-        <version>1.3</version>
-        <configuration>
-          <providerSelection>1.7</providerSelection>
-        </configuration>
-        <executions>
-          <execution>
-            <goals>
-              <goal>compile</goal>
-              <goal>testCompile</goal>
-            </goals>
-            <configuration>
-              <sources>
-                <fileset>
-                  <directory>test/groovy</directory>
-                  <includes>
-                    <include>**/*.groovy</include>
-                  </includes>
-                </fileset>
-              </sources>
-            </configuration>
-          </execution>
-        </executions>
-        <dependencies>
-          <dependency>
-            <groupId>org.codehaus.gmaven.runtime</groupId>
-            <artifactId>gmaven-runtime-1.7</artifactId>
-            <version>1.3</version>
-            <exclusions>
-              <exclusion>
-                <groupId>org.codehaus.groovy</groupId>
-                <artifactId>groovy-all</artifactId>
-              </exclusion>
-            </exclusions>
-          </dependency>
-          <dependency>
-            <groupId>org.codehaus.groovy</groupId>
-            <artifactId>groovy-all</artifactId>
-            <version>2.0.5</version>
-          </dependency>
-        </dependencies>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <includes>
-            <include>**/*Spec*</include>
-          </includes>
-        </configuration>
-      </plugin>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.codehaus.gmaven</groupId>
+          <artifactId>gmaven-plugin</artifactId>
+          <version>1.3</version>
+          <configuration>
+            <providerSelection>1.7</providerSelection>
+          </configuration>
+          <executions>
+            <execution>
+              <goals>
+                <goal>compile</goal>
+                <goal>testCompile</goal>
+              </goals>
+              <configuration>
+                <sources>
+                  <fileset>
+                    <directory>test/groovy</directory>
+                    <includes>
+                      <include>**/*.groovy</include>
+                    </includes>
+                  </fileset>
+                </sources>
+              </configuration>
+            </execution>
+          </executions>
+          <dependencies>
+            <dependency>
+              <groupId>org.codehaus.gmaven.runtime</groupId>
+              <artifactId>gmaven-runtime-1.7</artifactId>
+              <version>1.3</version>
+              <exclusions>
+                <exclusion>
+                  <groupId>org.codehaus.groovy</groupId>
+                  <artifactId>groovy-all</artifactId>
+                </exclusion>
+              </exclusions>
+            </dependency>
+            <dependency>
+              <groupId>org.codehaus.groovy</groupId>
+              <artifactId>groovy-all</artifactId>
+              <version>2.0.5</version>
+            </dependency>
+          </dependencies>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <includes>
+              <include>**/*Spec*</include>
+            </includes>
+          </configuration>
+        </plugin>
 
-      <plugin>
-        <groupId>com.btmatthews.maven.plugins</groupId>
-        <artifactId>ldap-maven-plugin</artifactId>
-        <version>1.1.0</version>
-        <configuration>
-          <monitorPort>11389</monitorPort>
+        <plugin>
+          <groupId>com.btmatthews.maven.plugins</groupId>
+          <artifactId>ldap-maven-plugin</artifactId>
+          <version>1.1.0</version>
+          <configuration>
+            <monitorPort>11389</monitorPort>
             <monitorKey>ldap</monitorKey>
             <daemon>false</daemon>
             <rootDn>dc=cloudstack,dc=org</rootDn>
             <ldapPort>10389</ldapPort>
             <ldifFile>test/resources/cloudstack.org.ldif</ldifFile>
-        </configuration>
-      </plugin>
+          </configuration>
+        </plugin>
 
-    </plugins>
+      </plugins>
+    </pluginManagement>
   </build>
 
   <dependencies>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5bcd8280/usage/pom.xml
----------------------------------------------------------------------
diff --git a/usage/pom.xml b/usage/pom.xml
index 04d1630..19929d6 100644
--- a/usage/pom.xml
+++ b/usage/pom.xml
@@ -51,74 +51,76 @@
         <directory>resources</directory>
       </resource>
     </resources>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-surefire-plugin</artifactId>
-        <configuration>
-          <excludes>
-            <exclude>com/cloud/usage/UsageManagerTest.java</exclude>
-          </excludes>
-        </configuration>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>copy-dependencies</id>
-            <phase>package</phase>
-            <goals>
-              <goal>copy-dependencies</goal>
-            </goals>
-            <configuration>
-              <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
-              <includeScope>runtime</includeScope>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      <plugin>
-        <artifactId>maven-antrun-plugin</artifactId>
-        <executions>
-          <execution>
-            <id>generate-resource</id>
-            <phase>generate-resources</phase>
-            <goals>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <target>
-                <copy overwrite="true" todir="${basedir}/target/transformed">
-                  <fileset dir="${basedir}/../client/tomcatconf">
-                    <include name="**/db.properties.in" />
-                  </fileset>
-                  <globmapper from="*.in" to="*" />
-                  <filterchain>
-                    <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
-                      <param type="propertiesfile" value="${cs.replace.properties}" />
-                    </filterreader>
-                  </filterchain>
-                </copy>
-              </target>
-              <target>
-                <copy overwrite="true" todir="${basedir}/target/transformed">
-                  <fileset dir="${basedir}/conf">
-                    <include name="*.in" />
-                  </fileset>
-                  <globmapper from="*.in" to="*" />
-                  <filterchain>
-                    <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
-                      <param type="propertiesfile" value="${cs.replace.properties}" />
-                    </filterreader>
-                  </filterchain>
-                </copy>
-              </target>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <excludes>
+              <exclude>com/cloud/usage/UsageManagerTest.java</exclude>
+            </excludes>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <executions>
+            <execution>
+              <id>copy-dependencies</id>
+              <phase>package</phase>
+              <goals>
+                <goal>copy-dependencies</goal>
+              </goals>
+              <configuration>
+                <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
+                <includeScope>runtime</includeScope>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <artifactId>maven-antrun-plugin</artifactId>
+          <executions>
+            <execution>
+              <id>generate-resource</id>
+              <phase>generate-resources</phase>
+              <goals>
+                <goal>run</goal>
+              </goals>
+              <configuration>
+                <target>
+                  <copy overwrite="true" todir="${basedir}/target/transformed">
+                    <fileset dir="${basedir}/../client/tomcatconf">
+                      <include name="**/db.properties.in" />
+                    </fileset>
+                    <globmapper from="*.in" to="*" />
+                    <filterchain>
+                      <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
+                        <param type="propertiesfile" value="${cs.replace.properties}" />
+                      </filterreader>
+                    </filterchain>
+                  </copy>
+                </target>
+                <target>
+                  <copy overwrite="true" todir="${basedir}/target/transformed">
+                    <fileset dir="${basedir}/conf">
+                      <include name="*.in" />
+                    </fileset>
+                    <globmapper from="*.in" to="*" />
+                    <filterchain>
+                      <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
+                        <param type="propertiesfile" value="${cs.replace.properties}" />
+                      </filterreader>
+                    </filterchain>
+                  </copy>
+                </target>
+              </configuration>
+            </execution>
+          </executions>
+        </plugin>
+      </plugins>
+    </pluginManagement>
   </build>
   <profiles>
     <profile>


[2/2] git commit: updated refs/heads/master to 5bcd828

Posted by an...@apache.org.
CLOUDSTACK-4976
     merge createVmFromTemplate in XSFP1 to CitrixResourceBase instead of fixing one bug in two different place.

Anthony


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

Branch: refs/heads/master
Commit: 4f8781f681b9dde979521b384e52f3c195f37dfe
Parents: 8a37f40
Author: Anthony Xu <an...@citrix.com>
Authored: Tue Oct 29 14:01:46 2013 -0700
Committer: Anthony Xu <an...@citrix.com>
Committed: Tue Oct 29 15:20:49 2013 -0700

----------------------------------------------------------------------
 .../xen/resource/CitrixResourceBase.java        | 135 ++++++++++++-------
 .../xen/resource/XenServer56FP1Resource.java    | 133 ------------------
 2 files changed, 86 insertions(+), 182 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f8781f6/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 6c1efe7..3323a15 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -174,6 +174,7 @@ import com.cloud.agent.api.to.VolumeTO;
 import com.cloud.exception.InternalErrorException;
 import com.cloud.host.Host.Type;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.hypervisor.xen.resource.CitrixHelper;
 import com.cloud.network.HAProxyConfigurator;
 import com.cloud.network.LoadBalancerConfigurator;
 import com.cloud.network.Networks;
@@ -1249,69 +1250,108 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 
         return vbd;
     }
+    
+
+    public long getStaticMax(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        return dynamicMaxRam;
+    }
+
+    public long getStaticMin(String os, boolean b, long dynamicMinRam, long dynamicMaxRam){
+        return dynamicMinRam;
+    }
 
     protected VM createVmFromTemplate(Connection conn, VirtualMachineTO vmSpec, Host host) throws XenAPIException, XmlRpcException {
         String guestOsTypeName = getGuestOsType(vmSpec.getOs(), vmSpec.getBootloader() == BootloaderType.CD);
-        if ( guestOsTypeName == null ) {
-            String msg =  " Hypervisor " + this.getClass().getName() + " doesn't support guest OS type " + vmSpec.getOs()
-                    + ". you can choose 'Other install media' to run it as HVM";
-            s_logger.warn(msg);
-            throw new CloudRuntimeException(msg);
-        }
         Set<VM> templates = VM.getByNameLabel(conn, guestOsTypeName);
         assert templates.size() == 1 : "Should only have 1 template but found " + templates.size();
-        if (!templates.iterator().hasNext()) {
-            throw new CloudRuntimeException("No matching OS type found for starting a [" + vmSpec.getOs()
-                    + "] VM on host " + host.getHostname(conn));
-        }
         VM template = templates.iterator().next();
-        VM vm = template.createClone(conn, vmSpec.getName());
-        VM.Record vmr = vm.getRecord(conn);
-        if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Created VM " + vmr.uuid + " for " + vmSpec.getName());
+
+        VM.Record vmr = template.getRecord(conn);
+        vmr.affinity = host;
+        vmr.otherConfig.remove("disks");
+        vmr.otherConfig.remove("default_template");
+        vmr.otherConfig.remove("mac_seed");
+        vmr.isATemplate = false;
+        vmr.nameLabel = vmSpec.getName();
+        vmr.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
+        vmr.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
+
+        if (isDmcEnabled(conn, host) && vmSpec.isEnableDynamicallyScaleVm()) {
+            //scaling is allowed
+            vmr.memoryStaticMin = getStaticMin(vmSpec.getOs(), vmSpec.getBootloader() == BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam());
+            vmr.memoryStaticMax = getStaticMax(vmSpec.getOs(), vmSpec.getBootloader() == BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam());
+            vmr.memoryDynamicMin = vmSpec.getMinRam();
+            vmr.memoryDynamicMax = vmSpec.getMaxRam();
+        } else {
+            //scaling disallowed, set static memory target
+            if (vmSpec.isEnableDynamicallyScaleVm() && !isDmcEnabled(conn, host)) {
+                s_logger.warn("Host "+ host.getHostname(conn) +" does not support dynamic scaling, so the vm " + vmSpec.getName() + " is not dynamically scalable");
+            }
+            vmr.memoryStaticMin = vmSpec.getMinRam();
+            vmr.memoryStaticMax = vmSpec.getMaxRam();
+            vmr.memoryDynamicMin = vmSpec.getMinRam();
+            vmr.memoryDynamicMax = vmSpec.getMaxRam();
         }
 
-        for (Console console : vmr.consoles) {
-            console.destroy(conn);
+        if (guestOsTypeName.toLowerCase().contains("windows")) {
+            vmr.VCPUsMax = (long) vmSpec.getCpus();
+        } else {
+            vmr.VCPUsMax = 32L;
         }
 
-        vm.setIsATemplate(conn, false);
-        vm.setAffinity(conn, host);
-        vm.removeFromOtherConfig(conn, "disks");
-        vm.setNameLabel(conn, vmSpec.getName());
-        setMemory(conn, vm, vmSpec.getMinRam(),vmSpec.getMaxRam());
-        vm.setVCPUsMax(conn, (long)vmSpec.getCpus());
-        vm.setVCPUsAtStartup(conn, (long)vmSpec.getCpus());
+        Map<String, String> details = vmSpec.getDetails();
+        if ( details != null ) {
+            String timeoffset = details.get("timeoffset");
+            if (timeoffset != null) {
+                Map<String, String> platform = vmr.platform;
+                platform.put("timeoffset", timeoffset);
+                vmr.platform = platform;
+            }
+
+            String coresPerSocket = details.get("cpu.corespersocket");
+            if (coresPerSocket != null) {
+                Map<String, String> platform = vmr.platform;
+                platform.put("cores-per-socket", coresPerSocket);
+                vmr.platform = platform;
+            }            
+        }
+
+        vmr.VCPUsAtStartup = (long) vmSpec.getCpus();
+        vmr.consoles.clear();
+
+        VM vm = VM.create(conn, vmr);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Created VM " + vm.getUuid(conn) + " for " + vmSpec.getName());
+        }
 
         Map<String, String> vcpuParams = new HashMap<String, String>();
 
         Integer speed = vmSpec.getMinSpeed();
         if (speed != null) {
 
-            int cpuWeight = _maxWeight; //cpu_weight
-            long utilization = 0; // max CPU cap, default is unlimited
+            int cpuWeight = _maxWeight; // cpu_weight
+            int utilization = 0; // max CPU cap, default is unlimited
 
-            // weight based allocation
-            cpuWeight = (int)((speed*0.99) / _host.speed * _maxWeight);
+            // weight based allocation, CPU weight is calculated per VCPU
+            cpuWeight = (int) ((speed * 0.99) / _host.speed * _maxWeight);
             if (cpuWeight > _maxWeight) {
                 cpuWeight = _maxWeight;
             }
 
             if (vmSpec.getLimitCpuUse()) {
-                utilization = ((long)speed * 100 * vmSpec.getCpus()) / _host.speed ;
+                // CPU cap is per VM, so need to assign cap based on the number of vcpus
+                utilization = (int) ((speed * 0.99 * vmSpec.getCpus()) / _host.speed * 100);
             }
 
             vcpuParams.put("weight", Integer.toString(cpuWeight));
-            vcpuParams.put("cap", Long.toString(utilization));
+            vcpuParams.put("cap", Integer.toString(utilization));
+
         }
 
         if (vcpuParams.size() > 0) {
             vm.setVCPUsParams(conn, vcpuParams);
         }
 
-        vm.setActionsAfterCrash(conn, Types.OnCrashBehaviour.DESTROY);
-        vm.setActionsAfterShutdown(conn, Types.OnNormalExit.DESTROY);
-
         String bootArgs = vmSpec.getBootArgs();
         if (bootArgs != null && bootArgs.length() > 0) {
             String pvargs = vm.getPVArgs(conn);
@@ -1324,36 +1364,32 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
 
         if (!(guestOsTypeName.startsWith("Windows") || guestOsTypeName.startsWith("Citrix") || guestOsTypeName.startsWith("Other"))) {
             if (vmSpec.getBootloader() == BootloaderType.CD) {
-                DiskTO [] disks = vmSpec.getDisks();
+                DiskTO[] disks = vmSpec.getDisks();
                 for (DiskTO disk : disks) {
-                    Volume.Type type = disk.getType();
-                    if (type == Volume.Type.ISO) {
-                        TemplateObjectTO tmpl = (TemplateObjectTO)disk.getData();
-                        String osType = tmpl.getGuestOsType();
-                        if (tmpl.getFormat() == ImageFormat.ISO && osType != null ) {
-                            String isoGuestOsName = getGuestOsType(osType, vmSpec.getBootloader() == BootloaderType.CD);
-                            if (!isoGuestOsName.equals(guestOsTypeName)) {
-                                vmSpec.setBootloader(BootloaderType.PyGrub);
-                            }
-                        }
+                    if (disk.getType() == Volume.Type.ISO ) {
+                    	TemplateObjectTO iso = (TemplateObjectTO)disk.getData();
+                    	String osType = iso.getGuestOsType();
+                    	if (osType != null) {
+                    		String isoGuestOsName = getGuestOsType(osType, vmSpec.getBootloader() == BootloaderType.CD);
+                    		if (!isoGuestOsName.equals(guestOsTypeName)) {
+                    			vmSpec.setBootloader(BootloaderType.PyGrub);
+                    		}
+                    	}
                     }
                 }
             }
             if (vmSpec.getBootloader() == BootloaderType.CD) {
                 vm.setPVBootloader(conn, "eliloader");
-                Map<String, String> otherConfig = vm.getOtherConfig(conn);
-                if ( ! vm.getOtherConfig(conn).containsKey("install-repository") ) {
-                    otherConfig.put( "install-repository", "cdrom");
+                if (!vm.getOtherConfig(conn).containsKey("install-repository")) {
+                    vm.addToOtherConfig(conn, "install-repository", "cdrom");
                 }
-                vm.setOtherConfig(conn, otherConfig);
-            } else if (vmSpec.getBootloader() == BootloaderType.PyGrub ){
+            } else if (vmSpec.getBootloader() == BootloaderType.PyGrub) {
                 vm.setPVBootloader(conn, "pygrub");
             } else {
                 vm.destroy(conn);
                 throw new CloudRuntimeException("Unable to handle boot loader type: " + vmSpec.getBootloader());
             }
         }
-
         try {
             finalizeVmMetaData(vm, conn, vmSpec);
         } catch ( Exception e) {
@@ -1361,6 +1397,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         }
         return vm;
     }
+ 
     
     protected void finalizeVmMetaData(VM vm, Connection conn, VirtualMachineTO vmSpec) throws Exception {
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4f8781f6/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
index 4a9b526..9c65a03 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
@@ -152,139 +152,6 @@ public class XenServer56FP1Resource extends XenServer56Resource {
         return dynamicMinRam;
     }
 
-    @Override
-    protected VM createVmFromTemplate(Connection conn, VirtualMachineTO vmSpec, Host host) throws XenAPIException, XmlRpcException {
-        String guestOsTypeName = getGuestOsType(vmSpec.getOs(), vmSpec.getBootloader() == BootloaderType.CD);
-        Set<VM> templates = VM.getByNameLabel(conn, guestOsTypeName);
-        assert templates.size() == 1 : "Should only have 1 template but found " + templates.size();
-        VM template = templates.iterator().next();
-
-        VM.Record vmr = template.getRecord(conn);
-        vmr.affinity = host;
-        vmr.otherConfig.remove("disks");
-        vmr.otherConfig.remove("default_template");
-        vmr.otherConfig.remove("mac_seed");
-        vmr.isATemplate = false;
-        vmr.nameLabel = vmSpec.getName();
-        vmr.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
-        vmr.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
-
-        if (isDmcEnabled(conn, host) && vmSpec.isEnableDynamicallyScaleVm()) {
-            //scaling is allowed
-            vmr.memoryStaticMin = getStaticMin(vmSpec.getOs(), vmSpec.getBootloader() == BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam());
-            vmr.memoryStaticMax = getStaticMax(vmSpec.getOs(), vmSpec.getBootloader() == BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam());
-            vmr.memoryDynamicMin = vmSpec.getMinRam();
-            vmr.memoryDynamicMax = vmSpec.getMaxRam();
-        } else {
-            //scaling disallowed, set static memory target
-            if (vmSpec.isEnableDynamicallyScaleVm() && !isDmcEnabled(conn, host)) {
-                s_logger.warn("Host "+ host.getHostname(conn) +" does not support dynamic scaling, so the vm " + vmSpec.getName() + " is not dynamically scalable");
-            }
-            vmr.memoryStaticMin = vmSpec.getMinRam();
-            vmr.memoryStaticMax = vmSpec.getMaxRam();
-            vmr.memoryDynamicMin = vmSpec.getMinRam();
-            vmr.memoryDynamicMax = vmSpec.getMaxRam();
-        }
-
-        if (guestOsTypeName.toLowerCase().contains("windows")) {
-            vmr.VCPUsMax = (long) vmSpec.getCpus();
-        } else {
-            vmr.VCPUsMax = 32L;
-        }
-
-        Map<String, String> details = vmSpec.getDetails();
-        if ( details != null ) {
-            String timeoffset = details.get("timeoffset");
-            if (timeoffset != null) {
-                Map<String, String> platform = vmr.platform;
-                platform.put("timeoffset", timeoffset);
-                vmr.platform = platform;
-            }
-
-            String coresPerSocket = details.get("cpu.corespersocket");
-            if (coresPerSocket != null) {
-                Map<String, String> platform = vmr.platform;
-                platform.put("cores-per-socket", coresPerSocket);
-                vmr.platform = platform;
-            }            
-        }
-
-        vmr.VCPUsAtStartup = (long) vmSpec.getCpus();
-        vmr.consoles.clear();
-
-        VM vm = VM.create(conn, vmr);
-        if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Created VM " + vm.getUuid(conn) + " for " + vmSpec.getName());
-        }
-
-        Map<String, String> vcpuParams = new HashMap<String, String>();
-
-        Integer speed = vmSpec.getMinSpeed();
-        if (speed != null) {
-
-            int cpuWeight = _maxWeight; // cpu_weight
-            int utilization = 0; // max CPU cap, default is unlimited
-
-            // weight based allocation, CPU weight is calculated per VCPU
-            cpuWeight = (int) ((speed * 0.99) / _host.speed * _maxWeight);
-            if (cpuWeight > _maxWeight) {
-                cpuWeight = _maxWeight;
-            }
-
-            if (vmSpec.getLimitCpuUse()) {
-                // CPU cap is per VM, so need to assign cap based on the number of vcpus
-                utilization = (int) ((speed * 0.99 * vmSpec.getCpus()) / _host.speed * 100);
-            }
-
-            vcpuParams.put("weight", Integer.toString(cpuWeight));
-            vcpuParams.put("cap", Integer.toString(utilization));
-
-        }
-
-        if (vcpuParams.size() > 0) {
-            vm.setVCPUsParams(conn, vcpuParams);
-        }
-
-        String bootArgs = vmSpec.getBootArgs();
-        if (bootArgs != null && bootArgs.length() > 0) {
-            String pvargs = vm.getPVArgs(conn);
-            pvargs = pvargs + vmSpec.getBootArgs().replaceAll(" ", "%");
-            if (s_logger.isDebugEnabled()) {
-                s_logger.debug("PV args are " + pvargs);
-            }
-            vm.setPVArgs(conn, pvargs);
-        }
-
-        if (!(guestOsTypeName.startsWith("Windows") || guestOsTypeName.startsWith("Citrix") || guestOsTypeName.startsWith("Other"))) {
-            if (vmSpec.getBootloader() == BootloaderType.CD) {
-                DiskTO[] disks = vmSpec.getDisks();
-                for (DiskTO disk : disks) {
-                    if (disk.getType() == Volume.Type.ISO ) {
-                    	TemplateObjectTO iso = (TemplateObjectTO)disk.getData();
-                    	String osType = iso.getGuestOsType();
-                    	if (osType != null) {
-                    		String isoGuestOsName = getGuestOsType(osType, vmSpec.getBootloader() == BootloaderType.CD);
-                    		if (!isoGuestOsName.equals(guestOsTypeName)) {
-                    			vmSpec.setBootloader(BootloaderType.PyGrub);
-                    		}
-                    	}
-                    }
-                }
-            }
-            if (vmSpec.getBootloader() == BootloaderType.CD) {
-                vm.setPVBootloader(conn, "eliloader");
-                if (!vm.getOtherConfig(conn).containsKey("install-repository")) {
-                    vm.addToOtherConfig(conn, "install-repository", "cdrom");
-                }
-            } else if (vmSpec.getBootloader() == BootloaderType.PyGrub) {
-                vm.setPVBootloader(conn, "pygrub");
-            } else {
-                vm.destroy(conn);
-                throw new CloudRuntimeException("Unable to handle boot loader type: " + vmSpec.getBootloader());
-            }
-        }
-        return vm;
-    }
 
     /**
      * When Dynamic Memory Control (DMC) is enabled -