[ovs-dev] [PATCH] xenserver: Set network-uuid for internal bridges

reid at nicira.com reid at nicira.com
Wed Oct 28 20:05:13 UTC 2009


Hi Justin,

One belated set of comments (the existing looks like it will work fine),
using some python conventions and more specific xapi calls.  Also moved the
finally down farther so it wouldn't give an overriding traceback if it
never made it to a session.

# Query XAPI for the information we need using the vif's opaque reference
def dump_vif_info(domid, devid, vif_ref):
    session = XenAPI.xapi_local()
    session.xenapi.login_with_password("root", "")
    try:
        net_ref = session.xenapi.VIF.get_network(vif_ref)
        net_pifs = session.xenapi.network.get_PIFs(vif_ref)

        if not net_pifs:
            print "true"
        else:
            print "false"
    finally:
        session.xenapi.session.logout()

Original below, hopefully my email client won't ruin the spacing
> +# Query XAPI for the information we need using the vif's opaque
reference
> +def dump_vif_info(domid, devid, vif_ref):
> +    try:
> +        session = XenAPI.xapi_local()
> +        session.xenapi.login_with_password("root", "")
> +        vif_rec = session.xenapi.VIF.get_record(vif_ref)
> +        net_rec = session.xenapi.network.get_record(vif_rec["network"])
> +
> +        if len(net_rec['PIFs']) == 0:
> +            sys.stdout.write("true\n")
> +        else:
> +            sys.stdout.write("false\n")
> +
> +    finally:
> +        session.xenapi.session.logout()

On Wed, 28 Oct 2009 12:08:08 -0700, Justin Pettit <jpettit at nicira.com>
wrote:
> On Oct 28, 2009, at 11:59 AM, Ben Pfaff wrote:
> 
>> Justin Pettit <jpettit at nicira.com> writes:
>>
>>> +    local internal=$(${vif_on_internal_bridge} ${DOMID} ${DEVID})
>>> +    if [ $internal = "true" ]; then
>>
>> Please quote $internal as "$internal", in case the
>> vif_on_internal_bridge script encounters an error.
>>
>> Otherwise it looks fine to me, as long as it works.
> 
> 
> Thanks for the feedback.  I've added your change and pushed.
> 
> --Justin
> 
> 
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list