def ensure_create_instance(self, context, instance, user_data): LOG.debug("Triggering worker app server to ensure instance created: %s.", instance['id']) rpc.cast(context, 'work', {"create-instance":{"uuid": instance['id'], "remoteUuid": instance['remote_uuid'], "remoteHostName": instance['remote_hostname'], "tenantId": instance['tenant_id'], "userData": base64.b64encode(user_data)}})
def apply_snapshot(self, context, instance_id, snapshot_id, credential, auth_url): LOG.debug("Triggering smart agent to apply Snapshot %s on Instance %s.", snapshot_id, instance_id) instance = dbutils.get_instance(instance_id) snapshot = dbutils.get_snapshot(snapshot_id) rpc.cast(context, instance['remote_hostname'], {"method": "apply_snapshot", "args": {"storage_path": snapshot['storage_uri'], "credential": {"user": credential['tenant_id']+":"+credential['user_name'], "key": credential['password'], "auth": auth_url}} })
def create_snapshot(self, context, instance_id, snapshot_id, credential, auth_url, snapshot_key): LOG.debug("Triggering smart agent to create Snapshot %s on Instance %s.", snapshot_id, instance_id) instance = dbutils.get_instance(instance_id) rpc.cast(context, instance['remote_hostname'], {"method": "create_snapshot", "args": {"sid": snapshot_id, "tenant_id": context.tenant, "snapshot_key": snapshot_key, "credential": {"user": credential['tenant_id']+":"+credential['user_name'], "key": credential['password'], "auth": auth_url}} })
def upgrade(self, context, id): """Make an asynchronous call to self upgrade the guest agent""" topic = self._get_routing_key(context, id) LOG.debug("Sending an upgrade call to nova-guest %s", topic) #reddwarf_rpc.cast_with_consumer(context, topic, {"method": "upgrade"}) rpc.cast(context, topic, {"method": "upgrade"})