Merge "correct nvplib to update device_id"

This commit is contained in:
Jenkins 2012-10-12 17:10:09 +00:00 committed by Gerrit Code Review
commit 12ed618200
2 changed files with 11 additions and 2 deletions

View File

@ -813,6 +813,8 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2):
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)

View File

@ -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),
@ -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