本文整理汇总了Python中vmware_nsx._i18n._LE函数的典型用法代码示例。如果您正苦于以下问题:Python _LE函数的具体用法?Python _LE怎么用?Python _LE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_LE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: nsx_clean_spoofguard_policy
def nsx_clean_spoofguard_policy(resource, event, trigger, **kwargs):
"""Delete spoofguard policy"""
errmsg = ("Need to specify policy-id. Add --property "
"policy-id=<policy-id>")
if not kwargs.get('property'):
LOG.error(_LE("%s"), errmsg)
return
properties = admin_utils.parse_multi_keyval_opt(kwargs['property'])
policy_id = properties.get('policy-id')
if not policy_id:
LOG.error(_LE("%s"), errmsg)
return
try:
nsxv.get_spoofguard_policy(policy_id)
except exceptions.NeutronException as e:
LOG.error(_LE("Unable to retrieve policy %(p)s: %(e)s"),
{'p': policy_id, 'e': str(e)})
else:
confirm = admin_utils.query_yes_no(
"Do you want to delete spoofguard-policy: %s" % policy_id,
default="no")
if not confirm:
LOG.info(_LI("spoofguard-policy deletion aborted by user"))
return
try:
nsxv.delete_spoofguard_policy(policy_id)
except Exception as e:
LOG.error(_LE("%s"), str(e))
LOG.info(_LI('spoofguard-policy successfully deleted.'))
开发者ID:ddoshiopenstack,项目名称:vmware-nsx,代码行数:29,代码来源:spoofguard_policy.py
示例2: update_vip
def update_vip(self, context, old_vip, vip, pool_mapping, vip_mapping):
LOG.debug('Updating VIP %s to %s', old_vip, vip)
edge_id = vip_mapping['edge_id']
edge_vip_id = vip_mapping['edge_vse_id']
app_profile_id = vip_mapping['edge_app_profile_id']
app_profile = convert_lbaas_app_profile(
vip['name'], vip.get('session_persistence', {}),
vip.get('protocol'))
try:
with locking.LockManager.get_lock(edge_id):
self.vcns.update_app_profile(edge_id, app_profile_id,
app_profile)
except nsxv_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv1_driver.vip_failed(context, vip)
LOG.error(_LE('Failed to update app profile on edge: %s'),
edge_id)
edge_vip = convert_lbaas_vip(vip, app_profile_id, pool_mapping)
try:
with locking.LockManager.get_lock(edge_id):
self.vcns.update_vip(edge_id, edge_vip_id, edge_vip)
self.lbv1_driver.vip_successful(context, vip)
except nsxv_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv1_driver.vip_failed(context, vip)
LOG.error(_LE('Failed to update vip on edge: %s'), edge_id)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:28,代码来源:edge_loadbalancer_driver.py
示例3: _status_edge
def _status_edge(self, task):
edge_id = task.userdata['edge_id']
try:
response = self.vcns.get_edge_deploy_status(edge_id)[1]
task.userdata['retries'] = 0
system_status = response.get('systemStatus', None)
if system_status is None:
status = task_constants.TaskStatus.PENDING
elif system_status == 'good':
status = task_constants.TaskStatus.COMPLETED
else:
status = task_constants.TaskStatus.ERROR
except exceptions.VcnsApiException as e:
LOG.exception(_LE("VCNS: Edge %s status query failed."), edge_id)
raise e
except Exception as e:
retries = task.userdata.get('retries', 0) + 1
if retries < 3:
task.userdata['retries'] = retries
LOG.exception(_LE("VCNS: Unable to retrieve edge %(edge_id)s "
"status. Retry %(retries)d."),
{'edge_id': edge_id,
'retries': retries})
status = task_constants.TaskStatus.PENDING
else:
LOG.exception(_LE("VCNS: Unable to retrieve edge %s status. "
"Abort."), edge_id)
status = task_constants.TaskStatus.ERROR
LOG.debug("VCNS: Edge %s status", edge_id)
return status
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:30,代码来源:edge_appliance_driver.py
示例4: _delete_port_group
def _delete_port_group(self, task):
try:
header, response = self.vcns.get_edge_id(task.userdata['job_id'])
except exceptions.VcnsApiException:
with excutils.save_and_reraise_exception():
LOG.error(_LE("NSXv: Failed to get job for %s"),
task.userdata)
status = response['status']
if status != 'COMPLETED':
if (status == 'QUEUED' or status == 'RUNNING' or
status == 'ROLLBACK'):
LOG.debug("NSXv: job is still pending for %s", task.userdata)
return task_constants.TaskStatus.PENDING
try:
self.vcns.delete_port_group(
task.userdata['dvs_id'],
task.userdata['port_group_id'])
except Exception as e:
LOG.error(_LE('Unable to delete %(pg)s (job status %(state)s) '
'exception %(ex)s'),
{'pg': task.userdata['port_group_id'],
'state': status,
'ex': e})
if status == 'FAILED':
return task_constants.TaskStatus.ERROR
return task_constants.TaskStatus.COMPLETED
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:26,代码来源:edge_appliance_driver.py
示例5: _reconfigure_port_group
def _reconfigure_port_group(self, pg_moref, spec_update_calback,
spec_update_data):
# Get the current configuration of the port group
pg_spec = self._session.invoke_api(vim_util,
'get_object_properties',
self._session.vim,
pg_moref, ['config'])
if len(pg_spec) == 0 or len(pg_spec[0].propSet[0]) == 0:
LOG.error(_LE('Failed to get object properties of %s'), pg_moref)
raise nsx_exc.DvsNotFound(dvs=pg_moref)
# Convert the extracted config to DVPortgroupConfigSpec
new_spec = self._copy_port_group_spec(pg_spec[0].propSet[0].val)
# Update the configuration using the callback & data
spec_update_calback(new_spec, spec_update_data)
# Update the port group configuration
task = self._session.invoke_api(self._session.vim,
'ReconfigureDVPortgroup_Task',
pg_moref, spec=new_spec)
try:
self._session.wait_for_task(task)
except Exception:
LOG.error(_LE('Failed to reconfigure DVPortGroup %s'), pg_moref)
raise nsx_exc.DvsNotFound(dvs=pg_moref)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:26,代码来源:dvs.py
示例6: check_edge_jobs
def check_edge_jobs(self, edge_id):
retries = max(cfg.CONF.nsxv.retries, 1)
delay = 0.5
for attempt in range(1, retries + 1):
if attempt != 1:
time.sleep(delay)
delay = min(2 * delay, 60)
h, jobs = self.vcns.get_edge_jobs(edge_id)
if jobs['edgeJob'] == []:
return
job_number = len(jobs['edgeJob'])
# Assume one job would wait time out after 20 minutes and one
# job takes about 1 minute to be completed.
if job_number < 20:
LOG.warning(_LW("NSXv: %(num)s jobs still running on edge "
"%(edge_id)s."),
{'num': job_number,
'edge_id': edge_id})
else:
LOG.error(_LE("NSXv: %(num)s jobs still running on edge "
"%(edge_id)s. Too many jobs may lead to job "
"time out at the backend"),
{'num': job_number,
'edge_id': edge_id})
LOG.error(_LE('NSXv: jobs are still runnings!'))
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:25,代码来源:edge_appliance_driver.py
示例7: nsx_update_switch
def nsx_update_switch(resource, event, trigger, **kwargs):
nsxv = utils.get_nsxv_client()
if not kwargs.get('property'):
LOG.error(_LE("Need to specify dvs-id parameter and "
"attribute to update. Add --property dvs-id=<dvs-id> "
"--property teamingpolicy=<policy>"))
return
properties = admin_utils.parse_multi_keyval_opt(kwargs['property'])
dvs_id = properties.get('dvs-id')
if not dvs_id:
LOG.error(_LE("Need to specify dvs-id. "
"Add --property dvs-id=<dvs-id>"))
return
h, switch = nsxv.get_vdn_switch(dvs_id)
policy = properties.get('teamingpolicy')
if policy:
if switch['teamingPolicy'] == policy:
LOG.info(_LI("Policy already set!"))
return
LOG.info(_LI("Updating NSXv switch %(dvs)s teaming policy to "
"%(policy)s"), {'dvs': dvs_id, 'policy': policy})
switch['teamingPolicy'] = policy
switch = nsxv.update_vdn_switch(switch)
LOG.info(_LI("Switch value after update: %s"), switch)
else:
LOG.error(_LE("No teaming policy set. "
"Add --property teamingpolicy=<policy>"))
LOG.info(_LI("Current switch value is: %s"), switch)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:28,代码来源:networks.py
示例8: create
def create(self, context, listener, certificate=None):
default_pool = None
lb_id = listener.loadbalancer_id
lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding(
context.session, lb_id)
edge_id = lb_binding['edge_id']
if listener.default_pool and listener.default_pool.id:
pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding(
context.session, lb_id, listener.id, listener.default_pool.id)
if pool_binding:
default_pool = pool_binding['edge_pool_id']
edge_cert_id = None
if certificate:
try:
edge_cert_id = self._upload_certificate(
context, edge_id, listener.default_tls_container_id,
certificate)
except Exception:
with excutils.save_and_reraise_exception():
self.lbv2_driver.listener.failed_completion(context,
listener)
app_profile = listener_to_edge_app_profile(listener, edge_cert_id)
app_profile_id = None
try:
with locking.LockManager.get_lock(edge_id):
h = (self.vcns.create_app_profile(edge_id, app_profile))[0]
app_profile_id = lb_common.extract_resource_id(h['location'])
except vcns_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv2_driver.listener.failed_completion(context, listener)
LOG.error(_LE('Failed to create app profile on edge: %s'),
lb_binding['edge_id'])
vse = listener_to_edge_vse(listener, lb_binding['vip_address'],
default_pool,
app_profile_id)
try:
with locking.LockManager.get_lock(edge_id):
h = self.vcns.create_vip(edge_id, vse)[0]
edge_vse_id = lb_common.extract_resource_id(h['location'])
nsxv_db.add_nsxv_lbaas_listener_binding(context.session,
lb_id,
listener.id,
app_profile_id,
edge_vse_id)
self.lbv2_driver.listener.successful_completion(context, listener)
except vcns_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv2_driver.listener.failed_completion(context, listener)
LOG.error(_LE('Failed to create vip on Edge: %s'), edge_id)
self.vcns.delete_app_profile(edge_id, app_profile_id)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:59,代码来源:listener_mgr.py
示例9: _validate_resource_choice
def _validate_resource_choice(resource, nsx_plugin):
if nsx_plugin == 'nsxv' and resource not in nsxv_resources:
LOG.error(_LE('Supported list of NSX-V resources: %s'),
nsxv_resources_names)
sys.exit(1)
elif nsx_plugin == 'nsxv3'and resource not in nsxv3_resources:
LOG.error(_LE('Supported list of NSX-V3 resources: %s'),
nsxv3_resources_names)
sys.exit(1)
开发者ID:ddoshiopenstack,项目名称:vmware-nsx,代码行数:9,代码来源:nsxadmin.py
示例10: create
def create(self, context, hm):
listener = hm.pool.listener
lb_id = listener.loadbalancer_id
lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding(
context.session, lb_id)
pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding(
context.session, lb_id, listener.id, hm.pool.id)
edge_id = lb_binding['edge_id']
edge_pool_id = pool_binding['edge_pool_id']
hm_binding = nsxv_db.get_nsxv_lbaas_monitor_binding(
context.session, lb_id, listener.id, hm.pool.id, hm.id, edge_id)
edge_mon_id = None
if hm_binding:
edge_mon_id = hm_binding['edge_mon_id']
else:
edge_monitor = self._convert_lbaas_monitor(hm)
try:
with locking.LockManager.get_lock(edge_id):
h = self.vcns.create_health_monitor(edge_id,
edge_monitor)[0]
edge_mon_id = lb_common.extract_resource_id(h['location'])
nsxv_db.add_nsxv_lbaas_monitor_binding(
context.session, lb_id, listener.id, hm.pool.id, hm.id,
edge_id, edge_mon_id)
except nsxv_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv2_driver.health_monitor.failed_completion(
context, hm)
LOG.error(_LE('Failed to create health monitor on edge: %s'
), edge_id)
try:
# Associate monitor with Edge pool
with locking.LockManager.get_lock(edge_id):
edge_pool = self.vcns.get_pool(edge_id, edge_pool_id)[1]
if edge_pool.get('monitorId'):
edge_pool['monitorId'].append(edge_mon_id)
else:
edge_pool['monitorId'] = [edge_mon_id]
self.vcns.update_pool(edge_id, edge_pool_id, edge_pool)
except nsxv_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv2_driver.health_monitor.failed_completion(context, hm)
LOG.error(
_LE('Failed to create health monitor on edge: %s'),
edge_id)
self.lbv2_driver.health_monitor.successful_completion(context, hm)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:55,代码来源:healthmon_mgr.py
示例11: change_edge_ha
def change_edge_ha(properties):
ha = bool(properties.get('highavailability').lower() == "true")
request = {
'featureType': 'highavailability_4.0',
'enabled': ha}
try:
nsxv.enable_ha(properties.get('edge-id'), request, async=False)
except nsxv_exceptions.ResourceNotFound as e:
LOG.error(_LE("Edge %s not found"), properties.get('edge-id'))
except exceptions.NeutronException as e:
LOG.error(_LE("%s"), str(e))
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:11,代码来源:edges.py
示例12: create_pool_health_monitor
def create_pool_health_monitor(self, context, health_monitor, pool_id,
pool_mapping, mon_mappings):
LOG.debug('Create HM %s', health_monitor)
edge_mon_id = None
with locking.LockManager.get_lock(pool_mapping['edge_id']):
# 1st, we find if we already have a pool with the same monitor, on
# the same Edge appliance.
# If there is no pool on this Edge which is already associated with
# this monitor, create this monitor on Edge
if mon_mappings:
edge_mon_id = mon_mappings['edge_monitor_id']
else:
edge_monitor = convert_lbaas_monitor(health_monitor)
try:
h = self.vcns.create_health_monitor(
pool_mapping['edge_id'], edge_monitor)[0]
edge_mon_id = lb_common.extract_resource_id(h['location'])
except nsxv_exc.VcnsApiException:
self.lbv1_driver.pool_health_monitor_failed(context,
health_monitor,
pool_id)
with excutils.save_and_reraise_exception():
LOG.error(
_LE('Failed to associate monitor on edge: %s'),
pool_mapping['edge_id'])
try:
# Associate monitor with Edge pool
edge_pool = self.vcns.get_pool(pool_mapping['edge_id'],
pool_mapping['edge_pool_id'])[1]
if edge_pool['monitorId']:
edge_pool['monitorId'].append(edge_mon_id)
else:
edge_pool['monitorId'] = [edge_mon_id]
self.vcns.update_pool(pool_mapping['edge_id'],
pool_mapping['edge_pool_id'],
edge_pool)
except nsxv_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv1_driver.pool_health_monitor_failed(context,
health_monitor,
pool_id)
LOG.error(
_LE('Failed to associate monitor on edge: %s'),
pool_mapping['edge_id'])
self.lbv1_driver.create_pool_health_monitor_successful(
context, health_monitor, pool_id, pool_mapping['edge_id'],
edge_mon_id)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:53,代码来源:edge_loadbalancer_driver.py
示例13: change_edge_appliance_size
def change_edge_appliance_size(properties):
size = properties.get('size')
if size not in nsxv_constants.ALLOWED_EDGE_SIZES:
LOG.error(_LE("Edge appliance size not in %(size)s"),
{'size': nsxv_constants.ALLOWED_EDGE_SIZES})
return
try:
nsxv.change_edge_appliance_size(
properties.get('edge-id'), size)
except nsxv_exceptions.ResourceNotFound as e:
LOG.error(_LE("Edge %s not found"), properties.get('edge-id'))
except exceptions.NeutronException as e:
LOG.error(_LE("%s"), str(e))
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:13,代码来源:edges.py
示例14: request
def request(self, method, url, body="", content_type="application/json"):
'''Issues request to controller.'''
g = eventlet_request.GenericRequestEventlet(
self, method, url, body, content_type, auto_login=True,
http_timeout=self._http_timeout,
retries=self._retries, redirects=self._redirects)
g.start()
response = g.join()
LOG.debug('Request returns "%s"', response)
# response is a modified HTTPResponse object or None.
# response.read() will not work on response as the underlying library
# request_eventlet.ApiRequestEventlet has already called this
# method in order to extract the body and headers for processing.
# ApiRequestEventlet derived classes call .read() and
# .getheaders() on the HTTPResponse objects and store the results in
# the response object's .body and .headers data members for future
# access.
if response is None:
# Timeout.
LOG.error(_LE('Request timed out: %(method)s to %(url)s'),
{'method': method, 'url': url})
raise exception.RequestTimeout()
status = response.status
if status == httplib.UNAUTHORIZED:
raise exception.UnAuthorizedRequest()
# Fail-fast: Check for exception conditions and raise the
# appropriate exceptions for known error codes.
if status in exception.ERROR_MAPPINGS:
LOG.error(_LE("Received error code: %s"), status)
LOG.error(_LE("Server Error Message: %s"), response.body)
exception.ERROR_MAPPINGS[status](response)
# Continue processing for non-error condition.
if (status != httplib.OK and status != httplib.CREATED
and status != httplib.NO_CONTENT):
LOG.error(_LE("%(method)s to %(url)s, unexpected response code: "
"%(status)d (content = '%(body)s')"),
{'method': method, 'url': url,
'status': response.status, 'body': response.body})
return None
if not self._version:
self._version = version.find_version(response.headers)
return response.body
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:49,代码来源:client.py
示例15: create
def create(self, context, lb):
edge_id = lb_common.get_lbaas_edge_id_for_subnet(
context, self.core_plugin, lb.vip_subnet_id, lb.tenant_id)
if not edge_id:
msg = _(
'No suitable Edge found for subnet %s') % lb.vip_subnet_id
raise n_exc.BadRequest(resource='edge-lbaas', msg=msg)
try:
if not nsxv_db.get_nsxv_lbaas_loadbalancer_binding_by_edge(
context.session, edge_id):
lb_common.enable_edge_acceleration(self.vcns, edge_id)
lb_common.add_vip_as_secondary_ip(self.vcns, edge_id,
lb.vip_address)
edge_fw_rule_id = lb_common.add_vip_fw_rule(
self.vcns, edge_id, lb.id, lb.vip_address)
nsxv_db.add_nsxv_lbaas_loadbalancer_binding(
context.session, lb.id, edge_id, edge_fw_rule_id,
lb.vip_address)
self.lbv2_driver.load_balancer.successful_completion(context, lb)
except nsxv_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv2_driver.load_balancer.failed_completion(context, lb)
LOG.error(_LE('Failed to create pool %s'), lb.id)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:28,代码来源:loadbalancer_mgr.py
示例16: update_port
def update_port(cluster, lswitch_uuid, lport_uuid, neutron_port_id, tenant_id,
display_name, device_id, admin_status_enabled,
mac_address=None, fixed_ips=None, port_security_enabled=None,
security_profiles=None, queue_id=None,
mac_learning_enabled=None, allowed_address_pairs=None):
lport_obj = dict(
admin_status_enabled=admin_status_enabled,
display_name=utils.check_and_truncate(display_name),
tags=utils.get_tags(os_tid=tenant_id,
q_port_id=neutron_port_id,
vm_id=utils.device_id_to_vm_id(device_id)))
_configure_extensions(lport_obj, mac_address, fixed_ips,
port_security_enabled, security_profiles,
queue_id, mac_learning_enabled,
allowed_address_pairs)
path = "/ws.v1/lswitch/" + lswitch_uuid + "/lport/" + lport_uuid
try:
result = nsxlib.do_request(HTTP_PUT, path, jsonutils.dumps(lport_obj),
cluster=cluster)
LOG.debug("Updated logical port %(result)s "
"on logical switch %(uuid)s",
{'result': result['uuid'], 'uuid': lswitch_uuid})
return result
except exception.NotFound as e:
LOG.error(_LE("Port or Network not found, Error: %s"), str(e))
raise exception.PortNotFoundOnNetwork(
port_id=lport_uuid, net_id=lswitch_uuid)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:29,代码来源:switch.py
示例17: update
def update(self, context, old_pool, new_pool):
edge_pool = {
'name': 'pool_' + new_pool.id,
'description': getattr(new_pool, 'description',
getattr(new_pool, 'name')),
'algorithm': lb_const.BALANCE_MAP.get(
new_pool.lb_algorithm, 'round-robin'),
'transparent': False
}
listener = new_pool.listener
lb_id = listener.loadbalancer_id
lb_binding = nsxv_db.get_nsxv_lbaas_loadbalancer_binding(
context.session, lb_id)
pool_binding = nsxv_db.get_nsxv_lbaas_pool_binding(
context.session, lb_id, listener.id, new_pool.id)
edge_id = lb_binding['edge_id']
edge_pool_id = pool_binding['edge_pool_id']
try:
with locking.LockManager.get_lock(edge_id):
self.vcns.update_pool(edge_id, edge_pool_id, edge_pool)
self.lbv2_driver.pool.successful_completion(context, new_pool)
except nsxv_exc.VcnsApiException:
with excutils.save_and_reraise_exception():
self.lbv2_driver.pool.failed_completion(context, new_pool)
LOG.error(_LE('Failed to update pool %s'), new_pool['id'])
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:30,代码来源:pool_mgr.py
示例18: _build_gateway_device_body
def _build_gateway_device_body(tenant_id, display_name, neutron_id,
connector_type, connector_ip,
client_certificate, tz_uuid):
connector_type_mappings = {
utils.NetworkTypes.STT: "STTConnector",
utils.NetworkTypes.GRE: "GREConnector",
utils.NetworkTypes.BRIDGE: "BridgeConnector",
'ipsec%s' % utils.NetworkTypes.STT: "IPsecSTT",
'ipsec%s' % utils.NetworkTypes.GRE: "IPsecGRE",
'ipsec_%s' % utils.NetworkTypes.STT: "IPsecSTT",
'ipsec_%s' % utils.NetworkTypes.GRE: "IPsecGRE"}
nsx_connector_type = connector_type_mappings.get(connector_type)
if connector_type and not nsx_connector_type:
LOG.error(_LE("There is no NSX mapping for connector type %s"),
connector_type)
raise nsx_exc.InvalidTransportType(transport_type=connector_type)
body = {"display_name": utils.check_and_truncate(display_name),
"tags": utils.get_tags(os_tid=tenant_id,
q_gw_dev_id=neutron_id),
"admin_status_enabled": True}
if connector_ip and nsx_connector_type:
body["transport_connectors"] = [
{"transport_zone_uuid": tz_uuid,
"ip_address": connector_ip,
"type": nsx_connector_type}]
if client_certificate:
body["credential"] = {"client_certificate":
{"pem_encoded": client_certificate},
"type": "SecurityCertificateCredential"}
return body
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:34,代码来源:l2gateway.py
示例19: lsn_port_get
def lsn_port_get(self, context, network_id, subnet_id, raise_on_err=True):
"""Retrieve LSN and LSN port for the network and the subnet."""
lsn_id = self.lsn_get(context, network_id, raise_on_err=raise_on_err)
if lsn_id:
try:
lsn_port_id = lsn_api.lsn_port_by_subnet_get(
self.cluster, lsn_id, subnet_id)
except (n_exc.NotFound, api_exc.NsxApiException):
if raise_on_err:
LOG.error(_LE('Unable to find Logical Service Node Port '
'for LSN %(lsn_id)s and subnet '
'%(subnet_id)s'),
{'lsn_id': lsn_id, 'subnet_id': subnet_id})
raise p_exc.LsnPortNotFound(lsn_id=lsn_id,
entity='subnet',
entity_id=subnet_id)
else:
LOG.warning(_LW('Unable to find Logical Service Node Port '
'for LSN %(lsn_id)s and subnet '
'%(subnet_id)s'),
{'lsn_id': lsn_id, 'subnet_id': subnet_id})
return (lsn_id, None)
else:
return (lsn_id, lsn_port_id)
else:
return (None, None)
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:26,代码来源:lsnmanager.py
示例20: run
def run(self):
while True:
try:
if self._stopped:
# Gracefully terminate this thread if the _stopped
# attribute was set to true
LOG.info(_LI("Stopping TaskManager"))
break
# get a task from queue, or timeout for periodic status check
task = self._get_task()
if task.resource_id in self._tasks:
# this resource already has some tasks under processing,
# append the task to same queue for ordered processing
self._enqueue(task)
continue
try:
self._main_thread_exec_task = task
self._execute(task)
finally:
self._main_thread_exec_task = None
if task.status is None:
# The thread is killed during _execute(). To guarantee
# the task been aborted correctly, put it to the queue.
self._enqueue(task)
elif task.status != constants.TaskStatus.PENDING:
self._result(task)
else:
self._enqueue(task)
except Exception:
LOG.exception(_LE("TaskManager terminating because "
"of an exception"))
break
开发者ID:aaronorosen,项目名称:vmware-nsx,代码行数:34,代码来源:tasks.py
注:本文中的vmware_nsx._i18n._LE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论