Exemplo n.º 1
0
 def post_create_port(self, port):
     if port.port_status == constants.PORT_STATUS_UP:
         device_id = port.vm_id
         _clu_mor, _clu_path, vds_name = self._find_cluster_switch_for_vm(
             device_id)
         pg_mor = network_util.get_portgroup_mor_by_name(
             self.session, vds_name, port.network_uuid)
         if pg_mor is None:
             msg = (_("Port group %(net_id)s not created on "
                      "virtual switch %(vds)s."), {
                          'net_id': port.network_uuid,
                          'vds': vds_name
                      })
             raise error_util.RunTimeError(msg)
         vm_mor = resource_util.get_vm_mor_for_uuid(self.session, device_id)
         if vm_mor is None:
             msg = (_("Virtual machine %(id)s with "
                      "port %(port)s not created."), {
                          'id': device_id,
                          'port': port.uuid
                      })
             raise error_util.RunTimeError(msg)
         (pg_key, port_key,
          swuuid) = self._wait_for_port_update_on_vm(vm_mor, pg_mor)
         if pg_key and port_key and swuuid:
             # enable the port on virtual switch.
             network_util.enable_disable_port(self.session, swuuid, pg_key,
                                              port_key, True)
Exemplo n.º 2
0
    def get_parser(self, prog_name):
        parser = super(neutronV20.NeutronCommand, self).get_parser(prog_name)
        parser.add_argument(
            '--request-format',
            help=_('The XML or JSON request format.'),
            default='json',
            choices=[
                'json',
                'xml',
            ],
        )
        parser.add_argument('--request_format',
                            choices=[
                                'json',
                                'xml',
                            ],
                            help=argparse.SUPPRESS)
        parser.add_argument('--vcenter-id',
                            metavar='VCENTER_ID',
                            required=True,
                            dest='vcenter_id',
                            help=_('Specify the vcenter_id.'))
        parser.add_argument('--cluster-id',
                            metavar='CLUSTER_ID',
                            dest='cluster_id',
                            required=True,
                            help=_('Specify the cluster_id.'))

        return parser
Exemplo n.º 3
0
def validate_clusters_list(data, valid_values=None):
    """Validate the list of clusters."""
    if not data:
        # Clusters must be provided.
        msg = _("Cannot create a list of clusters from the given input.")
        return msg
    if type(data) is not list:
        msg = _("Given cluster details is not in the form of list.")
        return msg
Exemplo n.º 4
0
def comman_add_args(parser):
    parser.add_argument(
        '--vcenter_id', metavar='VCENTER_ID',
        required=True,
        help=_('Id of the new vCenter Cluster.'))
    parser.add_argument(
        '--clusters', metavar='[CLUSTERS]',
        required=True, type=lambda x: x.split(),
        help=_('List of Clusters for the given vCenter.'))
    return parser
def comman_add_args(parser):
    parser.add_argument('--vcenter_id',
                        metavar='VCENTER_ID',
                        required=True,
                        help=_('Id of the new vCenter Cluster.'))
    parser.add_argument('--clusters',
                        metavar='[CLUSTERS]',
                        required=True,
                        type=lambda x: x.split(),
                        help=_('List of Clusters for the given vCenter.'))
    return parser
    def get_parser(self, prog_name):
        parser = super(neutronV20.ShowCommand, self).get_parser(prog_name)
        parser.add_argument(
            '--vcenter-id', metavar='VCENTER_ID',
            required=True,
            dest='vcenter_id',
            help=_('Specify the vcenter_id.'))
        parser.add_argument(
            '--cluster-id', metavar='CLUSTER_ID',
            dest='cluster_id',
            required=True,
            help=_('Specify the cluster_id.'))

        return parser
Exemplo n.º 7
0
    def get_parser(self, prog_name):
        parser = super(neutronV20.ShowCommand, self).get_parser(prog_name)
        parser.add_argument('--vcenter-id',
                            metavar='VCENTER_ID',
                            required=True,
                            dest='vcenter_id',
                            help=_('Specify the vcenter_id.'))
        parser.add_argument('--cluster-id',
                            metavar='CLUSTER_ID',
                            dest='cluster_id',
                            required=True,
                            help=_('Specify the cluster_id.'))

        return parser
Exemplo n.º 8
0
 def update_port(self, network=None, port=None, virtual_nic=None):
     device_id = port.vm_id
     mac_address = port.mac_address
     vm_mor = resource_util.get_vm_mor_for_uuid(self.session, device_id)
     if not vm_mor:
         LOG.warning(
             _LW("VM %(vm)s with mac address %(mac)s for "
                 "port %(uuid)s not found on this node."), {
                     'vm': device_id,
                     'mac': mac_address,
                     'uuid': port.uuid
                 })
         return False
     if port.port_status == constants.PORT_STATUS_UP:
         enabled = True
     elif port.port_status == constants.PORT_STATUS_DOWN:
         enabled = False
     else:
         msg = (_("Invalid port status %(port)s in update for port %(id)s"),
                {
                    'port': port.port_status,
                    'id': port.uuid
                })
         raise error.OVSvAppNeutronAgentError(msg)
     action = "Enabling" if enabled else "Disabling"
     LOG.debug(
         "%(action)s port used by VM %(id)s for VNIC with "
         "mac address %(mac)s.", {
             'action': action,
             'id': device_id,
             'mac': mac_address
         })
     status = network_util.enable_disable_port_of_vm(
         self.session, vm_mor, mac_address, enabled)
     return status
 def execute(self, parsed_args):
     self.log.debug('execute(%s)', parsed_args)
     neutron_client = self.get_client()
     neutron_client.format = parsed_args.request_format
     vcenter_id = parsed_args.id
     params = {}
     obj_shower = getattr(neutron_client, "show_%s" % self.resource)
     data = obj_shower(vcenter_id, **params)
     try:
         if data[self.resource] == {}:
             raise Exception()
         if self.resource in data:
             for k, v in six.iteritems(data[self.resource]):
                 if isinstance(v, list):
                     value = ""
                     for _item in v:
                         if value:
                             value += "\n"
                         if isinstance(_item, dict):
                             value += utils.dumps(_item)
                         else:
                             value += str(_item)
                     data[self.resource][k] = value
                 elif v is None:
                     data[self.resource][k] = ''
     except Exception:
         not_found_message = (_("Unable to find %(resource)s with vCenter "
                                "name '%(vcenter_id)s'.") % {
                                    'resource': self.resource,
                                    'vcenter_id': vcenter_id
                                })
         raise exceptions.NeutronClientException(message=not_found_message,
                                                 status_code=404)
     return zip(*sorted(six.iteritems(data[self.resource])))
Exemplo n.º 10
0
 def execute(self, parsed_args):
     self.log.debug('execute(%s)', parsed_args)
     neutron_client = self.get_client()
     neutron_client.format = parsed_args.request_format
     vcenter_id = parsed_args.id
     params = {}
     obj_shower = getattr(neutron_client,
                          "show_%s" % self.resource)
     data = obj_shower(vcenter_id, **params)
     try:
         if data[self.resource] == {}:
             raise Exception()
         if self.resource in data:
             for k, v in six.iteritems(data[self.resource]):
                 if isinstance(v, list):
                     value = ""
                     for _item in v:
                         if value:
                             value += "\n"
                         if isinstance(_item, dict):
                             value += utils.dumps(_item)
                         else:
                             value += str(_item)
                     data[self.resource][k] = value
                 elif v is None:
                     data[self.resource][k] = ''
     except Exception:
         not_found_message = (_("Unable to find %(resource)s with vCenter "
                                "name '%(vcenter_id)s'.") %
                              {'resource': self.resource,
                               'vcenter_id': vcenter_id})
         raise exceptions.NeutronClientException(
             message=not_found_message, status_code=404)
     return zip(*sorted(six.iteritems(data[self.resource])))
Exemplo n.º 11
0
 def update_port(self, network=None, port=None, virtual_nic=None):
     device_id = port.vm_id
     mac_address = port.mac_address
     vm_mor = resource_util.get_vm_mor_for_uuid(self.session, device_id)
     if not vm_mor:
         LOG.warning(
             _LW("VM %(vm)s with mac address %(mac)s for " "port %(uuid)s not found on this node."),
             {"vm": device_id, "mac": mac_address, "uuid": port.uuid},
         )
         return False
     if port.port_status == constants.PORT_STATUS_UP:
         enabled = True
     elif port.port_status == constants.PORT_STATUS_DOWN:
         enabled = False
     else:
         msg = (
             _("Invalid port status %(port)s in update for port %(id)s"),
             {"port": port.port_status, "id": port.uuid},
         )
         raise error.OVSvAppNeutronAgentError(msg)
     action = "Enabling" if enabled else "Disabling"
     LOG.debug(
         "%(action)s port used by VM %(id)s for VNIC with " "mac address %(mac)s.",
         {"action": action, "id": device_id, "mac": mac_address},
     )
     status = network_util.enable_disable_port_of_vm(self.session, vm_mor, mac_address, enabled)
     return status
 def run(self, parsed_args):
     self.log.debug('run(%s)', parsed_args)
     neutron_client = self.get_client()
     neutron_client.format = parsed_args.request_format
     parsed_args.id = (parsed_args.vcenter_id + ':'
                       + parsed_args.cluster_id.replace('/', '|'))
     body = self.args2body(parsed_args)
     if not body[self.resource]:
         raise exceptions.CommandError(
             _("Must specify new values to update %s.") % self.resource)
     obj_updator = getattr(neutron_client,
                           "update_%s" % self.resource)
     obj_updator(parsed_args.id, body)
     print(_('Updated the given vcenter:cluster %(vcenter_id)s:'
           '%(cluster_id)s.') % {'vcenter_id': parsed_args.vcenter_id,
           'cluster_id': parsed_args.cluster_id})
     return
Exemplo n.º 13
0
 def run(self, parsed_args):
     self.log.debug('run(%s)', parsed_args)
     neutron_client = self.get_client()
     neutron_client.format = parsed_args.request_format
     parsed_args.id = (parsed_args.vcenter_id + ':' +
                       parsed_args.cluster_id.replace('/', '|'))
     body = self.args2body(parsed_args)
     if not body[self.resource]:
         raise exceptions.CommandError(
             _("Must specify new values to update %s.") % self.resource)
     obj_updator = getattr(neutron_client, "update_%s" % self.resource)
     obj_updator(parsed_args.id, body)
     print(
         _('Updated the given vcenter:cluster %(vcenter_id)s:'
           '%(cluster_id)s.') % {
               'vcenter_id': parsed_args.vcenter_id,
               'cluster_id': parsed_args.cluster_id
           })
     return
def comman_add_args(parser):
    parser.add_argument(
        '--vcenter-id', metavar='VCENTER_ID',
        required=True,
        dest='vcenter_id',
        help=_('Specify the vcenter_id.'))
    parser.add_argument(
        '--cluster-id', metavar='CLUSTER_ID',
        dest='cluster_id',
        required=True,
        help=_('Specify the cluster_id.'))
    parser.add_argument(
        '--being-mitigated', metavar='BEING_MITIGATED',
        dest='being_mitigated',
        help=_('Specify the being mitigated flag (True/False).'))
    parser.add_argument(
        '--threshold-reached', metavar='THRESHOLD_REACHED',
        dest='threshold_reached',
        help=_('Specify the threshold reached flag (True/False).'))
Exemplo n.º 15
0
def comman_add_args(parser):
    parser.add_argument('--vcenter-id',
                        metavar='VCENTER_ID',
                        required=True,
                        dest='vcenter_id',
                        help=_('Specify the vcenter_id.'))
    parser.add_argument('--cluster-id',
                        metavar='CLUSTER_ID',
                        dest='cluster_id',
                        required=True,
                        help=_('Specify the cluster_id.'))
    parser.add_argument(
        '--being-mitigated',
        metavar='BEING_MITIGATED',
        dest='being_mitigated',
        help=_('Specify the being mitigated flag (True/False).'))
    parser.add_argument(
        '--threshold-reached',
        metavar='THRESHOLD_REACHED',
        dest='threshold_reached',
        help=_('Specify the threshold reached flag (True/False).'))
 def run(self, parsed_args):
     self.log.debug('run(%s)', parsed_args)
     neutron_client = self.get_client()
     neutron_client.format = parsed_args.request_format
     parsed_args.id = (parsed_args.vcenter_id + ':'
                       + parsed_args.cluster_id.replace('/', '|'))
     obj_deletor = getattr(neutron_client,
                           "delete_%s" % self.resource)
     obj_deletor(parsed_args.id)
     print(_('Deleted the given vcenter:cluster %(vcenter_id)s:'
           '%(cluster_id)s.') % {'vcenter_id': parsed_args.vcenter_id,
           'cluster_id': parsed_args.cluster_id})
Exemplo n.º 17
0
 def post_create_port(self, port):
     if port.port_status == constants.PORT_STATUS_UP:
         device_id = port.vm_id
         _clu_mor, _clu_path, vds_name = self._find_cluster_switch_for_vm(device_id)
         pg_mor = network_util.get_portgroup_mor_by_name(self.session, vds_name, port.network_uuid)
         if pg_mor is None:
             msg = (
                 _("Port group %(net_id)s not created on " "virtual switch %(vds)s."),
                 {"net_id": port.network_uuid, "vds": vds_name},
             )
             raise error_util.RunTimeError(msg)
         vm_mor = resource_util.get_vm_mor_for_uuid(self.session, device_id)
         if vm_mor is None:
             msg = (
                 _("Virtual machine %(id)s with " "port %(port)s not created."),
                 {"id": device_id, "port": port.uuid},
             )
             raise error_util.RunTimeError(msg)
         (pg_key, port_key, swuuid) = self._wait_for_port_update_on_vm(vm_mor, pg_mor)
         if pg_key and port_key and swuuid:
             # enable the port on virtual switch.
             network_util.enable_disable_port(self.session, swuuid, pg_key, port_key, True)
Exemplo n.º 18
0
 def _find_cluster_switch_for_vm(self, device_id):
     cluster_mor = resource_util.get_cluster_mor_for_vm(self.session,
                                                        device_id)
     cluster_path = None
     if cluster_mor:
         cluster_id = cluster_mor.value
         cluster_path = cache.VCCache.get_cluster_path_for_id(cluster_id)
     if not cluster_path:
         raise error.VcenterConfigurationError(_("Cluster for VM %s could "
                                               "not be determined")
                                               % device_id)
     switch_name = cache.VCCache.get_switch_for_cluster_path(cluster_path)
     return cluster_mor, cluster_path, switch_name
Exemplo n.º 19
0
 def _find_cluster_switch_for_vm(self, device_id):
     cluster_mor = resource_util.get_cluster_mor_for_vm(self.session,
                                                        device_id)
     cluster_path = None
     if cluster_mor:
         cluster_id = cluster_mor.value
         cluster_path = cache.VCCache.get_cluster_path_for_id(cluster_id)
     if not cluster_path:
         raise error.VcenterConfigurationError(_("Cluster for VM %s could "
                                               "not be determined")
                                               % device_id)
     switch_name = cache.VCCache.get_switch_for_cluster_path(cluster_path)
     return cluster_mor, cluster_path, switch_name
Exemplo n.º 20
0
 def run(self, parsed_args):
     self.log.debug('run(%s)', parsed_args)
     neutron_client = self.get_client()
     neutron_client.format = parsed_args.request_format
     parsed_args.id = parsed_args.vcenter_id
     body = self.args2body(parsed_args)
     if not body[self.resource]:
         raise exceptions.CommandError(
             _("Must specify existing values to delete %s "
               "info") % self.resource)
     obj_updator = getattr(neutron_client, "update_%s" % self.resource)
     obj_updator(parsed_args.id, body)
     return
 def get_parser(self, prog_name):
     parser = super(neutronV20.NeutronCommand, self).get_parser(prog_name)
     parser.add_argument(
         '--request-format',
         help=_('The XML or JSON request format.'),
         default='json',
         choices=['json', 'xml', ], )
     parser.add_argument(
         '--request_format',
         choices=['json', 'xml', ],
         help=argparse.SUPPRESS)
     comman_add_args(parser)
     return parser
 def update_port_postcommit(self, current, original, segment):
     try:
         dvs = self._lookup_dvs_for_context(segment)
         if current['id'] in self.booked_ports:
             self.added_ports.add(current['id'])
             self.booked_ports.discard(current['id'])
     except exceptions.NoDVSForPhysicalNetwork:
         raise exceptions.InvalidSystemState(
             details=_('Port %(port_id)s belong to VMWare VM, but there is '
                       'no mapping from network to DVS.') %
             {'port_id': current['id']})
     else:
         self._update_admin_state_up(dvs, original, current)
 def update_port_postcommit(self, current, original, segment):
     try:
         dvs = self._lookup_dvs_for_context(segment)
         if current['id'] in self.booked_ports:
             self.added_ports.add(current['id'])
             self.booked_ports.discard(current['id'])
     except exceptions.NoDVSForPhysicalNetwork:
         raise exceptions.InvalidSystemState(details=_(
             'Port %(port_id)s belong to VMWare VM, but there is '
             'no mapping from network to DVS.') % {'port_id': current['id']}
         )
     else:
         self._update_admin_state_up(dvs, original, current)
    def get_parser(self, prog_name):
        parser = super(neutronV20.NeutronCommand, self).get_parser(prog_name)
        parser.add_argument(
            '--request-format',
            help=_('The XML or JSON request format.'),
            default='json',
            choices=['json', 'xml', ], )
        parser.add_argument(
            '--request_format',
            choices=['json', 'xml', ],
            help=argparse.SUPPRESS)
        parser.add_argument(
            '--vcenter-id', metavar='VCENTER_ID',
            required=True,
            dest='vcenter_id',
            help=_('Specify the vcenter_id.'))
        parser.add_argument(
            '--cluster-id', metavar='CLUSTER_ID',
            dest='cluster_id',
            required=True,
            help=_('Specify the cluster_id.'))

        return parser
Exemplo n.º 25
0
def run():
    signal.signal(signal.SIGTERM, signal_handler)
    signal.signal(signal.SIGINT, signal_handler)
    try:
        global agent_obj
        ovsvapp_config.register_options()
        LOG.info(_LI("Loading agent: %s."), cfg.CONF.OVSVAPP.agent_driver)
        agent_obj = utils.load_object(cfg.CONF.OVSVAPP.agent_driver, agent.Agent)
        agent_obj.start()
    except Exception as e:
        LOG.exception(_LE("Error in OVSvApp agent service."))
        if agent_obj:
            agent_obj.stop()
        sys.exit(_("ERROR: %s.") % e)
Exemplo n.º 26
0
 def run(self, parsed_args):
     self.log.debug('run(%s)', parsed_args)
     neutron_client = self.get_client()
     neutron_client.format = parsed_args.request_format
     parsed_args.id = parsed_args.vcenter_id
     body = self.args2body(parsed_args)
     if not body[self.resource]:
         raise exceptions.CommandError(
             _("Must specify existing values to delete %s "
               "info") % self.resource)
     obj_updator = getattr(neutron_client,
                           "update_%s" % self.resource)
     obj_updator(parsed_args.id, body)
     return
Exemplo n.º 27
0
 def run(self, parsed_args):
     self.log.debug('run(%s)', parsed_args)
     neutron_client = self.get_client()
     neutron_client.format = parsed_args.request_format
     parsed_args.id = (parsed_args.vcenter_id + ':' +
                       parsed_args.cluster_id.replace('/', '|'))
     obj_deletor = getattr(neutron_client, "delete_%s" % self.resource)
     obj_deletor(parsed_args.id)
     print(
         _('Deleted the given vcenter:cluster %(vcenter_id)s:'
           '%(cluster_id)s.') % {
               'vcenter_id': parsed_args.vcenter_id,
               'cluster_id': parsed_args.cluster_id
           })
Exemplo n.º 28
0
 def delete_port_postcommit(self, current, original, segment):
     try:
         dvs = self._lookup_dvs_for_context(segment)
     except exceptions.NotSupportedNetworkType as e:
         LOG.info(_LI('Port %(id)s not deleted. Reason: %(reason)s') % {
             'id': current['id'],
             'reason': e.message})
     except exceptions.NoDVSForPhysicalNetwork:
         raise exceptions.InvalidSystemState(details=_(
             'Port %(port_id)s belong to VMWare VM, but there is '
             'no mapping from network to DVS.') % {'port_id': current['id']}
         )
     else:
         # TODO(SlOPS): update security groups on girect call
         dvs.release_port(current)
Exemplo n.º 29
0
def run():
    signal.signal(signal.SIGTERM, signal_handler)
    signal.signal(signal.SIGINT, signal_handler)
    try:
        global agent_obj
        ovsvapp_config.register_options()
        LOG.info(_LI("Loading agent: %s."), cfg.CONF.OVSVAPP.agent_driver)
        agent_obj = utils.load_object(cfg.CONF.OVSVAPP.agent_driver,
                                      agent.Agent)
        agent_obj.start()
    except Exception as e:
        LOG.exception(_LE("Error in OVSvApp agent service."))
        if agent_obj:
            agent_obj.stop()
        sys.exit(_("ERROR: %s.") % e)
 def delete_port_postcommit(self, current, original, segment):
     try:
         dvs = self._lookup_dvs_for_context(segment)
     except exceptions.NoDVSForPhysicalNetwork:
         raise exceptions.InvalidSystemState(
             details=_('Port %(port_id)s belong to VMWare VM, but there is '
                       'no mapping from network to DVS.') %
             {'port_id': current['id']})
     else:
         if sg_rpc.is_firewall_enabled():
             key = current.get('binding:vif_details',
                               {}).get('dvs_port_key')
             if key:
                 dvs.remove_block(key)
         else:
             dvs.release_port(current)
 def delete_port_postcommit(self, current, original, segment):
     try:
         dvs = self._lookup_dvs_for_context(segment)
     except exceptions.NoDVSForPhysicalNetwork:
         raise exceptions.InvalidSystemState(details=_(
             'Port %(port_id)s belong to VMWare VM, but there is '
             'no mapping from network to DVS.') % {'port_id': current['id']}
         )
     else:
         if sg_rpc.is_firewall_enabled():
             key = current.get(
                 'binding:vif_details', {}).get('dvs_port_key')
             if key:
                 dvs.remove_block(key)
         else:
             dvs.release_port(current)
Exemplo n.º 32
0
 def get_parser(self, prog_name):
     parser = super(neutronV20.NeutronCommand, self).get_parser(prog_name)
     parser.add_argument(
         '--request-format',
         help=_('The XML or JSON request format.'),
         default='json',
         choices=[
             'json',
             'xml',
         ],
     )
     parser.add_argument('--request_format',
                         choices=[
                             'json',
                             'xml',
                         ],
                         help=argparse.SUPPRESS)
     comman_add_args(parser)
     return parser
def create_agent_config_map(config):
    """Create a map of agent config parameters.

    :param config: an instance of cfg.CONF
    :returns: a map of agent configuration parameters
    """
    try:
        bridge_mappings = helpers.parse_mappings(
            config.ML2_VMWARE.network_maps, unique_values=False)
    except ValueError as e:
        raise ValueError(_("Parsing network_maps failed: %s.") % e)

    kwargs = dict(
        vsphere_hostname=config.ML2_VMWARE.vsphere_hostname,
        vsphere_login=config.ML2_VMWARE.vsphere_login,
        vsphere_password=config.ML2_VMWARE.vsphere_password,
        bridge_mappings=bridge_mappings,
        polling_interval=config.DVS_AGENT.polling_interval,
    )
    return kwargs
def create_agent_config_map(config):
    """Create a map of agent config parameters.

    :param config: an instance of cfg.CONF
    :returns: a map of agent configuration parameters
    """
    try:
        bridge_mappings = helpers.parse_mappings(
            config.ML2_VMWARE.network_maps, unique_values=False)
    except ValueError as e:
        raise ValueError(_("Parsing network_maps failed: %s.") % e)

    kwargs = dict(
        vsphere_hostname=config.ML2_VMWARE.vsphere_hostname,
        vsphere_login=config.ML2_VMWARE.vsphere_login,
        vsphere_password=config.ML2_VMWARE.vsphere_password,
        bridge_mappings=bridge_mappings,
        polling_interval=config.DVS_AGENT.polling_interval,
    )
    return kwargs
Exemplo n.º 35
0
class PortGroupNotFound(ResourceNotFound):
    message = _('Port Group %(pg_name)s not found')
Exemplo n.º 36
0
class DVSNotFound(ResourceNotFound):
    message = _('Distributed Virtual Switch %(dvs_name)s not found')
Exemplo n.º 37
0
class ClusterNotFound(ResourceNotFound):
    message = _('Cluster Compute Resource %(cluster_name)s not found')
Exemplo n.º 38
0
#    under the License.

from oslo_config import cfg

from networking_vsphere._i18n import _
from neutron.agent.common import config

DEFAULT_BRIDGE_MAPPINGS = []
DEFAULT_UPLINK_MAPPINGS = []
DEFAULT_VLAN_RANGES = []
DEFAULT_TUNNEL_RANGES = []
DEFAULT_TUNNEL_TYPES = []

agent_opts = [
    cfg.IntOpt('polling_interval', default=2,
               help=_("The number of seconds the agent will wait between "
                      "polling for local device changes.")),
    cfg.IntOpt('quitting_rpc_timeout', default=10,
               help=_("Set new timeout in seconds for new rpc calls after "
                      "agent receives SIGTERM. If value is set to 0, rpc "
                      "timeout won't be changed")),
    cfg.BoolOpt('log_agent_heartbeats', default=False,
               help=_("Log agent heartbeats")),
    cfg.IntOpt('report_interval',
               default=30,
               help='Seconds between nodes reporting state to server.'),
]

vmware_opts = [
    cfg.FloatOpt(
        'task_poll_interval',
        default=2,
Exemplo n.º 39
0
from neutron.db import agents_db
from neutron.db import common_db_mixin

from networking_vsphere._i18n import _, _LE, _LI, _LW
from networking_vsphere.common import constants as ovsvapp_const
from networking_vsphere.db import ovsvapp_db

LOG = log.getLogger(__name__)

DEFAULT_MONITOR_INTERVAL = 10

# OVSvApp Fault Management config read from neutron.conf.
OVSVAPP_MONITOR_OPTS = [
    cfg.BoolOpt('enable_ovsvapp_monitor', default=False,
                help=_('To monitor the OVSvApp Agents.'))
]

cfg.CONF.register_opts(OVSVAPP_MONITOR_OPTS, "OVSVAPP")


class AgentMonitor(agents_db.AgentDbMixin, common_db_mixin.CommonDbMixin):
    """OVSvApp agent monitor class.

    Represents agent_monitor class which maintains active and inactive
    agents and reschedules its resources.
    """
    active_agents = []
    inactive_agents = []
    agents = {}
    context = None
Exemplo n.º 40
0
class NoDVSForPhysicalNetwork(VMWareDVSException):
    message = _('No dvs mapped for physical network: %(physical_network)s')
Exemplo n.º 41
0
class HypervisorNotFound(ResourceNotFound):
    message = _('Hypervisor not found')
Exemplo n.º 42
0
def _admin_check(context, action):
    """Admin role check helper."""
    if not context.is_admin:
        reason = _('Cannot %s resource for non admin tenant') % action
        raise exc.AdminRequired(reason=reason)
Exemplo n.º 43
0
#    under the License.

from oslo_config import cfg

from networking_vsphere._i18n import _
from neutron.conf.agent import common as config

DEFAULT_BRIDGE_MAPPINGS = []
DEFAULT_UPLINK_MAPPINGS = []
DEFAULT_VLAN_RANGES = []
DEFAULT_TUNNEL_RANGES = []
DEFAULT_TUNNEL_TYPES = []

agent_opts = [
    cfg.IntOpt('polling_interval', default=2,
               help=_("The number of seconds the agent will wait between "
                      "polling for local device changes.")),
]

vmware_opts = [
    cfg.FloatOpt(
        'task_poll_interval',
        default=2,
        help=_("interval of task polling in seconds")),
    cfg.IntOpt(
        'api_retry_count',
        default=10,
        help=_("number of times an API must be retried upon "
               "session/connection related errors")),
    cfg.IntOpt(
        'connections_pool_size',
        default=100,
Exemplo n.º 44
0
class PortNotFound(ResourceNotFound):
    message = _('Port %(id)s not found')
Exemplo n.º 45
0
class UnboundPortNotFound(ResourceNotFound):
    message = _('Unbound port not found')
Exemplo n.º 46
0
#    License for the specific language governing permissions and limitations
#    under the License.

from oslo_config import cfg

from networking_vsphere._i18n import _
from neutron.agent.common import config

DEFAULT_BRIDGE_MAPPINGS = []
DEFAULT_VLAN_RANGES = []
DEFAULT_TUNNEL_RANGES = []
DEFAULT_TUNNEL_TYPES = []

agent_opts = [
    cfg.IntOpt('polling_interval', default=2,
               help=_("The number of seconds the agent will wait between "
                      "polling for local device changes.")),
    cfg.IntOpt('quitting_rpc_timeout', default=10,
               help=_("Set new timeout in seconds for new rpc calls after "
                      "agent receives SIGTERM. If value is set to 0, rpc "
                      "timeout won't be changed")),
]

vmware_opts = [
    cfg.FloatOpt(
        'task_poll_interval',
        default=2,
        help=_('The interval of task polling in seconds.')),
    cfg.IntOpt(
        'api_retry_count',
        default=10,
        help=_('number of times an API must be retried upon '
Exemplo n.º 47
0
class VMNotFound(ResourceNotFound):
    message = _('Virtual machine not found')
Exemplo n.º 48
0
class NotSupportedNetworkType(InvalidNetwork):
    message = _("VMWare DVS driver don't support %(network_type)s network")
Exemplo n.º 49
0
def _admin_check(context, action):
    """Admin role check helper."""
    if not context.is_admin:
        reason = _('Cannot %s resource for non admin tenant') % action
        raise exc.AdminRequired(reason=reason)
Exemplo n.º 50
0
class InvalidNetworkName(InvalidNetwork):
    message = _('Illegal network name %(name)s: %(reason)s')
Exemplo n.º 51
0
from networking_vsphere._i18n import _, _LE, _LI, _LW
from networking_vsphere.common import constants as ovsvapp_const
from networking_vsphere.db import ovsvapp_db

LOG = log.getLogger(__name__)

DEFAULT_MONITOR_INTERVAL = 10

# OVSvApp Fault Management config read from neutron.conf.
# DEPRECATED: This option is deprecated and will be removed in the
# next release
OVSVAPP_MONITOR_OPTS = [
    cfg.BoolOpt('enable_ovsvapp_monitor', default=False,
                deprecated_for_removal=True,
                help=_('To monitor the OVSvApp Agents. Deprecated, to be'
                       'removed in the next release'))
]

cfg.CONF.register_opts(OVSVAPP_MONITOR_OPTS, "OVSVAPP")


# DEPRECATED: AgentMonitor is deprecated and will be removed in the next
# release.
class AgentMonitor(agents_db.AgentDbMixin, common_db_mixin.CommonDbMixin):
    """OVSvApp agent monitor class.

    Represents agent_monitor class which maintains active and inactive
    agents and reschedules its resources.
    """
    active_agents = []
    inactive_agents = []
Exemplo n.º 52
0
class ResourceNotFound(VMWareDVSException):
    message = _('Resource not found')