2010-04-13 18:02:46 +00:00
|
|
|
/*
|
|
|
|
* libvirt-qemu.c: Interfaces for the libvirt library to handle qemu-specific
|
|
|
|
* APIs.
|
|
|
|
*
|
2013-12-19 22:43:46 +00:00
|
|
|
* Copyright (C) 2010-2014 Red Hat, Inc.
|
2010-04-13 18:02:46 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-09-20 22:30:55 +00:00
|
|
|
* License along with this library. If not, see
|
2012-07-21 10:06:23 +00:00
|
|
|
* <http://www.gnu.org/licenses/>.
|
2010-04-13 18:02:46 +00:00
|
|
|
*
|
|
|
|
* Author: Chris Lalancette <clalance@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2012-12-13 18:21:53 +00:00
|
|
|
#include "virerror.h"
|
2012-12-12 17:59:27 +00:00
|
|
|
#include "virlog.h"
|
2013-12-19 22:43:46 +00:00
|
|
|
#include "viruuid.h"
|
2010-04-13 18:02:46 +00:00
|
|
|
#include "datatypes.h"
|
|
|
|
|
Santize the reporting of VIR_ERR_INVALID_ERROR
To ensure consistent error reporting of invalid arguments,
provide a number of predefined helper methods & macros.
- An arg which must not be NULL:
virCheckNonNullArgReturn(argname, retvalue)
virCheckNonNullArgGoto(argname, label)
- An arg which must be NULL
virCheckNullArgGoto(argname, label)
- An arg which must be positive (ie 1 or greater)
virCheckPositiveArgGoto(argname, label)
- An arg which must not be 0
virCheckNonZeroArgGoto(argname, label)
- An arg which must be zero
virCheckZeroArgGoto(argname, label)
- An arg which must not be negative (ie 0 or greater)
virCheckNonNegativeArgGoto(argname, label)
* src/libvirt.c, src/libvirt-qemu.c,
src/nodeinfo.c, src/datatypes.c: Update to use
virCheckXXXX macros
* po/POTFILES.in: Add libvirt-qemu.c and virterror_internal.h
* src/internal.h: Define macros for checking invalid args
* src/util/virterror_internal.h: Define macros for reporting
invalid args
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-05-25 17:41:07 +00:00
|
|
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
|
|
|
|
2014-02-28 12:16:17 +00:00
|
|
|
VIR_LOG_INIT("libvirt-qemu");
|
|
|
|
|
2011-09-09 11:00:09 +00:00
|
|
|
/**
|
|
|
|
* virDomainQemuMonitorCommand:
|
|
|
|
* @domain: a domain object
|
|
|
|
* @cmd: the qemu monitor command string
|
|
|
|
* @result: a string returned by @cmd
|
|
|
|
* @flags: bitwise-or of supported virDomainQemuMonitorCommandFlags
|
|
|
|
*
|
2011-09-14 15:49:08 +00:00
|
|
|
* This API is QEMU specific, so it will only work with hypervisor
|
2011-09-09 11:00:09 +00:00
|
|
|
* connections to the QEMU driver.
|
|
|
|
*
|
|
|
|
* Send an arbitrary monitor command @cmd to @domain through the
|
|
|
|
* qemu monitor. There are several requirements to safely and
|
2011-09-14 15:49:08 +00:00
|
|
|
* successfully use this API:
|
2011-09-09 11:00:09 +00:00
|
|
|
*
|
2011-09-14 15:49:08 +00:00
|
|
|
* - A @cmd that queries state without making any modifications is safe
|
|
|
|
* - A @cmd that alters state that is also tracked by libvirt is unsafe,
|
|
|
|
* and may cause libvirtd to crash
|
|
|
|
* - A @cmd that alters state not tracked by the current version of
|
|
|
|
* libvirt is possible as a means to test new qemu features before
|
|
|
|
* they have support in libvirt, but no guarantees are made to safety
|
2011-09-09 11:00:09 +00:00
|
|
|
*
|
|
|
|
* If VIR_DOMAIN_QEMU_MONITOR_COMMAND_HMP is set, the command is
|
|
|
|
* considered to be a human monitor command and libvirt will automatically
|
|
|
|
* convert it into QMP if needed. In that case the @result will also
|
|
|
|
* be converted back from QMP.
|
|
|
|
*
|
2011-09-14 15:49:08 +00:00
|
|
|
* If successful, @result will be filled with the string output of the
|
|
|
|
* @cmd, and the caller must free this string.
|
2011-09-09 11:00:09 +00:00
|
|
|
*
|
|
|
|
* Returns 0 in case of success, -1 in case of failure
|
|
|
|
*
|
|
|
|
*/
|
2010-04-13 18:02:46 +00:00
|
|
|
int
|
|
|
|
virDomainQemuMonitorCommand(virDomainPtr domain, const char *cmd,
|
|
|
|
char **result, unsigned int flags)
|
|
|
|
{
|
|
|
|
virConnectPtr conn;
|
|
|
|
|
2017-09-25 10:43:33 +00:00
|
|
|
VIR_DOMAIN_DEBUG(domain, "cmd=%s, result=%p, flags=0x%x",
|
2013-12-19 22:43:46 +00:00
|
|
|
cmd, result, flags);
|
2010-04-13 18:02:46 +00:00
|
|
|
|
|
|
|
virResetLastError();
|
|
|
|
|
2014-01-07 21:38:12 +00:00
|
|
|
virCheckDomainReturn(domain, -1);
|
2010-04-13 18:02:46 +00:00
|
|
|
conn = domain->conn;
|
|
|
|
|
Santize the reporting of VIR_ERR_INVALID_ERROR
To ensure consistent error reporting of invalid arguments,
provide a number of predefined helper methods & macros.
- An arg which must not be NULL:
virCheckNonNullArgReturn(argname, retvalue)
virCheckNonNullArgGoto(argname, label)
- An arg which must be NULL
virCheckNullArgGoto(argname, label)
- An arg which must be positive (ie 1 or greater)
virCheckPositiveArgGoto(argname, label)
- An arg which must not be 0
virCheckNonZeroArgGoto(argname, label)
- An arg which must be zero
virCheckZeroArgGoto(argname, label)
- An arg which must not be negative (ie 0 or greater)
virCheckNonNegativeArgGoto(argname, label)
* src/libvirt.c, src/libvirt-qemu.c,
src/nodeinfo.c, src/datatypes.c: Update to use
virCheckXXXX macros
* po/POTFILES.in: Add libvirt-qemu.c and virterror_internal.h
* src/internal.h: Define macros for checking invalid args
* src/util/virterror_internal.h: Define macros for reporting
invalid args
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-05-25 17:41:07 +00:00
|
|
|
virCheckNonNullArgGoto(result, error);
|
2013-12-20 14:02:49 +00:00
|
|
|
virCheckReadOnlyGoto(conn->flags, error);
|
2010-04-13 18:02:46 +00:00
|
|
|
|
2013-04-22 17:26:01 +00:00
|
|
|
if (conn->driver->domainQemuMonitorCommand) {
|
2010-04-13 18:02:46 +00:00
|
|
|
int ret;
|
2013-04-22 17:26:01 +00:00
|
|
|
ret = conn->driver->domainQemuMonitorCommand(domain, cmd, result,
|
2010-04-13 18:02:46 +00:00
|
|
|
flags);
|
|
|
|
if (ret < 0)
|
|
|
|
goto error;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-12-20 01:38:59 +00:00
|
|
|
virReportUnsupportedError();
|
2010-04-13 18:02:46 +00:00
|
|
|
|
2014-03-25 06:57:22 +00:00
|
|
|
error:
|
2010-04-13 18:02:46 +00:00
|
|
|
virDispatchError(conn);
|
|
|
|
return -1;
|
|
|
|
}
|
2011-05-05 14:05:40 +00:00
|
|
|
|
maint: reset error on entrance to public API
We document that calling any public API wipes out all prior
libvirt errors in the same thread; but weren't obeying this
style in a few functions.
There are a couple of nested uses of virConnectRef (in lxc
and qemu reboot paths), but they should not be affected by
this change in semantics since there should not be any
previous error getting nuked (a later patch will clean up
the nested calls, along with abuse of virConnectClose on
cleanup paths which DOES nuke errors).
* src/libvirt.c (virGetVersion, virConnectRef, virDomainRef)
(virDomainGetSecurityLabel, virDomainGetSecurityLabelList)
(virDomainSetMetadata, virDomainGetMetadata)
(virNodeGetSecurityModel, virNetworkRef, virInterfaceRef)
(virStoragePoolRef, virStorageVolRef, virNodeDeviceGetName)
(virNodeDeviceRef, virSecretRef, virStreamRef, virNWFilterRef)
(virDomainSnapshotRef): Reset error on entrance.
(do_open): Drop redundant error reset.
* src/libvirt-qemu.c (virDomainQemuAgentCommand): Likewise.
* src/libvirt-lxc.c (virDomainLxcEnterNamespace)
(virDomainLxcEnterSecurityLabel): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-27 21:54:34 +00:00
|
|
|
|
2011-05-05 14:05:40 +00:00
|
|
|
/**
|
|
|
|
* virDomainQemuAttach:
|
|
|
|
* @conn: pointer to a hypervisor connection
|
build: use correct type for pid and similar types
No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
constructs like 'int pid'. Our API in libvirt-qemu cannot be
changed without breaking ABI; but then again, libvirt-qemu can
only be used on systems that support UNIX sockets, which rules
out Windows (even if qemu could be compiled there) - so for all
points on the call chain that interact with this API decision,
we require a different variable name to make it clear that we
audited the use for safety.
Adding a syntax-check rule only solves half the battle; anywhere
that uses printf on a pid_t still needs to be converted, but that
will be a separate patch.
* cfg.mk (sc_correct_id_types): New syntax check.
* src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
use pid_t for pid, and validate for overflow.
* include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
for syntax check.
* src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
* src/driver.h (virDrvDomainQemuAttach): Likewise.
* tools/virsh.c (cmdQemuAttach): Likewise.
* src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
* src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
* src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
Likewise.
* src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
(qemuParseCommandLinePid): Use pid_t for pid.
* daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
* src/conf/domain_conf.h (_virDomainObj): Likewise.
* src/probes.d (rpc_socket_new): Likewise.
* src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
* src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
Likewise.
* src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
* src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
* src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
* src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
* src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
* tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
* src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
and gid_t rather than int.
* src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
* src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
compiler warning.
2012-02-10 23:08:11 +00:00
|
|
|
* @pid_value: the UNIX process ID of the external QEMU process
|
2011-05-05 14:05:40 +00:00
|
|
|
* @flags: optional flags, currently unused
|
|
|
|
*
|
2011-09-14 15:49:08 +00:00
|
|
|
* This API is QEMU specific, so it will only work with hypervisor
|
2011-05-05 14:05:40 +00:00
|
|
|
* connections to the QEMU driver.
|
|
|
|
*
|
|
|
|
* This API will attach to an externally launched QEMU process
|
2011-09-14 15:49:08 +00:00
|
|
|
* identified by @pid. There are several requirements to successfully
|
2011-05-05 14:05:40 +00:00
|
|
|
* attach to an external QEMU process:
|
|
|
|
*
|
|
|
|
* - It must have been started with a monitor socket using the UNIX
|
|
|
|
* domain socket protocol.
|
|
|
|
* - No device hotplug/unplug, or other configuration changes can
|
|
|
|
* have been made via the monitor since it started.
|
|
|
|
* - The '-name' and '-uuid' arguments should have been set (not
|
|
|
|
* mandatory, but strongly recommended)
|
|
|
|
*
|
build: use correct type for pid and similar types
No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
constructs like 'int pid'. Our API in libvirt-qemu cannot be
changed without breaking ABI; but then again, libvirt-qemu can
only be used on systems that support UNIX sockets, which rules
out Windows (even if qemu could be compiled there) - so for all
points on the call chain that interact with this API decision,
we require a different variable name to make it clear that we
audited the use for safety.
Adding a syntax-check rule only solves half the battle; anywhere
that uses printf on a pid_t still needs to be converted, but that
will be a separate patch.
* cfg.mk (sc_correct_id_types): New syntax check.
* src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
use pid_t for pid, and validate for overflow.
* include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
for syntax check.
* src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
* src/driver.h (virDrvDomainQemuAttach): Likewise.
* tools/virsh.c (cmdQemuAttach): Likewise.
* src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
* src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
* src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
Likewise.
* src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
(qemuParseCommandLinePid): Use pid_t for pid.
* daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
* src/conf/domain_conf.h (_virDomainObj): Likewise.
* src/probes.d (rpc_socket_new): Likewise.
* src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
* src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
Likewise.
* src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
* src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
* src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
* src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
* src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
* tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
* src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
and gid_t rather than int.
* src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
* src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
compiler warning.
2012-02-10 23:08:11 +00:00
|
|
|
* To date, the only platforms we know of where pid_t is larger than
|
|
|
|
* unsigned int (64-bit Windows) also lack UNIX sockets, so the choice
|
|
|
|
* of @pid_value as an unsigned int should not present any difficulties.
|
|
|
|
*
|
2011-05-05 14:05:40 +00:00
|
|
|
* If successful, then the guest will appear in the list of running
|
|
|
|
* domains for this connection, and other APIs should operate
|
2011-09-14 15:49:08 +00:00
|
|
|
* normally (provided the above requirements were honored).
|
2011-05-05 14:05:40 +00:00
|
|
|
*
|
|
|
|
* Returns a new domain object on success, NULL otherwise
|
|
|
|
*/
|
|
|
|
virDomainPtr
|
|
|
|
virDomainQemuAttach(virConnectPtr conn,
|
build: use correct type for pid and similar types
No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
constructs like 'int pid'. Our API in libvirt-qemu cannot be
changed without breaking ABI; but then again, libvirt-qemu can
only be used on systems that support UNIX sockets, which rules
out Windows (even if qemu could be compiled there) - so for all
points on the call chain that interact with this API decision,
we require a different variable name to make it clear that we
audited the use for safety.
Adding a syntax-check rule only solves half the battle; anywhere
that uses printf on a pid_t still needs to be converted, but that
will be a separate patch.
* cfg.mk (sc_correct_id_types): New syntax check.
* src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
use pid_t for pid, and validate for overflow.
* include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
for syntax check.
* src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
* src/driver.h (virDrvDomainQemuAttach): Likewise.
* tools/virsh.c (cmdQemuAttach): Likewise.
* src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
* src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
* src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
Likewise.
* src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
(qemuParseCommandLinePid): Use pid_t for pid.
* daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
* src/conf/domain_conf.h (_virDomainObj): Likewise.
* src/probes.d (rpc_socket_new): Likewise.
* src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
* src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
Likewise.
* src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
* src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
* src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
* src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
* src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
* tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
* src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
and gid_t rather than int.
* src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
* src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
compiler warning.
2012-02-10 23:08:11 +00:00
|
|
|
unsigned int pid_value,
|
2011-05-05 14:05:40 +00:00
|
|
|
unsigned int flags)
|
|
|
|
{
|
build: use correct type for pid and similar types
No thanks to 64-bit windows, with 64-bit pid_t, we have to avoid
constructs like 'int pid'. Our API in libvirt-qemu cannot be
changed without breaking ABI; but then again, libvirt-qemu can
only be used on systems that support UNIX sockets, which rules
out Windows (even if qemu could be compiled there) - so for all
points on the call chain that interact with this API decision,
we require a different variable name to make it clear that we
audited the use for safety.
Adding a syntax-check rule only solves half the battle; anywhere
that uses printf on a pid_t still needs to be converted, but that
will be a separate patch.
* cfg.mk (sc_correct_id_types): New syntax check.
* src/libvirt-qemu.c (virDomainQemuAttach): Document why we didn't
use pid_t for pid, and validate for overflow.
* include/libvirt/libvirt-qemu.h (virDomainQemuAttach): Tweak name
for syntax check.
* src/vmware/vmware_conf.c (vmwareExtractPid): Likewise.
* src/driver.h (virDrvDomainQemuAttach): Likewise.
* tools/virsh.c (cmdQemuAttach): Likewise.
* src/remote/qemu_protocol.x (qemu_domain_attach_args): Likewise.
* src/qemu_protocol-structs (qemu_domain_attach_args): Likewise.
* src/util/cgroup.c (virCgroupPidCode, virCgroupKillInternal):
Likewise.
* src/qemu/qemu_command.c(qemuParseProcFileStrings): Likewise.
(qemuParseCommandLinePid): Use pid_t for pid.
* daemon/libvirtd.c (daemonForkIntoBackground): Likewise.
* src/conf/domain_conf.h (_virDomainObj): Likewise.
* src/probes.d (rpc_socket_new): Likewise.
* src/qemu/qemu_command.h (qemuParseCommandLinePid): Likewise.
* src/qemu/qemu_driver.c (qemudGetProcessInfo, qemuDomainAttach):
Likewise.
* src/qemu/qemu_process.c (qemuProcessAttach): Likewise.
* src/qemu/qemu_process.h (qemuProcessAttach): Likewise.
* src/uml/uml_driver.c (umlGetProcessInfo): Likewise.
* src/util/virnetdev.h (virNetDevSetNamespace): Likewise.
* src/util/virnetdev.c (virNetDevSetNamespace): Likewise.
* tests/testutils.c (virtTestCaptureProgramOutput): Likewise.
* src/conf/storage_conf.h (_virStoragePerms): Use mode_t, uid_t,
and gid_t rather than int.
* src/security/security_dac.c (virSecurityDACSetOwnership): Likewise.
* src/conf/storage_conf.c (virStorageDefParsePerms): Avoid
compiler warning.
2012-02-10 23:08:11 +00:00
|
|
|
pid_t pid = pid_value;
|
2017-09-25 10:43:33 +00:00
|
|
|
VIR_DEBUG("conn=%p, pid=%u, flags=0x%x", conn, pid_value, flags);
|
2011-05-05 14:05:40 +00:00
|
|
|
|
|
|
|
virResetLastError();
|
|
|
|
|
2013-12-28 03:31:17 +00:00
|
|
|
virCheckConnectReturn(conn, NULL);
|
Santize the reporting of VIR_ERR_INVALID_ERROR
To ensure consistent error reporting of invalid arguments,
provide a number of predefined helper methods & macros.
- An arg which must not be NULL:
virCheckNonNullArgReturn(argname, retvalue)
virCheckNonNullArgGoto(argname, label)
- An arg which must be NULL
virCheckNullArgGoto(argname, label)
- An arg which must be positive (ie 1 or greater)
virCheckPositiveArgGoto(argname, label)
- An arg which must not be 0
virCheckNonZeroArgGoto(argname, label)
- An arg which must be zero
virCheckZeroArgGoto(argname, label)
- An arg which must not be negative (ie 0 or greater)
virCheckNonNegativeArgGoto(argname, label)
* src/libvirt.c, src/libvirt-qemu.c,
src/nodeinfo.c, src/datatypes.c: Update to use
virCheckXXXX macros
* po/POTFILES.in: Add libvirt-qemu.c and virterror_internal.h
* src/internal.h: Define macros for checking invalid args
* src/util/virterror_internal.h: Define macros for reporting
invalid args
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-05-25 17:41:07 +00:00
|
|
|
virCheckPositiveArgGoto(pid_value, error);
|
|
|
|
if (pid != pid_value) {
|
|
|
|
virReportInvalidArg(pid_value,
|
|
|
|
_("pid_value in %s is too large"),
|
|
|
|
__FUNCTION__);
|
2011-05-05 14:05:40 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2013-12-20 14:02:49 +00:00
|
|
|
virCheckReadOnlyGoto(conn->flags, error);
|
2011-05-05 14:05:40 +00:00
|
|
|
|
2013-04-22 17:26:01 +00:00
|
|
|
if (conn->driver->domainQemuAttach) {
|
2011-05-05 14:05:40 +00:00
|
|
|
virDomainPtr ret;
|
2013-04-22 17:26:01 +00:00
|
|
|
ret = conn->driver->domainQemuAttach(conn, pid_value, flags);
|
2011-05-05 14:05:40 +00:00
|
|
|
if (!ret)
|
|
|
|
goto error;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2013-12-20 01:38:59 +00:00
|
|
|
virReportUnsupportedError();
|
2011-05-05 14:05:40 +00:00
|
|
|
|
2014-03-25 06:57:22 +00:00
|
|
|
error:
|
2011-05-05 14:05:40 +00:00
|
|
|
virDispatchError(conn);
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-08-23 03:29:23 +00:00
|
|
|
|
maint: reset error on entrance to public API
We document that calling any public API wipes out all prior
libvirt errors in the same thread; but weren't obeying this
style in a few functions.
There are a couple of nested uses of virConnectRef (in lxc
and qemu reboot paths), but they should not be affected by
this change in semantics since there should not be any
previous error getting nuked (a later patch will clean up
the nested calls, along with abuse of virConnectClose on
cleanup paths which DOES nuke errors).
* src/libvirt.c (virGetVersion, virConnectRef, virDomainRef)
(virDomainGetSecurityLabel, virDomainGetSecurityLabelList)
(virDomainSetMetadata, virDomainGetMetadata)
(virNodeGetSecurityModel, virNetworkRef, virInterfaceRef)
(virStoragePoolRef, virStorageVolRef, virNodeDeviceGetName)
(virNodeDeviceRef, virSecretRef, virStreamRef, virNWFilterRef)
(virDomainSnapshotRef): Reset error on entrance.
(do_open): Drop redundant error reset.
* src/libvirt-qemu.c (virDomainQemuAgentCommand): Likewise.
* src/libvirt-lxc.c (virDomainLxcEnterNamespace)
(virDomainLxcEnterSecurityLabel): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-27 21:54:34 +00:00
|
|
|
|
2012-08-23 03:29:23 +00:00
|
|
|
/**
|
|
|
|
* virDomainQemuAgentCommand:
|
|
|
|
* @domain: a domain object
|
|
|
|
* @cmd: the guest agent command string
|
|
|
|
* @timeout: timeout seconds
|
|
|
|
* @flags: execution flags
|
|
|
|
*
|
|
|
|
* Execute an arbitrary Guest Agent command.
|
|
|
|
*
|
|
|
|
* Issue @cmd to the guest agent running in @domain.
|
|
|
|
* @timeout must be -2, -1, 0 or positive.
|
|
|
|
* VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK(-2): meaning to block forever waiting for
|
|
|
|
* a result.
|
|
|
|
* VIR_DOMAIN_QEMU_AGENT_COMMAND_DEFAULT(-1): use default timeout value.
|
|
|
|
* VIR_DOMAIN_QEMU_AGENT_COMMAND_NOWAIT(0): does not wait.
|
|
|
|
* positive value: wait for @timeout seconds
|
|
|
|
*
|
|
|
|
* Returns strings if success, NULL in failure.
|
|
|
|
*/
|
|
|
|
char *
|
|
|
|
virDomainQemuAgentCommand(virDomainPtr domain,
|
|
|
|
const char *cmd,
|
|
|
|
int timeout,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
virConnectPtr conn;
|
2013-06-03 14:12:52 +00:00
|
|
|
char *ret;
|
2012-08-23 03:29:23 +00:00
|
|
|
|
2017-09-25 10:43:33 +00:00
|
|
|
VIR_DOMAIN_DEBUG(domain, "cmd=%s, timeout=%d, flags=0x%x",
|
2013-12-19 22:43:46 +00:00
|
|
|
cmd, timeout, flags);
|
2012-08-23 03:29:23 +00:00
|
|
|
|
maint: reset error on entrance to public API
We document that calling any public API wipes out all prior
libvirt errors in the same thread; but weren't obeying this
style in a few functions.
There are a couple of nested uses of virConnectRef (in lxc
and qemu reboot paths), but they should not be affected by
this change in semantics since there should not be any
previous error getting nuked (a later patch will clean up
the nested calls, along with abuse of virConnectClose on
cleanup paths which DOES nuke errors).
* src/libvirt.c (virGetVersion, virConnectRef, virDomainRef)
(virDomainGetSecurityLabel, virDomainGetSecurityLabelList)
(virDomainSetMetadata, virDomainGetMetadata)
(virNodeGetSecurityModel, virNetworkRef, virInterfaceRef)
(virStoragePoolRef, virStorageVolRef, virNodeDeviceGetName)
(virNodeDeviceRef, virSecretRef, virStreamRef, virNWFilterRef)
(virDomainSnapshotRef): Reset error on entrance.
(do_open): Drop redundant error reset.
* src/libvirt-qemu.c (virDomainQemuAgentCommand): Likewise.
* src/libvirt-lxc.c (virDomainLxcEnterNamespace)
(virDomainLxcEnterSecurityLabel): Likewise.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-27 21:54:34 +00:00
|
|
|
virResetLastError();
|
|
|
|
|
2014-01-07 21:38:12 +00:00
|
|
|
virCheckDomainReturn(domain, NULL);
|
2012-08-23 03:29:23 +00:00
|
|
|
conn = domain->conn;
|
|
|
|
|
2013-12-20 14:02:49 +00:00
|
|
|
virCheckReadOnlyGoto(conn->flags, error);
|
2013-06-03 14:12:52 +00:00
|
|
|
|
2013-04-22 17:26:01 +00:00
|
|
|
if (conn->driver->domainQemuAgentCommand) {
|
2013-06-03 14:12:52 +00:00
|
|
|
ret = conn->driver->domainQemuAgentCommand(domain, cmd,
|
|
|
|
timeout, flags);
|
|
|
|
if (!ret)
|
|
|
|
goto error;
|
|
|
|
return ret;
|
2012-08-23 03:29:23 +00:00
|
|
|
}
|
|
|
|
|
2013-12-20 01:38:59 +00:00
|
|
|
virReportUnsupportedError();
|
2012-08-23 03:29:23 +00:00
|
|
|
|
2014-03-25 06:57:22 +00:00
|
|
|
error:
|
2012-08-23 03:29:23 +00:00
|
|
|
virDispatchError(conn);
|
|
|
|
return NULL;
|
|
|
|
}
|
qemu: new API for tracking arbitrary monitor events
Several times in the past, qemu has implemented a new event,
but libvirt has not yet caught up to reporting that event to
the user applications. While it is possible to track libvirt
logs to see that an unknown event was received and ignored,
it would be nicer to copy what 'virsh qemu-monitor-command'
does, and expose this information to the end developer as
one of our unsupported qemu-specific commands.
If you find yourself needing to use this API for more than
just development purposes, please ask on the libvirt list
for a supported counterpart event to be added in libvirt.so.
While the supported virConnectDomainEventRegisterAny() API
takes an id which determines the signature of the callback,
this version takes a string filter and always uses the same
signature. Furthermore, I chose to expose this as a new API
instead of trying to add a new eventID at the top level, in
part because the generic option lacks event name filtering,
and in part because the normal domain event namespace should
not be polluted by a qemu-only event. I also added a flags
argument; unused for now, but we might decide to use it to
allow a user to request event names by glob or regex instead
of literal match.
This API intentionally requires full write access (while
normal event registration is allowed on read-only clients);
this is in part due to the fact that it should only be used
by debugging situations, and in part because the design of
per-event filtering in later patches ended up allowing for
duplicate registrations that could potentially be abused to
exhaust server memory - requiring write privileges means
that such abuse will not serve as a denial of service attack
against users with higher privileges.
* include/libvirt/libvirt-qemu.h
(virConnectDomainQemuMonitorEventCallback)
(virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New prototypes.
* src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New functions.
* src/libvirt_qemu.syms (LIBVIRT_QEMU_1.2.1): Export them.
* src/driver.h (virDrvConnectDomainQemuMonitorEventRegister)
(virDrvConnectDomainQemuMonitorEventDeregister): New callbacks.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-19 14:06:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virConnectDomainQemuMonitorEventRegister:
|
|
|
|
* @conn: pointer to the connection
|
|
|
|
* @dom: pointer to the domain, or NULL
|
|
|
|
* @event: name of the event, or NULL
|
|
|
|
* @cb: callback to the function handling monitor events
|
|
|
|
* @opaque: opaque data to pass on to the callback
|
|
|
|
* @freecb: optional function to deallocate opaque when not used anymore
|
2014-02-06 21:46:52 +00:00
|
|
|
* @flags: bitwise-OR of virConnectDomainQemuMonitorEventRegisterFlags
|
qemu: new API for tracking arbitrary monitor events
Several times in the past, qemu has implemented a new event,
but libvirt has not yet caught up to reporting that event to
the user applications. While it is possible to track libvirt
logs to see that an unknown event was received and ignored,
it would be nicer to copy what 'virsh qemu-monitor-command'
does, and expose this information to the end developer as
one of our unsupported qemu-specific commands.
If you find yourself needing to use this API for more than
just development purposes, please ask on the libvirt list
for a supported counterpart event to be added in libvirt.so.
While the supported virConnectDomainEventRegisterAny() API
takes an id which determines the signature of the callback,
this version takes a string filter and always uses the same
signature. Furthermore, I chose to expose this as a new API
instead of trying to add a new eventID at the top level, in
part because the generic option lacks event name filtering,
and in part because the normal domain event namespace should
not be polluted by a qemu-only event. I also added a flags
argument; unused for now, but we might decide to use it to
allow a user to request event names by glob or regex instead
of literal match.
This API intentionally requires full write access (while
normal event registration is allowed on read-only clients);
this is in part due to the fact that it should only be used
by debugging situations, and in part because the design of
per-event filtering in later patches ended up allowing for
duplicate registrations that could potentially be abused to
exhaust server memory - requiring write privileges means
that such abuse will not serve as a denial of service attack
against users with higher privileges.
* include/libvirt/libvirt-qemu.h
(virConnectDomainQemuMonitorEventCallback)
(virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New prototypes.
* src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New functions.
* src/libvirt_qemu.syms (LIBVIRT_QEMU_1.2.1): Export them.
* src/driver.h (virDrvConnectDomainQemuMonitorEventRegister)
(virDrvConnectDomainQemuMonitorEventDeregister): New callbacks.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-19 14:06:35 +00:00
|
|
|
*
|
|
|
|
* This API is QEMU specific, so it will only work with hypervisor
|
|
|
|
* connections to the QEMU driver.
|
|
|
|
*
|
|
|
|
* Adds a callback to receive notifications of arbitrary qemu monitor events
|
|
|
|
* occurring on a domain. Many qemu monitor events also result in a libvirt
|
|
|
|
* event which can be delivered via virConnectDomainEventRegisterAny(); this
|
|
|
|
* command is primarily for testing new qemu events that have not yet been
|
|
|
|
* given a libvirt counterpart event.
|
|
|
|
*
|
|
|
|
* If @dom is NULL, then events will be monitored for any domain. If @dom
|
|
|
|
* is non-NULL, then only the specific domain will be monitored.
|
|
|
|
*
|
|
|
|
* If @event is NULL, then all monitor events will be reported. If @event is
|
2014-02-06 21:46:52 +00:00
|
|
|
* non-NULL, then only specific monitor events will be reported. @flags
|
|
|
|
* controls how the filtering is performed: 0 requests an exact match, while
|
|
|
|
* VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX states that @event
|
|
|
|
* is a basic regular expression. Additionally, including
|
|
|
|
* VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE lets @event match
|
|
|
|
* case-insensitively.
|
qemu: new API for tracking arbitrary monitor events
Several times in the past, qemu has implemented a new event,
but libvirt has not yet caught up to reporting that event to
the user applications. While it is possible to track libvirt
logs to see that an unknown event was received and ignored,
it would be nicer to copy what 'virsh qemu-monitor-command'
does, and expose this information to the end developer as
one of our unsupported qemu-specific commands.
If you find yourself needing to use this API for more than
just development purposes, please ask on the libvirt list
for a supported counterpart event to be added in libvirt.so.
While the supported virConnectDomainEventRegisterAny() API
takes an id which determines the signature of the callback,
this version takes a string filter and always uses the same
signature. Furthermore, I chose to expose this as a new API
instead of trying to add a new eventID at the top level, in
part because the generic option lacks event name filtering,
and in part because the normal domain event namespace should
not be polluted by a qemu-only event. I also added a flags
argument; unused for now, but we might decide to use it to
allow a user to request event names by glob or regex instead
of literal match.
This API intentionally requires full write access (while
normal event registration is allowed on read-only clients);
this is in part due to the fact that it should only be used
by debugging situations, and in part because the design of
per-event filtering in later patches ended up allowing for
duplicate registrations that could potentially be abused to
exhaust server memory - requiring write privileges means
that such abuse will not serve as a denial of service attack
against users with higher privileges.
* include/libvirt/libvirt-qemu.h
(virConnectDomainQemuMonitorEventCallback)
(virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New prototypes.
* src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New functions.
* src/libvirt_qemu.syms (LIBVIRT_QEMU_1.2.1): Export them.
* src/driver.h (virDrvConnectDomainQemuMonitorEventRegister)
(virDrvConnectDomainQemuMonitorEventDeregister): New callbacks.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-19 14:06:35 +00:00
|
|
|
*
|
|
|
|
* The virDomainPtr object handle passed into the callback upon delivery
|
|
|
|
* of an event is only valid for the duration of execution of the callback.
|
|
|
|
* If the callback wishes to keep the domain object after the callback returns,
|
|
|
|
* it shall take a reference to it, by calling virDomainRef().
|
|
|
|
* The reference can be released once the object is no longer required
|
|
|
|
* by calling virDomainFree().
|
|
|
|
*
|
|
|
|
* The return value from this method is a positive integer identifier
|
|
|
|
* for the callback. To unregister a callback, this callback ID should
|
|
|
|
* be passed to the virConnectDomainQemuMonitorEventDeregister() method.
|
|
|
|
*
|
|
|
|
* Returns a callback identifier on success, -1 on failure
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
virConnectDomainQemuMonitorEventRegister(virConnectPtr conn,
|
|
|
|
virDomainPtr dom,
|
|
|
|
const char *event,
|
|
|
|
virConnectDomainQemuMonitorEventCallback cb,
|
|
|
|
void *opaque,
|
|
|
|
virFreeCallback freecb,
|
|
|
|
unsigned int flags)
|
|
|
|
{
|
|
|
|
VIR_DOMAIN_DEBUG(dom,
|
2017-09-25 10:43:33 +00:00
|
|
|
"conn=%p, event=%s, cb=%p, opaque=%p, freecb=%p, flags=0x%x",
|
qemu: new API for tracking arbitrary monitor events
Several times in the past, qemu has implemented a new event,
but libvirt has not yet caught up to reporting that event to
the user applications. While it is possible to track libvirt
logs to see that an unknown event was received and ignored,
it would be nicer to copy what 'virsh qemu-monitor-command'
does, and expose this information to the end developer as
one of our unsupported qemu-specific commands.
If you find yourself needing to use this API for more than
just development purposes, please ask on the libvirt list
for a supported counterpart event to be added in libvirt.so.
While the supported virConnectDomainEventRegisterAny() API
takes an id which determines the signature of the callback,
this version takes a string filter and always uses the same
signature. Furthermore, I chose to expose this as a new API
instead of trying to add a new eventID at the top level, in
part because the generic option lacks event name filtering,
and in part because the normal domain event namespace should
not be polluted by a qemu-only event. I also added a flags
argument; unused for now, but we might decide to use it to
allow a user to request event names by glob or regex instead
of literal match.
This API intentionally requires full write access (while
normal event registration is allowed on read-only clients);
this is in part due to the fact that it should only be used
by debugging situations, and in part because the design of
per-event filtering in later patches ended up allowing for
duplicate registrations that could potentially be abused to
exhaust server memory - requiring write privileges means
that such abuse will not serve as a denial of service attack
against users with higher privileges.
* include/libvirt/libvirt-qemu.h
(virConnectDomainQemuMonitorEventCallback)
(virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New prototypes.
* src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New functions.
* src/libvirt_qemu.syms (LIBVIRT_QEMU_1.2.1): Export them.
* src/driver.h (virDrvConnectDomainQemuMonitorEventRegister)
(virDrvConnectDomainQemuMonitorEventDeregister): New callbacks.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-19 14:06:35 +00:00
|
|
|
conn, NULLSTR(event), cb, opaque, freecb, flags);
|
|
|
|
|
|
|
|
virResetLastError();
|
|
|
|
|
|
|
|
virCheckConnectReturn(conn, -1);
|
|
|
|
if (dom) {
|
|
|
|
virCheckDomainGoto(dom, error);
|
|
|
|
if (dom->conn != conn) {
|
|
|
|
virReportInvalidArg(dom,
|
|
|
|
_("domain '%s' in %s must match connection"),
|
|
|
|
dom->name, __FUNCTION__);
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
virCheckNonNullArgGoto(cb, error);
|
|
|
|
virCheckReadOnlyGoto(conn->flags, error);
|
|
|
|
|
|
|
|
if (conn->driver && conn->driver->connectDomainQemuMonitorEventRegister) {
|
|
|
|
int ret;
|
|
|
|
ret = conn->driver->connectDomainQemuMonitorEventRegister(conn, dom, event, cb, opaque, freecb, flags);
|
|
|
|
if (ret < 0)
|
|
|
|
goto error;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
virReportUnsupportedError();
|
2014-03-25 06:57:22 +00:00
|
|
|
error:
|
qemu: new API for tracking arbitrary monitor events
Several times in the past, qemu has implemented a new event,
but libvirt has not yet caught up to reporting that event to
the user applications. While it is possible to track libvirt
logs to see that an unknown event was received and ignored,
it would be nicer to copy what 'virsh qemu-monitor-command'
does, and expose this information to the end developer as
one of our unsupported qemu-specific commands.
If you find yourself needing to use this API for more than
just development purposes, please ask on the libvirt list
for a supported counterpart event to be added in libvirt.so.
While the supported virConnectDomainEventRegisterAny() API
takes an id which determines the signature of the callback,
this version takes a string filter and always uses the same
signature. Furthermore, I chose to expose this as a new API
instead of trying to add a new eventID at the top level, in
part because the generic option lacks event name filtering,
and in part because the normal domain event namespace should
not be polluted by a qemu-only event. I also added a flags
argument; unused for now, but we might decide to use it to
allow a user to request event names by glob or regex instead
of literal match.
This API intentionally requires full write access (while
normal event registration is allowed on read-only clients);
this is in part due to the fact that it should only be used
by debugging situations, and in part because the design of
per-event filtering in later patches ended up allowing for
duplicate registrations that could potentially be abused to
exhaust server memory - requiring write privileges means
that such abuse will not serve as a denial of service attack
against users with higher privileges.
* include/libvirt/libvirt-qemu.h
(virConnectDomainQemuMonitorEventCallback)
(virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New prototypes.
* src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New functions.
* src/libvirt_qemu.syms (LIBVIRT_QEMU_1.2.1): Export them.
* src/driver.h (virDrvConnectDomainQemuMonitorEventRegister)
(virDrvConnectDomainQemuMonitorEventDeregister): New callbacks.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-19 14:06:35 +00:00
|
|
|
virDispatchError(conn);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* virConnectDomainQemuMonitorEventDeregister:
|
|
|
|
* @conn: pointer to the connection
|
|
|
|
* @callbackID: the callback identifier
|
|
|
|
*
|
|
|
|
* Removes an event callback. The callbackID parameter should be the
|
|
|
|
* value obtained from a previous virConnectDomainQemuMonitorEventRegister()
|
|
|
|
* method.
|
|
|
|
*
|
|
|
|
* Returns 0 on success, -1 on failure
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
virConnectDomainQemuMonitorEventDeregister(virConnectPtr conn,
|
|
|
|
int callbackID)
|
|
|
|
{
|
|
|
|
VIR_DEBUG("conn=%p, callbackID=%d", conn, callbackID);
|
|
|
|
|
|
|
|
virResetLastError();
|
|
|
|
|
|
|
|
virCheckConnectReturn(conn, -1);
|
|
|
|
virCheckNonNegativeArgGoto(callbackID, error);
|
|
|
|
virCheckReadOnlyGoto(conn->flags, error);
|
|
|
|
|
|
|
|
if (conn->driver && conn->driver->connectDomainQemuMonitorEventDeregister) {
|
|
|
|
int ret;
|
|
|
|
ret = conn->driver->connectDomainQemuMonitorEventDeregister(conn, callbackID);
|
|
|
|
if (ret < 0)
|
|
|
|
goto error;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
virReportUnsupportedError();
|
2014-03-25 06:57:22 +00:00
|
|
|
error:
|
qemu: new API for tracking arbitrary monitor events
Several times in the past, qemu has implemented a new event,
but libvirt has not yet caught up to reporting that event to
the user applications. While it is possible to track libvirt
logs to see that an unknown event was received and ignored,
it would be nicer to copy what 'virsh qemu-monitor-command'
does, and expose this information to the end developer as
one of our unsupported qemu-specific commands.
If you find yourself needing to use this API for more than
just development purposes, please ask on the libvirt list
for a supported counterpart event to be added in libvirt.so.
While the supported virConnectDomainEventRegisterAny() API
takes an id which determines the signature of the callback,
this version takes a string filter and always uses the same
signature. Furthermore, I chose to expose this as a new API
instead of trying to add a new eventID at the top level, in
part because the generic option lacks event name filtering,
and in part because the normal domain event namespace should
not be polluted by a qemu-only event. I also added a flags
argument; unused for now, but we might decide to use it to
allow a user to request event names by glob or regex instead
of literal match.
This API intentionally requires full write access (while
normal event registration is allowed on read-only clients);
this is in part due to the fact that it should only be used
by debugging situations, and in part because the design of
per-event filtering in later patches ended up allowing for
duplicate registrations that could potentially be abused to
exhaust server memory - requiring write privileges means
that such abuse will not serve as a denial of service attack
against users with higher privileges.
* include/libvirt/libvirt-qemu.h
(virConnectDomainQemuMonitorEventCallback)
(virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New prototypes.
* src/libvirt-qemu.c (virConnectDomainQemuMonitorEventRegister)
(virConnectDomainQemuMonitorEventDeregister): New functions.
* src/libvirt_qemu.syms (LIBVIRT_QEMU_1.2.1): Export them.
* src/driver.h (virDrvConnectDomainQemuMonitorEventRegister)
(virDrvConnectDomainQemuMonitorEventDeregister): New callbacks.
Signed-off-by: Eric Blake <eblake@redhat.com>
2013-12-19 14:06:35 +00:00
|
|
|
virDispatchError(conn);
|
|
|
|
return -1;
|
|
|
|
}
|