[libvirt] [PATCH] Automatically pause QEMU guests when an error occurs
by Daniel P. Berrange
With the QMP mode monitor, it is possible to get a notification
that a disk I/O error occurs ina guest. This patch enables such
reporting and when receiving an error updates libvirt's view
of the guest to indicate that it is now paused. It also emits
an event
VIR_DOMAIN_EVENT_SUSPENDED
with a detail of:
VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
* include/libvirt/libvirt.h.in: Add VIR_DOMAIN_EVENT_SUSPENDED_IOERROR
* src/qemu/qemu_driver.c: Update VM state to paused when IO error
occurrs
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h,
src/qemu/qemu_monitor_json.c: Wire up handlers for disk IO errors
---
include/libvirt/libvirt.h.in | 1 +
src/qemu/qemu_conf.c | 7 +++++--
src/qemu/qemu_conf.h | 2 +-
src/qemu/qemu_driver.c | 38 +++++++++++++++++++++++++++++++++++---
src/qemu/qemu_monitor.c | 16 ++++++++++++++++
src/qemu/qemu_monitor.h | 5 +++++
src/qemu/qemu_monitor_json.c | 6 ++++++
7 files changed, 69 insertions(+), 6 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 260505e..b7a6922 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1361,6 +1361,7 @@ typedef enum {
typedef enum {
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED = 0, /* Normal suspend due to admin pause */
VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED = 1, /* Suspended for offline migration */
+ VIR_DOMAIN_EVENT_SUSPENDED_IOERROR = 2, /* Suspended due to a disk I/O error */
} virDomainEventSuspendedDetailType;
/**
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index c9fe55b..20076bc 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -2385,6 +2385,9 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
} else if (disk->shared && !disk->readonly) {
virBufferAddLit(&opt, ",cache=off");
}
+ if (qemuCmdFlags & QEMUD_CMD_FLAG_MONITOR_JSON) {
+ virBufferVSprintf(&opt, ",werror=stop,rerror=stop");
+ }
if (virBufferError(&opt)) {
virReportOOMError();
@@ -2400,7 +2403,7 @@ error:
char *
-qemuBuildDriveDevStr(virDomainDiskDefPtr disk)
+qemuBuildDriveDevStr(virDomainDiskDefPtr disk, int qemuCmdFlags ATTRIBUTE_UNUSED)
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
@@ -3578,7 +3581,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
} else {
ADD_ARG_LIT("-device");
- if (!(optstr = qemuBuildDriveDevStr(disk)))
+ if (!(optstr = qemuBuildDriveDevStr(disk, qemuCmdFlags)))
goto error;
ADD_ARG(optstr);
}
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 7041489..ec8033a 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -214,7 +214,7 @@ char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
unsigned long long qemuCmdFlags);
/* Current, best practice */
-char * qemuBuildDriveDevStr(virDomainDiskDefPtr disk);
+char * qemuBuildDriveDevStr(virDomainDiskDefPtr disk, int qemuCmdFlags);
/* Current, best practice */
char * qemuBuildControllerDevStr(virDomainControllerDefPtr def);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 77306f3..23073bc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -824,9 +824,41 @@ cleanup:
return ret;
}
+
+static int
+qemuHandleDiskIOError(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
+ virDomainObjPtr vm,
+ const char *diskalias ATTRIBUTE_UNUSED)
+{
+ struct qemud_driver *driver = qemu_driver;
+ virDomainEventPtr event = NULL;
+
+ VIR_DEBUG("Received IO error on %p '%s': %s", vm, vm->def->name, diskalias);
+ virDomainObjLock(vm);
+
+ vm->state = VIR_DOMAIN_PAUSED;
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_SUSPENDED,
+ VIR_DOMAIN_EVENT_SUSPENDED_IOERROR);
+
+ if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
+ VIR_WARN("Unable to save status on vm %s after IO error", vm->def->name);
+
+ virDomainObjUnlock(vm);
+
+ if (event) {
+ qemuDriverLock(driver);
+ qemuDomainEventQueue(driver, event);
+ qemuDriverUnlock(driver);
+ }
+ return 0;
+}
+
+
static qemuMonitorCallbacks monitorCallbacks = {
.eofNotify = qemuHandleMonitorEOF,
.diskSecretLookup = findVolumeQcowPassphrase,
+ .diskIOError = qemuHandleDiskIOError,
};
static int
@@ -5353,7 +5385,7 @@ static int qemudDomainAttachPciDiskDevice(struct qemud_driver *driver,
if (!(drivestr = qemuBuildDriveStr(disk, 0, qemuCmdFlags)))
goto error;
- if (!(devstr = qemuBuildDriveDevStr(disk)))
+ if (!(devstr = qemuBuildDriveDevStr(disk, qemuCmdFlags)))
goto error;
}
@@ -5548,7 +5580,7 @@ static int qemudDomainAttachSCSIDisk(struct qemud_driver *driver,
if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
if (qemuAssignDeviceDiskAlias(disk, qemuCmdFlags) < 0)
goto error;
- if (!(devstr = qemuBuildDriveDevStr(disk)))
+ if (!(devstr = qemuBuildDriveDevStr(disk, qemuCmdFlags)))
goto error;
}
@@ -5652,7 +5684,7 @@ static int qemudDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
goto error;
if (!(drivestr = qemuBuildDriveStr(disk, 0, qemuCmdFlags)))
goto error;
- if (!(devstr = qemuBuildDriveDevStr(disk)))
+ if (!(devstr = qemuBuildDriveDevStr(disk, qemuCmdFlags)))
goto error;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index b88532c..3f8772a 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -791,6 +791,22 @@ int qemuMonitorEmitStop(qemuMonitorPtr mon)
}
+int qemuMonitorEmitDiskIOError(qemuMonitorPtr mon, const char *deviceAlias)
+{
+ int ret = -1;
+ VIR_DEBUG("mon=%p deviceAlias=%s", mon, deviceAlias);
+
+ qemuMonitorRef(mon);
+ qemuMonitorUnlock(mon);
+ if (mon->cb && mon->cb->diskIOError)
+ ret = mon->cb->diskIOError(mon, mon->vm, deviceAlias);
+ qemuMonitorLock(mon);
+ qemuMonitorUnref(mon);
+
+ return ret;
+}
+
+
int qemuMonitorSetCapabilities(qemuMonitorPtr mon)
{
int ret;
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 0ac3957..6b9fd50 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -86,6 +86,10 @@ struct _qemuMonitorCallbacks {
virDomainObjPtr vm);
int (*domainStop)(qemuMonitorPtr mon,
virDomainObjPtr vm);
+
+ int (*diskIOError)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ const char *diskAlias);
};
@@ -122,6 +126,7 @@ int qemuMonitorEmitShutdown(qemuMonitorPtr mon);
int qemuMonitorEmitReset(qemuMonitorPtr mon);
int qemuMonitorEmitPowerdown(qemuMonitorPtr mon);
int qemuMonitorEmitStop(qemuMonitorPtr mon);
+int qemuMonitorEmitDiskIOError(qemuMonitorPtr mon, const char *deviceAlias);
int qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 49e0370..c20d063 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -49,6 +49,7 @@ static void qemuMonitorJSONHandleShutdown(qemuMonitorPtr mon, virJSONValuePtr da
static void qemuMonitorJSONHandleReset(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandlePowerdown(qemuMonitorPtr mon, virJSONValuePtr data);
static void qemuMonitorJSONHandleStop(qemuMonitorPtr mon, virJSONValuePtr data);
+static void qemuMonitorJSONHandleDiskIOError(qemuMonitorPtr mon, virJSONValuePtr data);
struct {
const char *type;
@@ -58,6 +59,7 @@ struct {
{ "RESET", qemuMonitorJSONHandleReset, },
{ "POWERDOWN", qemuMonitorJSONHandlePowerdown, },
{ "STOP", qemuMonitorJSONHandleStop, },
+ { "BLOCK_IO_ERROR", qemuMonitorJSONHandleDiskIOError, },
};
@@ -495,6 +497,10 @@ static void qemuMonitorJSONHandleStop(qemuMonitorPtr mon, virJSONValuePtr data A
qemuMonitorEmitStop(mon);
}
+static void qemuMonitorJSONHandleDiskIOError(qemuMonitorPtr mon, virJSONValuePtr data ATTRIBUTE_UNUSED)
+{
+ qemuMonitorEmitDiskIOError(mon, NULL);
+}
int
qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon)
--
1.6.2.5
14 years, 9 months
[libvirt] [PATCH] python: Actually add virConnectGetVersion to generated bindings
by Cole Robinson
The recent commit to implement a python version of this function
didn't drop an explicit 'ignore' check in the generator, so this
never ended up in the bindings.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
python/generator.py | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/python/generator.py b/python/generator.py
index 37c0169..24eaf50 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -319,7 +319,6 @@ skip_function = (
'virConnectListDomains', # Python API is called virConectListDomainsID for unknown reasons
'virConnSetErrorFunc', # Not used in Python API XXX is this a bug ?
'virResetError', # Not used in Python API XXX is this a bug ?
- 'virConnectGetVersion', # Not used in Python API XXX is this a bug ?
'virGetVersion', # Python C code is manually written
'virSetErrorFunc', # Python API is called virRegisterErrorHandler for unknown reasons
'virConnCopyLastError', # Python API is called virConnGetLastError instead
--
1.6.5.2
14 years, 9 months
[libvirt] [PATCH] Run 'qmp_capabilities' command at monitor startup
by Daniel P. Berrange
---
src/qemu/qemu_driver.c | 18 ++++++++++++++----
src/qemu/qemu_monitor.c | 13 +++++++++++++
src/qemu/qemu_monitor.h | 2 ++
src/qemu/qemu_monitor_json.c | 20 ++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 2 ++
5 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 03feaf4..e5b11bc 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -829,9 +829,10 @@ static qemuMonitorCallbacks monitorCallbacks = {
};
static int
-qemuConnectMonitor(virDomainObjPtr vm)
+qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
+ int ret;
/* Hold an extra reference because we can't allow 'vm' to be
* deleted while the monitor is active */
@@ -845,7 +846,16 @@ qemuConnectMonitor(virDomainObjPtr vm)
return -1;
}
- return 0;
+ qemuDomainObjEnterMonitorWithDriver(driver, vm);
+ ret = qemuMonitorSetCapabilities(priv->mon);
+ qemuDomainObjExitMonitorWithDriver(driver, vm);
+
+ if (ret < 0) {
+ qemuMonitorClose(priv->mon);
+ priv->mon = NULL;
+ }
+
+ return ret;
}
/*
@@ -867,7 +877,7 @@ qemuReconnectDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq
priv = obj->privateData;
/* XXX check PID liveliness & EXE path */
- if (qemuConnectMonitor(obj) < 0)
+ if (qemuConnectMonitor(driver, obj) < 0)
goto error;
if (qemuUpdateActivePciHostdevs(driver, obj->def) < 0) {
@@ -1576,7 +1586,7 @@ qemudWaitForMonitor(struct qemud_driver* driver,
return -1;
VIR_DEBUG("Connect monitor to %p '%s'", vm, vm->def->name);
- if (qemuConnectMonitor(vm) < 0)
+ if (qemuConnectMonitor(driver, vm) < 0)
return -1;
/* Try to get the pty path mappings again via the monitor. This is much more
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index c1d369b..b88532c 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -791,6 +791,19 @@ int qemuMonitorEmitStop(qemuMonitorPtr mon)
}
+int qemuMonitorSetCapabilities(qemuMonitorPtr mon)
+{
+ int ret;
+ DEBUG("mon=%p, fd=%d", mon, mon->fd);
+
+ if (mon->json)
+ ret = qemuMonitorJSONSetCapabilities(mon);
+ else
+ ret = 0;
+ return ret;
+}
+
+
int
qemuMonitorStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 786ad7a..0ac3957 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -99,6 +99,8 @@ qemuMonitorPtr qemuMonitorOpen(virDomainObjPtr vm,
int qemuMonitorClose(qemuMonitorPtr mon);
+int qemuMonitorSetCapabilities(qemuMonitorPtr mon);
+
void qemuMonitorLock(qemuMonitorPtr mon);
void qemuMonitorUnlock(qemuMonitorPtr mon);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index c9b8d60..f0dcf81 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -477,6 +477,26 @@ static void qemuMonitorJSONHandleStop(qemuMonitorPtr mon, virJSONValuePtr data A
int
+qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon)
+{
+ int ret;
+ virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("qmp_capabilities", NULL);
+ virJSONValuePtr reply = NULL;
+ if (!cmd)
+ return -1;
+
+ ret = qemuMonitorJSONCommand(mon, cmd, &reply);
+
+ if (ret == 0)
+ ret = qemuMonitorJSONCheckError(cmd, reply);
+
+ virJSONValueFree(cmd);
+ virJSONValueFree(reply);
+ return ret;
+}
+
+
+int
qemuMonitorJSONStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn ATTRIBUTE_UNUSED)
{
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 65a70e3..c6a6d51 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -34,6 +34,8 @@ int qemuMonitorJSONIOProcess(qemuMonitorPtr mon,
size_t len,
qemuMonitorMessagePtr msg);
+int qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon);
+
int qemuMonitorJSONStartCPUs(qemuMonitorPtr mon,
virConnectPtr conn);
int qemuMonitorJSONStopCPUs(qemuMonitorPtr mon);
--
1.6.6
14 years, 9 months
Re: [libvirt] Cannot enumerate physical devices with libvirt 0.7.6
by Frédéric Grelot
Hi Dave and all
> have four on my test system, which I just installed. How did you
> install the box, install F12, then what? Just to rule this out, did
> you rebuild the RPM?
I first built it from source (0.7.6), but, when the package was released in rawvirt (repo enabled in my system), I uninstalled my version ("make uninstall" in the directory where I installed it from), then installed that of rawvirt...
When I started having these problems, I uninstalled / reinstalled again, but it didn't change anything.
Well... you solved my problem anyway : to sort this out, I tried that again. Thus I noticed that after having uninstalled everything (yum remove + make uninstall), the "libvirtd" command still "worked" (with errors). I checked... and there was a /sbin/libvirtd, left by I-don-t-know-which install! . It was one of those last, undoubtly, since "libvirtd --version" actually returned 0.7.6... (And, of course, in the default PATH, /sbin stands before /usr/bin/...)
I removed (=backuped just in case...) it, installed with yum, and it works at last!
Thanks for your help, you got me to the right path... And sorry for the inconvenient of a "custom" install...
However, I don't explain why this libvirtd was left there... Were the paths changed lately?
Frederic
----- "Dave Allan" <dallan(a)redhat.com> a écrit :
> On 02/16/2010 03:04 PM, Frédéric Grelot wrote:
> > Yep, here is what I get (see at the end) :
> >
(snip)
> >
> > I think the times when I get those lines matches with my "virsh
> nodedev-list" requests (or something like this : virt-manager tries to
> create a vm, add hardware...).
> >
> > Does this help?
>
> That's odd, you only have two entries in the node driver array, and I
>
> have four on my test system, which I just installed. How did you
> install the box, install F12, then what? Just to rule this out, did
> you
> rebuild the RPM?
>
> > Frederic.
> >
> >
> > ----- "Dave Allan"<dallan(a)redhat.com> a écrit :
> >
> >> On 02/16/2010 03:00 AM, Frédéric Grelot wrote:
> >>>> Daniel was referring to the libvirt udev driver--the libvirt
> code
> >> that
> >>>>
> >>>> interacts with udev--not to udev itself, which is what you're
> >> testing
> >>>>
> >>>> with udevadm.
> >>>
> >>> Ok, sorry... At least I ensured that udev itself is on...
> >>>
> >>>> In any of your logs when you have libvirt debug logging
> >>>> turned on, do you see the message:
> >>>>
> >>>> Registering udev node device backend
> >>>
> >>> Nope, I checked in /var/log/* and libvirt.log in debug mode
> (which,
> >> after 1 1/2 day of "debug" activity enabled, is already 2Gb!)
> >>> There is no mention of udev. I think it means that the udev
> driver
> >> is not loaded in libvirt? How could enable it then? (or produce
> some
> >> message telling me why it is not) ?
> >>>
> >>>
> >>>> These messages are the result of not being able to find the
> >> device,
> >>>> which is consistent with the other things you're seeing. These
> >> are
> >>>> all symptoms of the node device code not running.
> >>>
> >>> OK, I'll wait for your suggestions...
> >>
> >> Do you see messages like:
> >>
> >>
> >> 14:35:01.849: debug : do_open:1205 : node driver 0 Test returned
> >> DECLINED
> >> 14:35:01.849: debug : do_open:1205 : node driver 1 ESX returned
> >> DECLINED
> >> 14:35:01.849: debug : do_open:1205 : node driver 2 remote returned
> >> DECLINED
> >> 14:35:01.849: debug : do_open:1205 : node driver 3
> udevDeviceMonitor
> >> returned SUCCESS
> >>
> >> in your debug log?
> >>
> >>
> >>> Frederic.
> >>>
> >>>
> >>>>
> >>>>> Have you any other Idea?
> >>>>> Frederic.
> >>>>>
> >>>>>
> >>>>> ----- "Daniel P. Berrange"<berrange(a)redhat.com> a écrit :
> >>>>>
> >>>>>> On Fri, Feb 12, 2010 at 08:05:21PM +0100, Fr?d?ric Grelot
> wrote:
> >>>>>>> Hi all,
> >>>>>>>
> >>>>>>> I often update my F12 box with the rawvirt repository, which
> >>>>>>> just
> >>>>>> installed libvirt 0.7.6. Since that, I cannot enumerate
> physical
> >>>>>> devices (and thus get a beautiful error when I start one of my
> >> vms
> >>>>>> that should use a USB device).
> >>>>>>>
> >>>>>>> I don't think I changed anything else on that box, and, of
> >>>>>>> course, I
> >>>>>> already restarted the libvirt daemon.
> >>>>>>> I haven't restarted the server itself, because it is
> currently
> >>>>>>> used,
> >>>>>> but I could do it if necessary...
> >>>>>>>
> >>>>>>> I make good use of the qemu hypervisor, and I'm looking
> forward
> >>>>>>> to
> >>>>>> solve this issue!
> >>>>>>>
> >>>>>>> Frederic.
> >>>>>>>
> >>>>>>> # libvirtd --version libvirtd (libvirt) 0.7.6
> >>>>>>>
> >>>>>>> # virsh --version 0.7.6
> >>>>>>>
> >>>>>>> # virsh nodedev-list error :Failed to count node devices
> error
> >>>>>>> :this function is not supported by the hypervisor:
> >>>>>> virNodeNumOfDevices
> >>>>>>
> >>>>>> It would appear that the udev driver failed to start - there
> are
> >>>>>> probably messages in syslog about the problem
> >>>>>>
> >>>>>>
> >>>>>> Regards, Daniel -- |: Red Hat, Engineering, London -o-
> >>>>>> http://people.redhat.com/berrange/ :| |: http://libvirt.org
> -o-
> >>>>>> http://virt-manager.org -o- http://ovirt.org :| |:
> >>>>>> http://autobuild.org -o-
> http://search.cpan.org/~danberr/
> >> :|
> >>>>>> |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF
> F742
> >>>>>> 7D3B 9505 :|
> >>>>>
> >>>>> -- libvir-list mailing list libvir-list(a)redhat.com
> >>>>> https://www.redhat.com/mailman/listinfo/libvir-list
> >>>
> >>> --
> >>> libvir-list mailing list
> >>> libvir-list(a)redhat.com
> >>> https://www.redhat.com/mailman/listinfo/libvir-list
> >
> > --
> > libvir-list mailing list
> > libvir-list(a)redhat.com
> > https://www.redhat.com/mailman/listinfo/libvir-list
14 years, 9 months
[libvirt] [PATCH] Fix whitespace in domain.rng
by Matthew Booth
* src/schemas/domain.rng: Replace tabs with 8 spaces
---
docs/schemas/domain.rng | 52 +++++++++++++++++++++++-----------------------
1 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index a834705..1ac5943 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -538,7 +538,7 @@
<ref name="unsignedInt"/>
</attribute>
<optional>
- <ref name="address"/>
+ <ref name="address"/>
</optional>
</element>
</define>
@@ -603,7 +603,7 @@
</group>
</choice>
<optional>
- <ref name="address"/>
+ <ref name="address"/>
</optional>
</element>
</define>
@@ -762,7 +762,7 @@
</element>
</optional>
<optional>
- <ref name="address"/>
+ <ref name="address"/>
</optional>
</interleave>
</define>
@@ -1015,7 +1015,7 @@
</element>
</optional>
<optional>
- <ref name="address"/>
+ <ref name="address"/>
</optional>
</interleave>
</define>
@@ -1159,9 +1159,9 @@
<ref name="guestfwdTarget"/>
<ref name="virtioTarget"/>
</choice>
- <optional>
- <ref name="address"/>
- </optional>
+ <optional>
+ <ref name="address"/>
+ </optional>
</interleave>
</element>
</define>
@@ -1183,7 +1183,7 @@
</attribute>
</optional>
<optional>
- <ref name="address"/>
+ <ref name="address"/>
</optional>
</element>
</define>
@@ -1212,12 +1212,12 @@
<group>
<element name="source">
<choice>
- <group>
+ <group>
<ref name="usbproduct"/>
- <optional>
- <ref name="usbaddress"/>
- </optional>
- </group>
+ <optional>
+ <ref name="usbaddress"/>
+ </optional>
+ </group>
<ref name="usbaddress"/>
<element name="address">
<ref name="pciaddress"/>
@@ -1276,7 +1276,7 @@
</optional>
<optional>
<attribute name="bus">
- <ref name="driveBus"/>
+ <ref name="driveBus"/>
</attribute>
</optional>
<attribute name="unit">
@@ -1415,18 +1415,18 @@
<define name="address">
<element name="address">
<choice>
- <group>
- <attribute name="type">
- <value>pci</value>
- </attribute>
- <ref name="pciaddress"/>
- </group>
- <group>
- <attribute name="type">
- <value>drive</value>
- </attribute>
- <ref name="driveaddress"/>
- </group>
+ <group>
+ <attribute name="type">
+ <value>pci</value>
+ </attribute>
+ <ref name="pciaddress"/>
+ </group>
+ <group>
+ <attribute name="type">
+ <value>drive</value>
+ </attribute>
+ <ref name="driveaddress"/>
+ </group>
</choice>
</element>
</define>
--
1.6.6
14 years, 9 months
[libvirt] [PATCH] build: inform libtool of m4 directory
by Eric Blake
Silence a libtoolize warning.
* configure.ac (AC_CONFIG_MACRO_DIR): Add.
---
Libtool spits out this warning during ./autogen.sh:
| libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
| libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
I've checked that there is no significant difference in the generated
files when applying this patch to silence the warning, and that autoconf
2.59 supplied this macro.
configure.ac | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index 1c7c24c..743a357 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,6 +4,7 @@ AC_INIT([libvirt], [0.7.6])
AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
dnl Make automake keep quiet about wildcards & other GNUmake-isms
AM_INIT_AUTOMAKE([-Wno-portability])
--
1.6.6
14 years, 9 months
[libvirt] [PATCH] Fix macvtap device tear down problem on virsh destroy
by Stefan Berger
This patch fixes the problem with the tear down of the macvtap device
when issuing a 'virsh destroy' by moving the tear down block past the
point of killing the Qemu process. It seems necessary to loop at least
once in the case of 'virsh destory' since the device seems to be busy
for a while after the Qemu process has been killed. This also still
properly tears down the macvtap device when the VM is 'virsh shutdown'ed
or halted from inside.
Signed-off-by: Stefan Berger <stefanb(a)us.ibm.com>
14 years, 9 months
[libvirt] [PATCH v2 0/9] New public API for computing baseline CPU
by Jiri Denemark
Version 2 changes:
- rebased (mainly for conn argument removal)
- swapped array and number of elements in array parameters
- fixed absolute paths in generated RPC code
- added python bindings for virConnectBaselineCPU
- fixed uninitialized variable in cpuDecode, which wasn't revealed by gcc :-(
This series introduces a new virConnectBaselineCPU() API call for
computing baseline CPU model from a set of host CPU definitions.
The call accepts a list of <cpu>...</cpu> xml definitions taken from
host capabilities and returns an xml description of a guest CPU which is
supported by all hosts.
virsh is little bit less picky and accepts a file containing host CPU
definitions. It doesn't care what is outside of the <cpu/> tag, which
allows for concatenating outputs of virsh capabilities from several
hosts and feeding the result to virsh cpu-baseline.
This series can also be found on cpu-baseline branch of
git://gitorious.org/~jirka/libvirt/jirka-staging.git
In practice it works like this:
# virsh cpu-baseline /dev/stdin >guest-cpu <<EOF
<capabilities>
<host>
<cpu>
<arch>x86_64</arch>
<model>core2duo</model>
<topology sockets='1' cores='2' threads='1'/>
<feature name='lahf_lm'/>
<feature name='xtpr'/>
<feature name='cx16'/>
<feature name='tm2'/>
<feature name='est'/>
<feature name='vmx'/>
</cpu>
</host>
</capabilities>
<cpu>
<arch>i686</arch>
<model>pentiumpro</model>
<topology sockets='1' cores='2' threads='1'/>
<feature name='vme'/>
<feature name='pse36'/>
<feature name='pni'/>
<feature name='monitor'/>
<feature name='ssse3'/>
</cpu>
<cpu>
<arch>x86_64</arch>
<model>phenom</model>
</cpu>
EOF
# cat guest-cpu
<cpu match='exact'>
<model>qemu32</model>
<feature policy='require' name='monitor'/>
<feature policy='require' name='pse36'/>
</cpu>
Jiri Denemark (9):
Functions for computing baseline CPU from a set of host CPUs
Implement cpuArchBaseline in generic CPU driver
Implement cpuArchBaseline in x86 CPU driver
virConnectBaselineCPU public API
Internal driver API for virConnectBaselineCPU
virConnectBaselineCPU public API implementation
Wire protocol format and dispatcher for virConnectBaselineCPU
Implement cpuBaseline in remote and qemu drivers
cpu-baseline command for virsh
daemon/remote.c | 25 +++++++
daemon/remote_dispatch_args.h | 1 +
daemon/remote_dispatch_prototypes.h | 8 ++
daemon/remote_dispatch_ret.h | 1 +
daemon/remote_dispatch_table.h | 5 ++
include/libvirt/libvirt.h.in | 18 +++++
python/generator.py | 1 +
python/libvirt-override-api.xml | 7 ++
python/libvirt-override.c | 52 +++++++++++++++
src/cpu/cpu.c | 123 ++++++++++++++++++++++++++++++++++-
src/cpu/cpu.h | 21 ++++++-
src/cpu/cpu_generic.c | 104 +++++++++++++++++++++++++++++-
src/cpu/cpu_x86.c | 88 ++++++++++++++++++++++++-
src/driver.h | 6 ++
src/esx/esx_driver.c | 1 +
src/libvirt.c | 57 ++++++++++++++++
src/libvirt_private.syms | 2 +
src/libvirt_public.syms | 1 +
src/lxc/lxc_driver.c | 1 +
src/opennebula/one_driver.c | 1 +
src/openvz/openvz_driver.c | 1 +
src/phyp/phyp_driver.c | 1 +
src/qemu/qemu_driver.c | 14 ++++
src/remote/remote_driver.c | 32 +++++++++
src/remote/remote_protocol.c | 22 ++++++
src/remote/remote_protocol.h | 20 ++++++
src/remote/remote_protocol.x | 18 +++++-
src/test/test_driver.c | 1 +
src/uml/uml_driver.c | 1 +
src/vbox/vbox_tmpl.c | 1 +
src/xen/xen_driver.c | 1 +
tools/virsh.c | 72 ++++++++++++++++++++
tools/virsh.pod | 8 ++
33 files changed, 709 insertions(+), 6 deletions(-)
14 years, 9 months
[libvirt] [PATCH] vbox_tmpl.c: avoid leak on OOM error path
by Jim Meyering
We have to free def here, rather than after "cleanup:",
because "cleanup:" is on the successful-return path.
>From 2c7800c3560f03fd77e4a458cb0e557165faed3f Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 15 Feb 2010 17:54:15 +0100
Subject: [PATCH] vbox_tmpl.c: avoid leak on OOM error path
* src/vbox/vbox_tmpl.c (vboxDomainDumpXML): Free def upon virAsprintf
failure.
---
src/vbox/vbox_tmpl.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index 68dffd2..1fb8d56 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -6059,14 +6059,15 @@ static char *vboxNetworkDumpXML(virNetworkPtr network, int flags ATTRIBUTE_UNUSE
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
goto cleanup;
}
if (virAsprintf(&networkNameUtf8, "HostInterfaceNetworking-%s", network->name) < 0) {
virReportOOMError();
+ VIR_FREE(def);
goto cleanup;
}
PRUnichar *networkInterfaceNameUtf16 = NULL;
IHostNetworkInterface *networkInterface = NULL;
VBOX_UTF8_TO_UTF16(network->name, &networkInterfaceNameUtf16);
--
1.7.0.181.g41533
14 years, 9 months