[Libvirt-cim] [PATCH 3 of 5] Add network interface parsing for KVM domains

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Jan 16 18:59:50 UTC 2008


Dan Smith wrote:

>  static void cleanup_emu_device(struct emu_device *dev)
> @@ -216,18 +216,22 @@ static int parse_net_device(xmlNode *ino
>                          if (ndev->mac == NULL)
>                                  goto err;
>                  } else if (XSTREQ(child->name, "source")) {
> -                        ndev->bridge = get_attr_value(child, "bridge");
> -                        if (ndev->bridge == NULL)
> -                                goto err;
> +                        ndev->source = get_attr_value(child, "bridge");
> +                        if (ndev->source != NULL)
> +                                continue;
> +                        ndev->source = get_attr_value(child, "network");
> +                        if (ndev->source != NULL)
> +                                continue;
> +                        goto err;
>                  }
>          }
> 
>          if (ndev->mac == NULL)
>                  goto err;
> 
> -        if (ndev->bridge == NULL) {
> -                ndev->bridge = strdup(DEFAULT_BRIDGE);
> -                printf("No bridge, taking default of `%s'\n", ndev->bridge);
> +        if ((STREQC(ndev->type, "bridge")) && (ndev->source == NULL)) {
> +                ndev->source = strdup(DEFAULT_BRIDGE);
> +                printf("No bridge, taking default of `%s'\n", ndev->source);
>          }

Not a fault of this patch, but this should probably be changed to a 
CU_DEBUG() at some point.

Also, might be a good idea to add a comment or a debug message to 
indicate that we're not handling all interface types yet.

-- 
Kaitlin Rupert
IBM Linux Technology Center
karupert at us.ibm.com




More information about the Libvirt-cim mailing list