Customizing the availability zone of each compute node is Ineffective

Cloud administrators can customize the availability zone of
each compute node by setting the following in the config file:

  [DEFAULT]
  default_availability_zone = my-zone

When use "zun service-list", the availability-zone is always
nova no matter what we set default_availability_zone to

Change-Id: I3f1c8edd68ea089b7b40c30fac92d7dbbdf4fa59
Closes-Bug: #1762149
This commit is contained in:
weikeyou 2018-04-08 17:26:43 +08:00
parent af1f7b21ef
commit 501610a705

View File

@ -32,6 +32,7 @@ class ZunServicePeriodicTasks(periodic_task.PeriodicTasks):
self.zun_service_ref = None
self.host = conf.host
self.binary = binary
self.availability_zone = conf.default_availability_zone
super(ZunServicePeriodicTasks, self).__init__(conf)
@periodic_task.periodic_task(run_immediately=True)
@ -50,6 +51,7 @@ class ZunServicePeriodicTasks(periodic_task.PeriodicTasks):
self.zun_service_ref = objects.ZunService(
ctx, **zun_service_dict)
self.zun_service_ref.create()
self.zun_service_ref.availability_zone = self.availability_zone
self.zun_service_ref.report_state_up()