Feature 10239: Distributed VCA
- Add vca_id in all calls that invoke libjuju. This is for being able to
talk to the default VCA or the VCA associated to the VIM
- Add store.py: Abstraction to talk to the database.
- DBMongoStore: Use the db from common to talk to the database
- MotorStore: Use motor, an asynchronous mongodb client to talk to the
database
- Add vca/connection.py: Represents the data needed to connect the VCA
- Add EnvironConfig in config.py: Class to get the environment config,
and avoid LCM from passing that
Change-Id: I28625e0c56ce408114022c83d4b7cacbb649434c
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/n2vc/juju_watcher.py b/n2vc/juju_watcher.py
index 04ad10f..e206e06 100644
--- a/n2vc/juju_watcher.py
+++ b/n2vc/juju_watcher.py
@@ -72,7 +72,10 @@
class JujuModelWatcher:
@staticmethod
- async def wait_for_model(model: Model, timeout: float = 3600):
+ async def wait_for_model(
+ model: Model,
+ timeout: float = 3600
+ ):
"""
Wait for all entities in model to reach its final state.
@@ -121,6 +124,7 @@
total_timeout: float = 3600,
db_dict: dict = None,
n2vc: N2VCConnector = None,
+ vca_id: str = None,
):
"""
Wait for entity to reach its final state.
@@ -131,6 +135,7 @@
:param: total_timeout: Timeout for the entity to be active
:param: db_dict: Dictionary with data of the DB to write the updates
:param: n2vc: N2VC Connector objector
+ :param: vca_id: VCA ID
:raises: asyncio.TimeoutError when timeout reaches
"""
@@ -161,6 +166,7 @@
timeout=progress_timeout,
db_dict=db_dict,
n2vc=n2vc,
+ vca_id=vca_id,
)
)
@@ -182,6 +188,7 @@
timeout: float,
db_dict: dict = None,
n2vc: N2VCConnector = None,
+ vca_id: str = None,
):
"""
Observes the changes related to an specific entity in a model
@@ -192,6 +199,7 @@
:param: timeout: Maximum time between two updates in the model
:param: db_dict: Dictionary with data of the DB to write the updates
:param: n2vc: N2VC Connector objector
+ :param: vca_id: VCA ID
:raises: asyncio.TimeoutError when timeout reaches
"""
@@ -249,6 +257,7 @@
detailed_status=status_message,
vca_status=vca_status,
entity_type=delta_entity,
+ vca_id=vca_id,
)
# Check if timeout
if time.time() > timeout_end: