Add check for availability zone when set resources

We should avoid set compute node availability zone to str(None),
When it's None, just leave it to NULL.

Also, this change the default availability zone to mogan.

Change-Id: I25fdeeb1e2544c07089977fd3463572c0c96b510
This commit is contained in:
Zhenguo Niu 2017-05-09 09:59:39 +08:00
parent b68781e60b
commit 164ca9844e
2 changed files with 5 additions and 2 deletions

View File

@ -38,7 +38,7 @@ opts = [
help=_("Availability zone to use for scheduling when user "
"doesn't specify one.")),
cfg.StrOpt('default_availability_zone',
default='nova',
default='mogan',
help=_("Default bare metal node availability zone.")),
cfg.IntOpt('sync_power_state_pool_size',
default=1000,

View File

@ -148,12 +148,15 @@ class IronicDriver(base_driver.BaseEngineDriver):
'cpus': cpus,
'memory_mb': memory_mb,
'hypervisor_type': self._get_hypervisor_type(),
'availability_zone': str(availability_zone),
'node_type': str(node_type),
'extra_specs': nodes_extra_specs,
'node_uuid': str(node.uuid),
'ports': node.ports,
}
if availability_zone is not None:
dic['availability_zone'] = str(availability_zone)
return dic
def _port_resource(self, port):