DVS: ensure that network is configured if one of more hosts are down
If a host in the cluster is down we should still configure the network. That is, the VC will configure it on the hosts that are up. Change-Id: I8498c92d5e4f81ba5c03631a3edc9631858f22c1
This commit is contained in:
parent
4f56575b1f
commit
4252b617ed
@ -14,7 +14,7 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_vmware import api
|
||||
|
||||
from oslo_vmware import exceptions as oslo_vmware_exc
|
||||
|
||||
from vmware_nsx._i18n import _
|
||||
|
||||
@ -57,6 +57,16 @@ CONF = cfg.CONF
|
||||
CONF.register_opts(dvs_opts, 'dvs')
|
||||
|
||||
|
||||
# Create and register exceptions not in oslo.vmware
|
||||
class DvsOperationBulkFault(oslo_vmware_exc.VimException):
|
||||
msg_fmt = _("Cannot complete a DVS operation for one or more members.")
|
||||
|
||||
|
||||
def dvs_register_exceptions():
|
||||
oslo_vmware_exc.register_fault_class('DvsOperationBulkFault',
|
||||
DvsOperationBulkFault)
|
||||
|
||||
|
||||
def dvs_is_enabled(dvs_id=None):
|
||||
"""Returns the configured DVS status."""
|
||||
return bool(CONF.dvs.host_ip and CONF.dvs.host_username and
|
||||
|
@ -102,6 +102,7 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
security_group=securitygroup_model.SecurityGroup,
|
||||
security_group_rule=securitygroup_model.SecurityGroupRule)
|
||||
def __init__(self):
|
||||
dvs_utils.dvs_register_exceptions()
|
||||
self._extension_manager = nsx_managers.ExtensionManager()
|
||||
super(NsxDvsV2, self).__init__()
|
||||
LOG.debug('Driver support: DVS: %s' % dvs_utils.dvs_is_enabled())
|
||||
@ -190,7 +191,11 @@ class NsxDvsV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
dvs_id = dvpg_moref.value
|
||||
else:
|
||||
dvs_id = self._dvs_get_id(net_data)
|
||||
self._dvs.add_port_group(dvs_id, vlan_tag, trunk_mode=trunk_mode)
|
||||
try:
|
||||
self._dvs.add_port_group(dvs_id, vlan_tag,
|
||||
trunk_mode=trunk_mode)
|
||||
except dvs_utils.DvsOperationBulkFault:
|
||||
LOG.warning('One or more hosts may not be configured')
|
||||
|
||||
try:
|
||||
with db_api.context_manager.writer.using(context):
|
||||
|
Loading…
Reference in New Issue
Block a user