def check_mysql_status(self, context, id): """Make a synchronous call to trigger smart agent for checking MySQL status""" instance = dbutils.get_instance(id) LOG.debug("Triggering smart agent on Instance %s (%s) to check MySQL status.", id, instance['remote_hostname']) result = rpc.call(context, instance['remote_hostname'], {"method": "check_mysql_status"}) # update instance state in guest_status table upon receiving smart agent response dbutils.update_guest_status(id, int(result)) return result
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 reset_password(self, context, id, password): """Make a synchronous call to trigger smart agent for resetting MySQL password""" try: instance = dbutils.get_instance(id) except exception.ReddwarfError, e: raise exception.NotFound("Instance with id %s not found", id)