Devel
Threads by month
- ----- 2026 -----
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- 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
- 25 participants
- 40185 discussions
28 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 501409a..1c1aaf2 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 ab79afe..e5f92b2 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -4569,6 +4569,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 4b84be8..54b53ec 100644
--- a/src/esx/esx_vi.h
+++ b/src/esx/esx_vi.h
@@ -499,6 +499,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 910478c..c45be6a 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 a0efb68..47c3b20 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
1
0
[libvirt] [libvirt-php] Bug(?) in getting domain resource from sub-function
by Katelyn Schiesser 28 Jul '12
by Katelyn Schiesser 28 Jul '12
28 Jul '12
Hi everyone!
I ran into a rather annoying bug this evening. It appears that having
a special function to connect to libvirt (in a class), like:
<?php
function libvirtConnect(){
return libvirt_connect('qemu+tls://'.$this->hostname.':16514/system',
false);
}
?>
..causes any calls to get a domain resource to be corrupted somehow, like:
<?php
function getDomainResource(){
$lvd = $this->libvirtConnect();
return libvirt_domain_lookup_by_uuid_string($lvd, $this->uuid);
}
function doSomething(){
$res = $this->getDomainResource();
libvirt_domain_create($res);
}
?>
This throws a warning: invalid domain pointer in virDomainGetXMLDesc
However, doing everything in one function, or maunally doing a
libvirt_connect(), makes everything work fine. Which is why my bug
senses are tingling- or am I just not understanding how LV pointers
work?
libvirt_version returns:
$ php -r 'print_r(libvirt_version());'
Array
(
[libvirt.release] => 3
[libvirt.minor] => 8
[libvirt.major] => 0
[connector.version] => 0.4.5
[connector.major] => 0
[connector.minor] => 4
[connector.release] => 5
)
Full, working test code: http://pastie.org/4347100
Thank you!
Katelyn Schiesser
1
0
27 Jul '12
=================================================================
KVM Forum 2012: Call For Participation
November 7-9, 2012 - Hotel Fira Palace - Barcelona, Spain
(All submissions must be received before midnight Aug 31st, 2012)
=================================================================
KVM is an industry leading open source hypervisor that provides
an ideal platform for datacenter virtualization, virtual desktop
infrastructure, and cloud computing. Once again, it's time to bring
together the community of developers and users that define the KVM
ecosystem for our annual technical conference. We will discuss the
current state of affairs and plan for the future of KVM, its surrounding
infrastructure, and management tools. We are also excited to announce
the oVirt Workshop will run in parallel with the KVM Forum, bringing in
a community focused on enterprise datacenter virtualization management
built on KVM. For topics which overlap we will have shared sessions.
So mark your calendar and join us in advancing KVM.
http://events.linuxfoundation.org/events/kvm-forum/
Once again we are colocated with The Linux Foundation's LinuxCon,
Based on feedback from last year, this time it's LinuxCon Europe!
KVM Forum attendees will be able to attend oVirt Workshop sessions and
are eligible to attend LinuxCon Europe for a discounted rate.
http://events.linuxfoundation.org/events/kvm-forum/register
We invite you to lead part of the discussion by submitting a speaking
proposal for KVM Forum 2012.
http://events.linuxfoundation.org/cfp
Suggested topics:
KVM
- Scaling and performance
- Nested virtualization
- I/O improvements
- PCI device assignment
- Driver domains
- Time keeping
- Resource management (cpu, memory, i/o)
- Memory management (page sharing, swapping, huge pages, etc)
- VEPA, VN-Link, vswitch
- Security
- Architecture ports
QEMU
- Device model improvements
- New devices and chipsets
- Scaling and performance
- Desktop virtualization
- Spice
- Increasing robustness and hardening
- Security model
- Management interfaces
- QMP protocol and implementation
- Image formats
- Firmware (SeaBIOS, OVMF, UEFI, etc)
- Live migration
- Live snapshots and merging
- Fault tolerance, high availability, continuous backup
- Real-time guest support
Virtio
- Speeding up existing devices
- Alternatives
- Virtio on non-Linux or non-virtualized
Management infrastructure
- oVirt (shared track w/ oVirt Workshop)
- Libvirt
- KVM autotest
- OpenStack
- Network virtualization management
- Enterprise storage management
Cloud computing
- Scalable storage
- Virtual networking
- Security
- Provisioning
SUBMISSION REQUIREMENTS
Abstracts due: Aug 31st, 2012
Notification: Sep 14th, 2012
Please submit a short abstract (~150 words) describing your presentation
proposal. In your submission please note how long your talk will take.
Slots vary in length up to 45 minutes. Also include in your proposal
the proposal type -- one of:
- technical talk
- end-user talk
- birds of a feather (BOF) session
Submit your proposal here:
http://events.linuxfoundation.org/cfp
You will receive a notification whether or not your presentation proposal
was accepted by Sep 14th.
END-USER COLLABORATION
One of the big challenges as developers is to know what, where and how
people actually use our software. We will reserve a few slots for end
users talking about their deployment challenges and achievements.
If you are using KVM in production you are encouraged submit a speaking
proposal. Simply mark it as an end-user collaboration proposal. As an
end user, this is a unique opportunity to get your input to developers.
BOF SESSION
We will reserve some slots in the evening after the main conference
tracks, for birds of a feather (BOF) sessions. These sessions will be
less formal than presentation tracks and targetted for people who would
like to discuss specific issues with other developers and/or users.
If you are interested in getting developers and/or uses together to
discuss a specific problem, please submit a BOF proposal.
LIGHTNING TALKS
In addition to submitted talks we will also have some room for lightning
talks. These are short (5 minute) discussions to highlight new work or
ideas that aren't complete enough to warrant a full presentation slot.
Lightning talk submissions and scheduling will be handled on-site at
KVM Forum.
HOTEL / TRAVEL
The KVM Forum 2012 will be held in Barcelona, Spain at the Hotel Fira Palace.
http://events.linuxfoundation.org/events/kvm-forum/hotel
Thank you for your interest in KVM. We're looking forward to your
submissions and seeing you at the KVM Forum 2012 in November!
Thanks,
your KVM Forum 2012 Program Commitee
Please contact us with any questions or comments.
KVM-Forum-2012-PC(a)redhat.com
1
0
[libvirt] Support to transfer OVSDB:Interface stats during Live Migration
by kiran Chunduri 27 Jul '12
by kiran Chunduri 27 Jul '12
27 Jul '12
Hi,
I was experimenting 'live migration' with libvirt (using virsh) and
observed that post migration the Interface stats in 'OVSDB:Interface' table
are not transferred. Only the values in 'external_ids' column seem to be
synced up. The libvirt version I'm using is 0.9.11.3. The virsh command
used for migration is: 'virsh migrate --live fc17-vm qemu+ssh://
10.23.167.219/system'
Is this the right behavior (or) Have I missed out on some option?
Can some one please guide on the approach and the source files to look at
If i need to add this support?
thanks
Kiran
2
3
27 Jul '12
Pick up some build fixes in the latest gnulib. In particular,
we want to ensure that official tarballs are secure, but don't
want to penalize people who don't run 'make dist', since fixed
automake still hasn't hit common platforms like Fedora 17.
* .gnulib: Update to latest, for Automake CVE-2012-3386 detection.
* bootstrap: Resync from gnulib.
* bootstrap.conf (gnulib_extra_files): Drop missing, since gnulib
has dropped it in favor of Automake's version.
* cfg.mk (local-checks-to-skip): Conditionally skip the security
check in cases where it doesn't matter.
---
I'm stoked! I figured out how to upgrade to the latest automake
and make our release process secure (tested with 'make dist' on
a system with insecure automake), without penalizing normal
development (tested with 'make check' on the same system).
* .gnulib a02ba4b...6c37e0a (76):
> verify: document conflict with -Wnested-externs
> maint.mk: forbid exit(-1)
> fsusage: port back to Solaris
> gnu-web-doc-update: fix error messages
> gnu-web-doc-update: check the requirements.
> maint.mk: minor simplification.
> gitlog-to-changelog: VPATH build issues.
> fpending: Assume AC_CHECK_DECLS_ONCE invocation, like in fpending.m4.
> pthread_sigmask: fix bug on FreeBSD 9
> README-release: make it more legible
> autoupdate
> maint: require that each sc_... command start with "@"
> maint.mk: add leading "@" to quiet new "make syntax-check" rule
> autoupdate
> maint.mk: new syntax check for HAVE_DECL checks
> argp: make HAVE_DECL usage consistent
> stat-time: relax license to LGPLv2+
> strndup: fix m4 usage error
> maint: enable the sc_avoid_if_before_free syntax-check rule
> gettext: do not assume '#define ... defined ...' behavior
> getloadavg: clean out old Emacs and Autoconf cruft
> bootstrap: let warn be like tests/init.sh's warn_
> getopt: Simplify after Emacs changed.
> maint.mk: add sc_vulnerable_makefile_CVE-2012-3386
> maint.mk: _sc_search_regexp, sc_vulnerable_makefile_CVE-2009-4029: fix
> getloadavg, getopt: fix commentary re configure.in
> timespec: mark functions with const attributes
> canonicalize[-lgpl]: handle "guessing" values when cross-building
> canonicalize: make the right guess when cross-compiling to GNU
> update from texinfo
> timespec-sub: avoid duplicate include
> bootstrap: use a more consistent error reporting scheme
> sys_time: allow too-wide tv_sec
> pthread: check for both pthread_create and pthread_join
> parse-datetime: doc tuneup
> do-release-commit-and-tag: fix the previous commit
> do-release-commit-and-tag: fix typo
> pthread: check for pthread_create, not pthread_join
> parse-datetime: fix failure to diagnose invalid input
> bootstrap: do not require now-removed build-aux/missing
> alloca: add support for HP NonStop TNS/E native
> fsusage: remove code not needed on non GNU/Linux systems.
> fsusage: include files needed for glibc 2.6 fallback
> fsusage: avoid needless check on GNU/Linux
> log: Fix an autoconf >= 2.64 warning.
> autoupdate
> autoupdate
> log10f: Fix possible configuration problem.
> Fix typo in ChangeLog entry.
> remove: No longer override on all platforms. Fixes bug from 2012-03-20.
> config: drop scripts that automake says are not independent
> root-uid: new module
> regex: use locale-independent comparison for codeset name
> getopt-posix: No longer guarantee that option processing is resettable.
> argp, regex: Ensure strcasecmp gets declared.
> autoupdate
> ptsname_r: Fix typo in last commit.
> ptsname_r: Make it consistent with ptsname on AIX.
> ptsname_r: Make it consistent with ptsname on OSF/1.
> ttyname_r: Fix result on OSF/1, Solaris.
> ptsname_r: Add support for Solaris.
> ptsname_r: Fix test failure on native Windows.
> ptsname_r: Fix test failures on IRIX, Solaris.
> ptsname test: Extend test.
> time: fix obsolete comment
> getopt-gnu: Handle suboptimal getopt_long's abbreviation handling.
> time_r: fix typo that always overrode localtime_r decl
> Write "Mac OS X" instead of "MacOS X".
> grantpt: Relax requirement regarding invalid file descriptors.
> fbufmode test: Don't test unportable behaviour.
> gnulib-tool: Refactor inctests variable.
> gnulib-tool: --create-[mega]testdir, --[mega]test implies --with-tests.
> parse-duration test: Avoid spurious output.
> testing: fix typo in here doc
> maint: disable the strncpy prohibition
> Fix misspellings in comments.
.gnulib | 2 +-
bootstrap | 118 +++++++++++++++++++++++++++++++++-----------------------
bootstrap.conf | 1 -
cfg.mk | 11 ++++++
4 files changed, 81 insertions(+), 51 deletions(-)
diff --git a/.gnulib b/.gnulib
index a02ba4b..6c37e0a 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit a02ba4bf889fee4622db87f185c3d0af84d74ae7
+Subproject commit 6c37e0a73c7c1b6fe6eac4d794e2e65791a2700d
diff --git a/bootstrap b/bootstrap
index ce37a2c..e3e270b 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2012-05-15.06; # UTC
+scriptversion=2012-07-19.14; # UTC
# Bootstrap this package from checked-out sources.
@@ -77,6 +77,33 @@ Running without arguments will suffice in most cases.
EOF
}
+# warnf_ FORMAT-STRING ARG1...
+warnf_ ()
+{
+ warnf_format_=$1
+ shift
+ nl='
+'
+ case $* in
+ *$nl*) me_=$(printf "$me"|tr "$nl|" '??')
+ printf "$warnf_format_" "$@" | sed "s|^|$me_: |" ;;
+ *) printf "$me: $warnf_format_" "$@" ;;
+ esac >&2
+}
+
+# warn_ WORD1...
+warn_ ()
+{
+ # If IFS does not start with ' ', set it and emit the warning in a subshell.
+ case $IFS in
+ ' '*) warnf_ '%s\n' "$*";;
+ *) (IFS=' '; warn_ "$@");;
+ esac
+}
+
+# die WORD1...
+die() { warn_ "$@"; exit 1; }
+
# Configuration.
# Name of the Makefile.am
@@ -130,7 +157,8 @@ extract_package_name='
p
}
'
-package=$(sed -n "$extract_package_name" configure.ac) || exit
+package=$(sed -n "$extract_package_name" configure.ac) \
+ || die 'cannot find package name in configure.ac'
gnulib_name=lib$package
build_aux=build-aux
@@ -186,6 +214,8 @@ use_git=true
# otherwise find the first of the NAMES that can be run (i.e.,
# supports --version). If found, set ENVVAR to the program name,
# die otherwise.
+#
+# FIXME: code duplication, see also gnu-web-doc-update.
find_tool ()
{
find_tool_envvar=$1
@@ -203,19 +233,15 @@ find_tool ()
else
find_tool_error_prefix="\$$find_tool_envvar: "
fi
- if test x"$find_tool_res" = x; then
- echo >&2 "$me: one of these is required: $find_tool_names"
- exit 1
- fi
- ($find_tool_res --version </dev/null) >/dev/null 2>&1 || {
- echo >&2 "$me: ${find_tool_error_prefix}cannot run $find_tool_res --version"
- exit 1
- }
+ test x"$find_tool_res" != x \
+ || die "one of these is required: $find_tool_names"
+ ($find_tool_res --version </dev/null) >/dev/null 2>&1 \
+ || die "${find_tool_error_prefix}cannot run $find_tool_res --version"
eval "$find_tool_envvar=\$find_tool_res"
eval "export $find_tool_envvar"
}
-# Find sha1sum, named gsha1sum on MacPorts, and shasum on MacOS 10.6.
+# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
find_tool SHA1SUM sha1sum gsha1sum shasum
# Override the default configuration, if necessary.
@@ -230,7 +256,6 @@ esac
test -z "${gnulib_extra_files}" && \
gnulib_extra_files="
$build_aux/install-sh
- $build_aux/missing
$build_aux/mdate-sh
$build_aux/texinfo.tex
$build_aux/depcomp
@@ -270,21 +295,15 @@ do
--no-git)
use_git=false;;
*)
- echo >&2 "$0: $option: unknown option"
- exit 1;;
+ die "$option: unknown option";;
esac
done
-if $use_git || test -d "$GNULIB_SRCDIR"; then
- :
-else
- echo "$0: Error: --no-git requires --gnulib-srcdir" >&2
- exit 1
-fi
+$use_git || test -d "$GNULIB_SRCDIR" \
+ || die "Error: --no-git requires --gnulib-srcdir"
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
- echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
- exit 1
+ die "Bootstrapping from a non-checked-out distribution is risky."
fi
# Ensure that lines starting with ! sort last, per gitignore conventions
@@ -310,7 +329,7 @@ insert_sorted_if_absent() {
echo "$str" | sort_patterns - $file | cmp -s - $file > /dev/null \
|| { echo "$str" | sort_patterns - $file > $file.bak \
&& mv $file.bak $file; } \
- || exit 1
+ || die "insert_sorted_if_absent $file $str: failed"
}
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
@@ -334,11 +353,8 @@ grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
>/dev/null && found_aux_dir=yes
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
>/dev/null && found_aux_dir=yes
-if test $found_aux_dir = no; then
- echo "$0: expected line not found in configure.ac. Add the following:" >&2
- echo " AC_CONFIG_AUX_DIR([$build_aux])" >&2
- exit 1
-fi
+test $found_aux_dir = yes \
+ || die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
# If $build_aux doesn't exist, create it now, otherwise some bits
# below will malfunction. If creating it, also mark it as ignored.
@@ -444,7 +460,7 @@ check_versions() {
automake-ng|aclocal-ng)
app=${app%-ng}
($app --version | grep '(GNU automake-ng)') >/dev/null 2>&1 || {
- echo "$me: Error: '$app' not found or not from Automake-NG" >&2
+ warn_ "Error: '$app' not found or not from Automake-NG"
ret=1
continue
} ;;
@@ -454,20 +470,21 @@ check_versions() {
# so we have to rely on $? rather than get_version.
$app --version >/dev/null 2>&1
if [ 126 -le $? ]; then
- echo "$me: Error: '$app' not found" >&2
+ warn_ "Error: '$app' not found"
ret=1
fi
else
# Require app to produce a new enough version string.
inst_ver=$(get_version $app)
if [ ! "$inst_ver" ]; then
- echo "$me: Error: '$app' not found" >&2
+ warn_ "Error: '$app' not found"
ret=1
else
latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
if [ ! "$latest_ver" = "$inst_ver" ]; then
- echo "$me: Error: '$app' version == $inst_ver is too old" >&2
- echo " '$app' version >= $req_ver is required" >&2
+ warnf_ '%s\n' \
+ "Error: '$app' version == $inst_ver is too old" \
+ " '$app' version >= $req_ver is required"
ret=1
fi
fi
@@ -524,11 +541,10 @@ fi
if ! printf "$buildreq" | check_versions; then
echo >&2
if test -f README-prereq; then
- echo "$0: See README-prereq for how to get the prerequisite programs" >&2
+ die "See README-prereq for how to get the prerequisite programs"
else
- echo "$0: Please install the prerequisite programs" >&2
+ die "Please install the prerequisite programs"
fi
- exit 1
fi
echo "$0: Bootstrapping from checked-out $package sources..."
@@ -739,11 +755,10 @@ symlink_to_dir()
*)
case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/)
- echo >&2 "$me: invalid symlink calculation: $src -> $dst"
- exit 1;;
- /*/*/*/*/) dot_dots=../../../;;
- /*/*/*/) dot_dots=../../;;
- /*/*/) dot_dots=../;;
+ die "invalid symlink calculation: $src -> $dst";;
+ /*/*/*/*/) dot_dots=../../../;;
+ /*/*/*/) dot_dots=../../;;
+ /*/*/) dot_dots=../;;
esac;;
esac
@@ -765,7 +780,7 @@ version_controlled_file() {
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
grep '^/[^/]*/[0-9]' > /dev/null
else
- echo "$me: no version control for $file?" >&2
+ warn_ "no version control for $file?"
false
fi
}
@@ -855,11 +870,12 @@ echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
for file in $gnulib_files; do
- symlink_to_dir "$GNULIB_SRCDIR" $file || exit
+ symlink_to_dir "$GNULIB_SRCDIR" $file \
+ || die "failed to symlink $file"
done
bootstrap_post_import_hook \
- || { echo >&2 "$me: bootstrap_post_import_hook failed"; exit 1; }
+ || die "bootstrap_post_import_hook failed"
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
@@ -887,7 +903,7 @@ echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
"$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS"
AUTOPOINT=true LIBTOOLIZE=true \
$AUTORECONF --verbose --install $no_recursive -I $m4_base $ACLOCAL_FLAGS \
- || exit 1
+ || die "autoreconf failed"
# Get some extra files from gnulib, overriding existing files.
for file in $gnulib_extra_files; do
@@ -896,7 +912,8 @@ for file in $gnulib_extra_files; do
build-aux/*) dst=$build_aux/${file#build-aux/};;
*) dst=$file;;
esac
- symlink_to_dir "$GNULIB_SRCDIR" $file $dst || exit
+ symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
+ || die "failed to symlink $file"
done
if test $with_gettext = yes; then
@@ -912,7 +929,8 @@ if test $with_gettext = yes; then
a\
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
- ' po/Makevars.template >po/Makevars || exit 1
+ ' po/Makevars.template >po/Makevars \
+ || die 'cannot generate po/Makevars'
# If the 'gettext' module is in use, grab the latest Makefile.in.in.
# If only the 'gettext-h' module is in use, assume autopoint already
@@ -920,7 +938,8 @@ if test $with_gettext = yes; then
case $gnulib_modules in
*gettext-h*) ;;
*gettext*)
- cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in || exit 1
+ cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
+ || die "cannot create po/Makefile.in.in"
;;
esac
@@ -936,7 +955,8 @@ if test $with_gettext = yes; then
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
- ' po/Makevars.template >runtime-po/Makevars || exit 1
+ ' po/Makevars.template >runtime-po/Makevars \
+ || die 'cannot generate runtime-po/Makevars'
# Copy identical files from po to runtime-po.
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
diff --git a/bootstrap.conf b/bootstrap.conf
index 9b42cbf..3ac84f4 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -223,7 +223,6 @@ touch ChangeLog || exit 1
# Override bootstrap's list - we don't use mdate-sh or texinfo.tex.
gnulib_extra_files="
$build_aux/install-sh
- $build_aux/missing
$build_aux/depcomp
$build_aux/config.guess
$build_aux/config.sub
diff --git a/cfg.mk b/cfg.mk
index 39d19b4..d054e5a 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -76,6 +76,17 @@ local-checks-to-skip = \
sc_makefile_check \
sc_useless_cpp_parens
+# Most developers don't run 'make distcheck'. We want the official
+# dist to be secure, but don't want to penalize other developers
+# using a distro that has not yet picked up the automake fix.
+# FIXME remove this ifeq (making the syntax check unconditional)
+# once fixed automake (1.11.6 or 1.12.2+) is more common.
+ifeq ($(filter dist%, $(MAKECMDGOALS)), )
+local-checks-to-skip += sc_vulnerable_makefile_CVE-2012-3386
+else
+distdir: sc_vulnerable_makefile_CVE-2012-3386
+endif
+
# Files that should never cause syntax check failures.
VC_LIST_ALWAYS_EXCLUDE_REGEX = \
(^(HACKING|docs/(news\.html\.in|.*\.patch))|\.po)$$
--
1.7.10.4
2
4
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
[libvirt] [PATCHv2 0/2] Refactor and fix error resetting on fallback paths in virsh
by Peter Krempa 27 Jul '12
by Peter Krempa 27 Jul '12
27 Jul '12
This series fixes places where errors were not reset correctly and adds a
function for resetting libvirt errors in virsh that simplifies this operation.
v2 is a rebase of the previous version as it conflicted with the rewrite of
cmdUndefine.
Peter Krempa (2):
virsh: Refactor error clearing on graceful fallback paths
virsh: Fix error resetting on fallback paths
tools/virsh-domain-monitor.c | 16 ++++++----------
tools/virsh-domain.c | 36 ++++++++++++------------------------
tools/virsh-network.c | 3 +--
tools/virsh-pool.c | 3 +--
tools/virsh-snapshot.c | 19 +++++++------------
tools/virsh.c | 13 +++++++++++--
6 files changed, 38 insertions(+), 52 deletions(-)
--
1.7.8.6
2
5
Any time we have a string with no % passed through gettext, a
translator can inject a % to cause a stack overread. When there
is nothing to format, it's easier to ask for a string that cannot
be used as a formatter, by using a trivial "%s" format instead.
In the past, we have used --disable-nls to catch some of the
offenders, but that doesn't get run very often, and many more
uses have crept in. Syntax check to the rescue!
The syntax check can catch uses such as
virReportError(code,
_("split "
"string"));
by using a sed script to fold context lines into one pattern
space before checking for a string without %.
This patch is just mechanical insertion of %s; there are probably
several messages touched by this patch where we would be better
off giving the user more information than a fixed string.
* cfg.mk (sc_prohibit_diagnostic_without_format): New rule.
* src/datatypes.c (virUnrefConnect, virGetDomain)
(virUnrefDomain, virGetNetwork, virUnrefNetwork, virGetInterface)
(virUnrefInterface, virGetStoragePool, virUnrefStoragePool)
(virGetStorageVol, virUnrefStorageVol, virGetNodeDevice)
(virGetSecret, virUnrefSecret, virGetNWFilter, virUnrefNWFilter)
(virGetDomainSnapshot, virUnrefDomainSnapshot): Add %s wrapper.
* src/lxc/lxc_driver.c (lxcDomainSetBlkioParameters)
(lxcDomainGetBlkioParameters): Likewise.
* src/conf/domain_conf.c (virSecurityDeviceLabelDefParseXML)
(virDomainDiskDefParseXML, virDomainGraphicsDefParseXML):
Likewise.
* src/conf/network_conf.c (virNetworkDNSHostsDefParseXML)
(virNetworkDefParseXML): Likewise.
* src/conf/nwfilter_conf.c (virNWFilterIsValidChainName):
Likewise.
* src/conf/nwfilter_params.c (virNWFilterVarValueCreateSimple)
(virNWFilterVarAccessParse): Likewise.
* src/libvirt.c (virDomainSave, virDomainSaveFlags)
(virDomainRestore, virDomainRestoreFlags)
(virDomainSaveImageGetXMLDesc, virDomainSaveImageDefineXML)
(virDomainCoreDump, virDomainGetXMLDesc)
(virDomainMigrateVersion1, virDomainMigrateVersion2)
(virDomainMigrateVersion3, virDomainMigrate, virDomainMigrate2)
(virStreamSendAll, virStreamRecvAll)
(virDomainSnapshotGetXMLDesc): Likewise.
* src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel)
(virNWFilterDHCPSnoopReq): Likewise.
* src/openvz/openvz_driver.c (openvzUpdateDevice): Likewise.
* src/openvz/openvz_util.c (openvzKBPerPages): Likewise.
* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Likewise.
* src/qemu/qemu_command.c (qemuBuildHubDevStr, qemuBuildChrChardevStr)
(qemuBuildCommandLine): Likewise.
* src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Likewise.
* src/qemu/qemu_hotplug.c (qemuDomainAttachNetDevice): Likewise.
* src/rpc/virnetsaslcontext.c (virNetSASLSessionGetIdentity):
Likewise.
* src/rpc/virnetsocket.c (virNetSocketNewConnectUNIX)
(virNetSocketSendFD, virNetSocketRecvFD): Likewise.
* src/storage/storage_backend_disk.c
(virStorageBackendDiskBuildPool): Likewise.
* src/storage/storage_backend_fs.c
(virStorageBackendFileSystemProbe)
(virStorageBackendFileSystemBuild): Likewise.
* src/storage/storage_backend_rbd.c
(virStorageBackendRBDOpenRADOSConn): Likewise.
* src/storage/storage_driver.c (storageVolumeResize): Likewise.
* src/test/test_driver.c (testInterfaceChangeBegin)
(testInterfaceChangeCommit, testInterfaceChangeRollback):
Likewise.
* src/vbox/vbox_tmpl.c (vboxListAllDomains): Likewise.
* src/xenxs/xen_sxpr.c (xenFormatSxprDisk, xenFormatSxpr):
Likewise.
* src/xenxs/xen_xm.c (xenXMConfigGetUUID, xenFormatXMDisk)
(xenFormatXM): Likewise.
---
danpb asked me on IRC if it was possible to automate the checking
for our recent %s additions. Of course, my answer was yes, before
I knew it would take me three hours to get here...
cfg.mk | 15 ++++++++++++-
src/conf/domain_conf.c | 22 +++++++++----------
src/conf/network_conf.c | 8 +++----
src/conf/nwfilter_conf.c | 4 ++--
src/conf/nwfilter_params.c | 8 +++----
src/datatypes.c | 41 +++++++++++++++++++-----------------
src/libvirt.c | 34 +++++++++++++++---------------
src/lxc/lxc_driver.c | 6 ++++--
src/nwfilter/nwfilter_dhcpsnoop.c | 5 +++--
src/openvz/openvz_driver.c | 2 +-
src/openvz/openvz_util.c | 2 +-
src/qemu/qemu_cgroup.c | 4 ++--
src/qemu/qemu_command.c | 8 +++----
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_hotplug.c | 2 +-
src/rpc/virnetsaslcontext.c | 4 ++--
src/rpc/virnetsocket.c | 6 +++---
src/storage/storage_backend_disk.c | 8 +++----
src/storage/storage_backend_fs.c | 8 +++----
src/storage/storage_backend_rbd.c | 8 +++----
src/storage/storage_driver.c | 10 ++++-----
src/test/test_driver.c | 6 +++---
src/vbox/vbox_tmpl.c | 2 +-
src/xenxs/xen_sxpr.c | 6 +++---
src/xenxs/xen_xm.c | 8 +++----
25 files changed, 124 insertions(+), 105 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index d054e5a..085ef34 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -547,7 +547,7 @@ msg_gen_function += xenapiSessionErrorHandler
# msg_gen_function += vshPrint
# msg_gen_function += vshError
-func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
+func_or := $(shell echo $(msg_gen_function)|tr -s '[[:space:]]' '|')
func_re := ($(func_or))
# Look for diagnostics that aren't marked for translation.
@@ -567,6 +567,19 @@ sc_libvirt_unmarked_diagnostics:
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
+# Look for diagnostics that lack a % in the format string, except that we
+# allow VIR_ERROR to do this, and ignore functions that take a single
+# string rather than a format argument.
+sc_prohibit_diagnostic_without_format:
+ @{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
+ grep -A2 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
+ | sed -rn -e ':l; /[,"]$$/ {N;b l;}' \
+ -e '/xenapiSessionErrorHandler/d' \
+ -e '/\<$(func_re) *\([^"]*"([^%"]|"\n[^"]*")*"[,)]/p' \
+ | grep -vE '(VIR_ERROR|vah_(error|warning))' && \
+ { echo '$(ME): found diagnostic without %' 1>&2; \
+ exit 1; } || :
+
# Like the above, but prohibit a newline at the end of a diagnostic.
# This is subject to false positives partly because it naively looks for
# `\n"', which may not be the end of the string, and also because it takes
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1b5dad9..c92c6d4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3236,7 +3236,7 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr *def,
(*def)->label = p;
if ((*def)->label && (*def)->norelabel) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("Cannot specify a label if relabelling is turned off"));
VIR_FREE((*def)->label);
VIR_FREE(*def);
@@ -3423,7 +3423,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
}
if (!(source = virXMLPropString(cur, "name")) &&
def->protocol != VIR_DOMAIN_DISK_PROTOCOL_NBD) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing name for disk source"));
goto error;
}
@@ -3509,7 +3509,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
} else if (xmlStrEqual(cur->name, BAD_CAST "auth")) {
authUsername = virXMLPropString(cur, "username");
if (authUsername == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("missing username for auth"));
goto error;
}
@@ -3521,7 +3521,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
xmlStrEqual(child->name, BAD_CAST "secret")) {
usageType = virXMLPropString(child, "type");
if (usageType == NULL) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing type for secret"));
goto error;
}
@@ -3537,7 +3537,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
authUsage = virXMLPropString(child, "usage");
if (authUUID != NULL && authUsage != NULL) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("only one of uuid and usage can be specified"));
goto error;
}
@@ -3599,7 +3599,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
def->blkdeviotune.read_bytes_sec) ||
(def->blkdeviotune.total_bytes_sec &&
def->blkdeviotune.write_bytes_sec)) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write bytes_sec "
"cannot be set at the same time"));
goto error;
@@ -3609,7 +3609,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
def->blkdeviotune.read_iops_sec) ||
(def->blkdeviotune.total_iops_sec &&
def->blkdeviotune.write_iops_sec)) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("total and read/write iops_sec "
"cannot be set at the same time"));
goto error;
@@ -3825,7 +3825,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
if (ioeventfd) {
if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("disk ioeventfd mode supported "
"only for virtio bus"));
goto error;
@@ -3843,7 +3843,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
if (event_idx) {
if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("disk event_idx mode supported "
"only for virtio bus"));
goto error;
@@ -6411,7 +6411,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
if ((compressionVal =
virDomainGraphicsSpicePlaybackCompressionTypeFromString(compression)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unknown spice playback compression"));
VIR_FREE(compression);
goto error;
@@ -6431,7 +6431,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
}
if ((modeVal =
virDomainGraphicsSpiceStreamingModeTypeFromString(mode)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unknown spice streaming mode"));
VIR_FREE(mode);
goto error;
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 41864be..5550c95 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -519,7 +519,7 @@ virNetworkDNSHostsDefParseXML(virNetworkDNSDefPtr def,
if (!(ip = virXMLPropString(node, "ip")) ||
(virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) {
- virReportError(VIR_ERR_XML_DETAIL,
+ virReportError(VIR_ERR_XML_DETAIL, "%s",
_("Missing IP address in DNS host definition"));
VIR_FREE(ip);
goto error;
@@ -1086,7 +1086,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
nForwardPfs = virXPathNodeSet("./pf", ctxt, &forwardPfNodes);
if (nForwardIfs < 0 || nForwardPfs < 0) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("No interface pool or SRIOV physical device given"));
goto error;
}
@@ -1098,7 +1098,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
}
if (forwardDev) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("A forward Dev should not be used when using a SRIOV PF"));
goto error;
}
@@ -1116,7 +1116,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
forwardDev = NULL;
def->nForwardPfs++;
} else if (nForwardPfs > 1) {
- virReportError(VIR_ERR_XML_ERROR,
+ virReportError(VIR_ERR_XML_ERROR, "%s",
_("Use of more than one physical interface is not allowed"));
goto error;
}
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 70fadaa..2b68f41 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -2,7 +2,7 @@
* nwfilter_conf.c: network filter XML processing
* (derived from storage_conf.c)
*
- * Copyright (C) 2006-2011 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
* Copyright (C) 2006-2008 Daniel P. Berrange
*
* Copyright (C) 2010-2011 IBM Corporation
@@ -2423,7 +2423,7 @@ virNWFilterIsValidChainName(const char *chainname)
}
if (chainname[strspn(chainname, VALID_CHAINNAME)] != 0) {
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Chain name contains invalid characters"));
return false;
}
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index d08e860..6481c84 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -113,7 +113,7 @@ virNWFilterVarValueCreateSimple(char *value)
virNWFilterVarValuePtr val;
if (!isValidVarValue(value)) {
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Variable value contains invalid character"));
return NULL;
}
@@ -998,10 +998,10 @@ virNWFilterVarAccessParse(const char *varAccess)
}
if (parseError) {
if (dest->accessType == VIR_NWFILTER_VAR_ACCESS_ELEMENT)
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Malformatted array index"));
else
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Malformatted iterator id"));
goto err_exit;
}
@@ -1026,7 +1026,7 @@ virNWFilterVarAccessParse(const char *varAccess)
return dest;
} else {
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Malformatted variable"));
}
diff --git a/src/datatypes.c b/src/datatypes.c
index d718170..c5c4717 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -1,7 +1,7 @@
/*
* datatypes.h: management of structs for public data types
*
- * 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
@@ -138,7 +138,7 @@ virUnrefConnect(virConnectPtr conn) {
int refs;
if ((!VIR_IS_CONNECT(conn))) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return -1;
}
virMutexLock(&conn->lock);
@@ -173,7 +173,7 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
if (!VIR_IS_CONNECT(conn)) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return NULL;
}
virCheckNonNullArgReturn(name, NULL);
@@ -264,7 +264,8 @@ virUnrefDomain(virDomainPtr domain) {
int refs;
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
- virLibConnError(VIR_ERR_INVALID_DOMAIN, _("bad domain or no connection"));
+ virLibConnError(VIR_ERR_INVALID_DOMAIN, "%s",
+ _("bad domain or no connection"));
return -1;
}
virMutexLock(&domain->conn->lock);
@@ -300,7 +301,7 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
if (!VIR_IS_CONNECT(conn)) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return NULL;
}
virCheckNonNullArgReturn(name, NULL);
@@ -389,7 +390,7 @@ virUnrefNetwork(virNetworkPtr network) {
int refs;
if (!VIR_IS_CONNECTED_NETWORK(network)) {
- virLibConnError(VIR_ERR_INVALID_NETWORK,
+ virLibConnError(VIR_ERR_INVALID_NETWORK, "%s",
_("bad network or no connection"));
return -1;
}
@@ -427,7 +428,7 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
virInterfacePtr ret = NULL;
if (!VIR_IS_CONNECT(conn)) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return NULL;
}
virCheckNonNullArgReturn(name, NULL);
@@ -522,7 +523,7 @@ virUnrefInterface(virInterfacePtr iface) {
int refs;
if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
- virLibConnError(VIR_ERR_INVALID_INTERFACE,
+ virLibConnError(VIR_ERR_INVALID_INTERFACE, "%s",
_("bad interface or no connection"));
return -1;
}
@@ -561,7 +562,7 @@ virGetStoragePool(virConnectPtr conn, const char *name,
char uuidstr[VIR_UUID_STRING_BUFLEN];
if (!VIR_IS_CONNECT(conn)) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return NULL;
}
virCheckNonNullArgReturn(name, NULL);
@@ -651,7 +652,7 @@ virUnrefStoragePool(virStoragePoolPtr pool) {
int refs;
if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
- virLibConnError(VIR_ERR_INVALID_STORAGE_POOL,
+ virLibConnError(VIR_ERR_INVALID_STORAGE_POOL, "%s",
_("bad storage pool or no connection"));
return -1;
}
@@ -690,7 +691,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name,
virStorageVolPtr ret = NULL;
if (!VIR_IS_CONNECT(conn)) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return NULL;
}
virCheckNonNullArgReturn(name, NULL);
@@ -790,7 +791,7 @@ virUnrefStorageVol(virStorageVolPtr vol) {
int refs;
if (!VIR_IS_CONNECTED_STORAGE_VOL(vol)) {
- virLibConnError(VIR_ERR_INVALID_STORAGE_VOL,
+ virLibConnError(VIR_ERR_INVALID_STORAGE_VOL, "%s",
_("bad storage volume or no connection"));
return -1;
}
@@ -827,7 +828,7 @@ virGetNodeDevice(virConnectPtr conn, const char *name)
virNodeDevicePtr ret = NULL;
if (!VIR_IS_CONNECT(conn)) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return NULL;
}
virCheckNonNullArgReturn(name, NULL);
@@ -945,7 +946,7 @@ virGetSecret(virConnectPtr conn, const unsigned char *uuid,
char uuidstr[VIR_UUID_STRING_BUFLEN];
if (!VIR_IS_CONNECT(conn)) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return NULL;
}
virCheckNonNullArgReturn(uuid, NULL);
@@ -1031,7 +1032,8 @@ virUnrefSecret(virSecretPtr secret) {
int refs;
if (!VIR_IS_CONNECTED_SECRET(secret)) {
- virLibConnError(VIR_ERR_INVALID_SECRET, _("bad secret or no connection"));
+ virLibConnError(VIR_ERR_INVALID_SECRET, "%s",
+ _("bad secret or no connection"));
return -1;
}
virMutexLock(&secret->conn->lock);
@@ -1126,7 +1128,7 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)
char uuidstr[VIR_UUID_STRING_BUFLEN];
if (!VIR_IS_CONNECT(conn)) {
- virLibConnError(VIR_ERR_INVALID_CONN, _("no connection"));
+ virLibConnError(VIR_ERR_INVALID_CONN, "%s", _("no connection"));
return NULL;
}
virCheckNonNullArgReturn(name, NULL);
@@ -1218,7 +1220,7 @@ virUnrefNWFilter(virNWFilterPtr nwfilter)
int refs;
if (!VIR_IS_CONNECTED_NWFILTER(nwfilter)) {
- virLibConnError(VIR_ERR_INVALID_NWFILTER,
+ virLibConnError(VIR_ERR_INVALID_NWFILTER, "%s",
_("bad nwfilter or no connection"));
return -1;
}
@@ -1244,7 +1246,7 @@ virGetDomainSnapshot(virDomainPtr domain, const char *name)
virDomainSnapshotPtr ret = NULL;
if (!VIR_IS_DOMAIN(domain)) {
- virLibConnError(VIR_ERR_INVALID_DOMAIN, _("bad domain"));
+ virLibConnError(VIR_ERR_INVALID_DOMAIN, "%s", _("bad domain"));
return NULL;
}
virCheckNonNullArgReturn(name, NULL);
@@ -1307,7 +1309,8 @@ virUnrefDomainSnapshot(virDomainSnapshotPtr snapshot)
int refs;
if (!VIR_IS_DOMAIN_SNAPSHOT(snapshot)) {
- virLibConnError(VIR_ERR_INVALID_DOMAIN_SNAPSHOT, _("not a snapshot"));
+ virLibConnError(VIR_ERR_INVALID_DOMAIN_SNAPSHOT, "%s",
+ _("not a snapshot"));
return -1;
}
diff --git a/src/libvirt.c b/src/libvirt.c
index 8315b4f..1ed9e32 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2555,7 +2555,7 @@ virDomainSave(virDomainPtr domain, const char *to)
/* We must absolutize the file path as the save is done out of process */
if (virFileAbsPath(to, &absolute_to) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not build absolute output file path"));
goto error;
}
@@ -2650,7 +2650,7 @@ virDomainSaveFlags(virDomainPtr domain, const char *to,
/* We must absolutize the file path as the save is done out of process */
if (virFileAbsPath(to, &absolute_to) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not build absolute output file path"));
goto error;
}
@@ -2706,7 +2706,7 @@ virDomainRestore(virConnectPtr conn, const char *from)
/* We must absolutize the file path as the restore is done out of process */
if (virFileAbsPath(from, &absolute_from) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not build absolute input file path"));
goto error;
}
@@ -2788,7 +2788,7 @@ virDomainRestoreFlags(virConnectPtr conn, const char *from, const char *dxml,
/* We must absolutize the file path as the restore is done out of process */
if (virFileAbsPath(from, &absolute_from) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not build absolute input file path"));
goto error;
}
@@ -2845,7 +2845,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
virCheckNonNullArgGoto(file, error);
if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
- virLibConnError(VIR_ERR_OPERATION_DENIED,
+ virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
_("virDomainSaveImageGetXMLDesc with secure flag"));
goto error;
}
@@ -2856,7 +2856,7 @@ virDomainSaveImageGetXMLDesc(virConnectPtr conn, const char *file,
/* We must absolutize the file path as the read is done out of process */
if (virFileAbsPath(file, &absolute_file) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not build absolute input file path"));
goto error;
}
@@ -2937,7 +2937,7 @@ virDomainSaveImageDefineXML(virConnectPtr conn, const char *file,
/* We must absolutize the file path as the read is done out of process */
if (virFileAbsPath(file, &absolute_file) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not build absolute input file path"));
goto error;
}
@@ -3029,7 +3029,7 @@ virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags)
/* We must absolutize the file path as the save is done out of process */
if (virFileAbsPath(to, &absolute_to) < 0) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not build absolute core file path"));
goto error;
}
@@ -4341,7 +4341,7 @@ virDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
conn = domain->conn;
if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
- virLibConnError(VIR_ERR_OPERATION_DENIED,
+ virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
_("virDomainGetXMLDesc with secure flag"));
goto error;
}
@@ -4523,7 +4523,7 @@ virDomainMigrateVersion1 (virDomainPtr domain,
goto done;
if (uri == NULL && uri_out == NULL) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domainMigratePrepare did not set uri"));
goto done;
}
@@ -4635,7 +4635,7 @@ virDomainMigrateVersion2 (virDomainPtr domain,
goto done;
if (uri == NULL && uri_out == NULL) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domainMigratePrepare2 did not set uri"));
virDispatchError(domain->conn);
cancelled = 1;
@@ -4781,7 +4781,7 @@ virDomainMigrateVersion3(virDomainPtr domain,
}
if (uri == NULL && uri_out == NULL) {
- virLibConnError(VIR_ERR_INTERNAL_ERROR,
+ virLibConnError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domainMigratePrepare3 did not set uri"));
virDispatchError(domain->conn);
goto finish;
@@ -5198,7 +5198,7 @@ virDomainMigrate (virDomainPtr domain,
}
flags &= ~VIR_MIGRATE_CHANGE_PROTECTION;
if (flags & VIR_MIGRATE_TUNNELLED) {
- virLibConnError(VIR_ERR_OPERATION_INVALID,
+ virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot perform tunnelled migration without using peer2peer flag"));
goto error;
}
@@ -5400,7 +5400,7 @@ virDomainMigrate2(virDomainPtr domain,
}
flags &= ~VIR_MIGRATE_CHANGE_PROTECTION;
if (flags & VIR_MIGRATE_TUNNELLED) {
- virLibConnError(VIR_ERR_OPERATION_INVALID,
+ virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot perform tunnelled migration without using peer2peer flag"));
goto error;
}
@@ -14951,7 +14951,7 @@ int virStreamSendAll(virStreamPtr stream,
virCheckNonNullArgGoto(handler, cleanup);
if (stream->flags & VIR_STREAM_NONBLOCK) {
- virLibConnError(VIR_ERR_OPERATION_INVALID,
+ virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
_("data sources cannot be used for non-blocking streams"));
goto cleanup;
}
@@ -15050,7 +15050,7 @@ int virStreamRecvAll(virStreamPtr stream,
virCheckNonNullArgGoto(handler, cleanup);
if (stream->flags & VIR_STREAM_NONBLOCK) {
- virLibConnError(VIR_ERR_OPERATION_INVALID,
+ virLibConnError(VIR_ERR_OPERATION_INVALID, "%s",
_("data sinks cannot be used for non-blocking streams"));
goto cleanup;
}
@@ -17040,7 +17040,7 @@ virDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
conn = snapshot->domain->conn;
if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
- virLibConnError(VIR_ERR_OPERATION_DENIED,
+ virLibConnError(VIR_ERR_OPERATION_DENIED, "%s",
_("virDomainSnapshotGetXMLDesc with secure flag"));
goto error;
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 09c64b2..a057bdd 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2023,7 +2023,8 @@ lxcDomainSetBlkioParameters(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
- lxcError(VIR_ERR_OPERATION_INVALID, _("blkio cgroup isn't mounted"));
+ lxcError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("blkio cgroup isn't mounted"));
goto cleanup;
}
@@ -2127,7 +2128,8 @@ lxcDomainGetBlkioParameters(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!lxcCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
- lxcError(VIR_ERR_OPERATION_INVALID, _("blkio cgroup isn't mounted"));
+ lxcError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("blkio cgroup isn't mounted"));
goto cleanup;
}
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index 0a12be5..1971e1a 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -2,6 +2,7 @@
* nwfilter_dhcpsnoop.c: support for DHCP snooping used by a VM
* on an interface
*
+ * Copyright (C) 2012 Red Hat, Inc.
* Copyright (C) 2011,2012 IBM Corp.
*
* Authors:
@@ -886,7 +887,7 @@ virNWFilterSnoopReqLeaseDel(virNWFilterSnoopReqPtr req,
if (req->techdriver &&
req->techdriver->applyDHCPOnlyRules(req->ifname, &req->macaddr,
dhcpsrvrs, false) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("virNWFilterSnoopListDel failed"));
ret = -1;
}
@@ -1633,7 +1634,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
if (techdriver->applyDHCPOnlyRules(req->ifname, &req->macaddr,
dhcpsrvrs, false) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("applyDHCPOnlyRules "
"failed - spoofing not protected!"));
goto exit_snoopreqput;
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index a144408..43819a4 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -2017,7 +2017,7 @@ openvzUpdateDevice(virDomainDefPtr vmdef,
|| cur->accessmode != fs->accessmode
|| cur->wrpolicy != fs->wrpolicy
|| cur->readonly != fs->readonly) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Can only modify disk quota"));
return -1;
}
diff --git a/src/openvz/openvz_util.c b/src/openvz/openvz_util.c
index a878dd6..17528a0 100644
--- a/src/openvz/openvz_util.c
+++ b/src/openvz/openvz_util.c
@@ -45,7 +45,7 @@ openvzKBPerPages(void)
if (kb_per_pages > 0) {
kb_per_pages /= 1024;
} else {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Can't determine page size"));
kb_per_pages = 0;
return -1;
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index b93887c..9b59738 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -333,7 +333,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
}
}
} else {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Block I/O tuning is not available on this host"));
goto cleanup;
}
@@ -372,7 +372,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
}
}
} else {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Memory cgroup is not available on this host"));
}
}
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d6df4ee..1641929 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3424,7 +3424,7 @@ qemuBuildHubDevStr(virDomainHubDefPtr dev,
}
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("usb-hub not supported by QEMU binary"));
goto error;
}
@@ -3553,7 +3553,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("spicevmc not supported in this QEMU binary"));
goto error;
}
@@ -4806,7 +4806,7 @@ qemuBuildCommandLine(virConnectPtr conn,
def->controllers[i]->model == -1 &&
!qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
if (usblegacy) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Multiple legacy USB controller not supported"));
goto error;
}
@@ -5813,7 +5813,7 @@ qemuBuildCommandLine(virConnectPtr conn,
switch (mode) {
case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
if (!driver->spiceTLS) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("spice secure channels set in XML configuration, but TLS is disabled in qemu.conf"));
goto error;
}
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ecd2ec1..79ca208 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12886,7 +12886,7 @@ qemuDomainGetPercpuStats(virDomainPtr domain,
if (!map[i]) {
cpu_time = 0;
} else if (virStrToLong_ull(pos, &pos, 10, &cpu_time) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cpuacct parse error"));
goto cleanup;
} else {
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index d7e2a73..66ac683 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -832,7 +832,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
goto try_remove;
}
} else {
- virReportError(VIR_ERR_OPERATION_FAILED,
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("setting of link state not supported: Link is up"));
}
diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c
index 9943057..d35d016 100644
--- a/src/rpc/virnetsaslcontext.c
+++ b/src/rpc/virnetsaslcontext.c
@@ -1,7 +1,7 @@
/*
* virnetsaslcontext.c: SASL encryption/auth handling
*
- * Copyright (C) 2010-2011 Red Hat, Inc.
+ * Copyright (C) 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
@@ -313,7 +313,7 @@ const char *virNetSASLSessionGetIdentity(virNetSASLSessionPtr sasl)
goto cleanup;
}
if (val == NULL) {
- virReportError(VIR_ERR_AUTH_FAILED,
+ virReportError(VIR_ERR_AUTH_FAILED, "%s",
_("no client username was found"));
goto cleanup;
}
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index aee3c19..87afa2c 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -482,7 +482,7 @@ int virNetSocketNewConnectUNIX(const char *path,
remoteAddr.len = sizeof(remoteAddr.data.un);
if (spawnDaemon && !binary) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Auto-spawn of daemon requested, but no binary specified"));
return -1;
}
@@ -1178,7 +1178,7 @@ int virNetSocketSendFD(virNetSocketPtr sock, int fd)
{
int ret = -1;
if (!virNetSocketHasPassFD(sock)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Sending file descriptors is not supported on this socket"));
return -1;
}
@@ -1212,7 +1212,7 @@ int virNetSocketRecvFD(virNetSocketPtr sock, int *fd)
*fd = -1;
if (!virNetSocketHasPassFD(sock)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Receiving file descriptors is not supported on this socket"));
return -1;
}
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 75d2927..fc3a9d2 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -1,7 +1,7 @@
/*
* storage_backend_disk.c: storage backend for disk handling
*
- * Copyright (C) 2007-2008, 2010-2011 Red Hat, Inc.
+ * Copyright (C) 2007-2008, 2010-2012 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -399,7 +399,7 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Overwrite and no overwrite flags"
" are mutually exclusive"));
goto error;
@@ -415,10 +415,10 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
if (check > 0) {
ok_to_mklabel = true;
} else if (check < 0) {
- virReportError(VIR_ERR_OPERATION_FAILED,
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Error checking for disk label"));
} else {
- virReportError(VIR_ERR_OPERATION_INVALID,
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Disk label already present"));
}
}
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 8da985e..cb5e3f3 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -1,7 +1,7 @@
/*
* storage_backend_fs.c: storage backend for FS and directory handling
*
- * Copyright (C) 2007-2011 Red Hat, Inc.
+ * Copyright (C) 2007-2012 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -598,7 +598,7 @@ virStorageBackendFileSystemProbe(const char *device,
}
if (blkid_do_probe(probe) != 1) {
- virReportError(VIR_ERR_STORAGE_PROBE_FAILED,
+ virReportError(VIR_ERR_STORAGE_PROBE_FAILED, "%s",
_("Found additional probes to run, "
"filesystem probing may be incorrect"));
ret = FILESYSTEM_PROBE_ERROR;
@@ -620,7 +620,7 @@ static virStoragePoolProbeResult
virStorageBackendFileSystemProbe(const char *device ATTRIBUTE_UNUSED,
const char *format ATTRIBUTE_UNUSED)
{
- virReportError(VIR_ERR_OPERATION_INVALID,
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("probing for filesystems is unsupported "
"by this build"));
@@ -743,7 +743,7 @@ virStorageBackendFileSystemBuild(virConnectPtr conn ATTRIBUTE_UNUSED,
if (flags == (VIR_STORAGE_POOL_BUILD_OVERWRITE |
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Overwrite and no overwrite flags"
" are mutually exclusive"));
goto error;
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index 4df0b54..185ad0e 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -65,7 +65,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
VIR_DEBUG("Using cephx authorization");
if (rados_create(&ptr->cluster,
pool->def->source.auth.cephx.username) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to initialize RADOS"));
goto cleanup;
}
@@ -84,7 +84,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
}
if (secret == NULL) {
- virReportError(VIR_ERR_NO_SECRET,
+ virReportError(VIR_ERR_NO_SECRET, "%s",
_("failed to find the secret"));
goto cleanup;
}
@@ -95,7 +95,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
memset(secret_value, 0, secret_value_size);
if (rados_key == NULL) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to decode the RADOS key"));
goto cleanup;
}
@@ -119,7 +119,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr,
} else {
VIR_DEBUG("Not using cephx authorization");
if (rados_create(&ptr->cluster, NULL) < 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to create the RADOS cluster"));
goto cleanup;
}
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index c9b8021..e83b1e5 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1715,13 +1715,13 @@ storageVolumeResize(virStorageVolPtr obj,
storageDriverUnlock(driver);
if (!pool) {
- virReportError(VIR_ERR_NO_STORAGE_POOL,
+ virReportError(VIR_ERR_NO_STORAGE_POOL, "%s",
_("no storage pool with matching uuid"));
goto out;
}
if (!virStoragePoolObjIsActive(pool)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("storage pool is not active"));
goto out;
}
@@ -1753,20 +1753,20 @@ storageVolumeResize(virStorageVolPtr obj,
}
if (abs_capacity < vol->allocation) {
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
_("can't shrink capacity below "
"existing allocation"));
goto out;
}
if (abs_capacity > vol->capacity + pool->def->available) {
- virReportError(VIR_ERR_OPERATION_FAILED,
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
_("Not enough space left on storage pool"));
goto out;
}
if (!backend->resizeVol) {
- virReportError(VIR_ERR_NO_SUPPORT,
+ virReportError(VIR_ERR_NO_SUPPORT, "%s",
_("storage pool does not support changing of "
"volume capacity"));
goto out;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 990b20d..a36af7e 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -3534,7 +3534,7 @@ static int testInterfaceChangeBegin(virConnectPtr conn,
testDriverLock(privconn);
if (privconn->transaction_running) {
- virReportError(VIR_ERR_OPERATION_INVALID,
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("there is another transaction running."));
goto cleanup;
}
@@ -3562,7 +3562,7 @@ static int testInterfaceChangeCommit(virConnectPtr conn,
testDriverLock(privconn);
if (!privconn->transaction_running) {
- virReportError(VIR_ERR_OPERATION_INVALID,
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("no transaction running, "
"nothing to be committed."));
goto cleanup;
@@ -3590,7 +3590,7 @@ static int testInterfaceChangeRollback(virConnectPtr conn,
testDriverLock(privconn);
if (!privconn->transaction_running) {
- virReportError(VIR_ERR_OPERATION_INVALID,
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("no transaction running, "
"nothing to rollback."));
goto cleanup;
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 17e7e9a..b672b24 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -9311,7 +9311,7 @@ vboxListAllDomains(virConnectPtr conn,
if (MATCH(VIR_CONNECT_LIST_FILTERS_SNAPSHOT)) {
rc = machine->vtbl->GetSnapshotCount(machine, &snapshotCount);
if (NS_FAILED(rc)) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("could not get snapshot count for listed domains"));
goto cleanup;
}
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 42533ce..4e005f4 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -1870,7 +1870,7 @@ xenFormatSxprDisk(virDomainDiskDefPtr def,
else
virBufferAddLit(buf, "(mode 'w')");
if (def->transient) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("transient disks not supported yet"));
return -1;
}
@@ -2515,7 +2515,7 @@ xenFormatSxpr(virConnectPtr conn,
break;
case VIR_DOMAIN_CLOCK_OFFSET_UTC:
if (def->clock.data.utc_reset) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unsupported clock adjustment='reset'"));
goto error;
}
@@ -2524,7 +2524,7 @@ xenFormatSxpr(virConnectPtr conn,
break;
case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
if (def->clock.data.utc_reset) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unsupported clock adjustment='reset'"));
goto error;
}
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 99e736e..76c1faa 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -208,7 +208,7 @@ static int xenXMConfigGetUUID(virConfPtr conf, const char *name, unsigned char *
virConfValuePtr val;
if (!uuid || !name || !conf) {
- virReportError(VIR_ERR_INVALID_ARG,
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
_("Arguments must be non null"));
return -1;
}
@@ -1242,7 +1242,7 @@ static int xenFormatXMDisk(virConfValuePtr list,
else
virBufferAddLit(&buf, ",w");
if (disk->transient) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("transient disks not supported yet"));
return -1;
}
@@ -1686,7 +1686,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
break;
case VIR_DOMAIN_CLOCK_OFFSET_UTC:
if (def->clock.data.utc_reset) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unsupported clock adjustment='reset'"));
goto cleanup;
}
@@ -1695,7 +1695,7 @@ virConfPtr xenFormatXM(virConnectPtr conn,
break;
case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
if (def->clock.data.utc_reset) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("unsupported clock adjustment='reset'"));
goto cleanup;
}
--
1.7.10.4
3
5
[libvirt] [PATCH v8 0/8] Add basic driver for Parallels Virtuozzo Server
by Dmitry Guryanov 26 Jul '12
by Dmitry Guryanov 26 Jul '12
26 Jul '12
Parallels Cloud Server is a 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.
Dmitry Guryanov (8):
parallels: add driver skeleton
parallels: add functions to list domains and get info
parallels: implement functions for domain life cycle management
parallels: get info about serial ports
parallels: add support of VNC remote display
parallels: implement virDomainDefineXML operation for existing
domains
parallels: add storage driver
parallels: implement VM creation
cfg.mk | 1 +
configure.ac | 23 +
docs/drvparallels.html.in | 28 +
include/libvirt/virterror.h | 2 +-
libvirt.spec.in | 9 +-
po/POTFILES.in | 4 +
src/Makefile.am | 15 +
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 | 1309 +++++++++++++++++++++++++++++++++
src/parallels/parallels_driver.h | 75 ++
src/parallels/parallels_storage.c | 1456 +++++++++++++++++++++++++++++++++++++
src/parallels/parallels_utils.c | 131 ++++
src/util/virterror.c | 3 +-
16 files changed, 3066 insertions(+), 4 deletions(-)
create mode 100644 docs/drvparallels.html.in
create mode 100644 src/parallels/parallels_driver.c
create mode 100644 src/parallels/parallels_driver.h
create mode 100644 src/parallels/parallels_storage.c
create mode 100644 src/parallels/parallels_utils.c
3
28
[libvirt] [PATCH 0/6 v3] Support forward mode='hostdev' and interface pools
by Shradha Shah 26 Jul '12
by Shradha Shah 26 Jul '12
26 Jul '12
This patch series supports the forward mode='hostdev'. The functionality
of this mode is the same as interface type='hostdev' but with the added
benefit of using interface pools.
The patch series also contains a patch to support use of interface names
and PCI device addresses interchangeably in a network xml, and return
the appropriate one in actualDevice when networkAllocateActualDevice is
called.
At the top level managed attribute can be specified with identical results
as when it's specified for a hostdev.
Currently forward mode='hostdev' does not support USB devices.
Shradha Shah (6):
Prerequisite Patch. virDomainDevicePCIAddress and respective
functions moved to a new file called conf/device_conf.ch
Moved the code to create implicit interface pool from PF to a new
function
RNG updates, new xml parser/formatter code to support forward
mode=hostdev
Code to return interface name or pci_addr of the VF in actualDevice
Forward Mode Hostdev network driver Implementation
Forward Mode 'Hostdev' qemu driver implementation
docs/formatnetwork.html.in | 62 ++++++
docs/schemas/network.rng | 82 ++++++++-
include/libvirt/virterror.h | 1 +
src/Makefile.am | 7 +-
src/conf/device_conf.c | 135 +++++++++++++
src/conf/device_conf.h | 65 +++++++
src/conf/domain_conf.c | 114 ++----------
src/conf/domain_conf.h | 25 +---
src/conf/network_conf.c | 126 +++++++++++--
src/conf/network_conf.h | 29 +++-
src/libvirt_private.syms | 10 +-
src/network/bridge_driver.c | 322 +++++++++++++++++++++++++-------
src/qemu/qemu_command.c | 27 ++-
src/qemu/qemu_hotplug.c | 7 +-
src/qemu/qemu_monitor.c | 14 +-
src/qemu/qemu_monitor.h | 17 +-
src/qemu/qemu_monitor_json.c | 14 +-
src/qemu/qemu_monitor_json.h | 14 +-
src/qemu/qemu_monitor_text.c | 16 +-
src/qemu/qemu_monitor_text.h | 14 +-
src/util/virnetdev.c | 29 ++--
src/util/virnetdev.h | 4 +-
src/xen/xend_internal.c | 3 +-
tests/networkxml2xmlin/hostdev-pf.xml | 11 +
tests/networkxml2xmlin/hostdev.xml | 10 +
tests/networkxml2xmlout/hostdev-pf.xml | 7 +
tests/networkxml2xmlout/hostdev.xml | 10 +
tests/networkxml2xmltest.c | 2 +
28 files changed, 890 insertions(+), 287 deletions(-)
create mode 100644 src/conf/device_conf.c
create mode 100644 src/conf/device_conf.h
create mode 100644 tests/networkxml2xmlin/hostdev-pf.xml
create mode 100644 tests/networkxml2xmlin/hostdev.xml
create mode 100644 tests/networkxml2xmlout/hostdev-pf.xml
create mode 100644 tests/networkxml2xmlout/hostdev.xml
--
1.7.4.4
2
9
26 Jul '12
---
tools/virsh.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 5658796..34ae171 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3097,6 +3097,10 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
vshError(ctl, "%s", _("option -d takes a numeric argument"));
exit(EXIT_FAILURE);
}
+ if (ctl->debug < VSH_ERR_DEBUG || ctl->debug > VSH_ERR_ERROR) {
+ vshError(ctl, _("ignoring debug level %d out of range [0-4]"),
+ ctl->debug);
+ }
break;
case 'h':
vshUsage();
--
1.7.8.6
2
3
Hi all,
When I create a LXC guest(RHEL5.4) via libvirt, the guest could boot
successfully. I could ping to guest, but can not ssh into the it. The
secure log in the guest shows that this is due to lack of '/dev/tty' device:
# tail /path/to/rootfs/of/container/var/log/secure
Jul 27 04:25:25 xen2143v sshd[671]: Accepted password for zhangyufang from
10.0.0.1 port 34102 ssh2
Jul 27 04:25:25 xen2143v sshd[671]: pam_unix(sshd:session): session opened
for user zhangyufang by (uid=0)
Jul 27 04:25:25 xen2143v sshd[671]: pam_loginuid(sshd:session):
set_loginuid failed
*Jul 27 04:25:25 xen2143v sshd[671]: error: PAM: pam_open_session(): Cannot
make/remove an entry for the specified session*
*Jul 27 04:25:25 xen2143v sshd[674]: error: open /dev/tty failed - could
not set controlling tty: No such file or directory*
*Jul 27 04:25:25 xen2143v sshd[673]: Received disconnect from 10.0.0.1: 11:
disconnected by user*
The xml of the guest:
# virsh --connect lxc:/// dumpxml instance-00000034
<domain type='lxc' id='30090'>
<name>instance-00000034</name>
<uuid>8387e0f1-6df3-41c8-82ba-cde7d2b60844</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64'>exe</type>
<init>/sbin/init</init>
</os>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/libvirt_lxc</emulator>
<filesystem type='mount' accessmode='passthrough'>
<source dir='/var/lib/nova/instances/instance-00000034/rootfs'/>
<target dir='/'/>
</filesystem>
<interface type='bridge'>
<mac address='fa:16:3e:3c:1d:95'/>
<source bridge='demonetbr0'/>
<target dev='veth0'/>
<filterref filter='nova-instance-instance-00000034-fa163e3c1d95'>
<parameter name='DHCPSERVER' value='10.0.0.1'/>
<parameter name='IP' value='10.0.0.3'/>
</filterref>
</interface>
<console type='pty' tty='/dev/pts/0'>
<source path='/dev/pts/0'/>
<target type='serial' port='0'/>
</console>
</devices>
</domain>
Could anyone point me to where the problem is? Thanks.
Best Regards.
Yufang
1
0
[libvirt] [PATCH 0/2] Refactor and fix error resetting on fallback paths in virsh
by Peter Krempa 26 Jul '12
by Peter Krempa 26 Jul '12
26 Jul '12
This series fixes places where errors were not reset correctly and adds a
function for resetting libvirt errors in virsh.
Peter Krempa (2):
virsh: Refactor error clearing on graceful fallback paths
virsh: Fix error resetting on fallback paths
tools/virsh-domain-monitor.c | 16 ++++++----------
tools/virsh-domain.c | 35 ++++++++++++-----------------------
tools/virsh-network.c | 3 +--
tools/virsh-pool.c | 3 +--
tools/virsh-snapshot.c | 19 +++++++------------
tools/virsh.c | 13 +++++++++++--
6 files changed, 38 insertions(+), 51 deletions(-)
--
1.7.8.6
1
3
26 Jul '12
v3: Add skip for block_pull not implemented
v2: Add skip block for qemu only and 120s timeout for test
v1: Add tests for block job lifecyle and the test flow is as follows:
create 50M qed img with qed backing img->
block pull->abort block job->resume block pull->set block job speed->
wait to finish
---
scripts/qemu/300-blockjob-lifecycle.t | 146 +++++++++++++++++++++++++++++++++
1 files changed, 146 insertions(+), 0 deletions(-)
create mode 100644 scripts/qemu/300-blockjob-lifecycle.t
diff --git a/scripts/qemu/300-blockjob-lifecycle.t b/scripts/qemu/300-blockjob-lifecycle.t
new file mode 100644
index 0000000..e43dfe2
--- /dev/null
+++ b/scripts/qemu/300-blockjob-lifecycle.t
@@ -0,0 +1,146 @@
+# -*- perl -*-
+#
+# Copyright (C) 2011-2012 Red Hat, Inc.
+# Copyright (C) 2011 Xiaoqiang Hu <xhu redhat com>
+#
+# This program is free software; You can redistribute it and/or modify
+# it under the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any
+# later version
+#
+# The file "LICENSE" distributed along with this file provides full
+# details of the terms and conditions
+#
+
+=pod
+
+=head1 NAME
+
+qemu/300-blockjob-lifecycle.t - verify the lifecycle of block job:
+block pull, set block job speed, get block job info and abort block job
+
+=head1 DESCRIPTION
+
+The test case validates that it is possible to block pull, set block job
+speed, get block job info and abort block job for domain using qed img
+with qed backing img
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More tests => 16;
+
+use Sys::Virt::TCK;
+use Test::Exception;
+use File::Spec::Functions qw(catfile);
+use File::stat;
+
+my $tck = Sys::Virt::TCK->new();
+my $conn = eval { $tck->setup(); };
+BAIL_OUT "failed to setup test harness: $@" if $@;
+END {
+ $tck->cleanup if $tck;
+}
+
+SKIP:{
+ skip "Only relevant to QEMU driver", 16 unless $conn->get_type() eq "QEMU";
+ my $xml = $tck->generic_pool("dir")
+ ->mode("0755")->as_xml;
+
+ diag "Defining transient storage pool $xml";
+ my $pool;
+
+ ok_pool(sub { $pool = $conn->define_storage_pool($xml) }, "define transient storage pool");
+ lives_ok(sub { $pool->build(0) }, "built storage pool");
+ lives_ok(sub { $pool->create }, "started storage pool");
+
+ my $volbackxml = $tck->generic_volume("tck-back", "qed", 1024*1024*50)->allocation(0)->as_xml;
+
+ my ($volback, $pathback);
+ diag "back $volbackxml";
+ ok_volume(sub { $volback = $pool->create_volume($volbackxml) }, "create qed backing file volume");
+
+ my $st;
+ $pathback = xpath($volback, "string(/volume/target/path)");
+ $st = stat($pathback);
+
+ ok($st, "path $pathback exists");
+
+ ok($st->size < 1024*1024, "size is < 1M");
+
+ my $volmainxml = $tck->generic_volume("tck-main", "qed", 1024*1024*50)
+ ->backing_file($pathback)
+ ->backing_format("qed")
+ ->allocation(0)->as_xml;
+
+ my ($volmain, $pathmain);
+ diag "main $volmainxml";
+ ok_volume(sub { $volmain = $pool->create_volume($volmainxml) }, "create qed backing file volume");
+
+ $pathmain = xpath($volmain, "string(/volume/target/path)");
+ $st = stat($pathmain);
+
+ ok($st, "path $pathmain exists");
+
+ ok($st->size < 1024*1024, "size is < 1M");
+
+ # define the guest at a qed image
+ # and the backing store in this qed image.
+ $xml = $tck->generic_domain("tck")
+ ->disk(format => { name => "qemu", type => "qed" },
+ type => "file",
+ src => $pathmain,
+ dst => "vdb")
+ ->as_xml;
+
+ diag "Defining an inactive domain config $xml";
+ my $dom;
+ ok_domain(sub { $dom = $conn->define_domain($xml) }, "defined persistent domain config");
+
+ diag "Starting inactive domain config";
+ $dom->create;
+ ok($dom->get_id() > 0, "running domain has an ID > 0");
+
+ # start to block pull and bandwidth is 1MB/S
+ my ($bandwidth, $flags, $jobinfo, $timeout);
+ # 1MB/S
+ $bandwidth = 1;
+ $flags=0;
+ eval { $dom->block_pull($pathmain, $bandwidth, $flags); };
+ SKIP: {
+ skip "block_pull not implemented", 5 if $@ && $@->code() == 55;
+
+ # $jobinfo is a hash reference summarising the execution state of the block job
+ # and it has four keys:cur, end, bandwidth, type
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ ok($jobinfo->{bandwidth} == $bandwidth, "start to block pull and block job bandwidth is $bandwidth"."MB/S");
+
+ $dom->abort_block_job($pathmain, $flags);
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ ok($jobinfo->{type} == 0, "abort block job");
+
+ $dom->block_pull($pathmain, $bandwidth, $flags);
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ ok($jobinfo->{bandwidth} == $bandwidth, "continue to block pull and block job bandwidth is $bandwidth"."MB/S");
+
+ # set block job bandwidth to 2MB/S
+ $bandwidth = 2;
+ $dom->set_block_job_speed($pathmain, $bandwidth, $flags);
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ ok($jobinfo->{bandwidth} == $bandwidth, "block job bandwidth is set to $bandwidth"."MB/S");
+
+ # wait for the end of block pull and timeout is 120s
+ $timeout = 120;
+ while($jobinfo->{cur} < $jobinfo->{end} && $jobinfo->{type} == 1 && $timeout > 0) {
+ sleep(1);
+ $jobinfo = $dom->get_block_job_info($pathmain, $flags);
+ $timeout--;
+ }
+
+ diag "block pull is not finished in 120S" if $jobinfo->{type} == 1 && $timeout == 0;
+ ok($jobinfo->{type} == 0, "block pull is finished");
+ }
+}
+# end
--
1.7.1
1
0
[libvirt] [PATCH] virsh: Check for existence of storage before undefining the domain
by Peter Krempa 26 Jul '12
by Peter Krempa 26 Jul '12
26 Jul '12
When undefining a domain and removing associated storage using "virsh
undefine --storage" the domain was at first undefined and after that the
storage removal proces was started. If the user specified an invalid
disk to remove, the error could not be corrected.
This patch moves enumeration and filtering of volumes that should be
removed before the domain is undefined, but the removal process is still
kept after the domain has been undefined.
---
tools/virsh.c | 280 +++++++++++++++++++++++++++++----------------------------
1 files changed, 144 insertions(+), 136 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 0354822..e6b8e5f 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -3007,6 +3007,12 @@ static const vshCmdOptDef opts_undefine[] = {
{NULL, 0, 0, NULL}
};
+typedef struct {
+ virStorageVolPtr vol;
+ char *source;
+ char *target;
+} vshUndefineVolume;
+
static bool
cmdUndefine(vshControl *ctl, const vshCmd *cmd)
{
@@ -3019,7 +3025,6 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
bool managed_save = vshCommandOptBool(cmd, "managed-save");
bool snapshots_metadata = vshCommandOptBool(cmd, "snapshots-metadata");
bool wipe_storage = vshCommandOptBool(cmd, "wipe-storage");
- bool remove_storage = false;
bool remove_all_storage = vshCommandOptBool(cmd, "remove-all-storage");
/* Positive if these items exist. */
int has_managed_save = 0;
@@ -3031,6 +3036,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
int rc = -1;
int running;
/* list of volumes to remove along with this domain */
+ vshUndefineVolume *vlist = NULL;
+ int nvols = 0;
const char *volumes_arg = NULL;
char *volumes = NULL;
char **volume_tokens = NULL;
@@ -3045,8 +3052,10 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
xmlXPathContextPtr ctxt = NULL;
xmlNodePtr *vol_nodes = NULL;
int nvolumes = 0;
- virStorageVolPtr vol = NULL;
- bool vol_del_failed = false;
+ bool vol_not_found = false;
+
+ ignore_value(vshCommandOptString(cmd, "storage", &volumes_arg));
+ volumes = vshStrdup(ctl, volumes_arg);
if (managed_save) {
flags |= VIR_DOMAIN_UNDEFINE_MANAGED_SAVE;
@@ -3063,36 +3072,21 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
- /* check if a string that should contain list of volumes to remove is present */
- if (vshCommandOptString(cmd, "storage", &volumes_arg) > 0) {
- volumes = vshStrdup(ctl, volumes_arg);
-
- if (remove_all_storage) {
- vshError(ctl, _("Specified both --storage and --remove-all-storage"));
- goto cleanup;
- }
- remove_storage = true;
- }
-
/* Do some flag manipulation. The goal here is to disable bits
* from flags to reduce the likelihood of a server rejecting
* unknown flag bits, as well as to track conditions which are
* safe by default for the given hypervisor and server version. */
- running = virDomainIsActive(dom);
- if (running < 0) {
- virshReportError(ctl);
- goto cleanup;
- }
+ if ((running = virDomainIsActive(dom)) < 0)
+ goto error;
+
if (!running) {
/* Undefine with snapshots only fails for inactive domains,
* and managed save only exists on inactive domains; if
* running, then we don't want to remove anything. */
has_managed_save = virDomainHasManagedSaveImage(dom, 0);
if (has_managed_save < 0) {
- if (last_error->code != VIR_ERR_NO_SUPPORT) {
- virshReportError(ctl);
- goto cleanup;
- }
+ if (last_error->code != VIR_ERR_NO_SUPPORT)
+ goto error;
virFreeError(last_error);
last_error = NULL;
has_managed_save = 0;
@@ -3100,10 +3094,8 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
has_snapshots = virDomainSnapshotNum(dom, 0);
if (has_snapshots < 0) {
- if (last_error->code != VIR_ERR_NO_SUPPORT) {
- virshReportError(ctl);
- goto cleanup;
- }
+ if (last_error->code != VIR_ERR_NO_SUPPORT)
+ goto error;
virFreeError(last_error);
last_error = NULL;
has_snapshots = 0;
@@ -3137,16 +3129,116 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd)
}
/* Stash domain description for later use */
- if (remove_storage || remove_all_storage) {
+ if (volumes || remove_all_storage) {
if (running) {
vshError(ctl, _("Storage volume deletion is supported only on stopped domains"));
goto cleanup;
}
+ if (volumes && remove_all_storage) {
+ vshError(ctl, _("Specified both --storage and --remove-all-storage"));
+ goto cleanup;
+ }
+
if (!(def = virDomainGetXMLDesc(dom, 0))) {
vshError(ctl, _("Could not retrieve domain XML description"));
goto cleanup;
}
+
+ if (!(doc = virXMLParseStringCtxt(def, _("(domain_definition)"),
+ &ctxt)))
+ goto error;
+
+ /* tokenize the string from user and save it's parts into an array */
+ if (volumes) {
+ /* count the delimiters */
+ volume_tok = volumes;
+ nvolume_tokens = 1; /* we need at least one member */
+ while (*volume_tok) {
+ if (*(volume_tok++) == ',')
+ nvolume_tokens++;
+ }
+
+ volume_tokens = vshCalloc(ctl, nvolume_tokens, sizeof(char *));
+
+ /* tokenize the input string */
+ nvolume_tokens = 0;
+ volume_tok = volumes;
+ do {
+ volume_tokens[nvolume_tokens] = strsep(&volume_tok, ",");
+ nvolume_tokens++;
+ } while (volume_tok);
+ }
+
+ if ((nvolumes = virXPathNodeSet("./devices/disk", ctxt,
+ &vol_nodes)) < 0)
+ goto error;
+
+ if (nvolumes > 0)
+ vlist = vshCalloc(ctl, nvolumes, sizeof(*vlist));
+
+ for (vol_i = 0; vol_i < nvolumes; vol_i++) {
+ ctxt->node = vol_nodes[vol_i];
+
+ /* get volume source and target paths */
+ if (!(target = virXPathString("string(./target/@dev)", ctxt)))
+ goto error;
+
+ if (!(source = virXPathString("string("
+ "./source/@file|"
+ "./source/@dir|"
+ "./source/@name|"
+ "./source/@dev)", ctxt))) {
+ if (last_error && last_error->code != VIR_ERR_OK)
+ goto error;
+ else
+ continue;
+ }
+
+ /* lookup if volume was selected by user */
+ if (volumes) {
+ volume_tok = NULL;
+ for (tok_i = 0; tok_i < nvolume_tokens; tok_i++) {
+ if (volume_tokens[tok_i] &&
+ (STREQ(volume_tokens[tok_i], target) ||
+ STREQ(volume_tokens[tok_i], source))) {
+ volume_tok = volume_tokens[tok_i];
+ volume_tokens[tok_i] = NULL;
+ break;
+ }
+ }
+ if (!volume_tok)
+ continue;
+ }
+
+ if (!(vlist[nvols].vol = virStorageVolLookupByPath(ctl->conn,
+ source))) {
+ vshPrint(ctl,
+ _("Storage volume '%s'(%s) is not managed by libvirt. "
+ "Remove it manually.\n"), target, source);
+ virFreeError(last_error);
+ last_error = NULL;
+ continue;
+ }
+ vlist[nvols].source = source;
+ vlist[nvols].target = target;
+ nvols++;
+ }
+
+ /* print volumes specified by user that were not found in domain definition */
+ if (volumes) {
+ for (tok_i = 0; tok_i < nvolume_tokens; tok_i++) {
+ if (volume_tokens[tok_i]) {
+ vshError(ctl, _("Volume '%s' was not found in domain's "
+ "definition.\n"),
+ volume_tokens[tok_i]);
+ vol_not_found = true;
+ }
+ }
+
+ if (vol_not_found)
+ goto cleanup;
+ }
}
/* Generally we want to try the new API first. However, while
@@ -3202,96 +3294,15 @@ out:
}
/* try to undefine storage volumes associated with this domain, if it's requested */
- if (remove_storage || remove_all_storage) {
- ret = false;
-
- /* tokenize the string from user and save it's parts into an array */
- if (volumes) {
- /* count the delimiters */
- volume_tok = volumes;
- nvolume_tokens = 1; /* we need at least one member */
- while (*volume_tok) {
- if (*volume_tok == ',')
- nvolume_tokens++;
- volume_tok++;
- }
-
- volume_tokens = vshCalloc(ctl, nvolume_tokens, sizeof(char *));
-
- /* tokenize the input string */
- nvolume_tokens = 0;
- volume_tok = volumes;
- do {
- volume_tokens[nvolume_tokens] = strsep(&volume_tok, ",");
- nvolume_tokens++;
- } while (volume_tok);
- }
-
- doc = virXMLParseStringCtxt(def, _("(domain_definition)"), &ctxt);
- if (!doc)
- goto cleanup;
-
- nvolumes = virXPathNodeSet("./devices/disk", ctxt, &vol_nodes);
-
- if (nvolumes < 0)
- goto cleanup;
-
- for (vol_i = 0; vol_i < nvolumes; vol_i++) {
- ctxt->node = vol_nodes[vol_i];
- VIR_FREE(target);
- VIR_FREE(source);
- if (vol) {
- virStorageVolFree(vol);
- vol = NULL;
- }
-
- /* get volume source and target paths */
- if (!(target = virXPathString("string(./target/@dev)", ctxt))) {
- vshError(ctl, _("Failed to enumerate devices"));
- goto cleanup;
- }
-
- if (!(source = virXPathString("string("
- "./source/@file|"
- "./source/@dir|"
- "./source/@name|"
- "./source/@dev)", ctxt)) &&
- virGetLastError())
- goto cleanup;
-
- /* lookup if volume was selected by user */
- if (volumes) {
- volume_tok = NULL;
- for (tok_i = 0; tok_i < nvolume_tokens; tok_i++) {
- if (volume_tokens[tok_i] &&
- (STREQ_NULLABLE(volume_tokens[tok_i], target) ||
- STREQ_NULLABLE(volume_tokens[tok_i], source))) {
- volume_tok = volume_tokens[tok_i];
- volume_tokens[tok_i] = NULL;
- break;
- }
- }
- if (!volume_tok)
- continue;
- }
-
- if (!source)
- continue;
-
- if (!(vol = virStorageVolLookupByPath(ctl->conn, source))) {
- vshPrint(ctl,
- _("Storage volume '%s'(%s) is not managed by libvirt. "
- "Remove it manually.\n"), target, source);
- virResetLastError();
- continue;
- }
-
+ if (nvols) {
+ for (vol_i = 0; vol_i < nvols; vol_i++) {
if (wipe_storage) {
- vshPrint(ctl, _("Wiping volume '%s'(%s) ... "), target, source);
+ vshPrint(ctl, _("Wiping volume '%s'(%s) ... "),
+ vlist[vol_i].target, vlist[vol_i].source);
fflush(stdout);
- if (virStorageVolWipe(vol, 0) < 0) {
+ if (virStorageVolWipe(vlist[vol_i].vol, 0) < 0) {
vshError(ctl, _("Failed! Volume not removed."));
- vol_del_failed = true;
+ ret = false;
continue;
} else {
vshPrint(ctl, _("Done.\n"));
@@ -3299,41 +3310,38 @@ out:
}
/* delete the volume */
- if (virStorageVolDelete(vol, 0) < 0) {
+ if (virStorageVolDelete(vlist[vol_i].vol, 0) < 0) {
vshError(ctl, _("Failed to remove storage volume '%s'(%s)"),
- target, source);
- vol_del_failed = true;
- }
- vshPrint(ctl, _("Volume '%s' removed.\n"), volume_tok?volume_tok:source);
- }
-
- /* print volumes specified by user that were not found in domain definition */
- if (volumes) {
- for (tok_i = 0; tok_i < nvolume_tokens; tok_i++) {
- if (volume_tokens[tok_i])
- vshPrint(ctl, _("Volume '%s' was not found in domain's "
- "definition.\n"),
- volume_tokens[tok_i]);
+ vlist[vol_i].target, vlist[vol_i].source);
+ ret = false;
+ } else {
+ vshPrint(ctl, _("Volume '%s'(%s) removed.\n"),
+ vlist[vol_i].target, vlist[vol_i].source);
}
}
-
- if (!vol_del_failed)
- ret = true;
}
cleanup:
- VIR_FREE(source);
- VIR_FREE(target);
+ for (vol_i = 0; vol_i < nvols; vol_i++) {
+ VIR_FREE(vlist[vol_i].source);
+ VIR_FREE(vlist[vol_i].target);
+ if (vlist[vol_i].vol)
+ virStorageVolFree(vlist[vol_i].vol);
+ }
+ VIR_FREE(vlist);
+
VIR_FREE(volumes);
VIR_FREE(volume_tokens);
VIR_FREE(def);
VIR_FREE(vol_nodes);
- if (vol)
- virStorageVolFree(vol);
xmlFreeDoc(doc);
xmlXPathFreeContext(ctxt);
virDomainFree(dom);
return ret;
+
+error:
+ virshReportError(ctl);
+ goto cleanup;
}
--
1.7.8.6
2
4
[libvirt] [PATCH v3] util: set minimum value of nodesuspend duration to 60 seconds
by Guannan Ren 26 Jul '12
by Guannan Ren 26 Jul '12
26 Jul '12
Change the permissible minimum value of nodesuspend duration time
to 60 seconds. If option is less than the value, reports error.
Update virsh help and manpage the infomation.
---
src/util/virnodesuspend.c | 2 +-
tools/virsh.c | 2 +-
tools/virsh.pod | 3 ++-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c
index 71beb3d..91dfdf6 100644
--- a/src/util/virnodesuspend.c
+++ b/src/util/virnodesuspend.c
@@ -90,7 +90,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime)
virCommandPtr setAlarmCmd;
int ret = -1;
- if (alarmTime <= MIN_TIME_REQ_FOR_SUSPEND) {
+ if (alarmTime < MIN_TIME_REQ_FOR_SUSPEND) {
virReportError(VIR_ERR_INVALID_ARG, "%s", _("Suspend duration is too short"));
return -1;
}
diff --git a/tools/virsh.c b/tools/virsh.c
index 6d65036..d236950 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -6986,7 +6986,7 @@ static const vshCmdInfo info_nodesuspend[] = {
static const vshCmdOptDef opts_node_suspend[] = {
{"target", VSH_OT_DATA, VSH_OFLAG_REQ, N_("mem(Suspend-to-RAM), "
"disk(Suspend-to-Disk), hybrid(Hybrid-Suspend)")},
- {"duration", VSH_OT_INT, VSH_OFLAG_REQ, N_("Suspend duration in seconds")},
+ {"duration", VSH_OT_INT, VSH_OFLAG_REQ, N_("Suspend duration in seconds, at least 60")},
{"flags", VSH_OT_INT, VSH_OFLAG_NONE, N_("Suspend flags, 0 for default")},
{NULL, 0, 0, NULL}
};
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 6ecf6ce..dffd588 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -290,7 +290,8 @@ If I<cell> is specified, this will prints specified cell statistics only.
Puts the node (host machine) into a system-wide sleep state such as
Suspend-to-RAM, Suspend-to-Disk or Hybrid-Suspend and sets up a
Real-Time-Clock interrupt to fire (to wake up the node) after a time delay
-specified by the 'duration' parameter.
+specified by the 'duration' parameter. The duration time should be
+at least 60 seconds.
=item B<capabilities>
--
1.7.7.5
2
2