Amir, Yes to add any custom checks on top of the existing host allocation you will need to write your HostAllocator extending the default FirstFitAllocator. Also replace the FirstFitAllocator in componets.xml by your custom allocator. If your condition verification fails, your allocator should return an empty list of hosts and not an error. The deployment planner will handle the empty result returned by the host allocator.
Thanks, Prachi -----Original Message----- From: Amir Nashat [mailto:amir.nas...@citrix.com] Sent: Wednesday, August 08, 2012 1:58 PM To: cloudstack-users@incubator.apache.org Subject: CloudStack Allocator Pre-Condition Check Hello, I would like to get feedback as to the best approach for performing a pre-condition check before allocating a guest vm to a physical host. For my example, a pre-condition check is to verify the guest vm does not use an existing DNS entry. If the pre-condition fails we do not want to allocate the guest vm to the physical host and we want to record this as an error condition. As far as I can tell the only option I have is to extend the default FirstFitAllocator class and override the allocateTo methods to first perform my pre-condition verification and if it passes then to call the the overridden allocateTo() method. If it fails then I would throw a RuntimeException of some sort or possibly set the returnUpTo value equal to 0. Can you please advise as what would be the best approach? If anyone else is performing pre-conditions checks in their allocation logic before provisioning a guest VM please let me know of your approach. Thank you, Amir