Yaron Yogev's profile - activity

2016-12-04 09:16:19 -0600 answered a question AMQP not returning nova notifications

Finally found the reason for this: The format of message in process_task() is now different, and event_type does not appear in body. Instead, body has JSON message in string "oslo.message". I loaded this string and it gives me event_type and payload like body used to have.

2016-11-09 04:19:49 -0600 received badge  Famous Question (source)
2016-07-06 09:37:24 -0600 commented answer AMQP not returning nova notifications

No. I reverted to using Mirantis Liberty for now. This is only in POC stage at the moment, so that was enough.

2016-07-06 08:59:05 -0600 received badge  Notable Question (source)
2016-07-03 02:13:56 -0600 commented answer AMQP not returning nova notifications

Thanks for the answer. Re. Ceilometer: I'm actually trying to write code that will serve any OpenStack administrator, not just in my site or company. It should work without having to install Ceilometer.

2016-07-03 02:10:39 -0600 received badge  Popular Question (source)
2016-06-30 10:10:35 -0600 commented question AMQP not returning nova notifications

RDO: notification_driver=nova.openstack.common.notifier.rabbit_notifier,ceilometer.compute.nova_notifier Mirantis-Liberty, which works, doesn't have this setting at all.

I'm not sure what you mean about services not consuming. Do you mean that if my script consumes other services can't?

2016-06-30 00:39:40 -0600 commented question AMQP not returning nova notifications

In /etc/nova/nova.conf I had notify_on_state_change=<none> In Mirantis Liberty env. I had notify_on_state_change=vm_state

Changed this to match in the Devstack Mitaka env. but still no good :-( Left it for now. Will try again after I have Mirantis Mitaka in place. Will report back then.

2016-06-30 00:35:22 -0600 received badge  Enthusiast
2016-06-29 04:00:30 -0600 received badge  Editor (source)
2016-06-29 02:23:49 -0600 asked a question AMQP not returning nova notifications

I'm trying to fetch Nova notifications from OpenStack for a monitoring application. When I try launch and instance/rename/delete, I only get the port.create/update/delete notifications. The environment is RDO Mitaka. In another environment, with Mirantis and Liberty, I do get reasonable notifications. What am I doing wrong here?

My Python code follows:

from kombu.mixins import ConsumerMixin
from kombu.log import get_logger
from kombu import Queue, Exchange

class EventHandler:

def instance_add(self, notification): print("instance_add")

def instance_delete(self, notification): print("instance_delete")

def instance_update(self, notification): pass

def instance_down(self, notification): pass

def instance_up(self, notification): pass

def region_add(self, notification): pass

def region_delete(self, notification): pass

def region_update(self, notification): pass

logger = get_logger(__name__)


class Worker(ConsumerMixin):
  event_queues = [
    Queue('nova',
      Exchange('nova', 'topic', durable=False),
      durable=False, routing_key='#')
  ]

  def __init__(self, connection):
    self.connection = connection
    self.handler = EventHandler()
    self.notification_responses = {
      "compute.instance.create.end": self.handler.instance_add,
      "compute.instance.delete.end": self.handler.instance_delete,
      "compute.instance.rebuild.end": self.handler.instance_update,
      "compute.instance.update": self.handler.instance_update,
      "servergroup.create": self.handler.region_add,
      "servergroup.delete": self.handler.region_delete,
      "servergroup.update": self.handler.region_update,
      "servergroup.addmember": self.handler.region_update,
      "compute.instance.shutdown.start": self.handler.instance_down,
      "compute.instance.power_off.start": self.handler.instance_down,
      "compute.instance.power_on.end": self.handler.instance_up,
      "compute.instance.suspend.start": self.handler.instance_down,
      "compute.instance.suspend.end": self.handler.instance_up
    }

  def get_consumers(self, Consumer, channel):
    return [Consumer(queues=self.event_queues,
      accept=['json'],
      callbacks=[self.process_task])]

  def process_task(self, body, message):
    if "event_type" in body:
      self.handle_event(body["event_type"], body)
    message.ack()

  def handle_event(self, type, notification):
    if type not in self.notification_responses:
      return ""
    return self.notification_responses[type](notification)

if __name__ == '__main__':
  from kombu import Connection
  from kombu.utils.debug import setup_logging
  # setup root logger
  setup_logging(loglevel='DEBUG', loggers=[''])

  with Connection('amqp://guest:guest@10.56.20.81:5672//') as conn:
    try:
      print(conn)
      worker = Worker(conn)
      worker.run()
    except KeyboardInterrupt:
      print('Stopped')
2016-02-26 15:52:47 -0600 received badge  Notable Question (source)
2016-01-11 11:21:29 -0600 received badge  Popular Question (source)
2016-01-06 01:07:25 -0600 commented answer Fetch all tenants using Identity API V2

Hello Eduardo, thanks for your reply. the script (w/some fixes) shows the user has admin role in all tenants. If I try to authenticate to port 35357 using Identity API V2, I get "401 Unauthorized". If do the /tenants API call to 35357 after authenticating to port 5000, I get only "admin" again.

2016-01-05 08:33:31 -0600 received badge  Popular Question (source)
2016-01-05 07:16:15 -0600 asked a question Fetch all tenants using Identity API V2

I am trying to fetch the list of all tenants using OpenStack identity API V2.0. I have an "admin" user, which I made a user and administrator in all tenants. If I authenticate to public URL (port 5000), and then make the /v2.0/tenants GET call, I receive only the "admin" tenant in the response. The "admin" project is specified as the primary project for user "admin" in the Horizon UI.

I tried to follow the suggestion https://ask.openstack.org/en/question/160/openstack-apis-and-admin-user/?answer=236#post-id-236 (in this thread), but all that gave me was just one other tenant: the "services" tenant which appears in the distribution I'm using at the moment (Mirantis).

Is this the correct way to do this?

2016-01-05 01:36:23 -0600 commented answer API call to fetch all tenants

Correct, the tenantName (or tenantId) needs to be inside the "auth" hash. Thanks!

2016-01-05 01:33:53 -0600 received badge  Scholar (source)
2016-01-04 10:09:41 -0600 asked a question API call to fetch all tenants

I am trying to fetch the list of all tenants using OpenStack identity API 2.0. I have an "admin" user, which I made a user and administrator in all tenants. If I authenticate to public URL (port 5000), and then make the /v2.0/tenants GET call, I receive only the "admin" tenant in the response. The "admin" project is specified as the primary project for user "admin" in the Horizon UI.

I saw the post by the OP in this thread, but when I try to authenticate on the public URL (port 5000) I get "400 Bad Request". The request body is

{"auth":{"passwordCredentials":{"username":"admin","password": <admin pwd>}},"tenantName":"admin"}
2016-01-04 08:40:37 -0600 received badge  Supporter (source)