Skip to content

Commit

Permalink
Arista ML2 mech driver cleanup and integration with portbindings
Browse files Browse the repository at this point in the history
fixes bug: 1215097

This patch addresses minor cleanups which are the diff between the
original version of the patch which was merged into havana master
branch and the patch that is submitted for merge into stable/havana.

The original patch that was merged into havana master branch is at:
https://review.openstack.org/#/c/49086/
The new patch which has been submitted as havana-backport-potential is:
https://review.openstack.org/#/c/54447/

This whole excercise came into play because the original patch was not
picked up in havana-rc2 because of missing tag in the bug. Therefore, the
need to submit new patch against stable/havana.

When the new patch was submitted for havana-backport-potential, few very
minor previously commented cleanups were incorporated as well. This
patch brings these minor cleanups into master branch as well. Therefore,
merge of these two patches will bring both master branch and
stable/havana at parity.

Change-Id: I4ec5273c26a27ca52b430a6c7485a44e880a1787
  • Loading branch information
sukhdevkakpur committed Nov 12, 2013
1 parent 1fa79ce commit 78f54c2
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py
Expand Up @@ -18,6 +18,8 @@
import jsonrpclib
from oslo.config import cfg

from neutron.common import constants as n_const
from neutron.extensions import portbindings
from neutron.openstack.common import log as logging
from neutron.plugins.ml2.common import exceptions as ml2_exc
from neutron.plugins.ml2 import driver_api
Expand Down Expand Up @@ -73,7 +75,7 @@ def plug_port_into_network(self, vm_id, host_id, port_id,
:param port_name: Name of the port - for display purposes
:param device_owner: Device owner - e.g. compute or network:dhcp
"""
if device_owner == 'network:dhcp':
if device_owner == n_const.DEVICE_OWNER_DHCP:
self.plug_dhcp_port_into_network(vm_id,
host_id,
port_id,
Expand Down Expand Up @@ -263,8 +265,8 @@ def _register_with_eos(self):
"""
cmds = ['auth url %s user %s password %s' %
(self._keystone_url(),
self.keystone_conf.admin_user,
self.keystone_conf.admin_password)]
self.keystone_conf.admin_user,
self.keystone_conf.admin_password)]

self._run_openstack_cmds(cmds)

Expand Down Expand Up @@ -609,7 +611,7 @@ def create_port_precommit(self, context):
port = context.current
device_id = port['device_id']
device_owner = port['device_owner']
host = port['binding:host_id']
host = port[portbindings.HOST_ID]

# device_id and device_owner are set on VM boot
is_vm_boot = device_id and device_owner
Expand All @@ -630,7 +632,7 @@ def create_port_postcommit(self, context):
port = context.current
device_id = port['device_id']
device_owner = port['device_owner']
host = port['binding:host_id']
host = port[portbindings.HOST_ID]

# device_id and device_owner are set on VM boot
is_vm_boot = device_id and device_owner
Expand Down Expand Up @@ -666,8 +668,9 @@ def create_port_postcommit(self, context):
LOG.info(msg)

def update_port_precommit(self, context):
"""At the moment we only support port name change.
"""Update the name of a given port.
At the moment we only support port name change.
Any other change to port is not supported at this time.
We do not store the port names, therefore, no DB store
action is performed here.
Expand All @@ -679,8 +682,9 @@ def update_port_precommit(self, context):
LOG.info(msg)

def update_port_postcommit(self, context):
"""At the moment we only support port name change
"""Update the name of a given port in EOS.
At the moment we only support port name change
Any other change to port is not supported at this time.
"""
port = context.current
Expand All @@ -691,7 +695,7 @@ def update_port_postcommit(self, context):

device_id = port['device_id']
device_owner = port['device_owner']
host = port['binding:host_id']
host = port[portbindings.HOST_ID]
is_vm_boot = device_id and device_owner

if host and is_vm_boot:
Expand Down Expand Up @@ -732,7 +736,7 @@ def delete_port_precommit(self, context):
"""Delete information about a VM and host from the DB."""
port = context.current

host_id = port['binding:host_id']
host_id = port[portbindings.HOST_ID]
device_id = port['device_id']
tenant_id = port['tenant_id']
network_id = port['network_id']
Expand All @@ -753,7 +757,7 @@ def delete_port_postcommit(self, context):
"""
port = context.current
device_id = port['device_id']
host = port['binding:host_id']
host = port[portbindings.HOST_ID]
port_id = port['id']
network_id = port['network_id']
tenant_id = port['tenant_id']
Expand All @@ -762,7 +766,7 @@ def delete_port_postcommit(self, context):
try:
with self.eos_sync_lock:
hostname = self._host_name(host)
if device_owner == 'network:dhcp':
if device_owner == n_const.DEVICE_OWNER_DHCP:
self.rpc.unplug_dhcp_port_from_network(device_id,
hostname,
port_id,
Expand Down

0 comments on commit 78f54c2

Please sign in to comment.