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