vdu:
...
- relation:
- - provides: dataVM:db
- requires: mgmtVM:app
+ vca-relationships:
+ relation:
+ - provides: dataVM:db
+ requires: mgmtVM:app
This tells N2VC that the charm referred to by the dataVM vdu offers a relation named 'db', and the mgmtVM vdu has an 'app' endpoint that should be connected to a database.
# Loop through relations
for cfg in configs:
if 'juju' in cfg:
- if 'relation' in juju:
- for rel in juju['relation']:
+ juju = cfg['juju']
+ if 'vca-relationships' in juju and 'relation' in juju['vca-relationships']:
+ for rel in juju['vca-relationships']['relation']:
try:
# get the application name for the provides
if all(k in machine_spec for k in ['host', 'user']):
# Enlist an existing machine as a Juju unit
machine = await model.add_machine(spec='ssh:{}@{}:{}'.format(
- machine_spec['user'],
- machine_spec['host'],
+ machine_spec['username'],
+ machine_spec['hostname'],
self.GetPrivateKeyPath(),
))
to = machine.id
# Where to deploy the charm to.
to=to,
)
-
- # Map the vdu id<->app name,
- #
- await self.Relate(model_name, vnfd)
+ #############################
+ # Map the vdu id<->app name #
+ #############################
+ try:
+ await self.Relate(model_name, vnfd)
+ except KeyError as ex:
+ # We don't currently support relations between NS and VNF/VDU charms
+ self.log.warn("[N2VC] Relations not supported: {}".format(ex))
+ except Exception as ex:
+ # This may happen if not all of the charms needed by the relation
+ # are ready. We can safely ignore this, because Relate will be
+ # retried when the endpoint of the relation is deployed.
+ self.log.warn("[N2VC] Relations not ready")
# #######################################
# # Execute initial config primitive(s) #