[libvirt] RPM spec file patch
by Chris Picton
Hi
Please accept the following patch to the rpm spec file.
It allows me to enable specific options (like openvz) at the build
comand line, even if they have been disabled by OS feature selection.
eg for an openvz build on centos 6
rpmbuild -bb \
--define 'rhel 6' \
--without dtrace \
--without sanlock \
--without netcf \
--with openvz \
libvirt.spec
Regards
Chris
(Not subscribed to the mailing list)
13 years, 4 months
[libvirt] virDomainBlockJobAbort and block_job_cancel
by Stefan Hajnoczi
Block job cancellation waits until the job has been cancelled before
returning. This allows clients to know that the operation has been
cancelled successfully. Unfortunately, these semantics are not really
possible with today's QEMU and libvirt code.
A command that waits for block I/O completion may wait for many
minutes. During this time the monitor is unavailable. While the QMP
protocol may in theory support multiple in-flight commands, both QEMU
and libvirt's implemenations are geared towards one command at a time.
So in practice a hung cancellation command would make the monitor
unavailable - we need to avoid this.
This means block_job_cancel cannot wait until the job is cancelled or
it risks hanging the monitor if there is a block I/O timeout. We need
a solution that reflects this in QEMU and libvirt, here is what I
propose:
block_job_cancel returns immediately upon marking the job cancelled.
The job may still be finishing block I/O but will cancel itself at
some point in the future. When the job actually completes it raises
the new BLOCK_JOB_CANCELLED event.
This means that virDomainBlockJobAbort() returns to the client without
a guarantee that the job has completed. If the client enumerates jobs
it may still see a job that has not finished cancelling. The client
must register a handler for the BLOCK_JOB_CANCELLED event if it wants
to know when the job really goes away. The BLOCK_JOB_CANCELLED event
has the same fields as the BLOCK_JOB_COMPLETED event, except it lacks
the optional "error" message field.
The impact on clients is that they need to add a BLOCK_JOB_CANCELLED
handler if they really want to wait. Most clients today (not many
exist) will be fine without waiting for cancellation.
Any objections or thoughts on this?
Stefan
13 years, 4 months
[libvirt] [PATCH] When checking nttyFDs to see if it is != 1, be sure to use '1' and not '-1'
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
* src/lxc/lxc_controller.c: Fix check for tty count
---
src/lxc/lxc_controller.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 43414ba..bb936ee 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1388,9 +1388,9 @@ lxcControllerRun(virDomainDefPtr def,
VIR_FREE(devptmx);
}
} else {
- if (nttyFDs != -1) {
- lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("Expected exactly one TTY fd"));
+ if (nttyFDs != 1) {
+ lxcError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Expected exactly one TTY fd, but got %zu"), nttyFDs);
goto cleanup;
}
}
--
1.7.7.3
13 years, 4 months
[libvirt] [PATCH] Fix installation of libvirt-guests.service
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The installation rules for the libvirt-guests.service were
totally broken
- Installing in the wrong location
- The location was not overridable
- The install-systemd rule was not invoked anywhere
- The install-systemd rule was not invoking install-initscript
which it depends on
- The installed service file lacked a .service extension
* tools/Makefile.am: Fix install of libvirt-guests.service
---
tools/Makefile.am | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index c735398..25f0ffe 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -148,9 +148,9 @@ endif
virsh.1: virsh.pod
$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@
-install-data-local: install-init
+install-data-local: install-init install-systemd
-uninstall-local: uninstall-init
+uninstall-local: uninstall-init uninstall-systemd
install-sysconfig:
mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig
@@ -162,17 +162,20 @@ uninstall-sysconfig:
EXTRA_DIST += libvirt-guests.init.sh
-if LIBVIRT_INIT_SCRIPT_RED_HAT
-install-init: libvirt-guests.init install-sysconfig
+install-initscript: libvirt-guests.init
mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d
$(INSTALL_SCRIPT) libvirt-guests.init \
$(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
-uninstall-init: install-sysconfig
+uninstall-initscript:
rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirt-guests
-BUILT_SOURCES += libvirt-guests.init
+
+if LIBVIRT_INIT_SCRIPT_RED_HAT
+BUILT_SOURCES += libvirt-guests.init
+install-init: install-sysconfig install-initscript
+uninstall-init: uninstall-sysconfig uninstall-initscript
else
install-init:
uninstall-init:
@@ -194,14 +197,16 @@ libvirt-guests.init: libvirt-guests.init.sh $(top_builddir)/config.status
EXTRA_DIST += libvirt-guests.service.in
+SYSTEMD_UNIT_DIR = /lib/systemd/system
+
if LIBVIRT_INIT_SCRIPT_SYSTEMD
-install-systemd: libvirt-guests.service install-sysconfig
- mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/systemd.d
+install-systemd: libvirt-guests.service install-initscript install-sysconfig
+ mkdir -p $(DESTDIR)$(SYSTEMD_UNIT_DIR)
$(INSTALL_SCRIPT) libvirt-guests.service \
- $(DESTDIR)$(sysconfdir)/rc.d/systemd.d/libvirt-guests
+ $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
-uninstall-systemd: install-sysconfig
- rm -f $(DESTDIR)$(sysconfdir)/rc.d/systemd.d/libvirt-guests
+uninstall-systemd: uninstall-initscript uninstall-sysconfig
+ rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/libvirt-guests.service
BUILT_SOURCES += libvirt-guests.service
--
1.7.7.3
13 years, 4 months
[libvirt] [PATCH] Ensure to prefix %{buildroot} when overriding systemd install location
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The %makeinstall macro does not set DESTDIR, instead of explicitly
prefixes %{buildroot} onto all paths. Thus we need todo the same
when setting the systemd unit dir
* libvirt.spec.in: Prefix %{buildroot} onto %{unitdir}
---
libvirt.spec.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 4fe1c6a..80c5c1f 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -776,7 +776,7 @@ gzip -9 ChangeLog
%install
rm -fr %{buildroot}
-%makeinstall SYSTEMD_UNIT_DIR=%{_unitdir}
+%makeinstall SYSTEMD_UNIT_DIR=%{buildroot}%{_unitdir}
for i in domain-events/events-c dominfo domsuspend hellolibvirt openauth python xml/nwfilter systemtap
do
(cd examples/$i ; make clean ; rm -rf .deps .libs Makefile Makefile.in)
--
1.7.7.3
13 years, 4 months
[libvirt] [PATCH 2/2] nwfilter: Pass the VM operation type into the nwfilter subsystem
by Stefan Berger
Another preparatory patch for DHCP snooping where we want to be able to
differentiate between a VM start/interface attach and other operations
like VM resume and libvirtd restart so that upon VM start we can internally
discard all DHCP leases that may still be active for a VM's interface
identified by its MAC address (and the VM's UUID). This then helps to prevent
installation of filters with IP addresses from a previous run of the VM upon
for example a libvird restart or a 'kill -SIGHUP':
Pass the VM operation into the nwfilter subsystem. Also this parameter
currently is an ATTRIBUTE_UNUSED in 'virNWFilterInstantiate' until the
DHCP snooping patches make use of it.
I am 'abusing' the enum type originally introduced for 802.1Qb{g|h} to
determine what type of operation is being used. Introducing another type
probably doesn't make much sense but maybe renaming this enum type to
something like 'virVMOperation' would?
---
src/conf/domain_nwfilter.c | 3 ++-
src/conf/domain_nwfilter.h | 2 ++
src/lxc/lxc_driver.c | 10 ++++++++--
src/nwfilter/nwfilter_driver.c | 3 ++-
src/nwfilter/nwfilter_gentech_driver.c | 15 +++++++++++----
src/nwfilter/nwfilter_gentech_driver.h | 1 +
src/qemu/qemu_command.c | 8 +++++---
src/qemu/qemu_command.h | 1 +
src/qemu/qemu_hotplug.c | 4 +++-
src/qemu/qemu_process.c | 7 +++++--
src/uml/uml_conf.c | 14 +++++++++-----
src/uml/uml_conf.h | 3 ++-
src/uml/uml_driver.c | 3 ++-
13 files changed, 53 insertions(+), 21 deletions(-)
Index: libvirt-acl/src/conf/domain_nwfilter.c
===================================================================
--- libvirt-acl.orig/src/conf/domain_nwfilter.c
+++ libvirt-acl/src/conf/domain_nwfilter.c
@@ -38,9 +38,10 @@ virDomainConfNWFilterRegister(virDomainC
int
virDomainConfNWFilterInstantiate(virConnectPtr conn,
const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp,
virDomainNetDefPtr net) {
if (nwfilterDriver != NULL)
- return nwfilterDriver->instantiateFilter(conn, vmuuid, net);
+ return nwfilterDriver->instantiateFilter(conn, vmuuid, vmOp, net);
/* driver module not available -- don't indicate failure */
return 0;
}
Index: libvirt-acl/src/conf/domain_nwfilter.h
===================================================================
--- libvirt-acl.orig/src/conf/domain_nwfilter.h
+++ libvirt-acl/src/conf/domain_nwfilter.h
@@ -25,6 +25,7 @@
typedef int (*virDomainConfInstantiateNWFilter)(virConnectPtr conn,
const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp,
virDomainNetDefPtr net);
typedef void (*virDomainConfTeardownNWFilter)(virDomainNetDefPtr net);
@@ -38,6 +39,7 @@ void virDomainConfNWFilterRegister(virDo
int virDomainConfNWFilterInstantiate(virConnectPtr conn,
const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp,
virDomainNetDefPtr net);
void virDomainConfNWFilterTeardown(virDomainNetDefPtr net);
void virDomainConfVMNWFilterTeardown(virDomainObjPtr vm);
Index: libvirt-acl/src/nwfilter/nwfilter_driver.c
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_driver.c
+++ libvirt-acl/src/nwfilter/nwfilter_driver.c
@@ -444,9 +444,10 @@ cleanup:
static int
nwfilterInstantiateFilter(virConnectPtr conn,
const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp,
virDomainNetDefPtr net)
{
- return virNWFilterInstantiateFilter(conn, vmuuid, net);
+ return virNWFilterInstantiateFilter(conn, vmuuid, vmOp, net);
}
Index: libvirt-acl/src/nwfilter/nwfilter_gentech_driver.c
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_gentech_driver.c
+++ libvirt-acl/src/nwfilter/nwfilter_gentech_driver.c
@@ -627,6 +627,7 @@ virNWFilterRuleInstancesToArray(int nEnt
*/
static int
virNWFilterInstantiate(const unsigned char *vmuuid ATTRIBUTE_UNUSED,
+ enum virNetDevVPortProfileOp vmOp ATTRIBUTE_UNUSED,
virNWFilterTechDriverPtr techdriver,
enum virDomainNetType nettype,
virNWFilterDefPtr filter,
@@ -764,6 +765,7 @@ err_unresolvable_vars:
*/
static int
__virNWFilterInstantiateFilter(const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp,
bool teardownOld,
const char *ifname,
int ifindex,
@@ -856,7 +858,7 @@ __virNWFilterInstantiateFilter(const uns
break;
}
- rc = virNWFilterInstantiate(vmuuid,
+ rc = virNWFilterInstantiate(vmuuid, vmOp,
techdriver,
nettype,
filter,
@@ -888,6 +890,7 @@ err_exit:
static int
_virNWFilterInstantiateFilter(virConnectPtr conn,
const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp,
const virDomainNetDefPtr net,
bool teardownOld,
enum instCase useNewFilter,
@@ -913,7 +916,7 @@ _virNWFilterInstantiateFilter(virConnect
goto cleanup;
}
- rc = __virNWFilterInstantiateFilter(vmuuid,
+ rc = __virNWFilterInstantiateFilter(vmuuid, vmOp,
teardownOld,
net->ifname,
ifindex,
@@ -951,6 +954,7 @@ virNWFilterInstantiateFilterLate(const u
virNWFilterLockFilterUpdates();
rc = __virNWFilterInstantiateFilter(vmuuid,
+ VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
true,
ifname,
ifindex,
@@ -982,11 +986,12 @@ virNWFilterInstantiateFilterLate(const u
int
virNWFilterInstantiateFilter(virConnectPtr conn,
const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp,
const virDomainNetDefPtr net)
{
bool foundNewFilter = false;
- return _virNWFilterInstantiateFilter(conn, vmuuid, net,
+ return _virNWFilterInstantiateFilter(conn, vmuuid, vmOp, net,
1,
INSTANTIATE_ALWAYS,
&foundNewFilter);
@@ -1001,7 +1006,9 @@ virNWFilterUpdateInstantiateFilter(virCo
{
bool foundNewFilter = false;
- int rc = _virNWFilterInstantiateFilter(conn, vmuuid, net,
+ int rc = _virNWFilterInstantiateFilter(conn, vmuuid,
+ VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
+ net,
0,
INSTANTIATE_FOLLOW_NEWFILTER,
&foundNewFilter);
Index: libvirt-acl/src/nwfilter/nwfilter_gentech_driver.h
===================================================================
--- libvirt-acl.orig/src/nwfilter/nwfilter_gentech_driver.h
+++ libvirt-acl/src/nwfilter/nwfilter_gentech_driver.h
@@ -39,6 +39,7 @@ enum instCase {
int virNWFilterInstantiateFilter(virConnectPtr conn,
const unsigned char *vmuuid,
+ enum virNetDevVPortProfileOp vmOp,
const virDomainNetDefPtr net);
int virNWFilterUpdateInstantiateFilter(virConnectPtr conn,
const unsigned char *vmuuid,
Index: libvirt-acl/src/qemu/qemu_command.c
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_command.c
+++ libvirt-acl/src/qemu/qemu_command.c
@@ -171,6 +171,7 @@ qemuPhysIfaceConnect(virDomainDefPtr def
int
qemuNetworkIfaceConnect(virDomainDefPtr def,
virConnectPtr conn,
+ enum virNetDevVPortProfileOp vmOp,
struct qemud_driver *driver,
virDomainNetDefPtr net,
virBitmapPtr qemuCaps)
@@ -275,7 +276,8 @@ qemuNetworkIfaceConnect(virDomainDefPtr
if (tapfd >= 0) {
if ((net->filter) && (net->ifname)) {
- if (virDomainConfNWFilterInstantiate(conn, def->uuid, net) < 0)
+ if (virDomainConfNWFilterInstantiate(conn, def->uuid, vmOp,
+ net) < 0)
VIR_FORCE_CLOSE(tapfd);
}
}
@@ -4339,8 +4341,8 @@ qemuBuildCommandLine(virConnectPtr conn,
actualType = virDomainNetGetActualType(net);
if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
actualType == VIR_DOMAIN_NET_TYPE_BRIDGE) {
- int tapfd = qemuNetworkIfaceConnect(def, conn, driver, net,
- qemuCaps);
+ int tapfd = qemuNetworkIfaceConnect(def, conn, vmop, driver,
+ net, qemuCaps);
if (tapfd < 0)
goto error;
Index: libvirt-acl/src/lxc/lxc_driver.c
===================================================================
--- libvirt-acl.orig/src/lxc/lxc_driver.c
+++ libvirt-acl/src/lxc/lxc_driver.c
@@ -1184,6 +1184,7 @@ static void lxcVmCleanup(lxc_driver_t *d
static int lxcSetupInterfaceBridged(virConnectPtr conn,
virDomainDefPtr vm,
+ enum virNetDevVPortProfileOp vmOp,
virDomainNetDefPtr net,
const char *brname,
unsigned int *nveths,
@@ -1228,7 +1229,8 @@ static int lxcSetupInterfaceBridged(virC
}
if (net->filter &&
- virDomainConfNWFilterInstantiate(conn, vm->uuid, net) < 0)
+ virDomainConfNWFilterInstantiate(conn, vm->uuid, vmOp,
+ net) < 0)
goto cleanup;
ret = 0;
@@ -1319,6 +1321,7 @@ cleanup:
*/
static int lxcSetupInterfaces(virConnectPtr conn,
virDomainDefPtr def,
+ enum virNetDevVPortProfileOp vmOp,
unsigned int *nveths,
char ***veths)
{
@@ -1349,6 +1352,7 @@ static int lxcSetupInterfaces(virConnect
if (lxcSetupInterfaceBridged(conn,
def,
+ vmOp,
def->nets[i],
brname,
nveths,
@@ -1368,6 +1372,7 @@ static int lxcSetupInterfaces(virConnect
}
if (lxcSetupInterfaceBridged(conn,
def,
+ vmOp,
def->nets[i],
brname,
nveths,
@@ -1818,7 +1823,8 @@ static int lxcVmStart(virConnectPtr conn
}
}
- if (lxcSetupInterfaces(conn, vm->def, &nveths, &veths) != 0)
+ if (lxcSetupInterfaces(conn, vm->def, VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ &nveths, &veths) != 0)
goto cleanup;
/* Save the configuration for the controller */
Index: libvirt-acl/src/qemu/qemu_command.h
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_command.h
+++ libvirt-acl/src/qemu/qemu_command.h
@@ -126,6 +126,7 @@ char * qemuBuildRedirdevDevStr(virDomain
int qemuNetworkIfaceConnect(virDomainDefPtr def,
virConnectPtr conn,
+ enum virNetDevVPortProfileOp vmOp,
struct qemud_driver *driver,
virDomainNetDefPtr net,
virBitmapPtr qemuCaps)
Index: libvirt-acl/src/qemu/qemu_hotplug.c
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_hotplug.c
+++ libvirt-acl/src/qemu/qemu_hotplug.c
@@ -669,7 +669,9 @@ int qemuDomainAttachNetDevice(virConnect
actualType = virDomainNetGetActualType(net);
if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
actualType == VIR_DOMAIN_NET_TYPE_NETWORK) {
- if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn, driver, net,
+ if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
+ driver, net,
priv->qemuCaps)) < 0)
goto cleanup;
iface_connected = true;
Index: libvirt-acl/src/qemu/qemu_process.c
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_process.c
+++ libvirt-acl/src/qemu/qemu_process.c
@@ -2310,6 +2310,7 @@ qemuProcessNotifyNets(virDomainDefPtr de
static int
qemuProcessFiltersInstantiate(virConnectPtr conn,
+ enum virNetDevVPortProfileOp vmOp,
virDomainDefPtr def)
{
int err = 0;
@@ -2321,7 +2322,8 @@ qemuProcessFiltersInstantiate(virConnect
for (i = 0 ; i < def->nnets ; i++) {
virDomainNetDefPtr net = def->nets[i];
if ((net->filter) && (net->ifname)) {
- if (virDomainConfNWFilterInstantiate(conn, def->uuid, net) < 0) {
+ if (virDomainConfNWFilterInstantiate(conn, def->uuid, vmOp,
+ net) < 0) {
err = 1;
break;
}
@@ -2662,7 +2664,8 @@ qemuProcessReconnect(void *opaque)
if (qemuProcessNotifyNets(obj->def) < 0)
goto error;
- if (qemuProcessFiltersInstantiate(conn, obj->def))
+ if (qemuProcessFiltersInstantiate(conn, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
+ obj->def))
goto error;
if (qemuDomainCheckEjectableMedia(driver, obj) < 0)
Index: libvirt-acl/src/uml/uml_conf.c
===================================================================
--- libvirt-acl.orig/src/uml/uml_conf.c
+++ libvirt-acl/src/uml/uml_conf.c
@@ -118,6 +118,7 @@ virCapsPtr umlCapsInit(void) {
static int
umlConnectTapDevice(virConnectPtr conn,
virDomainDefPtr vm,
+ enum virNetDevVPortProfileOp vmOp,
virDomainNetDefPtr net,
const char *bridge)
{
@@ -144,7 +145,7 @@ umlConnectTapDevice(virConnectPtr conn,
}
if (net->filter) {
- if (virDomainConfNWFilterInstantiate(conn, vm->uuid, net) < 0) {
+ if (virDomainConfNWFilterInstantiate(conn, vm->uuid, vmOp, net) < 0) {
if (template_ifname)
VIR_FREE(net->ifname);
goto error;
@@ -162,6 +163,7 @@ error:
static char *
umlBuildCommandLineNet(virConnectPtr conn,
virDomainDefPtr vm,
+ enum virNetDevVPortProfileOp vmOp,
virDomainNetDefPtr def,
int idx)
{
@@ -227,7 +229,7 @@ umlBuildCommandLineNet(virConnectPtr con
goto error;
}
- if (umlConnectTapDevice(conn, vm, def, bridge) < 0) {
+ if (umlConnectTapDevice(conn, vm, vmOp, def, bridge) < 0) {
VIR_FREE(bridge);
goto error;
}
@@ -238,7 +240,7 @@ umlBuildCommandLineNet(virConnectPtr con
}
case VIR_DOMAIN_NET_TYPE_BRIDGE:
- if (umlConnectTapDevice(conn, vm, def,
+ if (umlConnectTapDevice(conn, vm, vmOp, def,
def->data.bridge.brname) < 0)
goto error;
@@ -399,7 +401,8 @@ static char *umlNextArg(char *args)
*/
virCommandPtr umlBuildCommandLine(virConnectPtr conn,
struct uml_driver *driver,
- virDomainObjPtr vm)
+ virDomainObjPtr vm,
+ enum virNetDevVPortProfileOp vmOp)
{
int i, j;
struct utsname ut;
@@ -432,7 +435,8 @@ virCommandPtr umlBuildCommandLine(virCon
}
for (i = 0 ; i < vm->def->nnets ; i++) {
- char *ret = umlBuildCommandLineNet(conn, vm->def, vm->def->nets[i], i);
+ char *ret = umlBuildCommandLineNet(conn, vm->def, vmOp,
+ vm->def->nets[i], i);
if (!ret)
goto error;
virCommandAddArg(cmd, ret);
Index: libvirt-acl/src/uml/uml_conf.h
===================================================================
--- libvirt-acl.orig/src/uml/uml_conf.h
+++ libvirt-acl/src/uml/uml_conf.h
@@ -79,6 +79,7 @@ virCapsPtr umlCapsInit (v
virCommandPtr umlBuildCommandLine(virConnectPtr conn,
struct uml_driver *driver,
- virDomainObjPtr dom);
+ virDomainObjPtr dom,
+ enum virNetDevVPortProfileOp vmOp);
#endif /* __UML_CONF_H */
Index: libvirt-acl/src/uml/uml_driver.c
===================================================================
--- libvirt-acl.orig/src/uml/uml_driver.c
+++ libvirt-acl/src/uml/uml_driver.c
@@ -1039,7 +1039,8 @@ static int umlStartVMDaemon(virConnectPt
return -1;
}
- if (!(cmd = umlBuildCommandLine(conn, driver, vm))) {
+ if (!(cmd = umlBuildCommandLine(conn, driver, vm,
+ VIR_NETDEV_VPORT_PROFILE_OP_CREATE))) {
VIR_FORCE_CLOSE(logfd);
virDomainConfVMNWFilterTeardown(vm);
umlCleanupTapDevices(vm);
13 years, 4 months
[libvirt] [RFC v5 PATCH 0/5] PowerPC : Extend Libvirt for PowerPC architecture
by Prerna Saxena
Libvirt continues to be the key interface to configure and manage the
KVM guest instances on x86. This patch set is an effort to enable
libvirt to support KVM guest configuration and management on Power Book3S
machines.
Based on community discussion around the earlier version, this patch
series augments the present 'kvm' driver to support PowerPC-KVM based
guests. With the CPU driver for PowerPC already merged, this patch series
adds on clean-ups, and some test cases as suggested.
This series mostly focuses on cleanup and addition of testcases for base-
powerpc patches. The patches for enabling spapr-vio based addressing would
be sent out shortly, with the right domain schema additions.
Series description:
-------------------
Patch 1/5 : Use sysfs to decipher cpu topology information.
Patch 2/5 : Modify the tests/nodeinfotest.c to use sysfs in addition to
proc/cpuinfo.
Patch 3/5 : Add support for ppc64 qemu
Patch 4/5 : Clean up qemuBuildCommandLine to remove x86-specific assumptions.
Patch 5/5 : Add ppc64 specific definitions to domain.rng
Changelog:
----------
** v1->v2 :
* Patches 1,2,3 unchanged ; The hacks in Patch 4 of v1 replaced by a
new patch to neatly select arch-specific features.
** v2->v3 :
* Patches 1,2,3 have minor cleanups ; Patch 4 no longer has an
arch-specific handler routine. It is now replaced by a much simpler
patch that merely removes x86/pc-specific assumptions from libvirt.
Patch 5 is a new addition from Michael Ellerman that adds a new
device-tree based addressing mechanism for the 'pseries' guest.
** v3->v4 :
* Patch 1 has minor cleanups,
Patch 2 is a new addition that introduces test cases for patch 1.
Patch 3,4 also have minor cleanups
Patch 5 is a new addition, it contains ppc64 specific definitions
to domain.rng
** v4->v5 :
* Patch 1 fixes some issues that were causing testcase (patch 2) to fail.
Patch 2 has minor cleanups.
Patch 3 unchanged.
Patch 4 has a whitespace cleanup.
Patch 5 is a subset of the original patch, it contains ppc64 specific
additions to domain.rng
--
Prerna Saxena
Linux Technology Centre,
IBM Systems and Technology Lab,
Bangalore, India
13 years, 4 months
[libvirt] Interface pools and passthrough mode (issue to discuss)
by Shradha Shah
Hello All,
While working on my patches I came across an issue which I would like to discuss with everybody.
The definition of passthrough mode in the Network XML Format document says that, in passthrough mode each physical interface can only be in use by a single guest interface at a time.
Consider the scenario where we a single KVM host:
We can define 2 network configurations, one that uses vepa and other that uses passthrough mode with the same interface pool.
# virsh net-define vepa_network.xml
# virsh net-define passthrough-network.xml
Examples:
<network>
<name>vepa-network</name>
<uuid>81ff9090-c91e-6742-64da-4a736edb9a8f</uuid>
<forward mode="vepa">
<interface dev="eth10"/>
<interface dev="eth11"/>
<interface dev="eth12"/>
</forward>
</network>
<network>
<name>passthrough-network</name>
<uuid>81ff9090-c91e-6742-64da-4a736edb9a88</uuid>
<forward mode="passthrough">
<interface dev="eth10"/>
<interface dev="eth11"/>
<interface dev="eth12"/>
</forward>
</network>
Suppose we use the vepa-network for guest1 and passthrough network for guest2.
Examples:
Guest 1: (snippet of xml)
<interface type='network'>
<source network='vepa-network'/>
<mac address='00:50:56:0e:86:3b'/>
<actual type='direct'>
<source mode='vepa'/>
</actual>
</interface>
Guest2: (snippet of xml)
<interface type='network'>
<source network='passthrough-network'/>
<mac address='00:50:56:0e:86:4b'/>
<actual type='direct'>
<source mode='passthrough'/>
</actual>
</interface>
# virsh define guest1.xml
# virsh define guest2.xml
# virsh start guest1
# virsh start guest2
Since the virNetworkDef is different for the two network configs, how does libvirt keep track of the interfaces in use at this point?
Wouldn't libvirt use the first free interface in both cases which will be eth10 since the usageCount will be zero in both cases start of day?
Many Thanks,
Regards,
Shradha Shah
13 years, 4 months
[libvirt] [PATCH] build: fix build with older libxml2
by Eric Blake
On RHEL 5, with libxml2-2.6.26, the build failed with:
virsh.c: In function 'vshNodeIsSuperset':
virsh.c:11951: warning: implicit declaration of function 'xmlChildElementCount'
(or if warnings aren't errors, a link failure later on).
* src/util/xml.h (virXMLChildElementCount): New prototype.
* src/util/xml.c (virXMLChildElementCount): New function.
* src/libvirt_private.syms (xml.h): Export it.
* tools/virsh.c (vshNodeIsSuperset): Use it.
---
I haven't decided yet whether this is trivial enough to push under
the build-breaker rule, but it did fix my build on RHEL 5.
src/libvirt_private.syms | 1 +
src/util/xml.c | 20 ++++++++++++++++++++
src/util/xml.h | 1 +
tools/virsh.c | 9 +++++----
4 files changed, 27 insertions(+), 4 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 99a1099..a81c230 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1400,6 +1400,7 @@ virTimeStringThenRaw;
# xml.h
+virXMLChildElementCount;
virXMLParseHelper;
virXMLPropString;
virXMLSaveFile;
diff --git a/src/util/xml.c b/src/util/xml.c
index 4e98b05..2909e85 100644
--- a/src/util/xml.c
+++ b/src/util/xml.c
@@ -833,3 +833,23 @@ virXMLSaveFile(const char *path,
return virFileRewrite(path, S_IRUSR | S_IWUSR, virXMLRewriteFile, &data);
}
+
+/* Returns the number of children of node, or -1 on error. */
+long
+virXMLChildElementCount(xmlNodePtr node)
+{
+ long ret = 0;
+ xmlNodePtr cur = NULL;
+
+ /* xmlChildElementCount returns 0 on error, which isn't helpful;
+ * besides, it is not available in libxml2 2.6. */
+ if (!node || node->type != XML_ELEMENT_NODE)
+ return -1;
+ cur = node->children;
+ while (cur) {
+ if (cur->type == XML_ELEMENT_NODE)
+ ret++;
+ cur = cur->next;
+ }
+ return ret;
+}
diff --git a/src/util/xml.h b/src/util/xml.h
index c492063..a3750fa 100644
--- a/src/util/xml.h
+++ b/src/util/xml.h
@@ -52,6 +52,7 @@ int virXPathNodeSet(const char *xpath,
xmlNodePtr **list);
char * virXMLPropString(xmlNodePtr node,
const char *name);
+long virXMLChildElementCount(xmlNodePtr node);
/* Internal function; prefer the macros below. */
xmlDocPtr virXMLParseHelper(int domcode,
diff --git a/tools/virsh.c b/tools/virsh.c
index d02be5c..a51478f 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -11919,7 +11919,7 @@ vshNodeIsSuperset(xmlNodePtr n1, xmlNodePtr n2)
bool found;
bool visited;
bool ret = false;
- unsigned long n1_child_size, n2_child_size, n1_iter;
+ long n1_child_size, n2_child_size, n1_iter;
virBitmapPtr bitmap;
if (!n1 && !n2)
@@ -11948,9 +11948,10 @@ vshNodeIsSuperset(xmlNodePtr n1, xmlNodePtr n2)
attr = attr->next;
}
- n1_child_size = xmlChildElementCount(n1);
- n2_child_size = xmlChildElementCount(n2);
- if (n1_child_size < n2_child_size)
+ n1_child_size = virXMLChildElementCount(n1);
+ n2_child_size = virXMLChildElementCount(n2);
+ if (n1_child_size < 0 || n2_child_size < 0 ||
+ n1_child_size < n2_child_size)
return false;
if (n1_child_size == 0 && n2_child_size == 0)
--
1.7.7.3
13 years, 4 months