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

[67/70] git commit: Adding missing Allocator Implementation Guide and removing reference to allocators in API overview

Adding missing Allocator Implementation Guide and removing reference to allocators in API overview


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

Branch: refs/heads/master
Commit: 8d7ed19142b7b93643233ff5185ce66e90fe4579
Parents: f874440
Author: Travis Graham <t...@tgraham.us>
Authored: Thu Oct 3 00:49:20 2013 -0400
Committer: David Nalley <da...@gnsa.us>
Committed: Thu Oct 3 11:21:46 2013 -0400

----------------------------------------------------------------------
 en-US/Allocator_Implementation_Guide.ent |  22 ++++
 en-US/Allocator_Implementation_Guide.xml |  51 ++++++++
 en-US/allocators.xml                     |  16 ++-
 en-US/api-overview.xml                   |   1 -
 en-US/custom-hostallocator.xml           | 173 ++++++++++++++++++++++++++
 en-US/custom-storagepoolallocator.xml    | 144 +++++++++++++++++++++
 en-US/feature-overview.xml               |   2 +-
 7 files changed, 404 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/8d7ed191/en-US/Allocator_Implementation_Guide.ent
----------------------------------------------------------------------
diff --git a/en-US/Allocator_Implementation_Guide.ent b/en-US/Allocator_Implementation_Guide.ent
new file mode 100644
index 0000000..abb1885
--- /dev/null
+++ b/en-US/Allocator_Implementation_Guide.ent
@@ -0,0 +1,22 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+   http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<!ENTITY PRODUCT "CloudStack">
+<!ENTITY BOOKID "Technical Documentation">
+<!ENTITY YEAR "2012">
+<!ENTITY HOLDER "Apache Software Foundation">

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/8d7ed191/en-US/Allocator_Implementation_Guide.xml
----------------------------------------------------------------------
diff --git a/en-US/Allocator_Implementation_Guide.xml b/en-US/Allocator_Implementation_Guide.xml
new file mode 100644
index 0000000..da12284
--- /dev/null
+++ b/en-US/Allocator_Implementation_Guide.xml
@@ -0,0 +1,51 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+   http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<book>
+    <bookinfo id="allocator_implementation_guide">
+    <title>&PRODUCT; Allocator Implementation Guide</title>
+    <productname>Apache CloudStack</productname>
+    <productnumber>4.2.0</productnumber>
+    <edition>1</edition>
+    <pubsnumber></pubsnumber>
+    <abstract>
+        <para>
+            Allocator Implementation Guide for &PRODUCT;.
+        </para>
+    </abstract>
+    <corpauthor>
+        <inlinemediaobject>
+            <imageobject>
+                <imagedata fileref="Common_Content/images/title_logo.svg" format="SVG" />
+            </imageobject>
+        </inlinemediaobject>
+    </corpauthor>
+    <xi:include href="Common_Content/Legal_Notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="Author_Group.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    </bookinfo>
+    <xi:include href="allocators.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="custom-hostallocator.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="custom-storagepoolallocator.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</book>
+

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/8d7ed191/en-US/allocators.xml
----------------------------------------------------------------------
diff --git a/en-US/allocators.xml b/en-US/allocators.xml
index d8ce2b8..821a7cb 100644
--- a/en-US/allocators.xml
+++ b/en-US/allocators.xml
@@ -23,6 +23,16 @@
 -->
 
 <section id="allocators">
-    <title>Allocators</title>
-    <para>&PRODUCT; enables administrators to write custom allocators that will choose the Host to place a new guest and the storage host from which to allocate guest virtual disk images.</para>
-   </section>
+  <title>Allocators</title>
+  <para>&PRODUCT; enables administrators to write custom allocators that will choose the Host to place a new guest and the storage host from which to allocate guest virtual disk images.</para>
+  <para>These are following categories of allocators currently supported:</para>
+  <itemizedlist>
+    <listitem>
+      <para>HostAllocators - Allows you to create custom rules to determine which physical host to allocate the guest virtual machines on. </para>
+    </listitem>
+    <listitem>
+      <para>StoragePoolAllocators - Allows you to create custom rules to determine which storage pool to allocate the guest virtual machines on. </para>
+    </listitem>
+  </itemizedlist>
+  
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/8d7ed191/en-US/api-overview.xml
----------------------------------------------------------------------
diff --git a/en-US/api-overview.xml b/en-US/api-overview.xml
index a541049..347e39e 100644
--- a/en-US/api-overview.xml
+++ b/en-US/api-overview.xml
@@ -33,6 +33,5 @@
       url="http://docs.cloudstack.org/CloudStack_Documentation/API_Reference%3A_CloudStack">the API
       Reference</ulink>.</para>
   <xi:include href="provisioning-auth-api.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
-  <xi:include href="allocators.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
   <xi:include href="user-data-and-meta-data.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/8d7ed191/en-US/custom-hostallocator.xml
----------------------------------------------------------------------
diff --git a/en-US/custom-hostallocator.xml b/en-US/custom-hostallocator.xml
new file mode 100644
index 0000000..3e25d1f
--- /dev/null
+++ b/en-US/custom-hostallocator.xml
@@ -0,0 +1,173 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+   http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<section id="custom-hostallocator">
+  <title>Implementing a custom HostAllocator</title>
+  <para>HostAllocators are written by extending com.cloud.agent.manager.allocator.HostAllocator interface.</para>
+  
+  <section>
+    <title>HostAllocator Interface</title>
+    <para>The interface defines the following two methods.</para>
+    
+    <programlisting>
+      /**
+        * Checks if the VM can be upgraded to the specified ServiceOffering
+        * @param UserVm vm
+        * @param ServiceOffering offering
+        * @return boolean true if the VM can be upgraded
+      **/
+
+      publicboolean isVirtualMachineUpgradable(final UserVm vm, final ServiceOffering offering);
+
+      /**
+        * Determines which physical hosts are suitable to allocate the guest virtual machines on
+        *
+        * @paramVirtualMachineProfile vmProfile
+        * @paramDeploymentPlan plan
+        * @paramType type
+        * @paramExcludeList avoid
+        * @paramint returnUpTo
+        * @returnList<Host>List of hosts that are suitable for VM allocation
+      **/      
+
+      publicList<Host> allocateTo( VirtualMachineProfile<?extendsVirtualMachine> vmProfile,  DeploymentPlan plan, Type type, ExcludeList avoid, intreturnUpTo);
+    </programlisting>
+    <para>A custom HostAllocator can be written by implementing the ‘allocateTo’ method</para>
+    
+    <section>
+      <title>Input Parameters for the method ‘HostAllocator :: allocateTo’</title>
+      
+      <para><emphasis role="italic">com.cloud.vm.VirtualMachineProfile vmProfile</emphasis></para>
+      <para>VirtualMachineProfile describes one virtual machine. This allows the adapters like Allocators to process the information in the virtual machine and make determinations on what the virtual machine profile should look like before it is actually started on the hypervisor.</para>
+      <para>HostAllocators can make use of the following information present in the VirtualMachineProfile:</para>
+      <itemizedlist>
+        <listitem>
+          <para>The ServiceOffering that specifies configuration like requested CPU speed, RAM etc necessary for the guest VM.</para>
+        </listitem>
+        <listitem>
+          <para>The VirtualMachineTemplate, the template to be used to start the VM.</para>
+        </listitem>
+      </itemizedlist>
+      
+      <para><emphasis role="italic">com.cloud.deploy.DeploymentPlan plan</emphasis></para>
+      <para>DeploymentPlan should specify:</para>
+      <itemizedlist>
+        <listitem>
+          <para>dataCenterId: The data center the VM should deploy in</para>
+        </listitem>
+        <listitem>
+          <para>podId: The pod the Vm should deploy in; null if no preference</para>
+        </listitem>
+        <listitem>
+          <para>clusterId: The cluster the VM should deploy in; null if no preference</para>
+        </listitem>
+        <listitem>
+          <para>poolId: The storage pool the VM should be created in; null if no preference</para>
+        </listitem>
+      </itemizedlist>
+      
+      <para><emphasis role="italic">com.cloud.host.Host.Type  type</emphasis></para>
+      <para>Type of the Host needed for this guest VM. Currently com.cloud.host.Host.Type interface defines the following Host types:</para>
+      <itemizedlist>
+        <listitem>
+          <para>Storage</para>
+        </listitem>
+        <listitem>
+          <para>Routing</para>
+        </listitem>
+        <listitem>
+          <para>SecondaryStorage</para>
+        </listitem>
+        <listitem>
+          <para>ConsoleProxy</para>
+        </listitem>
+        <listitem>
+          <para>ExternalFirewall</para>
+        </listitem>
+        <listitem>
+          <para>ExternalLoadBalancer</para>
+        </listitem>
+      </itemizedlist>
+      
+      <para><emphasis role="italic">com.cloud.deploy.DeploymentPlanner.ExcludeList avoid</emphasis></para>
+      <para>The ExcludeList specifies what datacenters, pods, clusters, hosts, storagePools should not be considered for allocating this guest VM. HostAllocators should avoid the hosts that are mentioned in ExcludeList.hostIds.</para>
+      <itemizedlist>
+        <listitem>
+          <para>Set<Long> dcIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set<Long> podIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set<Long> clusterIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set<Long> hostIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set<Long> poolIds;</para>
+        </listitem>
+      </itemizedlist>
+      
+      <para><emphasis role="italic">int returnUpTo</emphasis></para>
+      <para>This specifies return up to that many available hosts for this guest VM.</para>
+      <para>To get all possible hosts, set this value to -1.</para>
+    </section>
+    
+    <section>
+      <title>Reference HostAllocator implementation</title>
+      <para>Refer com.cloud.agent.manager.allocator.impl.FirstFitAllocator that implements the HostAllocator interface. This allocator checks available hosts in the specified datacenter, Pod, Cluster and considering the given ServiceOffering requirements.</para>
+      <para>If returnUpTo = 1, this allocator would return the first Host that fits the requirements of the guest VM.</para>
+    </section>
+    
+    <section>
+      <title>Loading a custom HostAllocator</title>
+      <orderedlist>
+        <listitem>
+          <para>Write a custom HostAllocator class, implementing the interface described above.</para>
+        </listitem>
+        <listitem>
+          <para>Package the code into a JAR file and make the JAR available in the classpath of the Management Server/tomcat.</para>
+        </listitem>
+        <listitem>
+          <para>Modify the components.xml and components-premium.xml files found in /client/ tomcatconf as follows.</para>
+        </listitem>
+        <listitem>
+          <para>Search for ‘HostAllocator’ in these files.</para>
+          <programlisting>
+            <adapters key="com.cloud.agent.manager.allocator.HostAllocator">
+              <adapter name="FirstFit" class="com.cloud.agent.manager.allocator.impl.FirstFitAllocator"/>
+            </adapters>
+          </programlisting>
+        </listitem>
+        <listitem>
+          <para>Replace the FirstFitAllocator with your class name. Optionally, you can change the name of the adapter as well.</para>
+        </listitem>
+        <listitem>
+          <para>Restart the Management Server.</para>
+        </listitem>
+      </orderedlist>
+    </section>
+  </section>
+</section>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/8d7ed191/en-US/custom-storagepoolallocator.xml
----------------------------------------------------------------------
diff --git a/en-US/custom-storagepoolallocator.xml b/en-US/custom-storagepoolallocator.xml
new file mode 100644
index 0000000..cf9af79
--- /dev/null
+++ b/en-US/custom-storagepoolallocator.xml
@@ -0,0 +1,144 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+   http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+<section id="custom-storagepoolallocator">
+  <title>Implementing a custom StoragePoolAllocator</title>
+  <para>StoragePoolAllocators are written by extending com.cloud.storage.allocator. StoragePoolAllocator interface.</para>
+  
+  <section>
+    <title>StoragePoolAllocator Interface</title>
+    <para>A custom StoragePoolAllocator can be written by implementing the ‘allocateTo’ method.</para>
+    
+    <programlisting>
+      /**
+        * Determines which storage pools are suitable for the guest virtual machine
+        * @param DiskProfile dskCh
+        * @param VirtualMachineProfile vmProfile
+        * @param DeploymentPlan plan
+        * @param ExcludeList avoid
+        * @param int returnUpTo
+        * @return List<StoragePool> List of storage pools that are suitable for the VM
+      **/
+
+      public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid, int returnUpTo);
+    </programlisting>
+    <para>This interface also contains some other methods to support some legacy code. However your custom allocator can extend the existing com.cloud.storage.allocator. AbstractStoragePoolAllocator. This class provides default implementation for all the other interface methods.</para>
+    
+    <section>
+      <title>Input Parameters for the method ‘StoragePoolAllocator :: allocateTo’</title>
+      
+      <para><emphasis role="italic">com.cloud.vm.DiskProfile dskCh</emphasis></para>
+      <para>DiskCharacteristics describes a disk and what functionality is required from it. It specifies the storage pool tags if any to be used while searching for a storage pool.</para>
+      
+      <para><emphasis role="italic">com.cloud.vm.VirtualMachineProfile vmProfile</emphasis></para>
+      <para>VirtualMachineProfile describes one virtual machine. This allows the adapters like Allocators to process the information in the virtual machine and make determinations on what the virtual machine profile should look like before it is actually started on the hypervisor.</para>
+      <para>StoragePoolAllocators can make use of the following information present in the VirtualMachineProfile:</para>
+      <itemizedlist>
+        <listitem>
+          <para>The VirtualMachine instance that specifies properties of the guest VM.</para>
+        </listitem>
+        <listitem>
+          <para>The VirtualMachineTemplate, the template to be used to start the VM.</para>
+        </listitem>
+      </itemizedlist>
+      
+      <para><emphasis role="italic">com.cloud.deploy.DeploymentPlan plan</emphasis></para>
+      <para>DeploymentPlan should specify:</para>
+      <itemizedlist>
+        <listitem>
+          <para>dataCenterId: The data center the VM should deploy in</para>
+        </listitem>
+        <listitem>
+          <para>podId: The pod the VM should deploy in; null if no preference</para>
+        </listitem>
+        <listitem>
+          <para>clusterId: The cluster the VM should deploy in; null if no preference</para>
+        </listitem>
+        <listitem>
+          <para>poolId: The storage pool the VM should be created in; null if no preference</para>
+        </listitem>
+      </itemizedlist>
+      
+      <para><emphasis role="italic">com.cloud.deploy.DeploymentPlanner.ExcludeList avoid</emphasis></para>
+      <para>The ExcludeList specifies what datacenters, pods, clusters, hosts, storagePools should not be considered for allocating this guest VM. StoragePoolAllocators should avoid the pools that are mentioned in ExcludeList.poolIds</para>
+      <itemizedlist>
+        <listitem>
+          <para>Set<Long> dcIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set<Long> podIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set<Long> clusterIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set<Long> hostIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set<Long> poolIds;</para>
+        </listitem>
+      </itemizedlist>
+      
+      <para><emphasis role="italic">int returnUpTo</emphasis></para>
+      <para>This specifies return up to that many available pools for this guest VM</para>
+      <para>To get all possible pools, set this value to -1</para>
+    </section>
+    
+    <section>
+      <title>Reference StoragePoolAllocator implementation</title>
+      
+      <para>Refer com.cloud.storage.allocator.FirstFitStoragePoolAllocator that implements the StoragePoolAllocator interface. This allocator checks available pools in the specified datacenter, Pod, Cluster and considering the given DiskProfile characteristics.</para>
+      <para>If returnUpTo = 1, this allocator would return the first Storage Pool that fits the requirements of the guest VM.</para>
+    </section>
+    
+    <section>
+      <title>Loading a custom StoragePoolAllocator</title>
+      <orderedlist>
+        <listitem>
+          <para>Write a custom StoragePoolAllocator class, implementing the interface described above.</para>
+        </listitem>
+        <listitem>
+          <para>Package the code into a JAR file and make the JAR available in the classpath of the Management Server/tomcat.</para>
+        </listitem>
+        <listitem>
+          <para>Modify the components.xml and components-premium.xml files found in /client/ tomcatconf as follows.</para>
+        </listitem>
+        <listitem>
+          <para>Search for ‘StoragePoolAllocator’ in these files.</para>
+          <programlisting>
+            <adapters key="com.cloud.storage.allocator.StoragePoolAllocator">
+              <adapter name="Storage" class="com.cloud.storage.allocator.FirstFitStoragePoolAllocator"/>
+            </adapters>
+          </programlisting>
+        </listitem>
+        <listitem>
+          <para>Replace the FirstFitStoragePoolAllocator with your class name. Optionally, you can change the name of the adapter as well.</para>
+        </listitem>
+        <listitem>
+          <para>Restart the Management Server.</para>
+        </listitem>
+      </orderedlist>
+    </section>
+  </section>
+</section>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/8d7ed191/en-US/feature-overview.xml
----------------------------------------------------------------------
diff --git a/en-US/feature-overview.xml b/en-US/feature-overview.xml
index 57b6d84..42a65bb 100644
--- a/en-US/feature-overview.xml
+++ b/en-US/feature-overview.xml
@@ -33,7 +33,7 @@
 		<emphasis role="bold">Massively Scalable Infrastructure Management</emphasis>
 	</para>
 	<para>
-		&PRODUCT; can manage tens of thousands of servers installed in multiple geographically distributed datacenters. The centralized management server scales linearly, eliminating the need for intermediate cluster-level management servers. No single component failure can cause cloud-wide outage. Periodic maintenance of the management server can be performed without affecting the functioning of virtual machines running in the cloud.
+		&PRODUCT; can manage tens of thousands of servers installed in multiple geographically distributed datacenters. The centralized management server scales linearly, eliminating the need for intermediate cluster-level management servers. No single component failure can cause a cloud-wide outage. Periodic maintenance of the management server can be performed without affecting the functioning of virtual machines running in the cloud.
 	</para>
 	<para>
 		<emphasis role="bold">Automatic Configuration Management</emphasis>