[libvirt] [PATCH v4] qemu: Add callback struct for qemuBuildCommandLine
by Osier Yang
Since 0d70656afded, it starts to access the sysfs files to build
the qemu command line (by virSCSIDeviceGetSgName, which is to find
out the scsi generic device name by adpater:bus:target:unit), there
is no way to work around, qemu wants to see the scsi generic device
like "/dev/sg6" anyway.
And there might be other places which need to access sysfs files
when building qemu command line in future.
Instead of increasing the arguments of qemuBuildCommandLine, this
introduces a new callback for qemuBuildCommandLine, and thus tests
can register their own callbacks for sysfs test input files accessing.
* src/qemu/qemu_command.h: (New callback struct
qemuBuildCommandLineCallbacks;
extern buildCommandLineCallbacks)
* src/qemu/qemu_command.c: (wire up the callback struct)
* src/qemu/qemu_driver.c: (Use the new syntax of qemuBuildCommandLine)
* src/qemu/qemu_hotplug.c: Likewise
* src/qemu/qemu_process.c: Likewise
* tests/qemuxml2argvtest.c: (Helper testSCSIDeviceGetSgName;
callback struct testCallbacks;
Use the callback struct)
* src/tests/qemuxmlnstest.c: (Like above)
---
src/qemu/qemu_command.c | 22 ++++++++++++++--------
src/qemu/qemu_command.h | 19 ++++++++++++++++---
src/qemu/qemu_driver.c | 3 ++-
src/qemu/qemu_hotplug.c | 6 ++++--
src/qemu/qemu_process.c | 3 ++-
tests/qemuxml2argvtest.c | 21 ++++++++++++++++++++-
tests/qemuxmlnstest.c | 21 ++++++++++++++++++++-
7 files changed, 78 insertions(+), 17 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c268a3a..33a1910 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4757,17 +4757,18 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
char *
qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
- virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED)
+ virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED,
+ qemuBuildCommandLineCallbacksPtr callbacks)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *sg = NULL;
- if (!(sg = virSCSIDeviceGetSgName(dev->source.subsys.u.scsi.adapter,
- dev->source.subsys.u.scsi.bus,
- dev->source.subsys.u.scsi.target,
- dev->source.subsys.u.scsi.unit))) {
+ sg = (callbacks->qemuGetSCSIDeviceSgName)(dev->source.subsys.u.scsi.adapter,
+ dev->source.subsys.u.scsi.bus,
+ dev->source.subsys.u.scsi.target,
+ dev->source.subsys.u.scsi.unit);
+ if (!sg)
goto error;
- }
virBufferAsprintf(&buf, "file=/dev/%s,if=none", sg);
virBufferAsprintf(&buf, ",id=%s-%s",
@@ -6405,6 +6406,10 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
return 0;
}
+qemuBuildCommandLineCallbacks buildCommandLineCallbacks = {
+ .qemuGetSCSIDeviceSgName = virSCSIDeviceGetSgName,
+};
+
/*
* Constructs a argv suitable for launching qemu with config defined
* for a given virtual machine.
@@ -6422,7 +6427,8 @@ qemuBuildCommandLine(virConnectPtr conn,
const char *migrateFrom,
int migrateFd,
virDomainSnapshotObjPtr snapshot,
- enum virNetDevVPortProfileOp vmop)
+ enum virNetDevVPortProfileOp vmop,
+ qemuBuildCommandLineCallbacksPtr callbacks)
{
virErrorPtr originalError = NULL;
int i, j;
@@ -8254,7 +8260,7 @@ qemuBuildCommandLine(virConnectPtr conn,
char *drvstr;
virCommandAddArg(cmd, "-drive");
- if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, qemuCaps)))
+ if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, qemuCaps, callbacks)))
goto error;
virCommandAddArg(cmd, drvstr);
VIR_FREE(drvstr);
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 36dfa6b..133e0b2 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -51,6 +51,16 @@
# define QEMU_WEBSOCKET_PORT_MIN 5700
# define QEMU_WEBSOCKET_PORT_MAX 65535
+typedef struct _qemuBuildCommandLineCallbacks qemuBuildCommandLineCallbacks;
+typedef qemuBuildCommandLineCallbacks *qemuBuildCommandLineCallbacksPtr;
+struct _qemuBuildCommandLineCallbacks {
+ char * (*qemuGetSCSIDeviceSgName) (const char *adapter,
+ unsigned int bus,
+ unsigned int target,
+ unsigned int unit);
+};
+
+extern qemuBuildCommandLineCallbacks buildCommandLineCallbacks;
virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
virQEMUDriverPtr driver,
@@ -61,8 +71,9 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
const char *migrateFrom,
int migrateFd,
virDomainSnapshotObjPtr current_snapshot,
- enum virNetDevVPortProfileOp vmop)
- ATTRIBUTE_NONNULL(1);
+ enum virNetDevVPortProfileOp vmop,
+ qemuBuildCommandLineCallbacksPtr callbacks)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(11);
/* Generate string for arch-specific '-device' parameter */
char *
@@ -142,7 +153,9 @@ char * qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
char * qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev,
- virQEMUCapsPtr qemuCaps);
+ virQEMUCapsPtr qemuCaps,
+ qemuBuildCommandLineCallbacksPtr callbacks)
+ ATTRIBUTE_NONNULL(3);
char * qemuBuildSCSIHostdevDevStr(virDomainDefPtr def,
virDomainHostdevDefPtr dev,
virQEMUCapsPtr qemuCaps);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 203cc6d..0665131 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5362,7 +5362,8 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
if (!(cmd = qemuBuildCommandLine(conn, driver, def,
&monConfig, monitor_json, qemuCaps,
- NULL, -1, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP)))
+ NULL, -1, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
+ &buildCommandLineCallbacks)))
goto cleanup;
ret = virCommandToString(cmd);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index d037c9d..77d9f4f 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1226,7 +1226,8 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, 0) < 0)
goto cleanup;
- if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, priv->qemuCaps)))
+ if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, priv->qemuCaps,
+ &buildCommandLineCallbacks)))
goto cleanup;
if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, hostdev, priv->qemuCaps)))
@@ -2543,7 +2544,8 @@ qemuDomainDetachHostScsiDevice(virQEMUDriverPtr driver,
return -1;
}
- if (!(drvstr = qemuBuildSCSIHostdevDrvStr(detach, priv->qemuCaps)))
+ if (!(drvstr = qemuBuildSCSIHostdevDrvStr(detach, priv->qemuCaps,
+ &buildCommandLineCallbacks)))
goto cleanup;
if (!(devstr = qemuBuildSCSIHostdevDevStr(vm->def, detach, priv->qemuCaps)))
goto cleanup;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4a7c612..95e712c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3605,7 +3605,8 @@ int qemuProcessStart(virConnectPtr conn,
VIR_DEBUG("Building emulator command line");
if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
priv->monJSON, priv->qemuCaps,
- migrateFrom, stdin_fd, snapshot, vmop)))
+ migrateFrom, stdin_fd, snapshot, vmop,
+ &buildCommandLineCallbacks)))
goto cleanup;
/* now that we know it is about to start call the hook if present */
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d853308..e103925 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -82,6 +82,24 @@ typedef enum {
FLAG_JSON = 1 << 3,
} virQemuXML2ArgvTestFlags;
+static char *
+testSCSIDeviceGetSgName(const char *adapter ATTRIBUTE_UNUSED,
+ unsigned int bus ATTRIBUTE_UNUSED,
+ unsigned int target ATTRIBUTE_UNUSED,
+ unsigned int unit ATTRIBUTE_UNUSED)
+{
+ char *sg = NULL;
+
+ if (VIR_STRDUP(sg, "sg0") < 0)
+ return NULL;
+
+ return sg;
+}
+
+static qemuBuildCommandLineCallbacks testCallbacks = {
+ .qemuGetSCSIDeviceSgName = testSCSIDeviceGetSgName,
+};
+
static int testCompareXMLToArgvFiles(const char *xml,
const char *cmdline,
virQEMUCapsPtr extraFlags,
@@ -157,7 +175,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (!(cmd = qemuBuildCommandLine(conn, &driver, vmdef, &monitor_chr,
(flags & FLAG_JSON), extraFlags,
migrateFrom, migrateFd, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_NO_OP))) {
+ VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
+ &testCallbacks))) {
if (flags & FLAG_EXPECT_FAILURE) {
ret = 0;
if (virTestGetDebug() > 1)
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 952b8e2..961405b 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -26,6 +26,24 @@
static const char *abs_top_srcdir;
static virQEMUDriver driver;
+static char *
+testSCSIDeviceGetSgName(const char *adapter ATTRIBUTE_UNUSED,
+ unsigned int bus ATTRIBUTE_UNUSED,
+ unsigned int target ATTRIBUTE_UNUSED,
+ unsigned int unit ATTRIBUTE_UNUSED)
+{
+ char *sg = NULL;
+
+ if (VIR_STRDUP(sg, "dummy") < 0)
+ return NULL;
+
+ return sg;
+}
+
+static qemuBuildCommandLineCallbacks testCallbacks = {
+ .qemuGetSCSIDeviceSgName = testSCSIDeviceGetSgName,
+};
+
static int testCompareXMLToArgvFiles(const char *xml,
const char *cmdline,
virQEMUCapsPtr extraFlags,
@@ -113,7 +131,8 @@ static int testCompareXMLToArgvFiles(const char *xml,
if (!(cmd = qemuBuildCommandLine(conn, &driver,
vmdef, &monitor_chr, json, extraFlags,
migrateFrom, migrateFd, NULL,
- VIR_NETDEV_VPORT_PROFILE_OP_NO_OP)))
+ VIR_NETDEV_VPORT_PROFILE_OP_NO_OP,
+ &testCallbacks)))
goto fail;
if (!!virGetLastError() != expectError) {
--
1.8.1.4
11 years, 6 months
[libvirt] traffic control
by Peter V. Saveliev
…
Hello.
I would like to start a discussion about network SLA mechs in libvirt.
Right now, as I understand, libvirt is managing traffic controls, e.g.
bandwitdh limitation, calling external routines (ip/tc). This approach
has its own drawbacks, including the need to parse text output of
external commands and also some complexity with the current state
identification — the queueing discipline can be changed on the interface
in runtime outside of libvirt.
But I would like to propose another approach — not dropping the previous
one, just as an option, maybe. Not so long time ago I started a project
[1] that works with netlink directly and can provide standalone daemon,
that manages interface properties, including queueing disciplines.
Working with netlink events, it is in permanent sync with the current
interface statuses w/o any polling. So maybe it would make sense to use
this daemon — e.g. with JSON or XML-RPC over SSL/TLS, or with any other
RPC that's preferred by libvirt.
That approach can provide:
* more high-level API, that will keep libvirt off the need to compute
rule and filter handlers, hierarchy and so on — we would be able to
implement more complex traffic control schemes in more easy way
* generally speaking, an RPC API is more easy to use, than the execution
of external binary file and parsing text output, and `tc` is not the
easiest command to automate.
If it sounds reasonably enough, we can discuss the overall scheme,
communication and API details that would be more comfortable to libvirt
and so on.
So, any comments?
[1] — https://github.com/svinota/pyroute2
--
Peter V. Saveliev
11 years, 6 months
[libvirt] Bug Reports
by Dennis Zou (yunzou)
Hi,
When I used function esxListDefinedDomains at esx_driver.c to list defined domains and found that retuned array include some templates.
Template just is a master image of a VM that can be used to create a new VM, maybe our function should not return this type of VM.
So I changed some code to get config.template property and then discarded the 'true' items. Code changes may look like as following:
if (esxVI_String_AppendValueListToList(&propertyNameList,
"name\0"
"runtime.powerState\0") < 0 ||
esxVI_LookupVirtualMachineList(priv->primary, propertyNameList,
&virtualMachineList) < 0)
Change to
if (esxVI_String_AppendValueListToList(&propertyNameList, "name\0"
"config.template\0"
"runtime.powerState\0") < 0
|| esxVI_LookupVirtualMachineList(priv->primary, propertyNameList,
&virtualMachineList) < 0)
After line 2493,insert
if (esxVI_DomainIsTemplate(virtualMachine, &isTemplate)
< 0) {
goto cleanup;
}
if (isTemplate == esxVI_Boolean_True) {
continue;
}
The function esxVI_DomainIsTemplate looks like this:
int esxVI_DomainIsTemplate(esxVI_ObjectContent *virtualMachine,
esxVI_Boolean *isTemplate) {
esxVI_DynamicProperty *dynamicProperty;
for (dynamicProperty = virtualMachine->propSet; dynamicProperty != NULL;
dynamicProperty = dynamicProperty->_next) {
if (STREQ(dynamicProperty->name, "config.template")) {
if (esxVI_AnyType_ExpectType(dynamicProperty->val,
esxVI_Type_Boolean) < 0) {
return -1;
}
*isTemplate = dynamicProperty->val->boolean;
return 0;
}
}
ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("Missing 'config.template' property"));
return -1;
}
Regards,
Dennis
11 years, 6 months
[libvirt] [PATCH] Remove bash-ism from tests/schematestutils.sh
by Chris Dunlop
Remove bash-ism from tests/schematestutils.sh
Fix a bash-ism in an sh script, introduced by commit a3f71eb
Signed-off-by: Chris Dunlop <chris(a)onthe.net.au>
diff --git a/tests/schematestutils.sh b/tests/schematestutils.sh
index e739b99..c34364f 100644
--- a/tests/schematestutils.sh
+++ b/tests/schematestutils.sh
@@ -20,7 +20,7 @@ do
result=`$cmd 2>&1`
ret=$?
- grep -- '-invalid.xml$' <<< "$xml" 2>&1 >/dev/null
+ echo "$xml" | grep -- '-invalid.xml$' 2>&1 >/dev/null
invalid=$?
# per xmllint man page, the return codes for validation error
11 years, 6 months
[libvirt] [PATCH] qemu: Increase RLIMIT_MEMLOCK when memoryBacking/locked is used
by Jiri Denemark
If a domain is configured to have all its memory locked, we need to
increase RLIMIT_MEMLOCK so that QEMU is actually allowed to lock the
memory.
---
src/qemu/qemu_command.c | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c268a3a..8e2de09 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6440,6 +6440,7 @@ qemuBuildCommandLine(virConnectPtr conn,
int spice = 0;
int usbcontroller = 0;
bool usblegacy = false;
+ bool mlock;
int contOrder[] = {
/* We don't add an explicit IDE or FD controller because the
* provided PIIX4 device already includes one. It isn't possible to
@@ -6551,6 +6552,7 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgFormat(cmd, "mlock=%s",
def->mem.locked ? "on" : "off");
}
+ mlock = def->mem.locked;
virCommandAddArg(cmd, "-smp");
if (!(smp = qemuBuildSmpArgStr(def, qemuCaps)))
@@ -8191,22 +8193,13 @@ qemuBuildCommandLine(virConnectPtr conn,
if (hostdev->source.subsys.u.pci.backend
== VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) {
- unsigned long long memKB;
-
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("VFIO PCI device assignment is not "
"supported by this version of qemu"));
goto error;
}
- /* VFIO requires all of the guest's memory to be
- * locked resident, plus some amount for IO
- * space. Alex Williamson suggested adding 1GiB for IO
- * space just to be safe (some finer tuning might be
- * nice, though).
- */
- memKB = def->mem.max_balloon + (1024 * 1024);
- virCommandSetMaxMemLock(cmd, memKB * 1024);
+ mlock = true;
}
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
@@ -8425,6 +8418,24 @@ qemuBuildCommandLine(virConnectPtr conn,
goto error;
}
+ if (mlock) {
+ unsigned long long memKB;
+ /* VFIO requires all of the guest's memory to be locked resident,
+ * plus some amount for IO space. Alex Williamson suggested
+ * adding 1GiB for IO space just to be safe (some finer tuning
+ * might be nice, though).
+ *
+ * If memory hard_limit is configured, we can use it directly as
+ * there is no sense to set MEMLOCK limit beyond it. Also we can
+ * safely use it instead of any magically computed value.
+ */
+ if (def->mem.hard_limit)
+ memKB = def->mem.hard_limit;
+ else
+ memKB = def->mem.max_balloon + (1024 * 1024);
+ virCommandSetMaxMemLock(cmd, memKB * 1024);
+ }
+
virObjectUnref(cfg);
return cmd;
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH 0/2] libxl: a few fixes related to event handling
by Jim Fehlig
Xen upstream commit 5fb11a07 fixed the signature of the event handler,
causing build failures of the libxl driver on xen-unstable / Xen 4.3.
While at it, plug leaking of libxl_event objects in the event handler.
Jim Fehlig (2):
libxl: fix build with Xen4.3
libxl: fix leaking libxl events
src/libxl/libxl_driver.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
--
1.7.7
11 years, 6 months
[libvirt] [PATCH] esx: Fix error reporting in esxVI_LookupManagedObjectHelper
by Matthias Bolte
As the name parameter can be NULL the error message can only contain it
conditionally.
---
src/esx/esx_vi.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index 5fd0693..d0df13d 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -5140,8 +5140,14 @@ esxVI_LookupManagedObjectHelper(esxVI_Context *ctx,
if (candidate == NULL) {
if (occurrence != esxVI_Occurrence_OptionalItem) {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Could not find %s with name '%s'"), type, name);
+ if (name != NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find %s with name '%s'"), type, name);
+ } else {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not find %s"), type);
+ }
+
goto cleanup;
}
--
1.7.9.5
11 years, 6 months
[libvirt] [PATCH] Avoid PRIuMAX constant in domain events example
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
The domain events example program uses asprintf() to avoid
portability problems with %llu in one place, but not in
another place. Make all places use asprintf() instead and
thus avoid need to use PRIuMAX
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
examples/domain-events/events-c/event-test.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/examples/domain-events/events-c/event-test.c b/examples/domain-events/events-c/event-test.c
index 301caad..901d41d 100644
--- a/examples/domain-events/events-c/event-test.c
+++ b/examples/domain-events/events-c/event-test.c
@@ -271,8 +271,15 @@ static int myDomainEventBalloonChangeCallback(virConnectPtr conn ATTRIBUTE_UNUSE
unsigned long long actual,
void *opaque ATTRIBUTE_UNUSED)
{
- printf("%s EVENT: Domain %s(%d) balloon change %" PRIuMAX "KB\n",
- __func__, virDomainGetName(dom), virDomainGetID(dom), (uintmax_t)actual);
+ char *str = NULL;
+ /* HACK: use asprintf since we have gnulib's wrapper for %lld on Win32
+ * but don't have a printf() replacement with %lld */
+ if (asprintf(&str, "%s EVENT: Domain %s(%d) balloon change %lluKB\n",
+ __func__, virDomainGetName(dom), virDomainGetID(dom), actual) < 0)
+ return 0;
+
+ printf("%s", str);
+ free(str);
return 0;
}
--
1.8.2.1
11 years, 6 months
[libvirt] New application
by Maciej Nabożny
Hello,
I'm developer of CC1 project in Institute of Nuclear Physics in
Cracow. We are creating cloud computing system based on Libvirt. Is it
possible to add link to our project at yours website in applications
section?
Title: CC1 Project (http://cc1.ifj.edu.pl)
Description: The Cloud Computing for Science and Economy project
At this time we are using version 0.8.3, but as soon as debian 7 will
we stable, we are going to migrate to newer version of Libvirt.
Regards,
Maciej Nabożny
11 years, 6 months
[libvirt] [PATCH v2] qemu: report useful error failling to destroy domain gracefully
by Guannan Ren
Resolves:https://bugzilla.redhat.com/show_bug.cgi?id=927620
#kill -STOP `pidof qemu-kvm`
#virsh destroy $guest --graceful
error: Failed to destroy domain testVM
error: An error occurred, but the cause is unknown
With --graceful, SIGTERM always is emitted to kill driver
process, but it won't success till burning out waiting time
in case of process being stopped.
But domain destroy without --graceful can work, SIGKILL will
be emitted to the stopped process after 10 secs which always
kills a process even one that is currently stopped.
So report an error after burning out waiting time in this case.
---
src/qemu/qemu_process.c | 2 +-
src/util/virprocess.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 4a7c612..e5b4679 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3930,7 +3930,7 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
}
}
- if ((flags & VIR_QEMU_PROCESS_KILL_NOWAIT)) {
+ if (flags & VIR_QEMU_PROCESS_KILL_NOWAIT) {
virProcessKill(vm->pid,
(flags & VIR_QEMU_PROCESS_KILL_FORCE) ?
SIGKILL : SIGTERM);
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 99db003..a569406 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -310,8 +310,9 @@ virProcessKillPainfully(pid_t pid, bool force)
usleep(200 * 1000);
}
- VIR_DEBUG("Timed out waiting after SIGKILL to process %lld",
- (long long)pid);
+ virReportSystemError(EBUSY,
+ _("Failed to terminate process %lld with SIG%s"),
+ (long long)pid, signame);
cleanup:
return ret;
--
1.8.1.4
11 years, 6 months