[Libvirt-cim] [PATCH 3 of 3] Update xml generation to support vepa
Richard Maciel
rmaciel at linux.vnet.ibm.com
Tue Mar 2 18:28:54 UTC 2010
+1
Em 23-02-2010 15:21, Sharad Mishra escreveu:
> # HG changeset patch
> # User Sharad Mishra
> # Date 1266955067 28800
> # Node ID 94e67df60eb8ca8ce580c4a43b0958f6243d0f31
> # Parent 19918810d820fc1ea1296f4cf8c48ac442f571cb
> Update xml generation to support vepa.
>
> Signed-of-by: Sharad Mishra<snmishra at us.ibm.com>
>
> diff -r 19918810d820 -r 94e67df60eb8 libxkutil/xmlgen.c
> --- a/libxkutil/xmlgen.c Tue Feb 23 11:57:42 2010 -0800
> +++ b/libxkutil/xmlgen.c Tue Feb 23 11:57:47 2010 -0800
> @@ -169,7 +169,14 @@
> tmp = xmlNewChild(nic, NULL, BAD_CAST "source", NULL);
> if (tmp == NULL)
> return XML_ERROR;
> - xmlNewProp(tmp, BAD_CAST src_type, BAD_CAST dev->source);
> + if (STREQ(src_type, "direct")) {
> + xmlNewProp(tmp, BAD_CAST "dev", BAD_CAST dev->source);
> + if (dev->net_mode != NULL)
> + xmlNewProp(tmp, BAD_CAST "mode",
> + BAD_CAST dev->net_mode);
> + } else
> + xmlNewProp(tmp, BAD_CAST src_type,
> + BAD_CAST dev->source);
> } else
> return XML_ERROR;
>
> @@ -212,10 +219,12 @@
> return XML_ERROR;
> xmlNewProp(nic, BAD_CAST "type", BAD_CAST net->type);
>
> - tmp = xmlNewChild(nic, NULL, BAD_CAST "mac", NULL);
> - if (tmp == NULL)
> - return XML_ERROR;
> - xmlNewProp(tmp, BAD_CAST "address", BAD_CAST net->mac);
> + if (net->mac != NULL) {
> + tmp = xmlNewChild(nic, NULL, BAD_CAST "mac", NULL);
> + if (tmp == NULL)
> + return XML_ERROR;
> + xmlNewProp(tmp, BAD_CAST "address", BAD_CAST net->mac);
> + }
>
> if (net->device != NULL) {
> tmp = xmlNewChild(nic, NULL, BAD_CAST "target", NULL);
> @@ -238,6 +247,8 @@
> msg = bridge_net_to_xml(nic, net);
> else if (STREQ(dev->dev.net.type, "user"))
> continue;
> + else if (STREQ(dev->dev.net.type, "direct"))
> + msg = set_net_source(nic, net, "direct");
> else
> msg = "Unknown interface type";
> }
> diff -r 19918810d820 -r 94e67df60eb8 src/Virt_VirtualSystemManagementService.c
> --- a/src/Virt_VirtualSystemManagementService.c Tue Feb 23 11:57:42 2010 -0800
> +++ b/src/Virt_VirtualSystemManagementService.c Tue Feb 23 11:57:47 2010 -0800
> @@ -63,6 +63,7 @@
> #define BRIDGE_TYPE "bridge"
> #define NETWORK_TYPE "network"
> #define USER_TYPE "user"
> +#define DIRECT_TYPE "direct"
> #define RASD_IND_CREATED "ResourceAllocationSettingDataCreatedIndication"
> #define RASD_IND_DELETED "ResourceAllocationSettingDataDeletedIndication"
> #define RASD_IND_MODIFIED "ResourceAllocationSettingDataModifiedIndication"
> @@ -750,6 +751,15 @@
> dev->dev.net.source = strdup(network);
> } else if (STREQC(val, USER_TYPE)) {
> dev->dev.net.type = strdup(USER_TYPE);
> + } else if (STREQC(val, DIRECT_TYPE)) {
> + dev->dev.net.type = strdup(DIRECT_TYPE);
> + if (cu_get_str_prop(inst, "SourceDevice",&val) == CMPI_RC_OK)
> + if (strlen(val)> 0)
> + dev->dev.net.source = strdup(val);
> + else
> + return "Source Device is empty";
> + else
> + return "No Source Device specified";
> } else
> return "Invalid Network Type specified";
>
> @@ -759,6 +769,12 @@
> else
> dev->dev.net.device = strdup(val);
>
> + free(dev->dev.net.net_mode);
> + if (cu_get_str_prop(inst, "NetworkMode",&val) != CMPI_RC_OK)
> + dev->dev.net.net_mode = NULL;
> + else
> + dev->dev.net.net_mode = strdup(val);
> +
> free(dev->dev.net.model);
>
> if (cu_get_str_prop(inst, "ResourceSubType",&val) != CMPI_RC_OK)
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
More information about the Libvirt-cim
mailing list