Skip to content

Commit

Permalink
Merge "correct nvplib to update device_id"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Oct 12, 2012
2 parents 15604ab + d6aa31b commit 12ed618
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions quantum/plugins/nicira/nicira_nvp_plugin/QuantumPlugin.py
Expand Up @@ -813,6 +813,8 @@ def update_port(self, context, id, port):

params["cluster"] = cluster
params["port"] = port["port"]
params["port"]["id"] = quantum_db["id"]
params["port"]["tenant_id"] = quantum_db["tenant_id"]
result = nvplib.update_port(quantum_db["network_id"],
port_nvp["uuid"], **params)
LOG.debug("update_port() completed for tenant: %s" % context.tenant_id)
Expand Down
11 changes: 9 additions & 2 deletions quantum/plugins/nicira/nicira_nvp_plugin/nvplib.py
Expand Up @@ -373,11 +373,20 @@ def update_port(network, port_id, **params):

admin_state_up = params['port'].get('admin_state_up')
name = params["port"].get("name")
device_id = params["port"].get("device_id")
if admin_state_up:
lport_obj["admin_status_enabled"] = admin_state_up
if name:
lport_obj["display_name"] = name

if device_id:
# device_id can be longer than 40 so we rehash it
device_id = hashlib.sha1(device_id).hexdigest()
lport_obj["tags"] = (
[dict(scope='os_tid', tag=params["port"].get("tenant_id")),
dict(scope='q_port_id', tag=params["port"]["id"]),
dict(scope='vm_id', tag=device_id)])

uri = "/ws.v1/lswitch/" + network + "/lport/" + port_id
try:
resp_obj = do_single_request("PUT", uri, json.dumps(lport_obj),
Expand All @@ -394,8 +403,6 @@ def update_port(network, port_id, **params):


def create_port(tenant, **params):
print "create_port_nvplib"
print params
clusters = params["clusters"]
dest_cluster = clusters[0] # primary cluster

Expand Down

0 comments on commit 12ed618

Please sign in to comment.