import rift.cal.rwcal_status as rwcal_status
import rwlogger
import neutronclient.common.exceptions as NeutronException
+import keystoneclient.exceptions as KeystoneExceptions
from gi.repository import (
GObject,
tenant_name = account.openstack.tenant,
mgmt_network = account.openstack.mgmt_network,
cert_validate = account.openstack.cert_validate )
+ except (KeystoneExceptions.Unauthorized, KeystoneExceptions.AuthorizationFailure,
+ NeutronException.NotFound) as e:
+ raise
except Exception as e:
self.log.error("RwcalOpenstackPlugin: OpenstackDriver init failed. Exception: %s" %(str(e)))
raise
Validation Code and Details String
"""
status = RwcalYang.CloudConnectionStatus()
-
try:
with self._use_driver(account) as drv:
drv.validate_account_creds()
+ except KeystoneExceptions.Unauthorized as e:
+ self.log.error("Invalid credentials given for VIM account %s" %account.name)
+ status.status = "failure"
+ status.details = "Invalid Credentials: %s" % str(e)
+
+ except KeystoneExceptions.AuthorizationFailure as e:
+ self.log.error("Bad authentication URL given for VIM account %s. Given auth url: %s" % (
+ account.name, account.openstack.auth_url))
+ status.status = "failure"
+ status.details = "Invalid auth url: %s" % str(e)
+
+ except NeutronException.NotFound as e:
+ self.log.error("Given management network %s could not be found for VIM account %s" % (
+ account.openstack.mgmt_network, account.name))
+ status.status = "failure"
+ status.details = "mgmt network does not exist: %s" % str(e)
+
except openstack_drv.ValidationError as e:
self.log.error("RwcalOpenstackPlugin: OpenstackDriver credential validation failed. Exception: %s", str(e))
status.status = "failure"
if guest_epa.numa_node_policy.has_field('node'):
for node in guest_epa.numa_node_policy.node:
if node.has_field('vcpu') and node.vcpu:
- epa_specs['hw:numa_cpus.'+str(node.id)] = ','.join([str(j) for j in node.vcpu])
+ epa_specs['hw:numa_cpus.'+str(node.id)] = ','.join([str(j.id) for j in node.vcpu])
if node.memory_mb:
epa_specs['hw:numa_mem.'+str(node.id)] = str(node.memory_mb)
cpu_features = []
espec_cpu_features = []
for feature in host_epa.cpu_feature:
- cpu_features.append(feature)
+ cpu_features.append(feature.feature)
espec_cpu_features = espec_utils.host.mano_to_extra_spec_cpu_features(cpu_features)
if espec_cpu_features is not None:
epa_specs['capabilities:cpu_info:features'] = espec_cpu_features
numa_node = getattr(flavor,'guest_epa').numa_node_policy.node.add()
numa_node.id = int(node_id)
- numa_node.vcpu = [ int(x) for x in flavor_info['extra_specs'][attr].split(',') ]
+ for x in flavor_info['extra_specs'][attr].split(','):
+ numa_node_vcpu = numa_node.vcpu.add()
+ numa_node_vcpu.id = int(x)
elif attr.startswith('hw:numa_mem.'):
node_id = attr.split('.')[1]