Use Nova versioned notifications by default
Changed the behavior of the Nova instance datasource to use by default the versioned notifications. Change-Id: Ife5c78c6568939f919174b5072fd70f461de0bd1 Story: 2004052 Task: 28501
This commit is contained in:
parent
a96bc0642b
commit
832522c292
@ -25,6 +25,10 @@ Enabling Vitrage in DevStack
|
||||
notification_topics = notifications,vitrage_notifications
|
||||
notification_driver=messagingv2
|
||||
|
||||
[notifications]
|
||||
versioned_notifications_topics = versioned_notifications,vitrage_notifications
|
||||
notification_driver = messagingv2
|
||||
|
||||
4. Add this to add notification from neutron to vitrage
|
||||
(make sure neutron is enabled in devstack)
|
||||
|
||||
|
@ -38,6 +38,10 @@ DEVSTACK_LOCAL_CONFIG+="$(cat <<EOF
|
||||
notification_topics = notifications,vitrage_notifications
|
||||
notification_driver = messagingv2
|
||||
|
||||
[notifications]
|
||||
versioned_notifications_topics = versioned_notifications,vitrage_notifications
|
||||
notification_driver = messagingv2
|
||||
|
||||
[[post-config|\$NEUTRON_CONF]]
|
||||
[DEFAULT]
|
||||
notification_topics = notifications,vitrage_notifications
|
||||
|
@ -32,6 +32,10 @@ DEVSTACK_LOCAL_CONFIG+="$(cat <<EOF
|
||||
notification_topics = notifications,vitrage_notifications
|
||||
notification_driver = messagingv2
|
||||
|
||||
[notifications]
|
||||
versioned_notifications_topics = versioned_notifications,vitrage_notifications
|
||||
notification_driver = messagingv2
|
||||
|
||||
[[post-config|\$CINDER_CONF]]
|
||||
[DEFAULT]
|
||||
notification_topics = notifications,vitrage_notifications
|
||||
|
@ -26,6 +26,7 @@ Datasources
|
||||
static-config
|
||||
zabbix_vitrage
|
||||
k8s_datasource
|
||||
nova-config
|
||||
|
||||
Notifiers
|
||||
---------
|
||||
|
23
doc/source/contributor/nova-config.rst
Normal file
23
doc/source/contributor/nova-config.rst
Normal file
@ -0,0 +1,23 @@
|
||||
=============================
|
||||
Nova Datasource Configuration
|
||||
=============================
|
||||
|
||||
By default, Nova datasource listens to Nova versioned notifications. If you
|
||||
are using Nova legacy notifications, then it should be indicated in Vitrage
|
||||
configuration as well.
|
||||
|
||||
That is, if you have in ``/etc/nova/nova.conf`` or in ``/etc/nova/nova-cpu.conf``:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
notification_format = unversioned
|
||||
|
||||
Then you should set in ``/etc/vitrage/vitrage.conf``:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
[nova.instance]
|
||||
use_nova_versioned_notifications = False
|
||||
|
||||
|
||||
In other cases there is no need to set this option.
|
@ -144,6 +144,10 @@ Neutron, Heat and Aodh) to Vitrage, set the following in their conf files:
|
||||
notification_driver=messagingv2
|
||||
|
||||
|
||||
[notifications]
|
||||
versioned_notifications_topics = versioned_notifications,vitrage_notifications
|
||||
notification_driver = messagingv2
|
||||
|
||||
Initialize Vitrage
|
||||
------------------
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- Added support for Nova versioned notifications.
|
||||
- Use Nova versioned notifications instead of the legacy, unversioned ones.
|
||||
This bahavior is controlled by the ``use_nova_versioned_notifications``
|
||||
configuration option.
|
||||
|
@ -97,9 +97,6 @@ LEGACY_NOTIFICATIONS = {
|
||||
|
||||
class InstanceDriver(NovaDriverBase):
|
||||
|
||||
def __init__(self, conf):
|
||||
super(InstanceDriver, self).__init__(conf)
|
||||
|
||||
@staticmethod
|
||||
def extract_events(instances):
|
||||
events = [instance.__dict__ for instance in instances]
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import abc
|
||||
|
||||
from vitrage.datasources.transformer_base import extract_field_value
|
||||
|
||||
|
||||
|
@ -30,7 +30,7 @@ OPTS = [
|
||||
cfg.StrOpt('mistral_version', default='2', help='Mistral version'),
|
||||
cfg.StrOpt('gnocchi_version', default='1', help='Gnocchi version'),
|
||||
cfg.BoolOpt('use_nova_versioned_notifications',
|
||||
default=False,
|
||||
default=True,
|
||||
help='Indicates whether to use Nova versioned notifications.'
|
||||
'The default is True. If False, the deprecated Nova '
|
||||
'legacy notifications will be used.'
|
||||
|
@ -65,7 +65,7 @@ class TestEntityGraphUnitBase(base.BaseTest):
|
||||
|
||||
OS_CLIENTS_OPTS = [
|
||||
cfg.BoolOpt('use_nova_versioned_notifications',
|
||||
default=False, required=True),
|
||||
default=True, required=True),
|
||||
]
|
||||
|
||||
NUM_CLUSTERS = 1
|
||||
|
@ -58,13 +58,17 @@ class TestProcessor(TestEntityGraphUnitBase):
|
||||
self._check_graph(processor, self.NUM_VERTICES_AFTER_CREATION,
|
||||
self.NUM_EDGES_AFTER_CREATION)
|
||||
|
||||
# check update instance event
|
||||
# check update instance event (versioned notification format)
|
||||
event[DSProps.DATASOURCE_ACTION] = DSAction.UPDATE
|
||||
event[DSProps.EVENT_TYPE] = 'compute.instance.volume.attach'
|
||||
event['hostname'] = 'new_host'
|
||||
event['instance_id'] = event['id']
|
||||
event['state'] = event['status']
|
||||
event['host'] = event['OS-EXT-SRV-ATTR:host']
|
||||
event[DSProps.EVENT_TYPE] = 'instance.volume_attach.end'
|
||||
|
||||
nova_object_data = {
|
||||
'host_name': 'new_host',
|
||||
'uuid': event['id'],
|
||||
'state': event['status'],
|
||||
'host': event['OS-EXT-SRV-ATTR:host']
|
||||
}
|
||||
event['nova_object.data'] = nova_object_data
|
||||
|
||||
processor.process_event(event)
|
||||
self._check_graph(processor, self.NUM_VERTICES_AFTER_CREATION,
|
||||
|
Loading…
x
Reference in New Issue
Block a user