[Libvirt-cim] [PATCH 1/2] cimtest: Add default network existence check to 28_definesystem_with_vsi_profile.py

John Ferlan jferlan at redhat.com
Wed Aug 7 00:09:07 UTC 2013


On 07/31/2013 10:08 PM, Xu Wang wrote:
> From: Xu Wang <cngesaint at gmail.com>
> 
> The default network card name is 'eth0' or 'em1'. But if the network
> card name doesn't contain those values, error would occur. So this patch
> will check if the default network card name exists in the network
> card name list. If not, the network card name would changed into
> the first one in the network card name list except lo.
> 
> Signed-off-by: Xu Wang <gesaint at linux.vnet.ibm.com>

Although the test fails in general for me based on my system
configuration, I did verify that by using either "eth1" or "em1" as the
initial value, that the changes here work, so

ACK

John
> ---
>  .../28_definesystem_with_vsi_profile.py            |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
> index 2b108f9..a901ae7 100644
> --- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
> +++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/28_definesystem_with_vsi_profile.py
> @@ -33,6 +33,7 @@
>  #
>  
>  import sys
> +import os
>  from CimTest.Globals import logger
>  from CimTest.ReturnCodes import FAIL, PASS, SKIP, XFAIL_RC, XFAIL
>  from VirtLib import utils
> @@ -188,6 +189,14 @@ def main():
>      if rc == 0:
>          vsi_defaults['SourceDevice'] = "em1"
>  
> +    # The default device name may not named 'eth1' or 'em1' so this case would
> +    # return FAIL. The following code will check if default device exists in
> +    # the network card list and if not, source_dev will be changed into the 1st
> +    # network card in the list.
> +    net_info = os.popen('ip addr').read()
> +    if net_info.find(vsi_defaults['SourceDevice']) == -1:
> +        vsi_defaults['SourceDevice'] = net_info.split(': ')[3]
> +
>      nrasd_cn = get_typed_class(virt, 'NetResourceAllocationSettingData')
>      status  = FAIL
>      cxml = None
> 




More information about the Libvirt-cim mailing list