[Libvirt-cim] [PATCH] If the resource type of a devices is set to UNKNOWN, do not generate XML for it

Guo Lian Yun yunguol at cn.ibm.com
Thu Mar 5 06:26:02 UTC 2009


+1

Best,
Regards

Daisy (运国莲)
VSM Team, China Systems & Technology Labs (CSTL)
E-mail: yunguol at cn.ibm.com
TEL: (86)-21-60922403
Building 10, 399 Ke Yuan Rd, Pudong Shanghai, 201203


libvirt-cim-bounces at redhat.com wrote on 2009-03-05 05:04:27:

> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1236200658 28800
> # Node ID ad367dfd38f4a78eeaf5369bb00d22bbf6aec911
> # Parent  e3dd4cec1b61373e738fe3ba58557ae543b41789
> If the resource type of a devices is set to UNKNOWN, do not generateXML 
for it
> 
> xmlgen was recently refactored, so this adds back in behavior that was 
missed
> during the refactor.  If the resource type of a device is 
> CIM_RES_TYPE_UNKNOWN,
> then the xml generation for that device should be skipped.
> 
> The RemoveResources() call sets a device's type to UNKNOWN to indicate 
that
> the device should be marked for removal.
> 
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
> 
> diff -r e3dd4cec1b61 -r ad367dfd38f4 libxkutil/xmlgen.c
> --- a/libxkutil/xmlgen.c   Tue Mar 03 10:04:00 2009 -0700
> +++ b/libxkutil/xmlgen.c   Wed Mar 04 13:04:18 2009 -0800
> @@ -128,6 +128,10 @@
>          const char *msg = NULL;;
> 
>          for (i = 0; (i < dominfo->dev_disk_ct) && (msg == NULL); i++) {
> +                struct virt_device *dev = &dominfo->dev_disk[i];
> +                if (dev->type == CIM_RES_TYPE_UNKNOWN)
> +                        continue;
> +
>                  struct disk_device *disk = 
&dominfo->dev_disk[i].dev.disk;
>                  CU_DEBUG("Disk: %i %s %s",
>                           disk->disk_type,
> @@ -229,6 +233,9 @@
> 
>          for (i = 0; (i < dominfo->dev_net_ct) && (msg == NULL); i++) {
>                  struct virt_device *dev = &dominfo->dev_net[i];
> +                if (dev->type == CIM_RES_TYPE_UNKNOWN)
> +                        continue;
> +
>                  struct net_device *net = &dev->dev.net;
> 
>                  if (STREQ(dev->dev.net.type, "network"))
> @@ -331,6 +338,9 @@
>          for (i = 0; i < dominfo->dev_graphics_ct; i++) {
>                  xmlNodePtr tmp;
>                  struct virt_device *_dev = &dominfo->dev_graphics[i];
> +                if (_dev->type == CIM_RES_TYPE_UNKNOWN)
> +                        continue;
> +
>                  struct graphics_device *dev = &_dev->dev.graphics;
> 
>                  tmp = xmlNewChild(root, NULL, BAD_CAST "graphics", 
NULL);
> @@ -353,6 +363,9 @@
>          for (i = 0; i < dominfo->dev_input_ct; i++) {
>                  xmlNodePtr tmp;
>                  struct virt_device *_dev = &dominfo->dev_input[i];
> +                if (_dev->type == CIM_RES_TYPE_UNKNOWN)
> +                        continue;
> +
>                  struct input_device *dev = &_dev->dev.input;
> 
>                  tmp = xmlNewChild(root, NULL, BAD_CAST "input", NULL);
> 
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20090305/3516d07e/attachment.htm>


More information about the Libvirt-cim mailing list