[libvirt] [PATCH] filter new files through cppi, so syntax-check passes once again
by Jim Meyering
FYI, just pushed (no semantic change):
>From d0e79bd5fa280a568d5b919fabd5f2f4dacf8f89 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 26 Mar 2010 19:29:54 +0100
Subject: [PATCH] filter new files through cppi, so syntax-check passes once again
* src/conf/nwfilter_conf.h: Indent cpp directives.
* src/conf/nwfilter_params.h: Likewise.
* src/datatypes.h: Likewise.
* src/nwfilter/nwfilter_driver.h: Likewise.
* src/nwfilter/nwfilter_ebiptables_driver.h: Likewise.
* src/nwfilter/nwfilter_gentech_driver.h: Likewise.
---
src/conf/nwfilter_conf.h | 24 ++++++++++++------------
src/conf/nwfilter_params.h | 4 ++--
src/datatypes.h | 6 +++---
src/nwfilter/nwfilter_driver.h | 6 +++---
src/nwfilter/nwfilter_ebiptables_driver.h | 6 +++---
src/nwfilter/nwfilter_gentech_driver.h | 2 +-
6 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 5ba2f41..9b6ca40 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -24,15 +24,15 @@
* Author: Stefan Berger <stefanb(a)us.ibm.com>
*/
#ifndef NWFILTER_CONF_H
-#define NWFILTER_CONF_H
+# define NWFILTER_CONF_H
-#include <stdint.h>
-#include <stddef.h>
+# include <stdint.h>
+# include <stddef.h>
-#include "internal.h"
-#include "util.h"
-#include "hash.h"
-#include "xml.h"
+# include "internal.h"
+# include "util.h"
+# include "hash.h"
+# include "xml.h"
/**
* Chain suffix size is:
@@ -43,7 +43,7 @@
* terminating '0' =
* 32-3-15-1-1 = 12
*/
-#define MAX_CHAIN_SUFFIX_SIZE 12
+# define MAX_CHAIN_SUFFIX_SIZE 12
enum virNWFilterEntryItemFlags {
@@ -53,10 +53,10 @@ enum virNWFilterEntryItemFlags {
};
-#define HAS_ENTRY_ITEM(data) \
+# define HAS_ENTRY_ITEM(data) \
(((data)->flags) & NWFILTER_ENTRY_ITEM_FLAG_EXISTS)
-#define ENTRY_GET_NEG_SIGN(data) \
+# define ENTRY_GET_NEG_SIGN(data) \
((((data)->flags) & NWFILTER_ENTRY_ITEM_FLAG_IS_NEG) ? "!" : "")
// datatypes appearing in rule attributes
@@ -288,7 +288,7 @@ enum virNWFilterEbtablesTableType {
};
-#define MAX_RULE_PRIORITY 1000
+# define MAX_RULE_PRIORITY 1000
typedef struct _virNWFilterRuleDef virNWFilterRuleDef;
@@ -522,7 +522,7 @@ void virNWFilterConfLayerShutdown(void);
int virNWFilterParamConfLayerInit(void);
void virNWFilterParamConfLayerShutdown(void);
-#define virNWFilterReportError(conn, code, fmt...) \
+# define virNWFilterReportError(conn, code, fmt...) \
virReportErrorHelper(conn, VIR_FROM_NWFILTER, code, __FILE__, \
__FUNCTION__, __LINE__, fmt)
diff --git a/src/conf/nwfilter_params.h b/src/conf/nwfilter_params.h
index 7a9b1ee..5b4afba 100644
--- a/src/conf/nwfilter_params.h
+++ b/src/conf/nwfilter_params.h
@@ -20,9 +20,9 @@
* Author: Stefan Berger <stefanb(a)us.ibm.com>
*/
#ifndef NWFILTER_PARAMS_H
-#define NWFILTER_PARAMS_H
+# define NWFILTER_PARAMS_H
-#include "hash.h"
+# include "hash.h"
typedef struct _virNWFilterHashTable virNWFilterHashTable;
typedef virNWFilterHashTable *virNWFilterHashTablePtr;
diff --git a/src/datatypes.h b/src/datatypes.h
index c221119..4663c9c 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -126,9 +126,9 @@
* magic value used to protect the API when pointers to network filter
* pool structures are passed down by the users.
*/
-#define VIR_NWFILTER_MAGIC 0xDEAD7777
-#define VIR_IS_NWFILTER(obj) ((obj) && (obj)->magic==VIR_NWFILTER_MAGIC)
-#define VIR_IS_CONNECTED_NWFILTER(obj) (VIR_IS_NWFILTER(obj) && VIR_IS_CONNECT((obj)->conn))
+# define VIR_NWFILTER_MAGIC 0xDEAD7777
+# define VIR_IS_NWFILTER(obj) ((obj) && (obj)->magic==VIR_NWFILTER_MAGIC)
+# define VIR_IS_CONNECTED_NWFILTER(obj) (VIR_IS_NWFILTER(obj) && VIR_IS_CONNECT((obj)->conn))
/**
diff --git a/src/nwfilter/nwfilter_driver.h b/src/nwfilter/nwfilter_driver.h
index b7d8668..3f60560 100644
--- a/src/nwfilter/nwfilter_driver.h
+++ b/src/nwfilter/nwfilter_driver.h
@@ -26,10 +26,10 @@
*/
#ifndef __VIR_NWFILTER_DRIVER_H__
-#define __VIR_NWFILTER_DRIVER_H__
+# define __VIR_NWFILTER_DRIVER_H__
-#include "nwfilter_params.h"
-#include "nwfilter_conf.h"
+# include "nwfilter_params.h"
+# include "nwfilter_conf.h"
int nwfilterRegister(void);
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.h b/src/nwfilter/nwfilter_ebiptables_driver.h
index a036b99..ff22844 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.h
+++ b/src/nwfilter/nwfilter_ebiptables_driver.h
@@ -21,9 +21,9 @@
* Author: Stefan Berger <stefanb(a)us.ibm.com>
*/
#ifndef VIR_NWFILTER_EBTABLES_DRIVER_H__
-#define VIR_NWFILTER_EBTABLES_DRIVER_H__
+# define VIR_NWFILTER_EBTABLES_DRIVER_H__
-#define MAX_CHAINNAME_LENGTH 32 /* see linux/netfilter_bridge/ebtables.h */
+# define MAX_CHAINNAME_LENGTH 32 /* see linux/netfilter_bridge/ebtables.h */
enum RuleType {
RT_EBTABLES,
@@ -43,6 +43,6 @@ struct _ebiptablesRuleInst {
extern virNWFilterTechDriver ebiptables_driver;
-#define EBIPTABLES_DRIVER_ID "ebiptables"
+# define EBIPTABLES_DRIVER_ID "ebiptables"
#endif
diff --git a/src/nwfilter/nwfilter_gentech_driver.h b/src/nwfilter/nwfilter_gentech_driver.h
index a77d95a..6b7da71 100644
--- a/src/nwfilter/nwfilter_gentech_driver.h
+++ b/src/nwfilter/nwfilter_gentech_driver.h
@@ -21,7 +21,7 @@
* Author: Stefan Berger <stefanb(a)us.ibm.com>
*/
#ifndef __NWFILTER_GENTECH_DRIVER_H
-#define __NWFILTER_GENTECH_DRIVER_H
+# define __NWFILTER_GENTECH_DRIVER_H
virNWFilterTechDriverPtr virNWFilterTechDriverForName(const char *name);
--
1.7.0.3.448.g82eeb
15 years
[libvirt] [PATCH 0/3] Check CPU features during migration
by Jiri Denemark
Jiri Denemark (3):
cpuUpdate() for updating guest CPU according to host CPU
Helper function for making a deep-copy of virCPUDefPtr
Introduce UPDATE_CPU flag for virDomainGetXMLDesc
include/libvirt/libvirt.h.in | 5 +-
src/conf/cpu_conf.c | 37 ++++++++++
src/conf/cpu_conf.h | 3 +
src/cpu/cpu.c | 22 ++++++
src/cpu/cpu.h | 9 +++
src/cpu/cpu_generic.c | 1 +
src/cpu/cpu_x86.c | 161 +++++++++++++++++++++++++++++++++++++-----
src/libvirt.c | 3 +-
src/libvirt_private.syms | 2 +
src/qemu/qemu_driver.c | 54 ++++++++++++--
tools/virsh.c | 4 +
11 files changed, 273 insertions(+), 28 deletions(-)
15 years
[libvirt] [PATCH] Don't replace persistent domain config with migrated config
by Jiri Denemark
When a domain is defined on host1, migrated to host2 and then migrated
back to host1, its current configuration would overwrite the libvirtd's
in-memory copy of persistent configuration of that domain. This is not
desired as we want to preserve the persistent configuration untouched.
This patch introduces new 'live' parameter to virDomainAssignDef.
Passing 'true' for 'live' means the configuration passed to
virDomainAssignDef describes a configuration of live instance of the
domain. This applies for saved domains which are being restored or for
incoming domains during migration.
All callers have been changed to pass the appropriate value.
---
src/conf/domain_conf.c | 19 +++++++++++++------
src/conf/domain_conf.h | 5 ++++-
src/lxc/lxc_driver.c | 4 ++--
src/opennebula/one_driver.c | 4 ++--
src/openvz/openvz_driver.c | 4 ++--
src/qemu/qemu_driver.c | 10 +++++-----
src/test/test_driver.c | 10 +++++-----
src/uml/uml_driver.c | 4 ++--
8 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 22e1679..4cc27ff 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -749,18 +749,25 @@ static virDomainObjPtr virDomainObjNew(virCapsPtr caps)
virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
virDomainObjListPtr doms,
- const virDomainDefPtr def)
+ const virDomainDefPtr def,
+ bool live)
{
virDomainObjPtr domain;
char uuidstr[VIR_UUID_STRING_BUFLEN];
if ((domain = virDomainFindByUUID(doms, def->uuid))) {
if (!virDomainObjIsActive(domain)) {
- virDomainDefFree(domain->def);
- domain->def = def;
+ if (live) {
+ /* save current configuration to be restored on domain shutdown */
+ if (!domain->newDef)
+ domain->newDef = domain->def;
+ domain->def = def;
+ } else {
+ virDomainDefFree(domain->def);
+ domain->def = def;
+ }
} else {
- if (domain->newDef)
- virDomainDefFree(domain->newDef);
+ virDomainDefFree(domain->newDef);
domain->newDef = def;
}
@@ -5780,7 +5787,7 @@ virDomainObjPtr virDomainLoadConfig(virCapsPtr caps,
newVM = 0;
}
- if (!(dom = virDomainAssignDef(caps, doms, def)))
+ if (!(dom = virDomainAssignDef(caps, doms, def, false)))
goto error;
dom->autostart = autostart;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 44fff0c..9e6cb69 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -810,9 +810,12 @@ void virDomainObjRef(virDomainObjPtr vm);
/* Returns 1 if the object was freed, 0 if more refs exist */
int virDomainObjUnref(virDomainObjPtr vm);
+/* live == true means def describes an active domain (being migrated or
+ * restored) as opposed to a new persistent configuration of the domain */
virDomainObjPtr virDomainAssignDef(virCapsPtr caps,
virDomainObjListPtr doms,
- const virDomainDefPtr def);
+ const virDomainDefPtr def,
+ bool live);
void virDomainRemoveInactive(virDomainObjListPtr doms,
virDomainObjPtr dom);
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index ba13065..9786cc0 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -381,7 +381,7 @@ static virDomainPtr lxcDomainDefine(virConnectPtr conn, const char *xml)
}
if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, def)))
+ &driver->domains, def, false)))
goto cleanup;
def = NULL;
vm->persistent = 1;
@@ -1368,7 +1368,7 @@ lxcDomainCreateAndStart(virConnectPtr conn,
if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, def)))
+ &driver->domains, def, false)))
goto cleanup;
def = NULL;
diff --git a/src/opennebula/one_driver.c b/src/opennebula/one_driver.c
index e1d1efc..f7fbd46 100644
--- a/src/opennebula/one_driver.c
+++ b/src/opennebula/one_driver.c
@@ -251,7 +251,7 @@ static virDomainPtr oneDomainDefine(virConnectPtr conn, const char *xml)
goto return_point;
if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, def))) {
+ &driver->domains, def, false))) {
virDomainDefFree(def);
goto return_point;
}
@@ -456,7 +456,7 @@ oneDomainCreateAndStart(virConnectPtr conn,
}
if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, def))) {
+ &driver->domains, def, false))) {
virDomainDefFree(def);
goto return_point;
}
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 50aadfc..e0a0768 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -825,7 +825,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
goto cleanup;
}
if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, vmdef)))
+ &driver->domains, vmdef, false)))
goto cleanup;
vmdef = NULL;
vm->persistent = 1;
@@ -905,7 +905,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
goto cleanup;
}
if (!(vm = virDomainAssignDef(driver->caps,
- &driver->domains, vmdef)))
+ &driver->domains, vmdef, false)))
goto cleanup;
vmdef = NULL;
/* All OpenVZ domains seem to be persistent - this is a bit of a violation
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 257f914..2c81d68 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3563,7 +3563,7 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
if (!(vm = virDomainAssignDef(driver->caps,
&driver->domains,
- def)))
+ def, false)))
goto cleanup;
def = NULL;
@@ -5220,7 +5220,7 @@ static int qemudDomainRestore(virConnectPtr conn,
if (!(vm = virDomainAssignDef(driver->caps,
&driver->domains,
- def))) {
+ def, true))) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("failed to assign new VM"));
goto cleanup;
@@ -5761,7 +5761,7 @@ static virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
if (!(vm = virDomainAssignDef(driver->caps,
&driver->domains,
- def))) {
+ def, false))) {
goto cleanup;
}
def = NULL;
@@ -8391,7 +8391,7 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
if (!(vm = virDomainAssignDef(driver->caps,
&driver->domains,
- def))) {
+ def, true))) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("failed to assign new VM"));
goto cleanup;
@@ -8622,7 +8622,7 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
if (!(vm = virDomainAssignDef(driver->caps,
&driver->domains,
- def))) {
+ def, true))) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("failed to assign new VM"));
goto cleanup;
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index f54ebae..9a880f1 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -554,7 +554,7 @@ static int testOpenDefault(virConnectPtr conn) {
if (testDomainGenerateIfnames(conn, domdef) < 0)
goto error;
if (!(domobj = virDomainAssignDef(privconn->caps,
- &privconn->domains, domdef)))
+ &privconn->domains, domdef, false)))
goto error;
domdef = NULL;
@@ -910,7 +910,7 @@ static int testOpenFromFile(virConnectPtr conn,
if (testDomainGenerateIfnames(conn, def) < 0 ||
!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def))) {
+ &privconn->domains, def, false))) {
virDomainDefFree(def);
goto error;
}
@@ -1308,7 +1308,7 @@ testDomainCreateXML(virConnectPtr conn, const char *xml,
if (testDomainGenerateIfnames(conn, def) < 0)
goto cleanup;
if (!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def)))
+ &privconn->domains, def, false)))
goto cleanup;
def = NULL;
@@ -1853,7 +1853,7 @@ static int testDomainRestore(virConnectPtr conn,
if (testDomainGenerateIfnames(conn, def) < 0)
goto cleanup;
if (!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def)))
+ &privconn->domains, def, true)))
goto cleanup;
def = NULL;
@@ -2302,7 +2302,7 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
if (testDomainGenerateIfnames(conn, def) < 0)
goto cleanup;
if (!(dom = virDomainAssignDef(privconn->caps,
- &privconn->domains, def)))
+ &privconn->domains, def, false)))
goto cleanup;
def = NULL;
dom->persistent = 1;
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index bf06787..0c12469 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1283,7 +1283,7 @@ static virDomainPtr umlDomainCreate(virConnectPtr conn, const char *xml,
if (!(vm = virDomainAssignDef(driver->caps,
&driver->domains,
- def)))
+ def, false)))
goto cleanup;
def = NULL;
@@ -1619,7 +1619,7 @@ static virDomainPtr umlDomainDefine(virConnectPtr conn, const char *xml) {
if (!(vm = virDomainAssignDef(driver->caps,
&driver->domains,
- def)))
+ def, false)))
goto cleanup;
def = NULL;
vm->persistent = 1;
--
1.7.0.3
15 years
[libvirt] [PATCH 0/1] Disk error policy
by David Allan
Here's a revised patch for disk error policy XML incorporating the feedback from Dan and Daniel.
Dave
David Allan (1):
Add disk error policy to domain XML
docs/schemas/domain.rng | 12 +++++++-
src/conf/domain_conf.c | 18 +++++++++++
src/conf/domain_conf.h | 10 ++++++
src/libvirt_private.syms | 2 +-
src/qemu/qemu_conf.c | 17 +++++++++-
tests/qemuargv2xmltest.c | 3 ++
.../qemuxml2argv-disk-drive-error-policy-stop.args | 1 +
.../qemuxml2argv-disk-drive-error-policy-stop.xml | 32 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 3 ++
9 files changed, 94 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-error-policy-stop.xml
15 years
[libvirt] [PATCH] [RFC] Use enum of virDomainNetType
by Stefan Berger
To find out where the net type 'direct' needs to be handled I introduced
the 'enum virDomainNetType' in the virDomainNetDef structure and let the
compiler tell me where the case statement is missing. Then I added the
unhandled device statement to the UML driver.
Signed-off-by; Stefan Berger <stefanb(a)us.ibm.com>
Index: libvirt-plain/src/conf/domain_conf.h
===================================================================
--- libvirt-plain.orig/src/conf/domain_conf.h
+++ libvirt-plain/src/conf/domain_conf.h
@@ -251,7 +251,7 @@ enum virDomainNetdevMacvtapType {
typedef struct _virDomainNetDef virDomainNetDef;
typedef virDomainNetDef *virDomainNetDefPtr;
struct _virDomainNetDef {
- int type;
+ enum virDomainNetType type;
unsigned char mac[VIR_MAC_BUFLEN];
char *model;
union {
Index: libvirt-plain/src/lxc/lxc_driver.c
===================================================================
--- libvirt-plain.orig/src/lxc/lxc_driver.c
+++ libvirt-plain/src/lxc/lxc_driver.c
@@ -800,6 +800,16 @@ static int lxcSetupInterfaces(virConnect
case VIR_DOMAIN_NET_TYPE_BRIDGE:
bridge = def->nets[i]->data.bridge.brname;
break;
+
+ case VIR_DOMAIN_NET_TYPE_USER:
+ case VIR_DOMAIN_NET_TYPE_ETHERNET:
+ case VIR_DOMAIN_NET_TYPE_SERVER:
+ case VIR_DOMAIN_NET_TYPE_CLIENT:
+ case VIR_DOMAIN_NET_TYPE_MCAST:
+ case VIR_DOMAIN_NET_TYPE_INTERNAL:
+ case VIR_DOMAIN_NET_TYPE_DIRECT:
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ break;
}
DEBUG("bridge: %s", bridge);
Index: libvirt-plain/src/qemu/qemu_conf.c
===================================================================
--- libvirt-plain.orig/src/qemu/qemu_conf.c
+++ libvirt-plain/src/qemu/qemu_conf.c
@@ -2686,6 +2686,14 @@ qemuBuildHostNetStr(virDomainNetDefPtr n
net->data.socket.address,
net->data.socket.port);
break;
+ case VIR_DOMAIN_NET_TYPE_USER:
+ case VIR_DOMAIN_NET_TYPE_ETHERNET:
+ case VIR_DOMAIN_NET_TYPE_NETWORK:
+ case VIR_DOMAIN_NET_TYPE_BRIDGE:
+ case VIR_DOMAIN_NET_TYPE_INTERNAL:
+ case VIR_DOMAIN_NET_TYPE_DIRECT:
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ break;
}
type_sep = ',';
break;
Index: libvirt-plain/src/uml/uml_conf.c
===================================================================
--- libvirt-plain.orig/src/uml/uml_conf.c
+++ libvirt-plain/src/uml/uml_conf.c
@@ -244,6 +244,14 @@ umlBuildCommandLineNet(virConnectPtr con
umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
_("internal networking type not supported"));
goto error;
+
+ case VIR_DOMAIN_NET_TYPE_DIRECT:
+ umlReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
+ _("direct networking type not supported"));
+ goto error;
+
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ break;
}
virBufferVSprintf(&buf, ",%02x:%02x:%02x:%02x:%02x:%02x",
Index: libvirt-plain/src/conf/domain_conf.c
===================================================================
--- libvirt-plain.orig/src/conf/domain_conf.c
+++ libvirt-plain/src/conf/domain_conf.c
@@ -450,6 +450,10 @@ void virDomainNetDefFree(virDomainNetDef
case VIR_DOMAIN_NET_TYPE_DIRECT:
VIR_FREE(def->data.direct.linkdev);
break;
+
+ case VIR_DOMAIN_NET_TYPE_USER:
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ break;
}
VIR_FREE(def->ifname);
@@ -1740,7 +1744,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
type = virXMLPropString(node, "type");
if (type != NULL) {
- if ((def->type = virDomainNetTypeFromString(type)) < 0) {
+ if ((int)(def->type = virDomainNetTypeFromString(type)) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown interface type '%s'"), type);
goto error;
@@ -1949,6 +1953,10 @@ virDomainNetDefParseXML(virCapsPtr caps,
dev = NULL;
break;
+
+ case VIR_DOMAIN_NET_TYPE_USER:
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ break;
}
if (ifname != NULL) {
@@ -4861,6 +4869,10 @@ virDomainNetDefFormat(virBufferPtr buf,
virDomainNetdevMacvtapTypeToString(def->data.direct.mode));
virBufferAddLit(buf, "/>\n");
break;
+
+ case VIR_DOMAIN_NET_TYPE_USER:
+ case VIR_DOMAIN_NET_TYPE_LAST:
+ break;
}
if (def->ifname)
15 years
Re: [libvirt] [Qemu-devel] Re: Supporting hypervisor specific APIs in libvirt
by Anthony Liguori
On 03/23/2010 10:57 AM, Paul Brook wrote:
>>> I think there is a serious divergence of approach there, instanciating
>>> API stating 'we are gonna deprecate them sooner or later' tell the
>>> application developper 'my time is more important than yours' and not
>>> really something I like to carry to the API users.
>>> The main goal of libvirt remains to provide APIs needed to unify the
>>> development of the virtualization layers. Having APIs which makes
>>> sense only for one or 2 virtualization engines is not a problem in
>>> itself, it just raises questions about the actual semantic of that API.
>>> If that semantic is sound, then I see no reason to not add it, really
>>> and we actually often do.
>>>
>> Yeah, but the problem we're facing is, I want there to be an API added
>> to the management layer as part of the feature commit in qemu. If there
>> has to be a discussion and decisions about how to model the API, it's
>> not going to be successful.
>>
> I thought the monitor protocol *was* our API. If not, why not?
>
It is. But our API is missing key components like guest enumeration.
So the fundamental topic here is, do we introduce these missing
components to allow people to build directly to our interface or do we
make use of the functionality that libvirt already provides if they can
plumb our API directly to users.
Regards,
Anthony Liguori
> Paul
>
15 years
[libvirt] [PATCH] Mention direct device support since 0.7.7 in web doc
by Stefan Berger
In the web documentation mention that the direct device support is there
since libvirt 0.7.7. A Linux kernel 2.6.34 is required for macvtap to be
available as standard device.
Index: libvirt-plain/docs/formatdomain.html.in
===================================================================
--- libvirt-plain.orig/docs/formatdomain.html.in
+++ libvirt-plain/docs/formatdomain.html.in
@@ -741,8 +741,11 @@
<p>
Provides direct attachment of the virtual machine's NIC to the given
- physial interface of the host. This setup requires the Linux macvtap
- driver to be available. One of the modes 'vepa'
+ physial interface of the host.
+ <span class="since">Since 0.7.7 (QEMU and KVM only)</span><br>
+ This setup requires the Linux macvtap
+ driver to be available. <span class="since">(Since Linux 2.6.34.)</span>
+ One of the modes 'vepa'
( <a href="http://www.ieee802.org/1/files/public/docs2009/new-evb-congdon-vepa-modul...">
'Virtual Ethernet Port Aggregator'</a>), 'bridge' or 'private'
can be chosen for the operation mode of the macvtap device, 'vepa'
15 years
[libvirt] [PATCH] Fix QEMU cpu affinity at startup to include all threads
by Daniel P. Berrange
The QEMU cpu affinity is used in NUMA scenarios to ensure that
guest memory is allocated from a specific node. Normally memory
is allocate on demand in vCPU threads, but when using hugepages
the initial thread leader allocates memory upfront. libvirt was
not setting affinity of the thread leader, or I/O threads. This
patch changes the code to set the process affinity in between
the fork()/exec() of QEMU. This ensures that every single QEMU
thread gets the affinity
* src/qemu/qemu_driver.c: Set affinity on entire QEMU process
at startup
---
src/qemu/qemu_driver.c | 29 ++++++++++++++++-------------
1 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 257f914..2598deb 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1701,6 +1701,9 @@ qemuDetectVcpuPIDs(struct qemud_driver *driver,
return 0;
}
+/*
+ * To be run between fork/exec of QEMU only
+ */
static int
qemudInitCpuAffinity(virDomainObjPtr vm)
{
@@ -1708,7 +1711,8 @@ qemudInitCpuAffinity(virDomainObjPtr vm)
virNodeInfo nodeinfo;
unsigned char *cpumap;
int cpumaplen;
- qemuDomainObjPrivatePtr priv = vm->privateData;
+
+ DEBUG0("Setting CPU affinity");
if (nodeGetInfo(NULL, &nodeinfo) < 0)
return -1;
@@ -1740,14 +1744,14 @@ qemudInitCpuAffinity(virDomainObjPtr vm)
VIR_USE_CPU(cpumap, i);
}
- /* The XML config only gives a per-VM affinity, so we apply
- * the same mapping to all vCPUs */
- for (i = 0 ; i < priv->nvcpupids ; i++) {
- if (virProcessInfoSetAffinity(priv->vcpupids[i],
- cpumap, cpumaplen, maxcpu) < 0) {
- VIR_FREE(cpumap);
- return -1;
- }
+ /* We are assuming we are running between fork/exec of QEMU, so
+ * that getpid() gives the QEMU process ID and we know that
+ * no threads are running.
+ */
+ if (virProcessInfoSetAffinity(getpid(),
+ cpumap, cpumaplen, maxcpu) < 0) {
+ VIR_FREE(cpumap);
+ return -1;
}
VIR_FREE(cpumap);
@@ -2653,6 +2657,9 @@ struct qemudHookData {
static int qemudSecurityHook(void *data) {
struct qemudHookData *h = data;
+ if (qemudInitCpuAffinity(h->vm) < 0)
+ return -1;
+
if (qemuAddToCgroup(h->driver, h->vm->def) < 0)
return -1;
@@ -2943,10 +2950,6 @@ static int qemudStartVMDaemon(virConnectPtr conn,
if (qemuDetectVcpuPIDs(driver, vm) < 0)
goto abort;
- DEBUG0("Setting CPU affinity");
- if (qemudInitCpuAffinity(vm) < 0)
- goto abort;
-
DEBUG0("Setting any required VM passwords");
if (qemuInitPasswords(conn, driver, vm, qemuCmdFlags) < 0)
goto abort;
--
1.6.2.5
15 years
[libvirt] [PATCH][Network] Make dhcp service enabled only if //ip/dhcp exists in network xml
by Satoru SATOH
Libvirtd enabls DHCP service on virtual networks even if the element
'//ip/dhcp' does not exist in the network xml. The following patch fixes
this problem.
Signed-off-by: Satoru SATOH <satoru.satoh(a)gmail.com>
---
src/conf/network_conf.c | 2 ++
src/conf/network_conf.h | 2 ++
src/network/bridge_driver.c | 5 +----
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 1f3a44c..e41775a 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -466,6 +466,8 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
if ((ip = virXPathNode("./ip[1]", ctxt)) &&
virNetworkIPParseXML(def, ip) < 0)
goto error;
+
+ def->dhcp = (virXPathNode("./ip/dhcp", ctxt) != NULL ? 1 : 0);
}
diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h
index 127a23a..847ddd3 100644
--- a/src/conf/network_conf.h
+++ b/src/conf/network_conf.h
@@ -74,6 +74,8 @@ struct _virNetworkDef {
char *netmask;
char *network;
+ unsigned int dhcp;
+
unsigned int nranges; /* Zero or more dhcp ranges */
virNetworkDHCPRangeDefPtr ranges;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 83ab00e..6dcf7b4 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -943,12 +943,9 @@ static int networkStartNetworkDaemon(struct network_driver *driver,
goto err_delbr2;
}
- if ((network->def->ipAddress ||
- network->def->nranges) &&
- dhcpStartDhcpDaemon(network) < 0)
+ if (network->def->dhcp && dhcpStartDhcpDaemon(network) < 0)
goto err_delbr2;
-
/* Persist the live configuration now we have bridge info */
if (virNetworkSaveConfig(NETWORK_STATE_DIR, network->def) < 0) {
goto err_kill;
--
1.6.2.5
15 years