use gigabytes and cores

This commit is contained in:
Vishvananda Ishaya
2010-09-11 18:45:15 -07:00
parent 694aa3aeed
commit 2fd10ebdca

View File

@@ -27,10 +27,10 @@ from nova.scheduler import driver
from nova.scheduler import chance
FLAGS = flags.FLAGS
flags.DEFINE_integer("max_instances", 16,
"maximum number of instances to allow per host")
flags.DEFINE_integer("max_volumes", 100,
"maximum number of volumes to allow per host")
flags.DEFINE_integer("max_cores", 16,
"maximum number of instance cores to allow per host")
flags.DEFINE_integer("max_gigabytes", 10000,
"maximum number of volume gigabytes to allow per host")
flags.DEFINE_integer("max_networks", 1000,
"maximum number of networks to allow per host")
@@ -42,9 +42,9 @@ class SimpleScheduler(chance.ChanceScheduler):
results = db.service_get_all_compute_sorted(context)
for result in results:
(service, instance_count) = result
if instance_count >= FLAGS.max_instances:
raise driver.NoValidHost("All hosts have too many instances")
(service, instance_cores) = result
if instance_cores >= FLAGS.max_cores:
raise driver.NoValidHost("All hosts have too many cores")
if self.service_is_up(service):
db.instance_update(context,
instance_id,
@@ -57,13 +57,13 @@ class SimpleScheduler(chance.ChanceScheduler):
results = db.service_get_all_volume_sorted(context)
for result in results:
(service, instance_count) = result
if instance_count >= FLAGS.max_volumes:
raise driver.NoValidHost("All hosts have too many volumes")
(service, volume_gigabytes) = result
if volume_gigabytes >= FLAGS.max_gigabytes:
raise driver.NoValidHost("All hosts have too many gigabytes")
if self.service_is_up(service):
db.instance_update(context,
volume_id,
{'host': service['host']})
db.volume_update(context,
volume_id,
{'host': service['host']})
return service['host']
raise driver.NoValidHost("No hosts found")