~zulcss/ubuntu/precise/quantum/trunk

« back to all changes in this revision

Viewing changes to quantum/plugins/nicira/nicira_nvp_plugin/nvplib.py

  • Committer: Chuck Short
  • Date: 2012-11-26 19:51:11 UTC
  • mfrom: (26.1.1 raring-proposed)
  • Revision ID: zulcss@ubuntu.com-20121126195111-jnz2cr4xi6whemw2
* New upstream release for the Ubuntu Cloud Archive.
* debian/patches/*: Refreshed for opening of Grizzly.
* New upstream release.
* debian/rules: FTFBS if there is missing binaries.
* debian/quantum-server.install: Add quantum-debug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
373
373
 
374
374
    admin_state_up = params['port'].get('admin_state_up')
375
375
    name = params["port"].get("name")
 
376
    device_id = params["port"].get("device_id")
376
377
    if admin_state_up:
377
378
        lport_obj["admin_status_enabled"] = admin_state_up
378
379
    if name:
379
380
        lport_obj["display_name"] = name
380
381
 
 
382
    if device_id:
 
383
        # device_id can be longer than 40 so we rehash it
 
384
        device_id = hashlib.sha1(device_id).hexdigest()
 
385
        lport_obj["tags"] = (
 
386
            [dict(scope='os_tid', tag=params["port"].get("tenant_id")),
 
387
             dict(scope='q_port_id', tag=params["port"]["id"]),
 
388
             dict(scope='vm_id', tag=device_id)])
 
389
 
381
390
    uri = "/ws.v1/lswitch/" + network + "/lport/" + port_id
382
391
    try:
383
392
        resp_obj = do_single_request("PUT", uri, json.dumps(lport_obj),
394
403
 
395
404
 
396
405
def create_port(tenant, **params):
397
 
    print "create_port_nvplib"
398
 
    print params
399
406
    clusters = params["clusters"]
400
407
    dest_cluster = clusters[0]  # primary cluster
401
408