Neutron port detach isn't detected by nova event handler

Bug #1565028 reported by Steve McLellan
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Opinion
Wishlist
Unassigned
OpenStack Searchlight
New
Critical
Unassigned

Bug Description

For reasons no longer clear to me, the nova event handler listens for neutron port.create.end events (possibly because we receive the nova creation events, but port attachment follows later?). It doesn't capture explicit attach/detach port events.

For example:

  neutron port-create test-net # id is ee486fc1-0919-4109-9990-a2f21b25fec7
  nova interface-attach server-1 --port-id ee486fc1-0919-4109-9990-a2f21b25fec7

The events received are port.update.end. For attaching, the device_owner and device_id are changed, although there's no indication of the reason for the update event.

For detach it's even worse because we don't even know what the port was previously attached to. Not sure here what the right answer is; a detach/attach event would be ideal.

Tags: neutron
Steve McLellan (sjmc7)
Changed in searchlight:
importance: Undecided → High
importance: High → Critical
Revision history for this message
Steve McLellan (sjmc7) wrote :

on interface-attach, device_id identifies the server

{
  "event_type": "port.update.end",
  "payload": {
    "port": {
      "allowed_address_pairs": [],
      "extra_dhcp_opts": [],
      "updated_at": "2016-04-06T17:38:09",
      "device_owner": "compute:None",
      "port_security_enabled": true,
      "binding:profile": {},
      "fixed_ips": [
        {
          "subnet_id": "e89b3879-db18-4c9d-a2b5-9a985f0bd512",
          "ip_address": "172.40.0.4"
        },
        {
          "subnet_id": "44064101-3f26-4eae-ab0e-2c9e6751f849",
          "ip_address": "fd4f:2ae3:e98a:0:f816:3eff:fe2e:2028"
        }
      ],
      "id": "ee486fc1-0919-4109-9990-a2f21b25fec7",
      "security_groups": [
        "9790d25c-aea7-4342-b4ef-5f0f7cb657bd"
      ],
      "binding:vif_details": {
        "port_filter": true,
        "ovs_hybrid_plug": true
      },
      "binding:vif_type": "ovs",
      "mac_address": "fa:16:3e:2e:20:28",
      "status": "DOWN",
      "binding:host_id": "devstack",
      "description": "",
      "device_id": "e861a26d-7d54-4f6a-8511-46eeb3dd4abe",
      "name": "attaching-port",
      "admin_state_up": true,
      "network_id": "910cc348-b4f2-4ee3-b131-27829ab59984",
      "dns_name": "octo-1",
      "created_at": "2016-04-01T17:47:16",
      "binding:vnic_type": "normal",
      "tenant_id": "3307049f95b7408c95d6e84483fc995a"
    }
  }
  # <SNIP>
}

Revision history for this message
Steve McLellan (sjmc7) wrote :

On detach, not so much:

{
  "event_type": "port.update.end",
  "payload": {
    "port": {
      "allowed_address_pairs": [],
      "extra_dhcp_opts": [],
      "updated_at": "2016-04-06T17:40:05",
      "device_owner": "",
      "port_security_enabled": true,
      "binding:profile": {},
      "fixed_ips": [
        {
          "subnet_id": "e89b3879-db18-4c9d-a2b5-9a985f0bd512",
          "ip_address": "172.40.0.4"
        },
        {
          "subnet_id": "44064101-3f26-4eae-ab0e-2c9e6751f849",
          "ip_address": "fd4f:2ae3:e98a:0:f816:3eff:fe2e:2028"
        }
      ],
      "id": "ee486fc1-0919-4109-9990-a2f21b25fec7",
      "security_groups": [
        "9790d25c-aea7-4342-b4ef-5f0f7cb657bd"
      ],
      "binding:vif_details": {},
      "binding:vif_type": "unbound",
      "mac_address": "fa:16:3e:2e:20:28",
      "status": "DOWN",
      "binding:host_id": "",
      "description": "",
      "device_id": "",
      "name": "attaching-port",
      "admin_state_up": true,
      "network_id": "910cc348-b4f2-4ee3-b131-27829ab59984",
      "dns_name": "octo-1",
      "created_at": "2016-04-01T17:47:16",
      "binding:vnic_type": "normal",
      "tenant_id": "3307049f95b7408c95d6e84483fc995a"
    }
  }
  # SNIP
}

Running a query against servers in e-s seems like something to try to avoid; it will rely on the search index being up to date (i.e. although a document may have been indexed it's not necessarily visible to search yet versus retrieval by id). I don't see a cleaner option though. Ideally nova would send out a notification as it does for volume attach.

Revision history for this message
Fahri Cihan Demirci (cihand) wrote :

I'm inclined to mark this as a wishlist item for nova, since as you concur, showing a detached interface with an empty device_id seems to be the reasonable thing to do. What you are suggesting seems to be that nova should generate notification events on interface attach and detach. Feel free to correct me if I missed your point.

Changed in nova:
importance: Undecided → Wishlist
tags: added: neutron
Changed in nova:
status: New → Opinion
Revision history for this message
Steve McLellan (sjmc7) wrote :

Hi Fahri,

Yeah, having thought about this some more, I do think nova should generate notifications on interface attach/detach, and maybe that should be a separate ticket. Since it does the same thing for volume events it wouldn't be unusual.

Since neutron sends a port.update notification that only includes the current state, it's not possible to determine the reason for the update or what the port was previously attached to in the case of a detach; arguably the neutron events could be more explicit but that's a discussion i can have with the neutron team.

Revision history for this message
Fahri Cihan Demirci (cihand) wrote :

Hello Steve,

I think it is also reasonable to expect nova to create such a notification, since as far as I can tell; e.g. for a port unbind operation, nova checks whether the device ID was successfully cleared, so that could be a suitable place for firing up a notification.

Also, I'm not sure whether you are aware or not, but the nova team has a proposal for eliminating bug reports which may be deemed as wishlist/enhancement items, requiring those requests to be in the form of blueprints. So while I think that you have a perfectly good proposal here, there is a chance that it might be neglected in nova's bug database, mostly by being shadowed by other items of higher priority.

However, I'd say having such a report for nova is certainly beneficial for achieving alignment with the Searchlight project and keeping track of the progress, though I'm far from an expert on this issue.

Revision history for this message
Steve McLellan (sjmc7) wrote :

Ok - I'm happy to re-file this as a blueprint. Thanks for the feedback; I'll include your comments in the BP.

Revision history for this message
Fahri Cihan Demirci (cihand) wrote :

Ok, I'll keep an eye on incoming blueprints and when you get around to creating the blueprint I'll see if there is a way I can contribute. Please feel free to link the blueprint here for better trackability and visibility. Thank you.

Revision history for this message
Steve McLellan (sjmc7) wrote :
Revision history for this message
Fahri Cihan Demirci (cihand) wrote :

Thank you for the blueprint, don't think a spec would be required for this case, since the corresponding change would be small. However, for best results you may want to have some nova people take a look and share their opinion, so that the implementation would have a point of reference.

looperx (looperx)
Changed in searchlight:
assignee: nobody → looperx (looperx)
assignee: looperx (looperx) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers