cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke4...@apache.org
Subject [68/70] git commit: allocator docs
Date Tue, 08 Oct 2013 19:28:12 GMT
allocator docs


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

Branch: refs/heads/master
Commit: 0a7eabfe3923d881ae737cff43ae62639859f53d
Parents: 8d7ed19
Author: David Nalley <david@gnsa.us>
Authored: Thu Oct 3 13:29:59 2013 -0400
Committer: David Nalley <david@gnsa.us>
Committed: Thu Oct 3 13:29:59 2013 -0400

----------------------------------------------------------------------
 .../en-US/Allocator_Implementation_Guide.ent    |  22 +++
 .../en-US/Allocator_Implementation_Guide.xml    |  51 +++++++
 allocator/en-US/Author_Group.xml                |  32 ++++
 allocator/en-US/Book_Info.xml                   |  47 ++++++
 allocator/en-US/allocators.xml                  |  38 +++++
 allocator/en-US/custom-hostallocator.xml        | 151 +++++++++++++++++++
 allocator/en-US/custom-storagepoolallocator.xml | 132 ++++++++++++++++
 .../en-US/extras/custom-hostallocator.java      |  21 +++
 .../en-US/extras/custom-hostallocator2.java     |   3 +
 .../en-US/extras/custom-storageallocator.java   |  11 ++
 .../en-US/extras/custom-storageallocator2.java  |   3 +
 allocator/publican.cfg                          |  30 ++++
 12 files changed, 541 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/Allocator_Implementation_Guide.ent
----------------------------------------------------------------------
diff --git a/allocator/en-US/Allocator_Implementation_Guide.ent b/allocator/en-US/Allocator_Implementation_Guide.ent
new file mode 100644
index 0000000..abb1885
--- /dev/null
+++ b/allocator/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/0a7eabfe/allocator/en-US/Allocator_Implementation_Guide.xml
----------------------------------------------------------------------
diff --git a/allocator/en-US/Allocator_Implementation_Guide.xml b/allocator/en-US/Allocator_Implementation_Guide.xml
new file mode 100644
index 0000000..da12284
--- /dev/null
+++ b/allocator/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/0a7eabfe/allocator/en-US/Author_Group.xml
----------------------------------------------------------------------
diff --git a/allocator/en-US/Author_Group.xml b/allocator/en-US/Author_Group.xml
new file mode 100644
index 0000000..ba9e651
--- /dev/null
+++ b/allocator/en-US/Author_Group.xml
@@ -0,0 +1,32 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE authorgroup PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
[
+<!ENTITY % BOOK_ENTITIES SYSTEM "Runbook.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.
+-->
+
+
+<authorgroup>
+    <author>
+        <firstname>Apache</firstname>
+        <surname>CloudStack</surname>
+    </author>
+</authorgroup>
+

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/Book_Info.xml
----------------------------------------------------------------------
diff --git a/allocator/en-US/Book_Info.xml b/allocator/en-US/Book_Info.xml
new file mode 100644
index 0000000..327668d
--- /dev/null
+++ b/allocator/en-US/Book_Info.xml
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE bookinfo 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.
+-->
+
+<bookinfo id="book-release-notes-3.0.4">
+    <title>&PRODUCT; Guide</title>
+    <subtitle>Revised August 9, 2012 10:48 pm Pacific</subtitle>
+    <productname>Apache CloudStack</productname>
+    <productnumber>4.2.0</productnumber>
+    <edition>1</edition>
+    <pubsnumber></pubsnumber>
+    <abstract>
+        <para>
+            Complete technical documentation of &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>

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/allocators.xml
----------------------------------------------------------------------
diff --git a/allocator/en-US/allocators.xml b/allocator/en-US/allocators.xml
new file mode 100644
index 0000000..39959f9
--- /dev/null
+++ b/allocator/en-US/allocators.xml
@@ -0,0 +1,38 @@
+<?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.
+-->
+
+<chapter 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>
+  <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>
+  
+</chapter>

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/custom-hostallocator.xml
----------------------------------------------------------------------
diff --git a/allocator/en-US/custom-hostallocator.xml b/allocator/en-US/custom-hostallocator.xml
new file mode 100644
index 0000000..e02f081
--- /dev/null
+++ b/allocator/en-US/custom-hostallocator.xml
@@ -0,0 +1,151 @@
+<?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.
+-->
+
+<chapter 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>
+      <xi:include parse="text" href="extras/custom-hostallocator.java" xmlns:xi="http://www.w3.org/2001/XInclude"
/>
+    </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 <replaceable>Long</replaceable> dcIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set <replaceable>Long</replaceable> podIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set <replaceable>Long</replaceable> clusterIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set <replaceable>Long</replaceable> hostIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set <replaceable>Long</replaceable> 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>
+            <xi:include parse="text" href="extras/custom-hostallocator2.java" xmlns:xi="http://www.w3.org/2001/XInclude"
/>
+          </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>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/custom-storagepoolallocator.xml
----------------------------------------------------------------------
diff --git a/allocator/en-US/custom-storagepoolallocator.xml b/allocator/en-US/custom-storagepoolallocator.xml
new file mode 100644
index 0000000..f774e65
--- /dev/null
+++ b/allocator/en-US/custom-storagepoolallocator.xml
@@ -0,0 +1,132 @@
+<?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.
+-->
+
+<chapter 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>
+      <xi:include parse="text" href="extras/custom-storageallocator.java" xmlns:xi="http://www.w3.org/2001/XInclude"
/>
+    </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 <replaceable>Long</replaceable> dcIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set <replaceable>Long</replaceable> podIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set <replaceable>Long</replaceable> clusterIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set <replaceable>Long</replaceable> hostIds;</para>
+        </listitem>
+        <listitem>
+          <para>Set <replaceable>Long</replaceable> 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>
+            <xi:include parse="text" href="extras/custom-storageallocator2.java" xmlns:xi="http://www.w3.org/2001/XInclude"
/>
+          </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>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/extras/custom-hostallocator.java
----------------------------------------------------------------------
diff --git a/allocator/en-US/extras/custom-hostallocator.java b/allocator/en-US/extras/custom-hostallocator.java
new file mode 100644
index 0000000..4072bd7
--- /dev/null
+++ b/allocator/en-US/extras/custom-hostallocator.java
@@ -0,0 +1,21 @@
+      /**
+        * 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);

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/extras/custom-hostallocator2.java
----------------------------------------------------------------------
diff --git a/allocator/en-US/extras/custom-hostallocator2.java b/allocator/en-US/extras/custom-hostallocator2.java
new file mode 100644
index 0000000..ecfc249
--- /dev/null
+++ b/allocator/en-US/extras/custom-hostallocator2.java
@@ -0,0 +1,3 @@
+            <adapters key="com.cloud.agent.manager.allocator.HostAllocator">
+              <adapter name="FirstFit" class="com.cloud.agent.manager.allocator.impl.FirstFitAllocator"/>
+            </adapters>

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/extras/custom-storageallocator.java
----------------------------------------------------------------------
diff --git a/allocator/en-US/extras/custom-storageallocator.java b/allocator/en-US/extras/custom-storageallocator.java
new file mode 100644
index 0000000..cd2fc24
--- /dev/null
+++ b/allocator/en-US/extras/custom-storageallocator.java
@@ -0,0 +1,11 @@
+      /**
+        * 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);

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/en-US/extras/custom-storageallocator2.java
----------------------------------------------------------------------
diff --git a/allocator/en-US/extras/custom-storageallocator2.java b/allocator/en-US/extras/custom-storageallocator2.java
new file mode 100644
index 0000000..acdcc3b
--- /dev/null
+++ b/allocator/en-US/extras/custom-storageallocator2.java
@@ -0,0 +1,3 @@
+            <adapters key="com.cloud.storage.allocator.StoragePoolAllocator">
+              <adapter name="Storage" class="com.cloud.storage.allocator.FirstFitStoragePoolAllocator"/>
+            </adapters>

http://git-wip-us.apache.org/repos/asf/cloudstack-docs/blob/0a7eabfe/allocator/publican.cfg
----------------------------------------------------------------------
diff --git a/allocator/publican.cfg b/allocator/publican.cfg
new file mode 100644
index 0000000..3856b5a
--- /dev/null
+++ b/allocator/publican.cfg
@@ -0,0 +1,30 @@
+# Publican configuration file for CloudStack Developer's Guide
+# Config::Simple 4.58
+# Tue May 29 00:57:27 2012
+#
+# 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.
+
+xml_lang: en-US
+type: Book
+docname: Allocator_Implementation_Guide
+brand: cloudstack
+chunk_first: 1
+chunk_section_depth: 1
+condition: admin
+
+
+


Mime
View raw message