Devel
  Threads by month 
                
            - ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
July 2012
- 99 participants
- 305 discussions
 
                        
                    27 Jul '12
                    
                        Add following routines to esx_interface_driver:
    esxNumOfInterfaces,
    esxNumOfDefinedInterfaces,
    esxListInterfaces,
    esxListDefinedInterfaces,
    esxInterfaceLookupByMACString,
    esxInterfaceGetXMLDesc,
    esxInterfaceUndefine,
    esxInterfaceCreate,
    esxInterfaceDestroy
Signed-off-by: Ata E Husain Bohra <ata.husain(a)hotmail.com>
---
 src/esx/esx_interface_driver.c |  506 +++++++++++++++++++++++++++++++++++++++-
 src/esx/esx_vi.c               |  126 ++++++++++
 src/esx/esx_vi.h               |   10 +
 src/esx/esx_vi_generator.input |  227 ++++++++++++++++++
 src/esx/esx_vi_generator.py    |   31 ++-
 src/esx/esx_vi_types.c         |   18 +-
 6 files changed, 913 insertions(+), 5 deletions(-)
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index 5713137..b1ba5e2 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -23,6 +23,9 @@
  */
 
 #include <config.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include "internal.h"
 #include "util.h"
@@ -34,6 +37,7 @@
 #include "esx_vi.h"
 #include "esx_vi_methods.h"
 #include "esx_util.h"
+#include "interface_conf.h"
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
@@ -67,10 +71,508 @@ esxInterfaceClose(virConnectPtr conn)
 
 
 
+static int
+esxNumOfInterfaces(virConnectPtr conn)
+{
+    esxPrivate *priv = conn->interfacePrivateData;
+    esxVI_HostVirtualNic *virtualNicList = NULL;
+    const esxVI_HostVirtualNic *virtualNic = NULL;
+    int count = 0;
+
+    if (esxVI_EnsureSession(priv->primary) < 0 ||
+        esxVI_LookupVirtualNicList(priv->primary, &virtualNicList) < 0) {
+        goto cleanup;
+    }
+
+    if (virtualNicList == NULL) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Could not retrieve vNic List"));
+
+        goto cleanup;
+    }
+
+    for (virtualNic = virtualNicList;
+         virtualNic != NULL;
+         virtualNic = virtualNic->_next) {
+        count++;
+    }
+
+cleanup:
+
+    esxVI_HostVirtualNic_Free(&virtualNicList);
+
+    return count;
+}
+
+
+
+static int
+esxNumOfDefinedInterfaces(virConnectPtr conn)
+{
+    conn->interfacePrivateData = NULL;
+
+    // ESX interfaces are always active
+    return 0;
+}
+
+
+
+static int
+esxListInterfaces(virConnectPtr conn, char **names, int maxnames)
+{
+    esxPrivate *priv = conn->interfacePrivateData;
+    esxVI_HostVirtualNic *virtualNicList = NULL;
+    const esxVI_HostVirtualNic *virtualNic = NULL;
+    int result = -1;
+    int i = 0;
+
+    if (esxVI_EnsureSession(priv->primary) < 0 ||
+        esxVI_LookupVirtualNicList(priv->primary,
+                                   &virtualNicList) < 0) {
+        goto cleanup;
+    }
+
+    if (virtualNicList == NULL) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Could not retrieve vNIC List"));
+        goto cleanup;
+    }
+
+    for (i= 0, virtualNic = virtualNicList;
+         virtualNic != NULL && i < maxnames;
+         ++i, virtualNic = virtualNic->_next) {
+        names[i] = strdup(virtualNic->device);
+
+        if (names[i] == NULL) {
+            for(;i >=0;--i) {
+                VIR_FREE(names[i]);
+            }
+            virReportOOMError();
+            goto cleanup;
+        }
+    }
+
+    result = i;
+ cleanup:
+    esxVI_HostVirtualNic_Free(&virtualNicList);
+
+    return result;
+}
+
+
+
+static int
+esxListDefinedInterfaces(virConnectPtr conn, char **names, int maxnames)
+{
+    conn->interfacePrivateData = conn->privateData;
+    *names = NULL;
+
+    /* keeps compiler happy */
+    VIR_DEBUG("max interfaces: %d", maxnames);
+
+    // ESX interfaces are always active
+    return 0;
+}
+
+
+
+static virInterfacePtr
+esxInterfaceLookupByName(virConnectPtr conn, const char *name)
+{
+    esxPrivate *priv = conn->interfacePrivateData;
+    esxVI_HostVirtualNic *virtualNicList = NULL;
+    const esxVI_HostVirtualNic *virtualNic = NULL;
+    virInterfacePtr ret = NULL;
+
+    if (esxVI_EnsureSession(priv->primary) < 0 ||
+        esxVI_LookupVirtualNicList(priv->primary,
+                                   &virtualNicList) < 0) {
+        goto cleanup;
+    }
+
+    if (virtualNicList == 0) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Could not retrieve vNIC List"));
+        goto cleanup;
+    }
+
+
+    for(virtualNic = virtualNicList;
+        virtualNic != NULL;
+        virtualNic = virtualNic->_next) {
+        if (STREQ(virtualNic->device, name)) {
+            if (virtualNic->spec == NULL ||
+                virtualNic->spec->mac == NULL) {
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                  _("Malformed HostVirtualNicSpec"));
+                goto cleanup;
+            }
+
+            ret = virGetInterface(conn, virtualNic->device, virtualNic->spec->mac);
+            break;
+        }
+    }
+
+ cleanup:
+    esxVI_HostVirtualNic_Free(&virtualNicList);
+
+    return ret;
+}
+
+
+
+static virInterfacePtr
+esxInterfaceLookupByMACString(virConnectPtr conn, const char *mac)
+{
+    esxPrivate *priv = conn->interfacePrivateData;
+    esxVI_HostVirtualNic *virtualNicList = NULL;
+    const esxVI_HostVirtualNic *virtualNic = NULL;
+    virInterfacePtr ret = NULL;
+
+    if (esxVI_EnsureSession(priv->primary) < 0 ||
+        esxVI_LookupVirtualNicList(priv->primary,
+                                   &virtualNicList) < 0) {
+        goto cleanup;
+    }
+
+    if (virtualNicList == 0) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Could not retrieve vNIC List"));
+        goto cleanup;
+    }
+
+
+    for(virtualNic = virtualNicList;
+        virtualNic != NULL;
+        virtualNic = virtualNic->_next) {
+        if (virtualNic->spec == NULL ||
+            virtualNic->spec->mac == NULL) {
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+              _("Malformed HostVirtualNicSpec"));
+            goto cleanup;
+        }
+
+        if (STREQ(virtualNic->spec->mac, mac)) {
+            ret = virGetInterface(conn, virtualNic->device, virtualNic->spec->mac);
+            break;
+        }
+    }
+
+ cleanup:
+    esxVI_HostVirtualNic_Free(&virtualNicList);
+
+    return ret;
+}
+
+
+
+static char*
+esxInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags)
+{
+    esxPrivate *priv = iface->conn->interfacePrivateData;
+    esxVI_HostVirtualNic *virtualNicList = NULL;
+    const esxVI_HostVirtualNic *virtualNic = NULL;
+    esxVI_PhysicalNic *physicalNicList = NULL;
+    const esxVI_PhysicalNic *physicalNic = NULL;
+    esxVI_PhysicalNic *matchingPhysicalNicList = NULL;
+    esxVI_HostIpRouteConfig *ipRouteConfig = NULL;
+    esxVI_HostPortGroup *portGroupList = NULL;
+    esxVI_HostVirtualSwitch *virtualSwitchList = NULL;
+    esxVI_String *propertyNameList = NULL;
+    esxVI_ObjectContent *hostSystem = NULL;
+    esxVI_DynamicProperty *dynamicProperty = NULL;
+    virInterfaceDefPtr def = NULL;
+    int use_static = 0;
+    struct in_addr addr;
+    uint32_t host_addr = 0;
+    int zero_count = 0;
+    int masklen = 0;
+    int i = 0;
+    char *ret = NULL;
+
+    if (VIR_INTERFACE_XML_INACTIVE & flags) {
+        use_static = 1;
+    }
+
+    if (esxVI_EnsureSession(priv->primary) < 0 ||
+        esxVI_String_AppendValueListToList(&propertyNameList,
+                              "config.network.vnic\0"
+                              "config.network.ipRouteConfig\0"
+                              "config.network.vswitch\0"
+                              "config.network.pnic\0"
+                              "config.network.portgroup\0") < 0 ||
+        esxVI_LookupHostSystemProperties(priv->primary, propertyNameList,
+                                         &hostSystem) < 0) {
+        goto cleanup;
+    }
+
+    for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
+         dynamicProperty = dynamicProperty->_next) {
+        if (STREQ(dynamicProperty->name, "config.network.vnic")) {
+            if (esxVI_HostVirtualNic_CastListFromAnyType(
+                  dynamicProperty->val, &virtualNicList) < 0) {
+                goto cleanup;
+            }
+        } else if (STREQ(dynamicProperty->name,
+              "config.network.ipRouteConfig")) {
+            if (esxVI_HostIpRouteConfig_CastFromAnyType(
+                  dynamicProperty->val, &ipRouteConfig)) {
+                goto cleanup;
+            }
+        } else if (STREQ(dynamicProperty->name, "config.network.vswitch")) {
+            if (esxVI_HostVirtualSwitch_CastListFromAnyType
+              (dynamicProperty->val, &virtualSwitchList) < 0) {
+                goto cleanup;
+            }
+        } else if (STREQ(dynamicProperty->name, "config.network.pnic")) {
+            if (esxVI_PhysicalNic_CastListFromAnyType(
+                  dynamicProperty->val, &physicalNicList) < 0) {
+                goto cleanup;
+            }
+        } else if (STREQ(dynamicProperty->name, "config.network.portgroup")) {
+            if (esxVI_HostPortGroup_CastListFromAnyType(
+                  dynamicProperty->val, &portGroupList) < 0) {
+                goto cleanup;
+            }
+        } else {
+            VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+        }
+    }
+
+    if (!virtualNicList ||
+        !ipRouteConfig ||
+        !virtualSwitchList ||
+        !portGroupList) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                  _("Unable to retrieve network parameters"));
+
+        goto cleanup;
+    }
+
+    for (virtualNic = virtualNicList;
+         virtualNic != NULL;
+         virtualNic = virtualNic->_next) {
+        if (STREQ(virtualNic->device, iface->name)) {
+            break;
+        }
+    }
+
+    if (virtualNic == NULL) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                  _("Could not find Interface"));
+        goto cleanup;
+    }
+
+    if (esxVI_LookupPhysicalNicFromPortGroup(virtualNic->portgroup,
+                                             portGroupList,
+                                             virtualSwitchList,
+                                             physicalNicList,
+                                             &matchingPhysicalNicList) < 0) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                  _("No Physical NIC found matching Virtual NIC's portgroup"));
+        goto cleanup;
+    }
+
+    /*
+     * populate virInterfaceDef object to obtain
+     * libvirt interface domain xml.
+     */
+    if (VIR_ALLOC(def) < 0) {
+        virReportOOMError();
+        goto cleanup;
+    }
+
+    def->type = VIR_INTERFACE_TYPE_BRIDGE;
+    def->name = strdup(virtualNic->device);
+    if (virtualNic->spec->mtu && virtualNic->spec->mtu->value) {
+        def->mtu = virtualNic->spec->mtu->value;
+    } else {
+        def->mtu = 1500;
+    }
+
+    def->startmode = VIR_INTERFACE_START_ONBOOT;
+
+    if (!use_static && virtualNic->spec->mac) {
+        def->mac = strdup(virtualNic->spec->mac);
+    }
+
+    /* TODO - Handle VLAN (via portgroup?) */
+    if (virtualNic->spec->ip->subnetMask &&
+        *virtualNic->spec->ip->subnetMask &&
+        inet_aton(virtualNic->spec->ip->subnetMask, &addr) == 0) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                  _("Error parsing netmask"));
+        goto cleanup;
+    }
+
+    host_addr = ntohl(addr.s_addr);
+    /* Calculate masklen */
+    for (i = 0; i < 32; ++i) {
+        if (host_addr & 0x01) {
+             break;
+        }
+        zero_count++;
+        host_addr >>= 1;
+    }
+    masklen = 32 - zero_count;
+
+    /* append protocol field */
+    def->nprotos = 1;
+    if (VIR_ALLOC_N(def->protos, def->nprotos) < 0) {
+        virReportOOMError();
+        goto cleanup;
+    }
+
+    /* TODO - Add IPv6 Support */
+    for (i = 0; i < def->nprotos; ++i) {
+        if (VIR_ALLOC(def->protos[i]) < 0) {
+            goto cleanup;
+        }
+
+        def->protos[i]->family = strdup("ipv4");
+        if (virtualNic->spec->ip->dhcp == 1) {
+            def->protos[i]->dhcp = 1;
+        }
+        def->protos[i]->nips = 1;
+        if (virtualNic->spec->ip->dhcp != 1 || !use_static) {
+            if (virtualNic->spec->ip->ipAddress &&
+              *virtualNic->spec->ip->ipAddress) {
+                int j =0;
+                if (VIR_ALLOC_N(def->protos[i]->ips, def->protos[i]->nips)
+                  < 0) {
+                    virReportOOMError();
+                    goto cleanup;
+                }
+
+                for (j=0; j < def->protos[i]->nips; ++j) {
+                    if (VIR_ALLOC(def->protos[i]->ips[j]) < 0) {
+                        virReportOOMError();
+                        goto cleanup;
+                    }
+                    def->protos[i]->ips[0]->address =
+                        strdup(virtualNic->spec->ip->ipAddress);
+                    def->protos[i]->ips[0]->prefix = masklen;
+                    def->protos[i]->gateway =
+                        strdup(ipRouteConfig->defaultGateway);
+                }
+            }
+        }
+    }
+
+    /* Add bridge information */
+    def->data.bridge.stp = 0; /* off */
+
+    /**
+     * traversing physical nic list twice, first to get total
+     * interfaces and second to populate interface items.
+     * Total Complexity ~= O(N); also total physical nics
+     * cannot be that large number
+     */
+    for (physicalNic = matchingPhysicalNicList, i = 0; physicalNic != NULL;
+         physicalNic = physicalNic->_next, ++i) {
+    }
+
+    if ( i > 0) {
+        if (VIR_ALLOC_N(def->data.bridge.itf, i) < 0) {
+            virReportOOMError();
+            goto cleanup;
+        }
+        def->data.bridge.nbItf = i;
+        for (physicalNic = matchingPhysicalNicList, i = 0; physicalNic != NULL;
+             physicalNic = physicalNic->_next, ++i) {
+            virInterfaceDefPtr itf = NULL;
+            if (VIR_ALLOC(itf) < 0) {
+                virReportOOMError();
+                goto cleanup;
+            }
+            itf->type = VIR_INTERFACE_TYPE_ETHERNET;
+            itf->name = strdup(physicalNic->device);
+            itf->mac = strdup(physicalNic->mac);
+
+            def->data.bridge.itf[i] = itf;
+        }
+    }
+
+    ret = virInterfaceDefFormat(def);
+    if (!ret) {
+        goto cleanup;
+    }
+
+ cleanup:
+    esxVI_HostVirtualNic_Free(&virtualNicList);
+    esxVI_PhysicalNic_Free(&physicalNicList);
+    esxVI_PhysicalNic_Free(&matchingPhysicalNicList);
+    esxVI_HostPortGroup_Free(&portGroupList);
+    esxVI_HostVirtualSwitch_Free(&virtualSwitchList);
+    esxVI_HostIpRouteConfig_Free(&ipRouteConfig);
+    esxVI_ObjectContent_Free(&hostSystem);
+    esxVI_String_Free(&propertyNameList);
+    virInterfaceDefFree(def);
+
+    return ret;
+}
+
+
+
+static int
+esxInterfaceUndefine(virInterfacePtr iface)
+{
+    esxPrivate *priv = iface->conn->interfacePrivateData;
+
+    if (esxVI_RemoveVirtualNic(
+          priv->primary,
+          priv->primary->hostSystem->configManager->networkSystem,
+          iface->name) < 0) {
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+          _("Error deleting interface"));
+        return -1;
+    }
+
+    return 0;
+}
+
+
+
+static int
+esxInterfaceCreate(virInterfacePtr iface, unsigned int flags)
+{
+    iface->conn->interfacePrivateData = NULL;
+
+    virCheckFlags(0, -1);
+
+    /* ESX interfaces are always active */
+    return 0;
+}
+
+
+
+static int
+esxInterfaceDestroy(virInterfacePtr iface, unsigned int flags)
+{
+    iface->conn->interfacePrivateData = NULL;
+
+    virCheckFlags(0, -1);
+
+    /* ESX interfaces can not be deactivated */
+    return 1;
+}
+
+
+
 static virInterfaceDriver esxInterfaceDriver = {
     .name = "ESX",
-    .open = esxInterfaceOpen, /* 0.7.6 */
-    .close = esxInterfaceClose, /* 0.7.6 */
+    .open = esxInterfaceOpen,                   /* 0.7.6 */
+    .close = esxInterfaceClose,                 /* 0.7.6 */
+    .numOfInterfaces = esxNumOfInterfaces,      /* 0.9.x */
+    .numOfDefinedInterfaces = esxNumOfDefinedInterfaces, /* 0.9.x */
+    .listInterfaces = esxListInterfaces,        /* 0.9.x */
+    .listDefinedInterfaces = esxListDefinedInterfaces, /* 0.9.x */
+    .interfaceLookupByName = esxInterfaceLookupByName, /* 0.9.x */
+    .interfaceLookupByMACString = esxInterfaceLookupByMACString, /* 0.9.x */
+    .interfaceGetXMLDesc = esxInterfaceGetXMLDesc, /* 0.9.x */
+    .interfaceUndefine = esxInterfaceUndefine, /* 0.9.x */
+    .interfaceCreate = esxInterfaceCreate, /* 0.9.x */
+    .interfaceDestroy = esxInterfaceDestroy, /* 0.9.x */
 };
 
 
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 48718b6..80ddb76 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -4523,6 +4523,132 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx,
     return result;
 }
 
+int
+esxVI_LookupVirtualNicList(esxVI_Context* ctx,
+                           esxVI_HostVirtualNic** virtualNicList)
+{
+    int result = -1;
+    esxVI_String *propertyNameList = NULL;
+    esxVI_DynamicProperty *dynamicProperty = NULL;
+    esxVI_ObjectContent* hostSystem = NULL;
+
+    if (esxVI_String_AppendValueListToList(
+          &propertyNameList, "config.network.vnic\0") < 0 ||
+        esxVI_LookupHostSystemProperties(ctx, propertyNameList, &hostSystem) < 0) {
+        goto cleanup;
+    }
 
+    if (hostSystem == NULL) {
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Could not retrieve the HostSystem object"));
+
+        goto cleanup;
+    }
+
+    for (dynamicProperty = hostSystem->propSet;
+         dynamicProperty != NULL;
+         dynamicProperty = dynamicProperty->_next) {
+        if (STREQ(dynamicProperty->name, "config.network.vnic")) {
+            if (esxVI_HostVirtualNic_CastListFromAnyType(dynamicProperty->val,
+                                                         virtualNicList) < 0) {
+                goto cleanup;
+            }
+            break;
+        } else {
+            VIR_WARN("Unexpected '%s' property", dynamicProperty->name);
+        }
+    }
+
+    result = 0;
+
+cleanup:
+    esxVI_String_Free(&propertyNameList);
+    esxVI_ObjectContent_Free(&hostSystem);
+
+    return result;
+}
+
+int
+esxVI_LookupPhysicalNicFromPortGroup(
+    const char *portgroup,
+    const esxVI_HostPortGroup *portGroupList,
+    const esxVI_HostVirtualSwitch *virtualSwitchList,
+    const esxVI_PhysicalNic *physicalNicList,
+    esxVI_PhysicalNic **ret_physicalNicList)
+{
+    int result = -1;
+    const esxVI_HostPortGroup *portGroup = NULL;
+    const esxVI_HostVirtualSwitch *virtualSwitch = NULL;
+    esxVI_PhysicalNic *matchingPhysicalNicList = NULL;
+    const esxVI_PhysicalNic *physicalNic = NULL;
+    esxVI_PhysicalNic *tempPhysicalNic = NULL;
+    const esxVI_String *pnicKey = NULL;
+
+    if (portgroup == NULL) {
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                  _("No Portgroup found!"));
+        goto cleanup;
+    }
+
+    /* Go through all the port groups to find the one that matches. */
+    for (portGroup = portGroupList;
+         portGroup != NULL;
+         portGroup = portGroup->_next) {
+        if (STREQ(portGroup->spec->name, portgroup)) {
+            break;
+        }
+    }
+
+    if (portGroup == NULL) {
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                  _("Could not find Host port group"));
+        goto cleanup;
+    }
+
+    /* Go through all the virtual switches to find the one that matches */
+    for (virtualSwitch = virtualSwitchList;
+         virtualSwitch != NULL;
+         virtualSwitch = virtualSwitch->_next) {
+        if (STREQ(portGroup->spec->vswitchName, virtualSwitch->name)) {
+            break;
+        }
+    }
+
+    if (virtualSwitch == NULL) {
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "%s",
+                  _("Could not find Virtual Switch"));
+        goto cleanup;
+    }
+
+    /* Go through all physical nics */
+    for (pnicKey = virtualSwitch->pnic;
+         pnicKey != NULL;
+         pnicKey = pnicKey->_next) {
+        /* O(n^2), but probably faster than a hash due to small N */
+        for (physicalNic = physicalNicList;
+             physicalNic != NULL;
+             physicalNic = physicalNic->_next) {
+
+            if (STREQ(pnicKey->value, physicalNic->key)) {
+                if (esxVI_PhysicalNic_DeepCopy(&tempPhysicalNic,
+                                  (esxVI_PhysicalNic *)physicalNic) < 0 ||
+                    esxVI_PhysicalNic_AppendToList(&matchingPhysicalNicList,
+                                                   tempPhysicalNic) < 0) {
+                    goto cleanup;
+                }
+                tempPhysicalNic = NULL;
+            }
+        }
+    }
+
+   *ret_physicalNicList = matchingPhysicalNicList;
+    matchingPhysicalNicList = NULL; /* no cleanup needed */
+    tempPhysicalNic = NULL; /* no cleanup needed */
+    result = 0;
+ cleanup:
+    esxVI_PhysicalNic_Free(&matchingPhysicalNicList);
+    esxVI_PhysicalNic_Free(&tempPhysicalNic);
+    return result;
+}
 
 #include "esx_vi.generated.c"
diff --git a/src/esx/esx_vi.h b/src/esx/esx_vi.h
index 9560bd2..9b694b5 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -505,6 +505,16 @@ int esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo *parsedHostCpuIdInfo,
 
 int esxVI_ProductVersionToDefaultVirtualHWVersion(esxVI_ProductVersion productVersion);
 
+int esxVI_LookupVirtualNicList(esxVI_Context* ctx,
+                               esxVI_HostVirtualNic** virtualNicList);
+
+int esxVI_LookupPhysicalNicFromPortGroup(
+        const char *portgroup,
+        const esxVI_HostPortGroup *portGroupList,
+        const esxVI_HostVirtualSwitch *virtualSwitchList,
+        const esxVI_PhysicalNic *physicalNicList,
+        esxVI_PhysicalNic **ret_physicalNicList);
+
 # include "esx_vi.generated.h"
 
 #endif /* __ESX_VI_H__ */
diff --git a/src/esx/esx_vi_generator.input b/src/esx/esx_vi_generator.input
index 1a67a8c..64f8389 100644
--- a/src/esx/esx_vi_generator.input
+++ b/src/esx/esx_vi_generator.input
@@ -57,6 +57,29 @@ enum AutoStartWaitHeartbeatSetting
     systemDefault
 end
 
+enum HostConfigChangeOperation
+    add
+    edit
+    remove
+end
+
+enum HostIpConfigIpV6AdressStatus
+    deprecated
+    duplicate
+    inaccessible
+    invalid
+    preferred
+    tentative
+    unknown
+end
+
+enum HostIpConfigV6AdressConfigType
+    dhcp
+    linklayer
+    manual
+    other
+    random
+end
 
 enum ManagedEntityStatus
     gray
@@ -197,6 +220,12 @@ object DeviceBackedVirtualDiskSpec   extends VirtualDiskSpec
     String                                   device                         r
 end
 
+object DistributedVirtualSwitchPortConnection
+    Int                                      connectionCookie               o
+    String                                   portgroupKey                   o
+    String                                   portKey                        o
+    String                                   switchUuid                     r
+end
 
 object DynamicProperty
     String                                   name                           r
@@ -316,6 +345,34 @@ object HostFileSystemVolume
     Long                                     capacity                       r
 end
 
+object HostIpConfig
+    Boolean                                  dhcp                           r
+    String                                   ipAddress                      o
+    HostIpConfigIpV6AddressConfiguration     ipV6Config                     o
+    String                                   subnetMask                     o
+end
+
+object HostIpConfigIpV6Address
+    String                                   dadState                       o
+    String                                   ipAddress                      r
+    DateTime                                 lifetime                       o
+    String                                   operation                      o
+    String                                   origin                         o
+    Int                                      prefixLength                   r
+end
+
+object HostIpConfigIpV6AddressConfiguration
+    Boolean                                  autoConfigurationEnabled       o
+    Boolean                                  dhcpV6Enabled                  o
+    HostIpConfigIpV6Address                  ipV6Address                    ol
+end
+
+object HostIpRouteConfig
+    String                                   defaultGateway                 o
+    String                                   gatewayDevice                  o
+    String                                   ipV6DefaultGateway             o
+    String                                   ipV6GatewayDevice              o
+end
 
 object HostMountInfo
     String                                   path                           o
@@ -331,11 +388,131 @@ object HostNasVolume                 extends HostFileSystemVolume
 end
 
 
+object HostNicTeamingPolicy
+    String                                   policy                         o
+    Boolean                                  reversePolicy                  o
+    Boolean                                  notifySwitches                 o
+    Boolean                                  rollingOrder                   o
+    HostNicFailureCriteria                   failureCriteria                o
+    HostNicOrderPolicy                       nicOrder                       o
+end
+
+object HostNetOffloadCapabilities
+    Boolean                                  csumOffload                    o
+    Boolean                                  tcpSegmentation                o
+    Boolean                                  zeroCopyXmit                   o
+end
+
+object HostNetworkSecurityPolicy
+    Boolean                                  allowPromiscuous               o
+    Boolean                                  macChanges                     o
+    Boolean                                  forgedTransmits                o
+end
+
+object HostNetworkPolicy
+    HostNetworkSecurityPolicy                security                       o
+    HostNicTeamingPolicy                     nicTeaming                     o
+    HostNetOffloadCapabilities               offloadPolicy                  o
+    HostNetworkTrafficShapingPolicy          shapingPolicy                  o
+end
+
+object HostNetworkTrafficShapingPolicy
+    Boolean                                  enabled                        o
+end
+
+object HostNicFailureCriteria
+    String                                   checkSpeed                     o
+    Int                                      speed                          o
+    Boolean                                  checkDuplex                    o
+    Boolean                                  fullDuplex                     o
+    Boolean                                  checkErrorPercent              o
+    Int                                      percentage                     o
+    Boolean                                  checkBeacon                    o
+end
+
+object HostNicOrderPolicy
+    String                                   activeNic                     ol
+    String                                   standbyNic                    ol
+end
+
+object HostPortGroup
+    String                                   key                            r
+    HostPortGroupPort                        port                           ol
+    String                                   vswitch                        r
+    HostNetworkPolicy                        computedPolicy                 r
+    HostPortGroupSpec                        spec                           r
+end
+
+object HostPortGroupPort
+    String                                   key                            o
+    String                                   mac                            ol
+    String                                   type                           r
+end
+
+object HostPortGroupSpec
+    String                                   name                           r
+    Int                                      vlanId                         r
+    String                                   vswitchName                    r
+    HostNetworkPolicy                        policy                         r
+end
+
 object HostScsiDiskPartition
     String                                   diskName                       r
     Int                                      partition                      r
 end
 
+object HostVirtualNic
+    String                                   device                         r
+    String                                   key                            r
+    String                                   port                           o
+    String                                   portgroup                      r
+    HostVirtualNicSpec                       spec                           r
+end
+
+object HostVirtualNicSpec
+   DistributedVirtualSwitchPortConnection    distributedVirtualPort         o
+   HostIpConfig                              ip                             o
+   String                                    mac                            o
+   Int                                       mtu                            o
+   String                                    portgroup                      o
+   Boolean                                   tsoEnabled                     o
+end
+
+
+object HostVirtualSwitch
+   String                                    key                            r
+   Int                                       mtu                            o
+   String                                    name                           r
+   Int                                       numPorts                       r
+   Int                                       numPortsAvailable              r
+   String                                    pnic                           ol
+   String                                    portgroup                      ol
+   HostVirtualSwitchSpec                     spec                           r
+end
+
+object HostVirtualSwitchBridge
+end
+
+object HostVirtualSwitchAutoBridge extends HostVirtualSwitchBridge
+   String                                    excludedNicDevice              ol
+end
+
+object HostVirtualSwitchBeaconBridge extends HostVirtualSwitchBridge
+   Int                                       interval                       r
+end
+
+object HostVirtualSwitchBondBridge extends HostVirtualSwitchBridge
+   HostVirtualSwitchBeaconBridge             beacon                         o
+   LinkDiscoveryProtocolConfig               linkDiscoveryProtocolConfig    o
+   String                                    nicDevice                      rl
+end
+
+object HostVirtualSwitchSpec
+  HostVirtualSwitchBridge                    bridge                         o
+  Int                                        mtu                            o
+  Int                                        numPorts                       r
+  HostNetworkPolicy                          policy                         o
+end
 
 object HostVmfsVolume                extends HostFileSystemVolume
     Int                                      blockSizeMb                    r
@@ -355,6 +532,10 @@ end
 object IsoImageFileQuery             extends FileQuery
 end
 
+object LinkDiscoveryProtocolConfig
+    String                                    operation                     r
+    String                                    protocol                      r
+end
 
 object LocalDatastoreInfo            extends DatastoreInfo
     String                                   path                           o
@@ -398,6 +579,10 @@ object OptionType
     Boolean                                  valueIsReadonly                o
 end
 
+object OptionValue
+    String                                   key                            r
+    AnyType                                  value                          r
+end
 
 object PerfCounterInfo
     Int                                      key                            r
@@ -454,6 +639,27 @@ object PerfSampleInfo
     Int                                      interval                       r
 end
 
+object PhysicalNic
+    String                                   device                         r
+    String                                   driver                         o
+    String                                   key                            o
+    PhysicalNicInfo                          linkSpeed                      o
+    String                                   mac                            r
+    String                                   pci                            r
+    PhysicalNicSpec                          spec                           r
+    PhysicalNicInfo                          validLinkSpecification         ol
+    Boolean                                  wakeOnLanSupported             r
+end
+
+object PhysicalNicInfo
+   Boolean                                   duplex                         r
+   Int                                       speedMb                        r
+end
+
+object PhysicalNicSpec
+    HostIpConfig                             ip                             o
+    PhysicalNicInfo                          linkSpeed                      o
+end
 
 object PropertyChange
     String                                   name                           r
@@ -773,6 +979,13 @@ end
 # Methods
 #
 
+method AddVirtualNic                 returns String                         r
+    ManagedObjectReference                   _this                          r
+    String                                   portgroup                      r
+    HostVirtualNicSpec                       nic                            r
+end
+
+
 method AnswerVM
     ManagedObjectReference                   _this                          r
     String                                   questionId                     r
@@ -954,6 +1167,10 @@ method RemoveSnapshot_Task           returns ManagedObjectReference         r
     Boolean                                  removeChildren                 r
 end
 
+method RemoveVirtualNic
+   ManagedObjectReference                    _this                          r
+   String                                    device                         r
+end
 
 method RetrieveProperties            returns ObjectContent                  ol
     ManagedObjectReference                   _this:propertyCollector        r
@@ -1002,6 +1219,16 @@ method UnregisterVM
     ManagedObjectReference                   _this                          r
 end
 
+method UpdateIpRouteConfig
+    ManagedObjectReference                   _this                          r
+    HostIpRouteConfig                        config                         r
+end
+
+method UpdateVirtualNic
+    ManagedObjectReference                   _this                          r
+    String                                   device                         r
+    HostVirtualNicSpec                       nic                            r
+end
 
 method WaitForUpdates                returns UpdateSet                      r
     ManagedObjectReference                   _this:propertyCollector        r
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 8a128df..f4e4a11 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -371,8 +371,12 @@ class Property(Member):
                    % self.name
         elif self.occurrence in [OCCURRENCE__REQUIRED_LIST,
                                  OCCURRENCE__OPTIONAL_LIST]:
-            return "    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(%s, %s)\n" \
-                   % (self.type, self.name)
+            if self.type == "String":
+                return "    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_STRING_LIST(%s, %s)\n" \
+                        % (self.type, self.name)
+            else:
+                return "    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_LIST(%s, %s)\n" \
+                        % (self.type, self.name)
         elif self.type == "String":
             return "    ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(String, %s)\n" \
                    % self.name
@@ -1519,8 +1523,31 @@ additional_object_features = { "AutoStartDefaults"          : Object.FEATURE__AN
                                                               Object.FEATURE__ANY_TYPE,
                                "HostDatastoreBrowserSearchResults" : Object.FEATURE__LIST |
                                                               Object.FEATURE__ANY_TYPE,
+                               "HostIpConfig"               : Object.FEATURE__DEEP_COPY,
+                               "HostIpRouteConfig"          : Object.FEATURE__ANY_TYPE,
+                               "HostIpConfigIpV6Address"    : Object.FEATURE__LIST |
+                                                              Object.FEATURE__ANY_TYPE |
+                                                              Object.FEATURE__DEEP_COPY,
+                               "HostIpConfigIpV6AddressConfiguration"  : Object.FEATURE__DEEP_COPY,
+                               "HostPortGroup"              : Object.FEATURE__LIST |
+                                                              Object.FEATURE__ANY_TYPE,
+                               "HostVirtualNic"             : Object.FEATURE__ANY_TYPE |
+                                                              Object.FEATURE__LIST,
+                               "HostVirtualSwitch"          : Object.FEATURE__ANY_TYPE |
+                                                              Object.FEATURE__LIST,
+                               "KeyValue"                   : Object.FEATURE__ANY_TYPE,
                                "ManagedObjectReference"     : Object.FEATURE__ANY_TYPE,
+                               "PhysicalNic"                : Object.FEATURE__LIST |
+                                                              Object.FEATURE__ANY_TYPE |
+                                                              Object.FEATURE__DEEP_COPY,
                                "ObjectContent"              : Object.FEATURE__DEEP_COPY,
+                               "OptionValue"                : Object.FEATURE__ANY_TYPE |
+                                                              Object.FEATURE__LIST,
+                               "PhysicalNic"                : Object.FEATURE__LIST |
+                                                              Object.FEATURE__ANY_TYPE |
+                                                              Object.FEATURE__DEEP_COPY,
+                               "PhysicalNicSpec"            : Object.FEATURE__DEEP_COPY,
+                               "PhysicalNicLinkInfo"        : Object.FEATURE__LIST,
                                "ResourcePoolResourceUsage"  : Object.FEATURE__ANY_TYPE,
                                "ServiceContent"             : Object.FEATURE__DESERIALIZE,
                                "SharesInfo"                 : Object.FEATURE__ANY_TYPE,
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index bcc310f..f23af8d 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -475,7 +475,23 @@
         continue;                                                             \
     }
 
-
+#define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_STRING_LIST(_type, _name)     \
+    if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
+        char *value = NULL;                                                   \
+                                                                              \
+        if (esxVI_String_DeserializeValue(childNode, &value) < 0 ||           \
+            value == NULL) {                                                  \
+            goto failure;                                                     \
+        }                                                                     \
+                                                                              \
+        if (esxVI_##_type##_AppendValueToList(&(*ptrptr)->_name,              \
+                                                value) < 0) {                 \
+            VIR_FREE(value);                                                  \
+            goto failure;                                                     \
+        }                                                                     \
+                                                                              \
+        continue;                                                             \
+    }
 
 /*
  * A required property must be != 0 (NULL for pointers, "undefined" == 0 for
-- 
1.7.9.5
                    
                  
                  
                          
                            
                            4
                            
                          
                          
                            
                            4
                            
                          
                          
                            
    
                          
                        
                     
                        
                    
                        
                            
                                
                            
                            [libvirt] [PATCH] security: Skip labeling resources when seclabel defaults to none
                        
                        
by Jiri Denemark 27 Jul '12
                    by Jiri Denemark 27 Jul '12
27 Jul '12
                    
                        If a domain is explicitly configured with <seclabel type="none"/> we
correctly ensure that no labeling will be done by setting
norelabel=true. However, if no seclabel element is present in domain XML
and hypervisor is configured not to confine domains by default, we only
set type to "none" without turning off relabeling. Thus if such a domain
is being started, security driver wants to relabel resources with
default label, which doesn't make any sense.
Moreover, with SELinux security driver, the generated image label lacks
"s0" sensitivity, which causes setfilecon() fail with EINVAL in
enforcing mode.
---
 src/security/security_manager.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 2e1be4d..44ab6fb 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -309,10 +309,12 @@ int virSecurityManagerGenLabel(virSecurityManagerPtr mgr,
                                virDomainDefPtr vm)
 {
     if (vm->seclabel.type == VIR_DOMAIN_SECLABEL_DEFAULT) {
-        if (mgr->defaultConfined)
+        if (mgr->defaultConfined) {
             vm->seclabel.type = VIR_DOMAIN_SECLABEL_DYNAMIC;
-        else
+        } else {
             vm->seclabel.type = VIR_DOMAIN_SECLABEL_NONE;
+            vm->seclabel.norelabel = true;
+        }
     }
 
     if ((vm->seclabel.type == VIR_DOMAIN_SECLABEL_NONE) &&
-- 
1.7.11.1
                    
                  
                  
                          
                            
                            2
                            
                          
                          
                            
                            2
                            
                          
                          
                            
    
                          
                        
                    
                    
                        This is a series which makes it possible to properly handle
reboots in the LXC driver. The lxc_controller can detect
if the container asked for a reboot by looking at the exit
status of the init process & checking for SIGHUP as the
termination signal. The fun is that the lxc controller cannot
actually restart the container itself though. It lacks the
permissions todo so (it dropped all capabilities), and it
is not able to configure the veth devices either. So we
introduce an RPC protocol with an event notification on
shutdown, to tell libvirtd that a restart is needed
This applies on top of
https://www.redhat.com/archives/libvir-list/2012-July/msg01309.html
                    
                  
                  
                          
                            
                            2
                            
                          
                          
                            
                            30
                            
                          
                          
                            
    
                          
                        
                    
                    
                        Commit f9ce7dad6 tried to kill uses of a raw street address, but
missed a few instances.  Automate things so we don't introduce
new problems in the future.
* cfg.mk (sc_copyright_address): New rule.
(exclude_file_name_regexp--sc_copyright_address): Add exemption.
* bootstrap.conf: Adjust offenders.
* build-aux/augeas-gentest.pl: Likewise.
* examples/systemtap/events.stp: Likewise.
* examples/systemtap/qemu-monitor.stp: Likewise.
* examples/systemtap/rpc-monitor.stp: Likewise.
* src/dtrace2systemtap.pl: Likewise.
* src/esx/esx_vi_generator.py: Likewise.
* src/hyperv/hyperv_wmi_generator.py: Likewise.
* src/remote/qemu_protocol.x: Likewise.
* src/remote/remote_protocol.x: Likewise.
* src/rpc/gensystemtap.pl: Likewise.
* src/rpc/virnetprotocol.x: Likewise.
* tests/object-locking.ml: Likewise.
* tools/virt-xml-validate.in: Likewise.
---
Not that I'm trying to demean Boston, but right now, the only
mention of it in our source code happens to come from stale
LGPL reference source boilerplate.
 bootstrap.conf                      |  4 +---
 build-aux/augeas-gentest.pl         |  3 +--
 cfg.mk                              | 10 ++++++++++
 examples/systemtap/events.stp       |  3 +--
 examples/systemtap/qemu-monitor.stp |  3 +--
 examples/systemtap/rpc-monitor.stp  |  3 +--
 src/dtrace2systemtap.pl             |  5 ++---
 src/esx/esx_vi_generator.py         |  3 +--
 src/hyperv/hyperv_wmi_generator.py  |  3 +--
 src/remote/qemu_protocol.x          |  3 +--
 src/remote/remote_protocol.x        |  3 +--
 src/rpc/gensystemtap.pl             |  5 ++---
 src/rpc/virnetprotocol.x            |  5 ++---
 tests/object-locking.ml             |  5 ++---
 tools/virt-xml-validate.in          |  5 ++---
 15 files changed, 29 insertions(+), 34 deletions(-)
diff --git a/bootstrap.conf b/bootstrap.conf
index 3ac84f4..84e37e7 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -13,9 +13,7 @@
 # GNU General Public License for more details.
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
-
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 # gnulib modules used by this package.
 gnulib_modules='
diff --git a/build-aux/augeas-gentest.pl b/build-aux/augeas-gentest.pl
index a5f9fd3..9cdc400 100755
--- a/build-aux/augeas-gentest.pl
+++ b/build-aux/augeas-gentest.pl
@@ -14,8 +14,7 @@
 # Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 #
 # Authors:
 #     Daniel P. Berrange <berrange(a)redhat.com>
diff --git a/cfg.mk b/cfg.mk
index 68f3a91..88131cb 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -622,6 +622,13 @@ sc_copyright_format:
 	halt='spell Red Hat as two words'				\
 	  $(_sc_search_regexp)
+# Prefer the new URL listing over the old street address listing when
+# calling out where to get a copy of the [L]GPL.
+sc_copyright_address:
+	@prohibit=Boston,' MA'						\
+	halt='Point to <http://www.gnu.org/licenses/>, not an address'	\
+	  $(_sc_search_regexp)
+
 # Some functions/macros produce messages intended solely for developers
 # and maintainers.  Do not mark them for translation.
 sc_prohibit_gettext_markup:
@@ -736,6 +743,9 @@ exclude_file_name_regexp--sc_avoid_write = \
 exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
+exclude_file_name_regexp--sc_copyright_address = \
+  ^COPYING\.LIB$$
+
 exclude_file_name_regexp--sc_flags_usage = ^(docs/|src/util/virnetdevtap\.c$$)
 exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = \
diff --git a/examples/systemtap/events.stp b/examples/systemtap/events.stp
index 7184000..3703be5 100644
--- a/examples/systemtap/events.stp
+++ b/examples/systemtap/events.stp
@@ -13,8 +13,7 @@
 # Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 #
 # Author: Daniel P. Berrange <berrange(a)redhat.com>
 #
diff --git a/examples/systemtap/qemu-monitor.stp b/examples/systemtap/qemu-monitor.stp
index b9d9b25..50f706f 100644
--- a/examples/systemtap/qemu-monitor.stp
+++ b/examples/systemtap/qemu-monitor.stp
@@ -13,8 +13,7 @@
 # Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 #
 # Author: Daniel P. Berrange <berrange(a)redhat.com>
 #
diff --git a/examples/systemtap/rpc-monitor.stp b/examples/systemtap/rpc-monitor.stp
index 69d7593..8b9dc1e 100644
--- a/examples/systemtap/rpc-monitor.stp
+++ b/examples/systemtap/rpc-monitor.stp
@@ -13,8 +13,7 @@
 # Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 #
 # Author: Daniel P. Berrange <berrange(a)redhat.com>
 #
diff --git a/src/dtrace2systemtap.pl b/src/dtrace2systemtap.pl
index 4c6c249..91c9452 100755
--- a/src/dtrace2systemtap.pl
+++ b/src/dtrace2systemtap.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# Copyright (C) 2011 Red Hat, Inc.
+# Copyright (C) 2011-2012 Red Hat, Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -13,8 +13,7 @@
 # Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 #
 # Author: Daniel P. Berrange <berrange(a)redhat.com>
 #
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 97b8e15..2a344cc 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -16,8 +16,7 @@
 # Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 #
 import sys
diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_generator.py
index 93f5ac2..d2d44d2 100755
--- a/src/hyperv/hyperv_wmi_generator.py
+++ b/src/hyperv/hyperv_wmi_generator.py
@@ -16,8 +16,7 @@
 # Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 #
 import sys
diff --git a/src/remote/qemu_protocol.x b/src/remote/qemu_protocol.x
index 5afe680..3536319 100644
--- a/src/remote/qemu_protocol.x
+++ b/src/remote/qemu_protocol.x
@@ -16,8 +16,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Chris Lalancette <clalance(a)redhat.com>
  */
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index dd460d4..bdfa8ff 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -16,8 +16,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Richard Jones <rjones(a)redhat.com>
  */
diff --git a/src/rpc/gensystemtap.pl b/src/rpc/gensystemtap.pl
index 1cf9c0f..0adf900 100755
--- a/src/rpc/gensystemtap.pl
+++ b/src/rpc/gensystemtap.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# Copyright (C) 2011 Red Hat, Inc.
+# Copyright (C) 2011-2012 Red Hat, Inc.
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -13,8 +13,7 @@
 # Lesser General Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 #
 # Author: Daniel P. Berrange <berrange(a)redhat.com>
 #
diff --git a/src/rpc/virnetprotocol.x b/src/rpc/virnetprotocol.x
index 9663ddb..f81a059 100644
--- a/src/rpc/virnetprotocol.x
+++ b/src/rpc/virnetprotocol.x
@@ -1,7 +1,7 @@
 /* -*- c -*-
  * virnetprotocol.x: basic protocol for all RPC services.
  *
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -14,8 +14,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Richard Jones <rjones(a)redhat.com>
  */
diff --git a/tests/object-locking.ml b/tests/object-locking.ml
index 68c414e..e952fe7 100644
--- a/tests/object-locking.ml
+++ b/tests/object-locking.ml
@@ -1,7 +1,7 @@
 (*
  * Analyse libvirt driver API methods for mutex locking mistakes
  *
- * Copyright (C) 2008-2010 Red Hat, Inc.
+ * Copyright (C) 2008-2010, 2012 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -14,8 +14,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Daniel P. Berrange <berrange(a)redhat.com>
  *)
diff --git a/tools/virt-xml-validate.in b/tools/virt-xml-validate.in
index 9ba3a0a..ce13aff 100644
--- a/tools/virt-xml-validate.in
+++ b/tools/virt-xml-validate.in
@@ -10,9 +10,8 @@
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
 set -e
-- 
1.7.11.2
                    
                  
                  
                          
                            
                            2
                            
                          
                          
                            
                            3
                            
                          
                          
                            
    
                          
                        
                    
                    
                        This series probably would qualify as build breaker but I'm posting it anyways.
Without this, docs building in apibuild.py fails.
Peter Krempa (2):
  docs: Add method to print warnings in docBuilder class
  lib: Revert removing of Summary and Description fields in headers
 docs/apibuild.py               |    5 +++++
 include/libvirt/libvirt-qemu.h |    3 +++
 include/libvirt/libvirt.h.in   |    3 +++
 include/libvirt/virterror.h    |    3 +++
 4 files changed, 14 insertions(+), 0 deletions(-)
-- 
1.7.8.6
                    
                  
                  
                          
                            
                            2
                            
                          
                          
                            
                            4
                            
                          
                          
                            
    
                          
                        
                     
                        
                    27 Jul '12
                    
                        From: "Daniel P. Berrange" <berrange(a)redhat.com>
The cfg.mk file rule to check for tab characters was not
applied to perl files. Much of our Perl code is full of
tabs as a result. Kill them, kill them all !
---
 build-aux/augeas-gentest.pl |   42 +++----
 cfg.mk                      |    2 +-
 docs/hvsupport.pl           |  268 +++++++++++++++++++++----------------------
 docs/todo.pl                |   42 +++----
 src/check-symfile.pl        |    4 +-
 src/dtrace2systemtap.pl     |  104 ++++++++---------
 src/rpc/gendispatch.pl      |  180 ++++++++++++++---------------
 src/rpc/genprotocol.pl      |  106 ++++++++---------
 src/rpc/gensystemtap.pl     |   48 ++++----
 tests/oomtrace.pl           |    6 +-
 10 files changed, 401 insertions(+), 401 deletions(-)
diff --git a/build-aux/augeas-gentest.pl b/build-aux/augeas-gentest.pl
index a5f9fd3..607ea20 100755
--- a/build-aux/augeas-gentest.pl
+++ b/build-aux/augeas-gentest.pl
@@ -41,28 +41,28 @@ open TEMPLATE, "<", $template or die "cannot read $template: $!";
 my $group = 0;
 while (<TEMPLATE>) {
     if (/::CONFIG::/) {
-	my $group = 0;
-	print AUGTEST "  let conf = \"";
-	while (<CONFIG>) {
-	    if (/^#\w/) {
-		s/^#//;
-		s/\"/\\\"/g;
-		print AUGTEST $_;
-		$group = /\[\s$/;
-	    } elsif ($group) {
-		s/\"/\\\"/g;
-		if (/#\s*\]/) {
-		    $group = 0;
-		}
-		if (/^#/) {
-		    s/^#//;
-		    print AUGTEST $_;
-		}
-	    }
-	}
-	print AUGTEST "\"\n";
+        my $group = 0;
+        print AUGTEST "  let conf = \"";
+        while (<CONFIG>) {
+            if (/^#\w/) {
+                s/^#//;
+                s/\"/\\\"/g;
+                print AUGTEST $_;
+                $group = /\[\s$/;
+            } elsif ($group) {
+                s/\"/\\\"/g;
+                if (/#\s*\]/) {
+                    $group = 0;
+                }
+                if (/^#/) {
+                    s/^#//;
+                    print AUGTEST $_;
+                }
+            }
+        }
+        print AUGTEST "\"\n";
     } else {
-	print AUGTEST $_;
+        print AUGTEST $_;
     }
 }
 
diff --git a/cfg.mk b/cfg.mk
index 68f3a91..aa457f9 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -453,7 +453,7 @@ sc_size_of_brackets:
 # Ensure that no C source file, docs, or rng schema uses TABs for
 # indentation.  Also match *.h.in files, to get libvirt.h.in.  Exclude
 # files in gnulib, since they're imported.
-space_indent_files=(\.(rng|s?[ch](\.in)?|html.in|py|syms)|(daemon|tools)/.*\.in)
+space_indent_files=(\.(rng|s?[ch](\.in)?|html.in|py|pl|syms)|(daemon|tools)/.*\.in)
 sc_TAB_in_indentation:
 	@prohibit='^ *	'						\
 	in_vc_files='$(space_indent_files)$$'				\
diff --git a/docs/hvsupport.pl b/docs/hvsupport.pl
index b0d1f0f..4871739 100755
--- a/docs/hvsupport.pl
+++ b/docs/hvsupport.pl
@@ -27,9 +27,9 @@ my %groupheaders = (
 my @srcs;
 find({
     wanted => sub {
-	if (m!$srcdir/.*/\w+_(driver|tmpl|monitor|hal|udev)\.c$!) {
-	    push @srcs, $_ if $_ !~ /vbox_driver\.c/;
-	}
+        if (m!$srcdir/.*/\w+_(driver|tmpl|monitor|hal|udev)\.c$!) {
+            push @srcs, $_ if $_ !~ /vbox_driver\.c/;
+        }
     }, no_chdir => 1}, $srcdir);
 my $line;
 
@@ -47,26 +47,26 @@ while (defined($line = <FILE>)) {
     next if $line =~ /^\s*$/;
     next if $line =~ /^\s*(global|local):/;
     if ($line =~ /^\s*LIBVIRT_(\d+\.\d+\.\d+)\s*{\s*$/) {
-	if (defined $vers) {
-	    die "malformed syms file";
-	}
-	$vers = $1;
+        if (defined $vers) {
+            die "malformed syms file";
+        }
+        $vers = $1;
     } elsif ($line =~ /\s*}\s*;\s*$/) {
-	if (defined $prevvers) {
-	    die "malformed syms file";
-	}
-	$prevvers = $vers;
-	$vers = undef;
+        if (defined $prevvers) {
+            die "malformed syms file";
+        }
+        $prevvers = $vers;
+        $vers = undef;
     } elsif ($line =~ /\s*}\s*LIBVIRT_(\d+\.\d+\.\d+)\s*;\s*$/) {
-	if ($1 ne $prevvers) {
-	    die "malformed syms file $1 != $vers";
-	}
-	$prevvers = $vers;
-	$vers = undef;
+        if ($1 ne $prevvers) {
+            die "malformed syms file $1 != $vers";
+        }
+        $prevvers = $vers;
+        $vers = undef;
     } elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
-	$apis{$1} = $vers;
+        $apis{$1} = $vers;
     } else {
-	die "unexpected data $line\n";
+        die "unexpected data $line\n";
     }
 }
 
@@ -86,26 +86,26 @@ while (defined($line = <FILE>)) {
     next if $line =~ /^\s*$/;
     next if $line =~ /^\s*(global|local):/;
     if ($line =~ /^\s*LIBVIRT_QEMU_(\d+\.\d+\.\d+)\s*{\s*$/) {
-	if (defined $vers) {
-	    die "malformed syms file";
-	}
-	$vers = $1;
+        if (defined $vers) {
+            die "malformed syms file";
+        }
+        $vers = $1;
     } elsif ($line =~ /\s*}\s*;\s*$/) {
-	if (defined $prevvers) {
-	    die "malformed syms file";
-	}
-	$prevvers = $vers;
-	$vers = undef;
+        if (defined $prevvers) {
+            die "malformed syms file";
+        }
+        $prevvers = $vers;
+        $vers = undef;
     } elsif ($line =~ /\s*}\s*LIBVIRT_QEMU_(\d+\.\d+\.\d+)\s*;\s*$/) {
-	if ($1 ne $prevvers) {
-	    die "malformed syms file $1 != $vers";
-	}
-	$prevvers = $vers;
-	$vers = undef;
+        if ($1 ne $prevvers) {
+            die "malformed syms file $1 != $vers";
+        }
+        $prevvers = $vers;
+        $vers = undef;
     } elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
-	$apis{$1} = $vers;
+        $apis{$1} = $vers;
     } else {
-	die "unexpected data $line\n";
+        die "unexpected data $line\n";
     }
 }
 
@@ -143,31 +143,31 @@ my %groups;
 my $ingrp;
 while (defined($line = <FILE>)) {
     if ($line =~ /struct _(vir\w*(?:Driver|Monitor))/) {
-	my $grp = $1;
-	if ($grp ne "virStateDriver" &&
-	    $grp ne "virStreamDriver") {
-	    $ingrp = $grp;
-	    $groups{$ingrp} = { apis => {}, drivers => {} };
-	}
+        my $grp = $1;
+        if ($grp ne "virStateDriver" &&
+            $grp ne "virStreamDriver") {
+            $ingrp = $grp;
+            $groups{$ingrp} = { apis => {}, drivers => {} };
+        }
     } elsif ($ingrp) {
-	if ($line =~ /^\s*vir(?:Drv|DevMon)(\w+)\s+(\w+);\s*$/) {
-	    my $field = $2;
-	    my $name = $1;
-
-	    my $api;
-	    if (exists $apis{"vir$name"}) {
-		$api = "vir$name";
-	    } elsif (exists $apis{"virConnect$name"}) {
-		$api = "virConnect$name";
-	    } elsif (exists $apis{"virNode$name"}) {
-		$api = "virNode$name";
-	    } else {
-		die "driver $name does not have a public API";
-	    }
-	    $groups{$ingrp}->{apis}->{$field} = $api;
-	} elsif ($line =~ /};/) {
-	    $ingrp = undef;
-	}
+        if ($line =~ /^\s*vir(?:Drv|DevMon)(\w+)\s+(\w+);\s*$/) {
+            my $field = $2;
+            my $name = $1;
+
+            my $api;
+            if (exists $apis{"vir$name"}) {
+                $api = "vir$name";
+            } elsif (exists $apis{"virConnect$name"}) {
+                $api = "virConnect$name";
+            } elsif (exists $apis{"virNode$name"}) {
+                $api = "virNode$name";
+            } else {
+                die "driver $name does not have a public API";
+            }
+            $groups{$ingrp}->{apis}->{$field} = $api;
+        } elsif ($line =~ /};/) {
+            $ingrp = undef;
+        }
     }
 }
 
@@ -179,60 +179,60 @@ close FILE;
 
 foreach my $src (@srcs) {
     open FILE, "<$src" or
-	die "cannot read $src: $!";
+        die "cannot read $src: $!";
 
     $ingrp = undef;
     my $impl;
     while (defined($line = <FILE>)) {
-	if (!$ingrp) {
-	    foreach my $grp (keys %groups) {
-		if ($line =~ /^\s*(?:static\s+)?$grp\s+(\w+)\s*=\s*{/ ||
-		    $line =~ /^\s*(?:static\s+)?$grp\s+NAME\(\w+\)\s*=\s*{/) {
-		    $ingrp = $grp;
-		    $impl = $src;
-
-		    if ($impl =~ m,.*/node_device_(\w+)\.c,) {
-			$impl = $1;
-		    } else {
-			$impl =~ s,.*/(\w+?)_((\w+)_)?(\w+)\.c,$1,;
-		    }
-
-		    if ($groups{$ingrp}->{drivers}->{$impl}) {
-			die "Group $ingrp already contains $impl";
-		    }
-
-		    $groups{$ingrp}->{drivers}->{$impl} = {};
-		}
-	    }
-
-	} else {
-	    if ($line =~ m!\s*\.(\w+)\s*=\s*(\w+)\s*,?\s*(?:/\*\s*(\d+\.\d+\.\d+)\s*\*/\s*)?$!) {
-		my $api = $1;
-		my $meth = $2;
-		my $vers = $3;
-
-		next if $api eq "no" || $api eq "name";
-
-		die "Method $meth in $src is missing version" unless defined $vers;
-
-		die "Driver method for $api is NULL in $src" if $meth eq "NULL";
-
-		if (!exists($groups{$ingrp}->{apis}->{$api})) {
-		    die "Found unexpected method $api in $ingrp\n";
-		}
-
-		$groups{$ingrp}->{drivers}->{$impl}->{$api} = $vers;
-		if ($api eq "domainMigratePrepare" ||
-		    $api eq "domainMigratePrepare2" ||
-		    $api eq "domainMigratePrepare3") {
-		    $groups{$ingrp}->{drivers}->{$impl}->{"domainMigrate"} = $vers
-			unless $groups{$ingrp}->{drivers}->{$impl}->{"domainMigrate"};
-		}
-
-	    } elsif ($line =~ /}/) {
-		$ingrp = undef;
-	    }
-	}
+        if (!$ingrp) {
+            foreach my $grp (keys %groups) {
+                if ($line =~ /^\s*(?:static\s+)?$grp\s+(\w+)\s*=\s*{/ ||
+                    $line =~ /^\s*(?:static\s+)?$grp\s+NAME\(\w+\)\s*=\s*{/) {
+                    $ingrp = $grp;
+                    $impl = $src;
+
+                    if ($impl =~ m,.*/node_device_(\w+)\.c,) {
+                        $impl = $1;
+                    } else {
+                        $impl =~ s,.*/(\w+?)_((\w+)_)?(\w+)\.c,$1,;
+                    }
+
+                    if ($groups{$ingrp}->{drivers}->{$impl}) {
+                        die "Group $ingrp already contains $impl";
+                    }
+
+                    $groups{$ingrp}->{drivers}->{$impl} = {};
+                }
+            }
+
+        } else {
+            if ($line =~ m!\s*\.(\w+)\s*=\s*(\w+)\s*,?\s*(?:/\*\s*(\d+\.\d+\.\d+)\s*\*/\s*)?$!) {
+                my $api = $1;
+                my $meth = $2;
+                my $vers = $3;
+
+                next if $api eq "no" || $api eq "name";
+
+                die "Method $meth in $src is missing version" unless defined $vers;
+
+                die "Driver method for $api is NULL in $src" if $meth eq "NULL";
+
+                if (!exists($groups{$ingrp}->{apis}->{$api})) {
+                    die "Found unexpected method $api in $ingrp\n";
+                }
+
+                $groups{$ingrp}->{drivers}->{$impl}->{$api} = $vers;
+                if ($api eq "domainMigratePrepare" ||
+                    $api eq "domainMigratePrepare2" ||
+                    $api eq "domainMigratePrepare3") {
+                    $groups{$ingrp}->{drivers}->{$impl}->{"domainMigrate"} = $vers
+                        unless $groups{$ingrp}->{drivers}->{$impl}->{"domainMigrate"};
+                }
+
+            } elsif ($line =~ /}/) {
+                $ingrp = undef;
+            }
+        }
     }
 
     close FILE;
@@ -253,21 +253,21 @@ foreach my $drv (keys %{$groups{"virDriver"}->{drivers}}) {
     my $openVersStr = $groups{"virDriver"}->{drivers}->{$drv}->{"open"};
     my $openVers;
     if ($openVersStr =~ /(\d+)\.(\d+)\.(\d+)/) {
-	$openVers = ($1 * 1000 * 1000) + ($2 * 1000) + $3;
+        $openVers = ($1 * 1000 * 1000) + ($2 * 1000) + $3;
     }
 
     # virConnectOpenReadOnly always matches virConnectOpen version
     $groups{"virDriver"}->{drivers}->{$drv}->{"openReadOnly"} =
-	$groups{"virDriver"}->{drivers}->{$drv}->{"open"};
+        $groups{"virDriver"}->{drivers}->{$drv}->{"open"};
 
     # virConnectOpenAuth is always 0.4.0 if the driver existed
     # before this time, otherwise it matches the version of
     # the driver's virConnectOpen entry
     if ($openVersStr eq "Y" ||
-	$openVers >= $openAuthVers) {
-	$groups{"virDriver"}->{drivers}->{$drv}->{"openAuth"} = $openVersStr;
+        $openVers >= $openAuthVers) {
+        $groups{"virDriver"}->{drivers}->{$drv}->{"openAuth"} = $openVersStr;
     } else {
-	$groups{"virDriver"}->{drivers}->{$drv}->{"openAuth"} = "0.4.0";
+        $groups{"virDriver"}->{drivers}->{$drv}->{"openAuth"} = "0.4.0";
     }
 }
 
@@ -283,17 +283,17 @@ foreach my $drv (keys %{$groups{"virDriver"}->{drivers}}) {
     next unless defined $createVersStr;
     my $createVers;
     if ($createVersStr =~ /(\d+)\.(\d+)\.(\d+)/) {
-	$createVers = ($1 * 1000 * 1000) + ($2 * 1000) + $3;
+        $createVers = ($1 * 1000 * 1000) + ($2 * 1000) + $3;
     }
 
     # virCreateLinux is always 0.0.3 if the driver existed
     # before this time, otherwise it matches the version of
     # the driver's virCreateXML entry
     if ($createVersStr eq "Y" ||
-	$createVers >= $createAPIVers) {
-	$groups{"virDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = $createVersStr;
+        $createVers >= $createAPIVers) {
+        $groups{"virDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = $createVersStr;
     } else {
-	$groups{"virDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = "0.0.3";
+        $groups{"virDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = "0.0.3";
     }
 }
 
@@ -329,7 +329,7 @@ foreach my $grp (sort { $a cmp $b } keys %groups) {
 EOF
 
     foreach my $drv (sort { $a cmp $b } keys %{$groups{$grp}->{drivers}}) {
-	print "  <th>$drv</th>\n";
+        print "  <th>$drv</th>\n";
     }
 
     print <<EOF;
@@ -340,27 +340,27 @@ EOF
 
     my $row = 0;
     foreach my $field (sort {
-	$groups{$grp}->{apis}->{$a}
-	cmp
-	$groups{$grp}->{apis}->{$b}
-	} keys %{$groups{$grp}->{apis}}) {
-	my $api = $groups{$grp}->{apis}->{$field};
-	my $vers = $apis{$api};
-	print <<EOF;
+        $groups{$grp}->{apis}->{$a}
+        cmp
+        $groups{$grp}->{apis}->{$b}
+        } keys %{$groups{$grp}->{apis}}) {
+        my $api = $groups{$grp}->{apis}->{$field};
+        my $vers = $apis{$api};
+        print <<EOF;
 <tr>
 <td><a href=\"html/libvirt-libvirt.html#$api\">$api</a></td>
 <td>$vers</td>
 EOF
 
         foreach my $drv (sort {$a cmp $b } keys %{$groups{$grp}->{drivers}}) {
-	    if (exists $groups{$grp}->{drivers}->{$drv}->{$field}) {
-		print "<td>", $groups{$grp}->{drivers}->{$drv}->{$field}, "</td>\n";
-	    } else {
-		print "<td></td>\n";
-	    }
+            if (exists $groups{$grp}->{drivers}->{$drv}->{$field}) {
+                print "<td>", $groups{$grp}->{drivers}->{$drv}->{$field}, "</td>\n";
+            } else {
+                print "<td></td>\n";
+            }
         }
 
-	print <<EOF;
+        print <<EOF;
 </tr>
 EOF
 
@@ -373,13 +373,13 @@ EOF
 EOF
 
             foreach my $drv (sort { $a cmp $b } keys %{$groups{$grp}->{drivers}}) {
-	        print "  <th>$drv</th>\n";
+                print "  <th>$drv</th>\n";
             }
 
         print <<EOF;
 </tr>
 EOF
-	}
+        }
 
     }
 
diff --git a/docs/todo.pl b/docs/todo.pl
index 1183ff5..68d82d4 100755
--- a/docs/todo.pl
+++ b/docs/todo.pl
@@ -22,17 +22,17 @@ my $blurb = $cfg->get("output/blurb", undef);
 $SIG{__DIE__} = sub {
     my $err = shift;
     if (UNIVERSAL::isa($err, "BZ::Client::Exception")) {
-	die "Unable to access bugzilla: " . $err->message;
+        die "Unable to access bugzilla: " . $err->message;
     }
     die $err;
 };
 
 my $client = BZ::Client->new(url => $server,
-			     user => $username,
-			     password => $password);
+                             user => $username,
+                             password => $password);
 
 my $todo = BZ::Client::Bug->search($client, {'product' => $product,
-					     'alias' => $todoalias});
+                                             'alias' => $todoalias});
 
 die "Cannot find bug alias 'libvirtTodo'" unless $#{$todo} > -1;
 my $todoid = $todo->[0]->{'bug_id'};
@@ -42,7 +42,7 @@ $todosummary =~ s/^\s*\[\s*RFE\s*\]\s*:?\s*//;
 $todosummary =~ s/^\s*Tracker\s*:\s*//;
 
 my $trackers = BZ::Client::Bug->search($client, {'product' => $product,
-						 'blocked' => $todoid });
+                                                 'blocked' => $todoid });
 
 my @trackers;
 
@@ -55,27 +55,27 @@ foreach my $tracker (@{$trackers}) {
     $summary =~ s/^\s*Tracker\s*:\s*//;
 
     push @trackers, {
-	id => $tracker->{'bug_id'},
-	summary => $summary,
-	features => [],
+        id => $tracker->{'bug_id'},
+        summary => $summary,
+        features => [],
     };
 }
 
 foreach my $tracker (@trackers) {
     my $features = BZ::Client::Bug->search($client, {'product' => $product,
-						     'blocked' => $tracker->{id}});
+                                                     'blocked' => $tracker->{id}});
 
     foreach my $feature (@{$features}) {
-	next if $feature->{'bug_status'} eq "CLOSED";
+        next if $feature->{'bug_status'} eq "CLOSED";
 
-	my $summary = $feature->{'short_desc'};
-	$summary =~ s/^\s*RFE\s*:\s*//;
-	$summary =~ s/^\s*\[\s*RFE\s*\]\s*:?\s*//;
+        my $summary = $feature->{'short_desc'};
+        $summary =~ s/^\s*RFE\s*:\s*//;
+        $summary =~ s/^\s*\[\s*RFE\s*\]\s*:?\s*//;
 
-	push @{$tracker->{features}}, {
-	    id => $feature->{'bug_id'},
-	    summary => $summary,
-	};
+        push @{$tracker->{features}}, {
+            id => $feature->{'bug_id'},
+            summary => $summary,
+        };
     }
 }
 
@@ -108,11 +108,11 @@ foreach my $tracker (sort { $a->{summary} cmp $b->{summary} } @trackers) {
     print "    <h2><a href=\"$server/$id\">$summary</a></h2>\n";
     print "    <ul>\n";
     foreach my $feature (sort { $a->{summary} cmp $b->{summary} } @{$tracker->{features}}) {
-	$summary = &escape($feature->{summary});
-	$summary =~ s,^([^:]+):,<strong>$1</strong>,;
+        $summary = &escape($feature->{summary});
+        $summary =~ s,^([^:]+):,<strong>$1</strong>,;
 
-	$id = $feature->{id};
-	print "      <li>$summary (<strong>rhbz <a href=\"$server/$id\">$id</a></strong>)</li>\n";
+        $id = $feature->{id};
+        print "      <li>$summary (<strong>rhbz <a href=\"$server/$id\">$id</a></strong>)</li>\n";
     }
     print "    </ul>\n";
 }
diff --git a/src/check-symfile.pl b/src/check-symfile.pl
index 19ffec5..73cdfcd 100755
--- a/src/check-symfile.pl
+++ b/src/check-symfile.pl
@@ -34,9 +34,9 @@ foreach my $elflib (@elflibs) {
     open NM, "-|", "nm", $elflib or die "cannot run 'nm $elflib': $!";
 
     while (<NM>) {
-	next unless /^\S+\s(?:T|D)\s(\S+)\s*$/;
+        next unless /^\S+\s(?:T|D)\s(\S+)\s*$/;
 
-	$gotsyms{$1} = 1;
+        $gotsyms{$1} = 1;
     }
 
     close NM;
diff --git a/src/dtrace2systemtap.pl b/src/dtrace2systemtap.pl
index 4c6c249..8852379 100755
--- a/src/dtrace2systemtap.pl
+++ b/src/dtrace2systemtap.pl
@@ -46,38 +46,38 @@ while (<>) {
     next if /^\s*};\s*$/;
 
     if (m,^\s*\#,) {
-	if (m,^\s*\#\s*file:\s*(\S+)\s*$,) {
-	    $file = $1;
-	    push @files, $file;
-	    $files{$file} = { prefix => undef, probes => [] };
-	} elsif (m,^\s*\#\s*prefix:\s*(\S+)\s*$,) {
-	    $files{$file}->{prefix} = $1;
-	} elsif (m,^\s*\#\s*binary:\s*(\S+)\s*$,) {
-	    $files{$file}->{binary} = $1;
-	} else {
-	    # ignore unknown comments
-	}
+        if (m,^\s*\#\s*file:\s*(\S+)\s*$,) {
+            $file = $1;
+            push @files, $file;
+            $files{$file} = { prefix => undef, probes => [] };
+        } elsif (m,^\s*\#\s*prefix:\s*(\S+)\s*$,) {
+            $files{$file}->{prefix} = $1;
+        } elsif (m,^\s*\#\s*binary:\s*(\S+)\s*$,) {
+            $files{$file}->{binary} = $1;
+        } else {
+            # ignore unknown comments
+        }
     } else {
-	if (m,\s*probe\s+([a-zA-Z0-9_]+)\((.*?)(\);)?$,) {
-	    $probe = $1;
-	    $args = $2;
-	    if ($3) {
-		push @{$files{$file}->{probes}}, [$probe, $args];
-		$probe = $args = undef;
-	    }
-	} elsif ($probe) {
-	    if (m,^(.*?)(\);)?$,) {
-		$args .= $1;
-		if ($2) {
-		    push @{$files{$file}->{probes}}, [$probe, $args];
-		    $probe = $args = undef;
-		}
-	    } else {
-		die "unexpected data $_ on line $.";
-	    }
-	} else {
-	    die "unexpected data $_ on line $.";
-	}
+        if (m,\s*probe\s+([a-zA-Z0-9_]+)\((.*?)(\);)?$,) {
+            $probe = $1;
+            $args = $2;
+            if ($3) {
+                push @{$files{$file}->{probes}}, [$probe, $args];
+                $probe = $args = undef;
+            }
+        } elsif ($probe) {
+            if (m,^(.*?)(\);)?$,) {
+                $args .= $1;
+                if ($2) {
+                    push @{$files{$file}->{probes}}, [$probe, $args];
+                    $probe = $args = undef;
+                }
+            } else {
+                die "unexpected data $_ on line $.";
+            }
+        } else {
+            die "unexpected data $_ on line $.";
+        }
     }
 }
 
@@ -88,32 +88,32 @@ foreach my $file (@files) {
 
     print "# $file\n\n";
     foreach my $probe (@probes) {
-	my $name = $probe->[0];
-	my $args = $probe->[1];
+        my $name = $probe->[0];
+        my $args = $probe->[1];
 
-	my $pname = $name;
-	$pname =~ s/${prefix}_/libvirt.$prefix./;
+        my $pname = $name;
+        $pname =~ s/${prefix}_/libvirt.$prefix./;
 
-	my $binary = "$libdir/libvirt.so";
-	if (exists $files{$file}->{binary}) {
-	    $binary = $sbindir . "/" . $files{$file}->{binary};
-	}
+        my $binary = "$libdir/libvirt.so";
+        if (exists $files{$file}->{binary}) {
+            $binary = $sbindir . "/" . $files{$file}->{binary};
+        }
 
-	print "probe $pname = process(\"$binary\").mark(\"$name\") {\n";
+        print "probe $pname = process(\"$binary\").mark(\"$name\") {\n";
 
-	my @args = split /,/, $args;
-	for (my $i = 0 ; $i <= $#args ; $i++) {
-	    my $arg = $args[$i];
-	    my $isstr = $arg =~ /char\s+\*/;
-	    $arg =~ s/^.*\s\*?(\S+)$/$1/;
+        my @args = split /,/, $args;
+        for (my $i = 0 ; $i <= $#args ; $i++) {
+            my $arg = $args[$i];
+            my $isstr = $arg =~ /char\s+\*/;
+            $arg =~ s/^.*\s\*?(\S+)$/$1/;
 
-	    if ($isstr) {
-		print "  $arg = user_string(\$arg", $i + 1, ");\n";
-	    } else {
-		print "  $arg = \$arg", $i + 1, ";\n";
-	    }
-	}
-	print "}\n\n";
+            if ($isstr) {
+                print "  $arg = user_string(\$arg", $i + 1, ");\n";
+            } else {
+                print "  $arg = \$arg", $i + 1, ";\n";
+            }
+        }
+        print "}\n\n";
     }
     print "\n";
 }
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 17bfb2e..3a66445 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -54,11 +54,11 @@ sub name_to_ProcName {
 
     my @elems;
     if ($name =~ /_/ || (lc $name) eq "open" || (lc $name) eq "close") {
-	@elems = split /_/, $name;
-	@elems = map lc, @elems;
-	@elems = map ucfirst, @elems;
+        @elems = split /_/, $name;
+        @elems = map lc, @elems;
+        @elems = map ucfirst, @elems;
     } else {
-	@elems = $name;
+        @elems = $name;
     }
     @elems = map { fixup_name($_) } @elems;
     my $procname = join "", @elems;
@@ -332,53 +332,53 @@ elsif ($opt_b) {
         # skip things which are REMOTE_MESSAGE
         next if $call->{msg};
 
-	my $name = $structprefix . "Dispatch" . $call->{ProcName};
-	my $argtype = $call->{args};
-	my $rettype = $call->{ret};
-
-	my $argann = $argtype ne "void" ? "" : " ATTRIBUTE_UNUSED";
-	my $retann = $rettype ne "void" ? "" : " ATTRIBUTE_UNUSED";
-
-	# First we print out a function declaration for the
-	# real dispatcher body
-	print "static int ${name}(\n";
-	print "    virNetServerPtr server,\n";
-	print "    virNetServerClientPtr client,\n";
-	print "    virNetMessagePtr msg,\n";
-	print "    virNetMessageErrorPtr rerr";
-	if ($argtype ne "void") {
-	    print ",\n    $argtype *args";
-	}
-	if ($rettype ne "void") {
-	    print ",\n    $rettype *ret";
-	}
-	print ");\n";
-
-
-	# Next we print out a generic wrapper method which has
-	# fixed function signature, for use in the dispatcher
-	# table. This simply callers the real dispatcher method
-	print "static int ${name}Helper(\n";
-	print "    virNetServerPtr server,\n";
-	print "    virNetServerClientPtr client,\n";
-	print "    virNetMessagePtr msg,\n";
-	print "    virNetMessageErrorPtr rerr,\n";
-	print "    void *args$argann,\n";
-	print "    void *ret$retann)\n";
-	print "{\n";
-	print "  VIR_DEBUG(\"server=%p client=%p msg=%p rerr=%p args=%p ret=%p\", server, client, msg, rerr, args, ret);\n";
-	print "  return $name(server, client, msg, rerr";
-	if ($argtype ne "void") {
-	    print ", args";
-	}
-	if ($rettype ne "void") {
-	    print ", ret";
-	}
-	print ");\n";
-	print "}\n";
-
-	# Finally we print out the dispatcher method body impl
-	# (if possible)
+        my $name = $structprefix . "Dispatch" . $call->{ProcName};
+        my $argtype = $call->{args};
+        my $rettype = $call->{ret};
+
+        my $argann = $argtype ne "void" ? "" : " ATTRIBUTE_UNUSED";
+        my $retann = $rettype ne "void" ? "" : " ATTRIBUTE_UNUSED";
+
+        # First we print out a function declaration for the
+        # real dispatcher body
+        print "static int ${name}(\n";
+        print "    virNetServerPtr server,\n";
+        print "    virNetServerClientPtr client,\n";
+        print "    virNetMessagePtr msg,\n";
+        print "    virNetMessageErrorPtr rerr";
+        if ($argtype ne "void") {
+            print ",\n    $argtype *args";
+        }
+        if ($rettype ne "void") {
+            print ",\n    $rettype *ret";
+        }
+        print ");\n";
+
+
+        # Next we print out a generic wrapper method which has
+        # fixed function signature, for use in the dispatcher
+        # table. This simply callers the real dispatcher method
+        print "static int ${name}Helper(\n";
+        print "    virNetServerPtr server,\n";
+        print "    virNetServerClientPtr client,\n";
+        print "    virNetMessagePtr msg,\n";
+        print "    virNetMessageErrorPtr rerr,\n";
+        print "    void *args$argann,\n";
+        print "    void *ret$retann)\n";
+        print "{\n";
+        print "  VIR_DEBUG(\"server=%p client=%p msg=%p rerr=%p args=%p ret=%p\", server, client, msg, rerr, args, ret);\n";
+        print "  return $name(server, client, msg, rerr";
+        if ($argtype ne "void") {
+            print ", args";
+        }
+        if ($rettype ne "void") {
+            print ", ret";
+        }
+        print ");\n";
+        print "}\n";
+
+        # Finally we print out the dispatcher method body impl
+        # (if possible)
         if (!exists($generate{$call->{ProcName}})) {
             print "/* ${structprefix}Dispatch$call->{ProcName} body has " .
                   "to be implemented manually */\n\n\n\n";
@@ -794,18 +794,18 @@ elsif ($opt_b) {
         }
 
         # print functions signature
-	print "static int $name(\n";
-	print "    virNetServerPtr server ATTRIBUTE_UNUSED,\n";
-	print "    virNetServerClientPtr client,\n";
-	print "    virNetMessagePtr msg ATTRIBUTE_UNUSED,\n";
-	print "    virNetMessageErrorPtr rerr";
+        print "static int $name(\n";
+        print "    virNetServerPtr server ATTRIBUTE_UNUSED,\n";
+        print "    virNetServerClientPtr client,\n";
+        print "    virNetMessagePtr msg ATTRIBUTE_UNUSED,\n";
+        print "    virNetMessageErrorPtr rerr";
         if ($argtype ne "void") {
-	    print ",\n    $argtype *args";
-	}
+            print ",\n    $argtype *args";
+        }
         if ($rettype ne "void") {
-	    print ",\n    $rettype *ret";
-	}
-	print ")\n";
+            print ",\n    $rettype *ret";
+        }
+        print ")\n";
 
         # print function body
         print "{\n";
@@ -814,7 +814,7 @@ elsif ($opt_b) {
         foreach my $var (@vars_list) {
             print "    $var;\n";
         }
-	print "    struct daemonClientPrivate *priv =\n";
+        print "    struct daemonClientPrivate *priv =\n";
         print "        virNetServerClientGetPrivateData(client);\n";
 
         if ($call->{streamflag} ne "none") {
@@ -994,32 +994,32 @@ elsif ($opt_b) {
 
     print "virNetServerProgramProc ${structprefix}Procs[] = {\n";
     for ($id = 0 ; $id <= $#calls ; $id++) {
-	my ($comment, $name, $argtype, $arglen, $argfilter, $retlen, $retfilter, $priority);
-
-	if (defined $calls[$id] && !$calls[$id]->{msg}) {
-	    $comment = "/* Method $calls[$id]->{ProcName} => $id */";
-	    $name = $structprefix . "Dispatch" . $calls[$id]->{ProcName} . "Helper";
-	    my $argtype = $calls[$id]->{args};
-	    my $rettype = $calls[$id]->{ret};
-	    $arglen = $argtype ne "void" ? "sizeof($argtype)" : "0";
-	    $retlen = $rettype ne "void" ? "sizeof($rettype)" : "0";
-	    $argfilter = $argtype ne "void" ? "xdr_$argtype" : "xdr_void";
-	    $retfilter = $rettype ne "void" ? "xdr_$rettype" : "xdr_void";
-	} else {
-	    if ($calls[$id]->{msg}) {
-		$comment = "/* Async event $calls[$id]->{ProcName} => $id */";
-	    } else {
-		$comment = "/* Unused $id */";
-	    }
-	    $name = "NULL";
-	    $arglen = $retlen = 0;
-	    $argfilter = "xdr_void";
-	    $retfilter = "xdr_void";
-	}
+        my ($comment, $name, $argtype, $arglen, $argfilter, $retlen, $retfilter, $priority);
+
+        if (defined $calls[$id] && !$calls[$id]->{msg}) {
+            $comment = "/* Method $calls[$id]->{ProcName} => $id */";
+            $name = $structprefix . "Dispatch" . $calls[$id]->{ProcName} . "Helper";
+            my $argtype = $calls[$id]->{args};
+            my $rettype = $calls[$id]->{ret};
+            $arglen = $argtype ne "void" ? "sizeof($argtype)" : "0";
+            $retlen = $rettype ne "void" ? "sizeof($rettype)" : "0";
+            $argfilter = $argtype ne "void" ? "xdr_$argtype" : "xdr_void";
+            $retfilter = $rettype ne "void" ? "xdr_$rettype" : "xdr_void";
+        } else {
+            if ($calls[$id]->{msg}) {
+                $comment = "/* Async event $calls[$id]->{ProcName} => $id */";
+            } else {
+                $comment = "/* Unused $id */";
+            }
+            $name = "NULL";
+            $arglen = $retlen = 0;
+            $argfilter = "xdr_void";
+            $retfilter = "xdr_void";
+        }
 
     $priority = defined $calls[$id]->{priority} ? $calls[$id]->{priority} : 0;
 
-	print "{ $comment\n   ${name},\n   $arglen,\n   (xdrproc_t)$argfilter,\n   $retlen,\n   (xdrproc_t)$retfilter,\n   true,\n   $priority\n},\n";
+        print "{ $comment\n   ${name},\n   $arglen,\n   (xdrproc_t)$argfilter,\n   $retlen,\n   (xdrproc_t)$retfilter,\n   true,\n   $priority\n},\n";
     }
     print "};\n";
     print "size_t ${structprefix}NProcs = ARRAY_CARDINALITY(${structprefix}Procs);\n";
@@ -1039,8 +1039,8 @@ elsif ($opt_k) {
         # skip procedures not on generate list
         next if ! exists($generate{$call->{ProcName}});
 
-	my $argtype = $call->{args};
-	my $rettype = $call->{ret};
+        my $argtype = $call->{args};
+        my $rettype = $call->{ret};
 
         # handle arguments to the function
         my @args_list = ();
@@ -1574,10 +1574,10 @@ elsif ($opt_k) {
         }
 
         if ($call->{ProcName} eq "DomainDestroy" ||
-	    $call->{ProcName} eq "DomainSave" ||
-	    $call->{ProcName} eq "DomainManagedSave") {
+            $call->{ProcName} eq "DomainSave" ||
+            $call->{ProcName} eq "DomainManagedSave") {
             # SPECIAL: virDomain{Destroy|Save|ManagedSave} need to reset
-	    # the domain id explicitly on success
+            # the domain id explicitly on success
             print "    dom->id = -1;\n";
         }
 
diff --git a/src/rpc/genprotocol.pl b/src/rpc/genprotocol.pl
index f8e68f5..c8c1570 100755
--- a/src/rpc/genprotocol.pl
+++ b/src/rpc/genprotocol.pl
@@ -41,14 +41,14 @@ while (<RPCGEN>) {
     # We only want to fixup the GLibc rpcgen output
     # So just print data unchanged, if non-Linux
     unless ($fixup) {
-	print TARGET;
-	next;
+        print TARGET;
+        next;
     }
 
     if (m/^{/) {
-	$in_function = 1;
-	print TARGET;
-	next;
+        $in_function = 1;
+        print TARGET;
+        next;
     }
 
     s/\t/        /g;
@@ -64,58 +64,58 @@ while (<RPCGEN>) {
     s/(?<!IXDR_GET_INT32 )IXDR_GET_LONG/IXDR_GET_INT32/g;
 
     if (m/^}/) {
-	$in_function = 0;
-
-	# Note: The body of the function is in @function.
-
-	# Remove decl of buf, if buf isn't used in the function.
-	my @uses = grep /[^.>]\bbuf\b/, @function;
-	@function = grep !/[^.>]\bbuf\b/, @function if @uses == 1;
-
-	# Remove decl of i, if i isn't used in the function.
-	@uses = grep /[^.>]\bi\b/, @function;
-	@function = grep !/[^.>]\bi\b/, @function if @uses == 1;
-
-	# (char **)&objp->... gives:
-	# warning: dereferencing type-punned pointer will break
-	#   strict-aliasing rules
-	# so rewrite it.
-	my %uses = ();
-	my $i = 0;
-	foreach (@function) {
-	    $uses{$1} = $i++ if m/\(char \*\*\)\&(objp->[a-z_.]+_val)/i;
-	}
-	if (keys %uses >= 1) {
-	    my $i = 1;
-
-	    foreach (keys %uses) {
-		$i = $uses{$_};
-		unshift @function,
-		("        char **objp_cpp$i = (char **) (void *) &$_;\n");
-		$i++;
-	    }
-	    @function =
-		map { s{\(char \*\*\)\&(objp->[a-z_.]+_val)}
-		       {objp_cpp$uses{$1}}gi; $_ } @function;
-	}
-
-	# The code uses 'IXDR_PUT_{U_,}LONG' but it's wrong in two
-	# ways: Firstly these functions are deprecated and don't
-	# work on 64 bit platforms.  Secondly the return value should
-	# be ignored.  Correct both these mistakes.
-	@function =
-	    map { s/\bIXDR_PUT_((U_)?)LONG\b/(void)IXDR_PUT_$1INT32/; $_ }
-	    map { s/\bXDR_INLINE\b/(int32_t*)XDR_INLINE/; $_ }
-	    @function;
-
-	print TARGET (join ("", @function));
-	@function = ();
+        $in_function = 0;
+
+        # Note: The body of the function is in @function.
+
+        # Remove decl of buf, if buf isn't used in the function.
+        my @uses = grep /[^.>]\bbuf\b/, @function;
+        @function = grep !/[^.>]\bbuf\b/, @function if @uses == 1;
+
+        # Remove decl of i, if i isn't used in the function.
+        @uses = grep /[^.>]\bi\b/, @function;
+        @function = grep !/[^.>]\bi\b/, @function if @uses == 1;
+
+        # (char **)&objp->... gives:
+        # warning: dereferencing type-punned pointer will break
+        #   strict-aliasing rules
+        # so rewrite it.
+        my %uses = ();
+        my $i = 0;
+        foreach (@function) {
+            $uses{$1} = $i++ if m/\(char \*\*\)\&(objp->[a-z_.]+_val)/i;
+        }
+        if (keys %uses >= 1) {
+            my $i = 1;
+
+            foreach (keys %uses) {
+                $i = $uses{$_};
+                unshift @function,
+                ("        char **objp_cpp$i = (char **) (void *) &$_;\n");
+                $i++;
+            }
+            @function =
+                map { s{\(char \*\*\)\&(objp->[a-z_.]+_val)}
+                       {objp_cpp$uses{$1}}gi; $_ } @function;
+        }
+
+        # The code uses 'IXDR_PUT_{U_,}LONG' but it's wrong in two
+        # ways: Firstly these functions are deprecated and don't
+        # work on 64 bit platforms.  Secondly the return value should
+        # be ignored.  Correct both these mistakes.
+        @function =
+            map { s/\bIXDR_PUT_((U_)?)LONG\b/(void)IXDR_PUT_$1INT32/; $_ }
+            map { s/\bXDR_INLINE\b/(int32_t*)XDR_INLINE/; $_ }
+            @function;
+
+        print TARGET (join ("", @function));
+        @function = ();
     }
 
     unless ($in_function) {
-	print TARGET;
+        print TARGET;
     } else {
-	push @function, $_;
+        push @function, $_;
     }
 }
 
diff --git a/src/rpc/gensystemtap.pl b/src/rpc/gensystemtap.pl
index 1cf9c0f..41c5625 100755
--- a/src/rpc/gensystemtap.pl
+++ b/src/rpc/gensystemtap.pl
@@ -37,33 +37,33 @@ my $intype = 0;
 my $inauth = 0;
 while (<>) {
     if (/enum\s+virNetMessageType/) {
-	$intype = 1;
+        $intype = 1;
     } elsif (/enum\s+virNetMessageStatus/) {
-	$instatus = 1;
+        $instatus = 1;
     } elsif (/enum remote_auth_type/) {
-	$inauth = 1;
+        $inauth = 1;
     } elsif (/}/) {
-	$instatus = $intype = $inauth = 0;
+        $instatus = $intype = $inauth = 0;
     } elsif ($instatus) {
-	if (/^\s+VIR_NET_(\w+)\s*=\s*(\d+),?$/) {
-	    $status{$2} = lc $1;
-	}
+        if (/^\s+VIR_NET_(\w+)\s*=\s*(\d+),?$/) {
+            $status{$2} = lc $1;
+        }
     } elsif ($intype) {
-	if (/^\s+VIR_NET_(\w+)\s*=\s*(\d+),?$/) {
-	    $type{$2} = lc $1;
-	}
+        if (/^\s+VIR_NET_(\w+)\s*=\s*(\d+),?$/) {
+            $type{$2} = lc $1;
+        }
     } elsif ($inauth) {
-	if (/^\s+REMOTE_AUTH_(\w+)\s*=\s*(\d+),?$/) {
-	    $auth{$2} = lc $1;
-	}
+        if (/^\s+REMOTE_AUTH_(\w+)\s*=\s*(\d+),?$/) {
+            $auth{$2} = lc $1;
+        }
     } else {
-	if (/(\w+)_PROGRAM\s*=\s*0x([a-fA-F0-9]+)\s*;/) {
-	    $funcs{lc $1} = { id => hex($2), version => undef, progs => [] };
-	} elsif (/(\w+)_PROTOCOL_VERSION\s*=\s*(\d+)\s*;/) {
-	    $funcs{lc $1}->{version} = $2;
-	} elsif (/(\w+)_PROC_(.*?)\s+=\s+(\d+)/) {
-	    $funcs{lc $1}->{progs}->[$3] = lc $2;
-	}
+        if (/(\w+)_PROGRAM\s*=\s*0x([a-fA-F0-9]+)\s*;/) {
+            $funcs{lc $1} = { id => hex($2), version => undef, progs => [] };
+        } elsif (/(\w+)_PROTOCOL_VERSION\s*=\s*(\d+)\s*;/) {
+            $funcs{lc $1}->{version} = $2;
+        } elsif (/(\w+)_PROC_(.*?)\s+=\s+(\d+)/) {
+            $funcs{lc $1}->{progs}->[$3] = lc $2;
+        }
     }
 }
 
@@ -172,10 +172,10 @@ foreach my $prog (keys %funcs) {
 
     my $pfirst = 1;
     for (my $id = 1 ; $id <= $#{$funcs{$prog}->{progs}} ; $id++) {
-	my $cond = $pfirst ? "if" : "} else if";
-	$pfirst = 0;
-	print "      $cond (proc == $id) {\n";
-	print "          procstr = \"", $funcs{$prog}->{progs}->[$id], "\";\n";
+        my $cond = $pfirst ? "if" : "} else if";
+        $pfirst = 0;
+        print "      $cond (proc == $id) {\n";
+        print "          procstr = \"", $funcs{$prog}->{progs}->[$id], "\";\n";
     }
     print "      } else {\n";
     print "          procstr = \"unknown\";\n";
diff --git a/tests/oomtrace.pl b/tests/oomtrace.pl
index c615ed9..6d423e7 100755
--- a/tests/oomtrace.pl
+++ b/tests/oomtrace.pl
@@ -21,7 +21,7 @@ my %lines;
 
 foreach (@data) {
     if (/^\s*TRACE:\s+(\S+?)(?:\(.*\))?\s+\[0x(.*)\]\s*$/ ) {
-	$trace{$2} = $1;
+        $trace{$2} = $1;
     }
 }
 
@@ -34,8 +34,8 @@ foreach my $key (keys %trace) {
 
 foreach (@data) {
     if (/^\s*TRACE:\s+(\S+?)(?:\(.*\))?\s+\[0x(.*)\]\s*$/ ) {
-	print $lines{$2};
+        print $lines{$2};
     } else {
-	print;
+        print;
     }
 }
-- 
1.7.10.4
                    
                  
                  
                          
                            
                            3
                            
                          
                          
                            
                            3
                            
                          
                          
                            
    
                          
                        
                    
                    
                        Hi all.
I amd trying to use libvirt-php to build a public cloud. I used Vmware
hypervisor (free), XEN and KVM. Now I want to create a Virtual Machine from
template. After that, I want to install some application on that VM.
*Can I run a shell script in Guest OS via Libvirt?*
Tuyen V. Doan
---------------------------------------------------------------------------------------------------------------
Đoàn Văn Tuyển
Mobile: 0904.554.112
Email : DoanVanTuyen(a)gmail.com
           ITBachKhoa(a)yahoo.com.vn
--------------------------------------------
Ti`m di.a diem http://timdiadiem.net
                    
                  
                  
                          
                            
                            2
                            
                          
                          
                            
                            1
                            
                          
                          
                            
    
                          
                        
                    
                    
                        Parallels Cloud Server is a cloud-ready virtualization
solution that allows users to simultaneously run multiple virtual
machines and containers on the same physical server.
More information can be found here: http://www.parallels.com/products/pcs/
Also beta version of Parallels Cloud Server can be downloaded there.
Signed-off-by: Dmitry Guryanov <dguryanov(a)parallels.com>
---
 configure.ac                     |   61 ++++++---
 docs/drvparallels.html.in        |   28 ++++
 include/libvirt/virterror.h      |    1 +
 libvirt.spec.in                  |    9 +-
 mingw-libvirt.spec.in            |    6 +
 po/POTFILES.in                   |    1 +
 src/Makefile.am                  |   13 ++
 src/conf/domain_conf.c           |    3 +-
 src/conf/domain_conf.h           |    1 +
 src/driver.h                     |    1 +
 src/libvirt.c                    |    9 ++
 src/parallels/parallels_driver.c |  287 ++++++++++++++++++++++++++++++++++++++
 src/parallels/parallels_driver.h |   28 ++++
 src/util/virterror.c             |    3 +-
 14 files changed, 429 insertions(+), 22 deletions(-)
 create mode 100644 docs/drvparallels.html.in
 create mode 100644 src/parallels/parallels_driver.c
 create mode 100644 src/parallels/parallels_driver.h
diff --git a/configure.ac b/configure.ac
index 3cc7b3c..400ac3b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -330,6 +330,8 @@ AC_ARG_WITH([esx],
   AC_HELP_STRING([--with-esx], [add ESX support @<:@default=check@:>@]),[],[with_esx=check])
 AC_ARG_WITH([hyperv],
   AC_HELP_STRING([--with-hyperv], [add Hyper-V support @<:@default=check@:>@]),[],[with_hyperv=check])
+AC_ARG_WITH([parallels],
+  AC_HELP_STRING([--with-parallels], [add Parallels Cloud Server support @<:@default=check@:>@]),[],[with_parallels=check])
 AC_ARG_WITH([test],
   AC_HELP_STRING([--with-test], [add test driver support @<:@default=yes@:>@]),[],[with_test=yes])
 AC_ARG_WITH([remote],
@@ -788,6 +790,26 @@ fi
 AM_CONDITIONAL([WITH_LXC], [test "$with_lxc" = "yes"])
 
 dnl
+dnl Checks for the Parallels driver
+dnl
+
+if test "$with_parallels" = "check"; then
+    with_parallels=$with_linux
+    if test ! $host_cpu = 'x86_64'; then
+        with_parallels=no
+    fi
+fi
+
+if test "$with_parallels" = "yes" && test "$with_linux" = "no"; then
+    AC_MSG_ERROR([The Parallels driver can be enabled on Linux only.])
+fi
+
+if test "$with_parallels" = "yes"; then
+    AC_DEFINE_UNQUOTED([WITH_PARALLELS], 1, [whether Parallels driver is enabled])
+fi
+AM_CONDITIONAL([WITH_PARALLELS], [test "$with_parallels" = "yes"])
+
+dnl
 dnl check for shell that understands <> redirection without truncation,
 dnl needed by src/qemu/qemu_monitor_{text,json}.c.
 dnl
@@ -2824,25 +2846,26 @@ AC_MSG_NOTICE([=====================])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Drivers])
 AC_MSG_NOTICE([])
-AC_MSG_NOTICE([     Xen: $with_xen])
-AC_MSG_NOTICE([    QEMU: $with_qemu])
-AC_MSG_NOTICE([     UML: $with_uml])
-AC_MSG_NOTICE([  OpenVZ: $with_openvz])
-AC_MSG_NOTICE([  VMware: $with_vmware])
-AC_MSG_NOTICE([    VBox: $with_vbox])
-AC_MSG_NOTICE([  XenAPI: $with_xenapi])
-AC_MSG_NOTICE([xenlight: $with_libxl])
-AC_MSG_NOTICE([     LXC: $with_lxc])
-AC_MSG_NOTICE([    PHYP: $with_phyp])
-AC_MSG_NOTICE([     ESX: $with_esx])
-AC_MSG_NOTICE([ Hyper-V: $with_hyperv])
-AC_MSG_NOTICE([    Test: $with_test])
-AC_MSG_NOTICE([  Remote: $with_remote])
-AC_MSG_NOTICE([ Network: $with_network])
-AC_MSG_NOTICE([Libvirtd: $with_libvirtd])
-AC_MSG_NOTICE([   netcf: $with_netcf])
-AC_MSG_NOTICE([ macvtap: $with_macvtap])
-AC_MSG_NOTICE([virtport: $with_virtualport])
+AC_MSG_NOTICE([      Xen: $with_xen])
+AC_MSG_NOTICE([     QEMU: $with_qemu])
+AC_MSG_NOTICE([      UML: $with_uml])
+AC_MSG_NOTICE([   OpenVZ: $with_openvz])
+AC_MSG_NOTICE([   VMware: $with_vmware])
+AC_MSG_NOTICE([     VBox: $with_vbox])
+AC_MSG_NOTICE([   XenAPI: $with_xenapi])
+AC_MSG_NOTICE([ xenlight: $with_libxl])
+AC_MSG_NOTICE([      LXC: $with_lxc])
+AC_MSG_NOTICE([     PHYP: $with_phyp])
+AC_MSG_NOTICE([      ESX: $with_esx])
+AC_MSG_NOTICE([  Hyper-V: $with_hyperv])
+AC_MSG_NOTICE([Parallels: $with_parallels])
+AC_MSG_NOTICE([     Test: $with_test])
+AC_MSG_NOTICE([   Remote: $with_remote])
+AC_MSG_NOTICE([  Network: $with_network])
+AC_MSG_NOTICE([ Libvirtd: $with_libvirtd])
+AC_MSG_NOTICE([    netcf: $with_netcf])
+AC_MSG_NOTICE([  macvtap: $with_macvtap])
+AC_MSG_NOTICE([ virtport: $with_virtualport])
 AC_MSG_NOTICE([])
 AC_MSG_NOTICE([Storage Drivers])
 AC_MSG_NOTICE([])
diff --git a/docs/drvparallels.html.in b/docs/drvparallels.html.in
new file mode 100644
index 0000000..40a0fe5
--- /dev/null
+++ b/docs/drvparallels.html.in
@@ -0,0 +1,28 @@
+<html><body>
+    <h1>Parallels Cloud Server driver</h1>
+    <ul id="toc"></ul>
+    <p>
+        The libvirt Parallels driver can manage Parallels Cloud Server starting from version 6.0.
+    </p>
+
+
+    <h2><a name="project">Project Links</a></h2>
+    <ul>
+      <li>
+        The <a href="http://www.parallels.com/products/server/baremetal/sp/">Parallels Cloud Server</a> Virtualization Solution.
+      </li>
+    </ul>
+
+
+    <h2><a name="uri">Connections to the Parallels Cloud Server driver</a></h2>
+    <p>
+        The libvirt Parallels driver is a single-instance privileged driver, with a driver name of 'parallels'. Some example connection URIs for the libvirt driver are:
+    </p>
+<pre>
+parallels:///default                     (local access)
+parallels+unix:///default                (local access)
+parallels://example.com/default          (remote access, TLS/x509)
+parallels+tcp://example.com/default      (remote access, SASl/Kerberos)
+parallels+ssh://root@example.com/default (remote access, SSH tunnelled)
+</pre>
+</body></html>
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 0e0bc9c..1c58c66 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -97,6 +97,7 @@ typedef enum {
     VIR_FROM_URI = 45,          /* Error from URI handling */
     VIR_FROM_AUTH = 46,         /* Error from auth handling */
     VIR_FROM_DBUS = 47,         /* Error from DBus */
+    VIR_FROM_PARALLELS = 48,    /* Error from Parallels */
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_ERR_DOMAIN_LAST
diff --git a/libvirt.spec.in b/libvirt.spec.in
index cfcfc1c..c642f80 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -67,6 +67,7 @@
 %define with_esx           0%{!?_without_esx:1}
 %define with_hyperv        0%{!?_without_hyperv:1}
 %define with_xenapi        0%{!?_without_xenapi:1}
+%define with_parallels     0%{!?_without_parallels:1}
 
 # Then the secondary host drivers, which run inside libvirtd
 %define with_network          0%{!?_without_network:%{server_drivers}}
@@ -136,6 +137,7 @@
 %define with_xenapi 0
 %define with_libxl 0
 %define with_hyperv 0
+%define with_parallels 0
 %endif
 
 # Fedora 17 / RHEL-7 are first where we use systemd. Although earlier
@@ -1068,6 +1070,10 @@ of recent versions of Linux (and other OSes).
 %define _without_vmware --without-vmware
 %endif
 
+%if ! %{with_parallels}
+%define _without_parallels --without-parallels
+%endif
+
 %if ! %{with_polkit}
 %define _without_polkit --without-polkit
 %endif
@@ -1210,6 +1216,7 @@ autoreconf -if
            %{?_without_esx} \
            %{?_without_hyperv} \
            %{?_without_vmware} \
+           %{?_without_parallels} \
            %{?_without_network} \
            %{?_with_rhel5_api} \
            %{?_without_storage_fs} \
@@ -1401,7 +1408,7 @@ fi
 
 /sbin/chkconfig --add libvirtd
 if [ "$1" -ge "1" ]; then
-	/sbin/service libvirtd condrestart > /dev/null 2>&1
+    /sbin/service libvirtd condrestart > /dev/null 2>&1
 fi
 %endif
 
diff --git a/mingw-libvirt.spec.in b/mingw-libvirt.spec.in
index d2a8cf3..4695895 100644
--- a/mingw-libvirt.spec.in
+++ b/mingw-libvirt.spec.in
@@ -13,6 +13,7 @@
 # missing libwsman, so can't build hyper-v
 %define with_hyperv        0%{!?_without_hyperv:0}
 %define with_xenapi        0%{!?_without_xenapi:1}
+%define with_parallels           0%{!?_without_parallels:0}
 
 # RHEL ships ESX but not PowerHypervisor, HyperV, or libxenserver (xenapi)
 %if 0%{?rhel}
@@ -125,6 +126,10 @@ MinGW Windows libvirt virtualization library, static version.
 %define _without_xenapi --without-xenapi
 %endif
 
+%if ! %{with_parallels}
+%define _without_parallels --without-parallels
+%endif
+
 %if 0%{?enable_autotools}
 autoreconf -if
 %endif
@@ -148,6 +153,7 @@ autoreconf -if
   %{?_without_esx} \
   %{?_without_hyperv} \
   --without-vmware \
+  --without-parallels \
   --without-netcf \
   --without-audit \
   --without-dtrace
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 0f32918..c4a84a9 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -64,6 +64,7 @@ src/nwfilter/nwfilter_learnipaddr.c
 src/openvz/openvz_conf.c
 src/openvz/openvz_driver.c
 src/openvz/openvz_util.c
+src/parallels/parallels_driver.c
 src/phyp/phyp_driver.c
 src/qemu/qemu_agent.c
 src/qemu/qemu_bridge_filter.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 93fcf3b..ca0c930 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -483,6 +483,10 @@ HYPERV_DRIVER_EXTRA_DIST =							\
 		hyperv/hyperv_wmi_generator.py					\
 		$(HYPERV_DRIVER_GENERATED)
 
+PARALLELS_DRIVER_SOURCES =					\
+		parallels/parallels_driver.h			\
+		parallels/parallels_driver.c
+
 NETWORK_DRIVER_SOURCES =					\
 		network/bridge_driver.h network/bridge_driver.c
 
@@ -921,6 +925,14 @@ libvirt_driver_hyperv_la_LIBADD = $(OPENWSMAN_LIBS)
 libvirt_driver_hyperv_la_SOURCES = $(HYPERV_DRIVER_SOURCES)
 endif
 
+if WITH_PARALLELS
+noinst_LTLIBRARIES += libvirt_driver_parallels.la
+libvirt_la_BUILT_LIBADD += libvirt_driver_parallels.la
+libvirt_driver_parallels_la_CFLAGS = \
+		-I$(top_srcdir)/src/conf $(AM_CFLAGS)
+libvirt_driver_parallels_la_SOURCES = $(PARALLELS_DRIVER_SOURCES)
+endif
+
 if WITH_NETWORK
 noinst_LTLIBRARIES += libvirt_driver_network_impl.la
 libvirt_driver_network_la_SOURCES =
@@ -1132,6 +1144,7 @@ EXTRA_DIST +=							\
 		$(ESX_DRIVER_EXTRA_DIST)			\
 		$(HYPERV_DRIVER_SOURCES)			\
 		$(HYPERV_DRIVER_EXTRA_DIST)			\
+		$(PARALLELS_DRIVER_SOURCES)				\
 		$(NETWORK_DRIVER_SOURCES)			\
 		$(INTERFACE_DRIVER_SOURCES)			\
 		$(STORAGE_DRIVER_SOURCES)			\
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c53722a..e695417 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -93,7 +93,8 @@ VIR_ENUM_IMPL(virDomainVirt, VIR_DOMAIN_VIRT_LAST,
               "vmware",
               "hyperv",
               "vbox",
-              "phyp")
+              "phyp",
+              "parallels")
 
 VIR_ENUM_IMPL(virDomainBoot, VIR_DOMAIN_BOOT_LAST,
               "fd",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index bc02caf..0db1693 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -160,6 +160,7 @@ enum virDomainVirtType {
     VIR_DOMAIN_VIRT_HYPERV,
     VIR_DOMAIN_VIRT_VBOX,
     VIR_DOMAIN_VIRT_PHYP,
+    VIR_DOMAIN_VIRT_PARALLELS,
 
     VIR_DOMAIN_VIRT_LAST,
 };
diff --git a/src/driver.h b/src/driver.h
index 46d9846..aab9766 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -31,6 +31,7 @@ typedef enum {
     VIR_DRV_VMWARE = 13,
     VIR_DRV_LIBXL = 14,
     VIR_DRV_HYPERV = 15,
+    VIR_DRV_PARALLELS = 16,
 } virDrvNo;
 
 
diff --git a/src/libvirt.c b/src/libvirt.c
index 8315b4f..e3cc832 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -72,6 +72,9 @@
 #ifdef WITH_XENAPI
 # include "xenapi/xenapi_driver.h"
 #endif
+#ifdef WITH_PARALLELS
+# include "parallels/parallels_driver.h"
+#endif
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
@@ -443,6 +446,9 @@ virInitialize(void)
 #ifdef WITH_XENAPI
     if (xenapiRegister() == -1) return -1;
 #endif
+#ifdef WITH_PARALLELS
+    if (parallelsRegister() == -1) return -1;
+#endif
 #ifdef WITH_REMOTE
     if (remoteRegister () == -1) return -1;
 #endif
@@ -1144,6 +1150,9 @@ do_open (const char *name,
 #ifndef WITH_XENAPI
              STRCASEEQ(ret->uri->scheme, "xenapi") ||
 #endif
+#ifndef WITH_PARALLELS
+             STRCASEEQ(ret->uri->scheme, "parallels") ||
+#endif
              false)) {
             virReportErrorHelper(VIR_FROM_NONE, VIR_ERR_CONFIG_UNSUPPORTED,
                                  __FILE__, __FUNCTION__, __LINE__,
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
new file mode 100644
index 0000000..00a9074
--- /dev/null
+++ b/src/parallels/parallels_driver.c
@@ -0,0 +1,287 @@
+/*
+ * parallels_driver.c: core driver functions for managing
+ * Parallels Cloud Server hosts
+ *
+ * Copyright (C) 2012 Parallels, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#include <config.h>
+
+#include <sys/types.h>
+#include <sys/poll.h>
+#include <limits.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/utsname.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <pwd.h>
+#include <stdio.h>
+#include <sys/wait.h>
+#include <sys/time.h>
+#include <sys/statvfs.h>
+
+#include "datatypes.h"
+#include "virterror_internal.h"
+#include "memory.h"
+#include "util.h"
+#include "logging.h"
+#include "command.h"
+#include "configmake.h"
+#include "storage_file.h"
+#include "nodeinfo.h"
+#include "json.h"
+#include "domain_conf.h"
+#include "storage_conf.h"
+#include "domain_event.h"
+
+#include "parallels_driver.h"
+
+#define VIR_FROM_THIS VIR_FROM_PARALLELS
+
+#define PRLCTL                      "prlctl"
+#define PARALLELS_DEFAULT_ARCH      "x86_64"
+
+struct _parallelsConn {
+    virMutex lock;
+    virDomainObjList domains;
+    virStoragePoolObjList pools;
+    virCapsPtr caps;
+    virDomainEventStatePtr domainEventState;
+};
+
+typedef struct _parallelsConn parallelsConn;
+typedef struct _parallelsConn *parallelsConnPtr;
+
+static int parallelsClose(virConnectPtr conn);
+
+static void
+parallelsDriverLock(parallelsConnPtr driver)
+{
+    virMutexLock(&driver->lock);
+}
+
+static void
+parallelsDriverUnlock(parallelsConnPtr driver)
+{
+    virMutexUnlock(&driver->lock);
+}
+
+static int
+parallelsDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
+{
+    return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
+}
+
+static virCapsPtr
+parallelsBuildCapabilities(void)
+{
+    virCapsPtr caps;
+    virCapsGuestPtr guest;
+    struct utsname utsname;
+    uname(&utsname);
+
+    if ((caps = virCapabilitiesNew(utsname.machine, 0, 0)) == NULL)
+        goto no_memory;
+
+    if (nodeCapsInitNUMA(caps) < 0)
+        goto no_memory;
+
+    virCapabilitiesSetMacPrefix(caps, (unsigned char[]) {
+                                0x42, 0x1C, 0x00});
+
+    if ((guest = virCapabilitiesAddGuest(caps, "hvm", PARALLELS_DEFAULT_ARCH,
+                                         64, "parallels",
+                                         NULL, 0, NULL)) == NULL)
+        goto no_memory;
+
+    if (virCapabilitiesAddGuestDomain(guest,
+                                      "parallels", NULL, NULL, 0, NULL) == NULL)
+        goto no_memory;
+
+    caps->defaultConsoleTargetType = parallelsDefaultConsoleType;
+    return caps;
+
+  no_memory:
+    virReportOOMError();
+    virCapabilitiesFree(caps);
+    return NULL;
+}
+
+static char *
+parallelsGetCapabilities(virConnectPtr conn)
+{
+    parallelsConnPtr privconn = conn->privateData;
+    char *xml;
+
+    parallelsDriverLock(privconn);
+    if ((xml = virCapabilitiesFormatXML(privconn->caps)) == NULL)
+        virReportOOMError();
+    parallelsDriverUnlock(privconn);
+    return xml;
+}
+
+static int
+parallelsOpenDefault(virConnectPtr conn)
+{
+    parallelsConnPtr privconn;
+
+    if (VIR_ALLOC(privconn) < 0) {
+        virReportOOMError();
+        return VIR_DRV_OPEN_ERROR;
+    }
+    if (virMutexInit(&privconn->lock) < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("cannot initialize mutex"));
+        goto error;
+    }
+
+    if (!(privconn->caps = parallelsBuildCapabilities()))
+        goto error;
+
+    if (virDomainObjListInit(&privconn->domains) < 0)
+        goto error;
+
+    conn->privateData = privconn;
+
+    return VIR_DRV_OPEN_SUCCESS;
+
+  error:
+    virDomainObjListDeinit(&privconn->domains);
+    virCapabilitiesFree(privconn->caps);
+    virStoragePoolObjListFree(&privconn->pools);
+    VIR_FREE(privconn);
+    return VIR_DRV_OPEN_ERROR;
+}
+
+static virDrvOpenStatus
+parallelsOpen(virConnectPtr conn,
+              virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+              unsigned int flags)
+{
+    int ret;
+    parallelsConnPtr privconn;
+    virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
+
+    if (!conn->uri)
+        return VIR_DRV_OPEN_DECLINED;
+
+    if (!conn->uri->scheme || STRNEQ(conn->uri->scheme, "parallels"))
+        return VIR_DRV_OPEN_DECLINED;
+
+    /* Remote driver should handle these. */
+    if (conn->uri->server)
+        return VIR_DRV_OPEN_DECLINED;
+
+    /* From this point on, the connection is for us. */
+    if (!conn->uri->path ||
+        conn->uri->path[0] == '\0' ||
+        (conn->uri->path[0] == '/' && conn->uri->path[1] == '\0')) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("parallelsOpen: supply a path or use "
+                         "parallels:///default"));
+        return VIR_DRV_OPEN_ERROR;
+    }
+
+    if (STREQ(conn->uri->path, "/default"))
+        ret = parallelsOpenDefault(conn);
+    else
+        return VIR_DRV_OPEN_DECLINED;
+
+    if (ret != VIR_DRV_OPEN_SUCCESS)
+        return ret;
+
+    privconn = conn->privateData;
+    parallelsDriverLock(privconn);
+    privconn->domainEventState = virDomainEventStateNew();
+    if (!privconn->domainEventState) {
+        parallelsDriverUnlock(privconn);
+        parallelsClose(conn);
+        return VIR_DRV_OPEN_ERROR;
+    }
+
+    parallelsDriverUnlock(privconn);
+    return VIR_DRV_OPEN_SUCCESS;
+}
+
+static int
+parallelsClose(virConnectPtr conn)
+{
+    parallelsConnPtr privconn = conn->privateData;
+
+    parallelsDriverLock(privconn);
+    virCapabilitiesFree(privconn->caps);
+    virDomainObjListDeinit(&privconn->domains);
+    virDomainEventStateFree(privconn->domainEventState);
+    conn->privateData = NULL;
+
+    parallelsDriverUnlock(privconn);
+    virMutexDestroy(&privconn->lock);
+
+    VIR_FREE(privconn);
+    return 0;
+}
+
+static int
+parallelsGetVersion(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned long *hvVer)
+{
+    /* TODO */
+    *hvVer = 6;
+    return 0;
+}
+
+static virDriver parallelsDriver = {
+    .no = VIR_DRV_PARALLELS,
+    .name = "Parallels",
+    .open = parallelsOpen,            /* 0.10.0 */
+    .close = parallelsClose,          /* 0.10.0 */
+    .version = parallelsGetVersion,   /* 0.10.0 */
+    .getHostname = virGetHostname,      /* 0.10.0 */
+    .nodeGetInfo = nodeGetInfo,      /* 0.10.0 */
+    .getCapabilities = parallelsGetCapabilities,      /* 0.10.0 */
+};
+
+/**
+ * parallelsRegister:
+ *
+ * Registers the parallels driver
+ */
+int
+parallelsRegister(void)
+{
+    char *prlctl_path;
+
+    prlctl_path = virFindFileInPath(PRLCTL);
+    if (!prlctl_path) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Can't find prlctl command in the PATH env"));
+        return VIR_DRV_OPEN_ERROR;
+    }
+
+    VIR_FREE(prlctl_path);
+
+    if (virRegisterDriver(¶llelsDriver) < 0)
+        return -1;
+
+    return 0;
+}
diff --git a/src/parallels/parallels_driver.h b/src/parallels/parallels_driver.h
new file mode 100644
index 0000000..0a021c9
--- /dev/null
+++ b/src/parallels/parallels_driver.h
@@ -0,0 +1,28 @@
+/*
+ * parallels_driver.c: core driver functions for managing
+ * Parallels Cloud Server hosts
+ *
+ * Copyright (C) 2012 Parallels, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ *
+ */
+
+#ifndef PARALLELS_DRIVER_H
+# define PARALLELS_DRIVER_H
+
+int parallelsRegister(void);
+
+#endif
diff --git a/src/util/virterror.c b/src/util/virterror.c
index b5c6853..8cf738a 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -99,7 +99,8 @@ VIR_ENUM_IMPL(virErrorDomain, VIR_ERR_DOMAIN_LAST,
 
               "URI Utils", /* 45 */
               "Authentication Utils",
-              "DBus Utils"
+              "DBus Utils",
+              "Parallels Cloud Server"
     )
 
 
-- 
1.7.1
                    
                  
                  
                          
                            
                            2
                            
                          
                          
                            
                            18
                            
                          
                          
                            
    
                          
                        
                     
                        
                    
                        
                            
                                
                            
                            [libvirt] [PATCH] maint: Use consistent copyright.
                        
                        
by [4mWho should the emails appear to be from? [Osier Yang 27 Jul '12
                    by [4mWho should the emails appear to be from? [Osier Yang 27 Jul '12
27 Jul '12
                    
                        From: Osier Yang <jyang(a)redhat.com>
This is a follow up patch of commit f9ce7dad6, it modifies all
the files which declare the copyright like "See COPYING.LIB for
the License of this software" to use the detailed/consistent one.
And deserts the outdated comments like:
 * libvirt-qemu.h:
 * Summary: qemu specific interfaces
 * Description: Provides the interfaces of the libvirt library to handle
 *              qemu specific methods
 *
 * Copy:  Copyright (C) 2010, 2012 Red Hat, Inc.
Uses the more compact style like:
 * libvirt-qemu.h: Interfaces specific for QEMU/KVM driver
 *
 * Copyright (C) 2010, 2012 Red Hat, Inc.
---
 include/libvirt/libvirt-qemu.h |   21 +++++++++++++++------
 include/libvirt/libvirt.h.in   |   21 +++++++++++++++------
 include/libvirt/virterror.h    |   21 +++++++++++++++------
 src/libvirt.c                  |   14 +++++++++++++-
 src/security/virt-aa-helper.c  |   14 +++++++++++++-
 src/util/buf.c                 |   14 +++++++++++++-
 src/util/buf.h                 |   14 +++++++++++++-
 src/util/cgroup.c              |   14 +++++++++++++-
 src/util/cgroup.h              |   14 +++++++++++++-
 src/util/conf.c                |   14 +++++++++++++-
 src/util/conf.h                |   14 +++++++++++++-
 src/util/stats_linux.c         |   14 +++++++++++++-
 src/util/stats_linux.h         |   14 +++++++++++++-
 src/util/virterror.c           |   16 ++++++++++++++--
 src/util/viruri.c              |   14 +++++++++++++-
 src/util/viruri.h              |   14 +++++++++++++-
 src/util/xml.c                 |   14 +++++++++++++-
 src/xen/block_stats.c          |   14 +++++++++++++-
 src/xen/block_stats.h          |   14 +++++++++++++-
 src/xen/xen_driver.c           |   14 +++++++++++++-
 src/xen/xen_driver.h           |   14 +++++++++++++-
 src/xen/xen_hypervisor.c       |   14 +++++++++++++-
 src/xen/xen_hypervisor.h       |   14 +++++++++++++-
 src/xen/xs_internal.c          |   14 +++++++++++++-
 src/xen/xs_internal.h          |   14 +++++++++++++-
 tests/testutils.c              |   14 +++++++++++++-
 tests/testutils.h              |   14 +++++++++++++-
 tools/virsh-edit.c             |   14 +++++++++++++-
 tools/virsh.c                  |   14 +++++++++++++-
 29 files changed, 384 insertions(+), 45 deletions(-)
diff --git a/include/libvirt/libvirt-qemu.h b/include/libvirt/libvirt-qemu.h
index ba75ae3..6f4aedc 100644
--- a/include/libvirt/libvirt-qemu.h
+++ b/include/libvirt/libvirt-qemu.h
@@ -1,12 +1,21 @@
 /* -*- c -*-
- * libvirt-qemu.h:
- * Summary: qemu specific interfaces
- * Description: Provides the interfaces of the libvirt library to handle
- *              qemu specific methods
+ * libvirt-qemu.h: Interfaces specific for QEMU/KVM driver
  *
- * Copy:  Copyright (C) 2010, 2012 Red Hat, Inc.
+ * Copyright (C) 2010, 2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Author: Chris Lalancette <clalance(a)redhat.com>
  */
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index fcef461..fc7fa85 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1,12 +1,21 @@
 /* -*- c -*-
- * libvirt.h:
- * Summary: core interfaces for the libvirt library
- * Description: Provides the interfaces of the libvirt library to handle
- *              virtualized domains
+ * libvirt.h: Core interfaces for the libvirt library
  *
- * Copy:  Copyright (C) 2005-2006, 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2005-2006, 2010-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Author: Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h
index 0e0bc9c..b3f80ab 100644
--- a/include/libvirt/virterror.h
+++ b/include/libvirt/virterror.h
@@ -1,12 +1,21 @@
 /*
- * virterror.h:
- * Summary: error handling interfaces for the libvirt library
- * Description: Provides the interfaces of the libvirt library to handle
- *              errors raised while using the library.
+ * virterror.h: Error handling interfaces for the libvirt library
  *
- * Copy:  Copyright (C) 2006, 2010-2012 Red Hat, Inc.
+ * Copyright (C) 2006, 2010-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Author: Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/libvirt.c b/src/libvirt.c
index 8315b4f..de22d81 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -4,7 +4,19 @@
  *
  * Copyright (C) 2005-2006, 2008-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index 056362c..5352a4a 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -5,7 +5,19 @@
  * Copyright (C) 2010-2012 Red Hat, Inc.
  * Copyright (C) 2009-2011 Canonical Ltd.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Author:
  *   Jamie Strandboge <jamie(a)canonical.com>
diff --git a/src/util/buf.c b/src/util/buf.c
index 6c7c501..a7e5bd4 100644
--- a/src/util/buf.c
+++ b/src/util/buf.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2005-2008, 2010-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/util/buf.h b/src/util/buf.h
index 2750b17..c58f1d7 100644
--- a/src/util/buf.h
+++ b/src/util/buf.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2005-2008, 2011, 2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 5b32881..6c29c87 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -4,7 +4,19 @@
  * Copyright (C) 2010-2012 Red Hat, Inc.
  * Copyright IBM Corp. 2008
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Authors:
  *  Dan Smith <danms(a)us.ibm.com>
diff --git a/src/util/cgroup.h b/src/util/cgroup.h
index 05325ae..265f7c9 100644
--- a/src/util/cgroup.h
+++ b/src/util/cgroup.h
@@ -4,7 +4,19 @@
  * Copyright (C) 2011-2012 Red Hat, Inc.
  * Copyright IBM Corp. 2008
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Authors:
  *  Dan Smith <danms(a)us.ibm.com>
diff --git a/src/util/conf.c b/src/util/conf.c
index b9392f7..8c1a963 100644
--- a/src/util/conf.c
+++ b/src/util/conf.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2006-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/util/conf.h b/src/util/conf.h
index e7d470d..6af2377 100644
--- a/src/util/conf.h
+++ b/src/util/conf.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2006, 2007 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/util/stats_linux.c b/src/util/stats_linux.c
index a74ed6a..2a1c6ee 100644
--- a/src/util/stats_linux.c
+++ b/src/util/stats_linux.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2007-2010 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Richard W.M. Jones <rjones(a)redhat.com>
  */
diff --git a/src/util/stats_linux.h b/src/util/stats_linux.h
index 0aff832..73aeb5f 100644
--- a/src/util/stats_linux.h
+++ b/src/util/stats_linux.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2007 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Richard W.M. Jones <rjones(a)redhat.com>
  */
diff --git a/src/util/virterror.c b/src/util/virterror.c
index b5c6853..74adeed 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -1,9 +1,21 @@
 /*
  * virterror.c: implements error handling and reporting code for libvirt
  *
- * Copy:  Copyright (C) 2006, 2008-2012 Red Hat, Inc.
+ * Copyright (C) 2006, 2008-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Author: Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/util/viruri.c b/src/util/viruri.c
index 791a412..1cbfbc1 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  */
 
 #include <config.h>
diff --git a/src/util/viruri.h b/src/util/viruri.h
index 79a5668..571bf3c 100644
--- a/src/util/viruri.h
+++ b/src/util/viruri.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  */
 
 #ifndef __VIR_URI_H__
diff --git a/src/util/xml.c b/src/util/xml.c
index 4c88a06..b093d5f 100644
--- a/src/util/xml.c
+++ b/src/util/xml.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
index 3d77720..b42666e 100644
--- a/src/xen/block_stats.c
+++ b/src/xen/block_stats.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2007-2009 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Richard W.M. Jones <rjones(a)redhat.com>
  */
diff --git a/src/xen/block_stats.h b/src/xen/block_stats.h
index c94f645..5eecc6e 100644
--- a/src/xen/block_stats.h
+++ b/src/xen/block_stats.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2007 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Richard W.M. Jones <rjones(a)redhat.com>
  */
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index f01ce16..d33737e 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2007-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Richard W.M. Jones <rjones(a)redhat.com>
  */
diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h
index 3cefea3..0b3138a 100644
--- a/src/xen/xen_driver.h
+++ b/src/xen/xen_driver.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2007, 2010-2011 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Richard W.M. Jones <rjones(a)redhat.com>
  */
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 986621a..86e0514 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2005-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/xen/xen_hypervisor.h b/src/xen/xen_hypervisor.h
index 55a99f1..61434dc 100644
--- a/src/xen/xen_hypervisor.h
+++ b/src/xen/xen_hypervisor.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2005, 2010-2011 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index 8f52e8f..e56d1a4 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2006, 2009-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/src/xen/xs_internal.h b/src/xen/xs_internal.h
index 1ada0f3..b9438ea 100644
--- a/src/xen/xs_internal.h
+++ b/src/xen/xs_internal.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2006, 2010-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  */
diff --git a/tests/testutils.c b/tests/testutils.c
index 8f2ca51..171321f 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2005-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Karel Zak <kzak(a)redhat.com>
  */
diff --git a/tests/testutils.h b/tests/testutils.h
index f8c7567..f372c23 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2005, 2008-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Karel Zak <kzak(a)redhat.com>
  */
diff --git a/tools/virsh-edit.c b/tools/virsh-edit.c
index 27140e2..4dea4b8 100644
--- a/tools/virsh-edit.c
+++ b/tools/virsh-edit.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Usage:
  * Define macros:
diff --git a/tools/virsh.c b/tools/virsh.c
index 5658796..8de0518 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3,7 +3,19 @@
  *
  * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
- * See COPYING.LIB for the License of this software
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
  *
  * Daniel Veillard <veillard(a)redhat.com>
  * Karel Zak <kzak(a)redhat.com>
-- 
1.7.7.3
                    
                  
                  
                          
                            
                            3
                            
                          
                          
                            
                            2
                            
                          
                          
                            
    
                          
                        
                    
                    
                        There are conflicts after splitting 2/11 and 3/11, so post the whole
set again.
v1 - v2:
  * split 2/11, and 3/11 for the patches were too big. However, the new
    3/13 is still quite big. I will send it individualy after compression.
This splits virsh.c by the command groups, except 'virsh itself' group,
each group will have a separate .c, filled with the its commands, a
few helpers, and command group definition moved from virsh.c. and virsh.c
simply include those new .c files.
It still could be optimized, but this set could set up the skelton, and
further optimization could be later patches.
Osier Yang (13):
  virsh: Move definition of cmds and cmd groups right at the top of
    main
  virsh: Split cmds for domain monitoring from virsh.c
  virsh: Split cmds of domain group from virsh.c
  virsh: Split cmds of storage volume group from virsh.c
  virsh: Split cmds of storage pool group from virsh.c
  virsh: Split cmds to manage network from virsh.c
  virsh: Split cmds to manage host interface from virsh.c
  virsh: Split cmds to manage network filter from virsh.c
  virsh: Split cmds to manage secret from virsh.c
  virsh: Split cmds to manage domain snapshot from virsh.c
  virsh: Split cmds in host group from virsh.c
  virsh: Split cmds in node device group from virsh.c
  virsh: Move command group definition into its own file
 tools/virsh-domain-monitor.c | 1701 ++++
 tools/virsh-domain.c         | 8139 +++++++++++++++++++
 tools/virsh-host.c           |  839 ++
 tools/virsh-interface.c      | 1032 +++
 tools/virsh-network.c        |  710 ++
 tools/virsh-nodedev.c        |  402 +
 tools/virsh-nwfilter.c       |  324 +
 tools/virsh-pool.c           | 1442 ++++
 tools/virsh-secret.c         |  373 +
 tools/virsh-snapshot.c       | 1628 ++++
 tools/virsh-volume.c         | 1462 ++++
 tools/virsh.c                |18474 +-----------------------------------------
 12 files changed, 18361 insertions(+), 18165 deletions(-)
 create mode 100644 tools/virsh-domain-monitor.c
 create mode 100644 tools/virsh-domain.c
 create mode 100644 tools/virsh-host.c
 create mode 100644 tools/virsh-interface.c
 create mode 100644 tools/virsh-network.c
 create mode 100644 tools/virsh-nodedev.c
 create mode 100644 tools/virsh-nwfilter.c
 create mode 100644 tools/virsh-pool.c
 create mode 100644 tools/virsh-secret.c
 create mode 100644 tools/virsh-snapshot.c
 create mode 100644 tools/virsh-volume.c
Regards,
Osier
                    
                  
                  
                          
                            
                            5
                            
                          
                          
                            
                            35
                            
                          
                          
                            
    
                          
                        
                     
                        
                     
                        
                     
                        
                    