Optimize zun service update task

No need to update availability zone every time

Change-Id: I313b337a7c51d493b648e2235da2e4a69ceaf2be
This commit is contained in:
Xianghui Zeng 2018-08-08 16:53:21 +08:00
parent 14fa80132f
commit 545c3737a7

View File

@ -46,12 +46,15 @@ class ZunServicePeriodicTasks(periodic_task.PeriodicTasks):
if self.zun_service_ref is None:
zun_service_dict = {
'host': self.host,
'binary': self.binary
'binary': self.binary,
'availability_zone': self.availability_zone
}
self.zun_service_ref = objects.ZunService(
ctx, **zun_service_dict)
self.zun_service_ref.create()
self.zun_service_ref.availability_zone = self.availability_zone
else:
self.zun_service_ref.availability_zone = \
self.availability_zone
self.zun_service_ref.report_state_up()