[Libvirt-cim] [PATCH] [TEST]Fixing 01_netport.py tc failure

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Fri Apr 11 02:41:02 UTC 2008


> 
> -    if dev == None:
> +    if devid not in dev.DeviceID :

I checked in Daisy's fix for this, however it is probably a better check 
since we're looking for a specific device instance.

However, instead of devid not in dev.DeviceID, I would use dev.DeviceID 
!= devid.  A DeviceID should be unique.  If the provider returns 
"test_domain/procAndsomegarbage" and our devid is "test_domain/proc", 
we'd pass here.

Due to similar logic, I should have rejected Daisy's patch - a mistake 
on my part.

>          logger.error("Error retrieving instance for devid %s" % devid)
>          vsxml.undefine(options.ip)
>          return FAIL
> -
> -    status = PASS
>      
>      if dev.LinkTechnology != devices.LinkTechnology_Ethernet:
>          logger.error("LinkTechnology should be set to `%i' instead of `%s'" % \
> @@ -86,20 +83,17 @@ def main():
> 
>      addrs = dev.NetworkAddresses
>      if len(addrs) != 1:
> -        logger.error("Too many NetworkAddress entries (%i instead of %i)" % \
> -              (len(addrs), 1))
> +        logger.error("Too many NetworkAddress entries (%i instead of %i)" % (len(addrs), 1))

This line and the next end up spanning 80 characters long.  The 
libvirt-cim convention is 80 character lines.  Even though we don't 
follow their convention, I like the idea of shorter line lengths.  This 
helps prevent text from running into the next line - helps with 
readability.  You can do the following without in python (I believe):

logger.error("Too many NetworkAddress entries (%i instead of %i)"
              % (len(addrs), 1))

-- 
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list