Since cpus is now it's own table, we no longer have a "num_cpus" column to order by in available_vm_resources. Thanks to Scott Seago, replace this with a LEFT OUTER JOIN combined with a select to count the cpus for a particular host.