add another missing libvirt command
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
configure.ac | 3 +++
src/Makefile.am | 5 +++--
src/libvirt-php.c | 29 +++++++++++++++++++++++++++++
src/libvirt-php.h | 2 ++
4 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 04ebbdc..b6ef27a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,9 @@ fi
LIBVIRT_REQUIRED=1.2.8
PKG_CHECK_MODULES(LIBVIRT, libvirt >= $LIBVIRT_REQUIRED)
+PKG_CHECK_MODULES(QEMU, libvirt-qemu)
+AC_SUBST([QEMU_CFLAGS])
+AC_SUBST([QEMU_LIBS])
dnl ==========================================================================
dnl required minimum version of libxml2
diff --git a/src/Makefile.am b/src/Makefile.am
index 8e6a800..f270ec2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,13 +27,14 @@ uninstall-local:
AM_CFLAGS = \
$(PHPINC) $(LIBXML_CFLAGS) \
- $(LIBVIRT_CFLAGS) $(DEFINES) \
+ $(LIBVIRT_CFLAGS) $(QEMU_CFLAGS) $(DEFINES) \
-I$(top_srcdir)/winsrc
AM_LDFLAGS = \
$(SHLIB_LDFLAGS) \
$(LIBXML_LIBS) \
- $(LIBVIRT_LIBS)
+ $(LIBVIRT_LIBS) \
+ $(QEMU_LIBS)
lib_LTLIBRARIES = libvirt-php.la
diff --git a/src/libvirt-php.c b/src/libvirt-php.c
index d13e5b4..b018cb0 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -242,6 +242,8 @@ static zend_function_entry libvirt_functions[] = {
/* Debugging functions */
PHP_FE(libvirt_logfile_set, NULL)
PHP_FE(libvirt_print_binding_resources, NULL)
+ /* Agent functions */
+ PHP_FE(libvirt_domain_qemu_agent_command, NULL)
{NULL, NULL, NULL}
};
@@ -3611,6 +3613,33 @@ PHP_FUNCTION(libvirt_domain_lookup_by_uuid)
}
/*
+ * Function name: libvirt_domain_qemu_agent_command
+ * Since version: 0.5.2(-1)
+ * Description: Function is used to send qemu-ga command
+ * Arguments: @res [resource]: libvirt domain resource, e.g. from
libvirt_domain_lookup_by_*()
+ * @timeout [int] timeout for waiting (-2 block, -1 default, 0 no wait,
>0 wait specific time
+ * @flags [int]: unknown
+ * Returns: String on success and FALSE on error
+ */
+PHP_FUNCTION(libvirt_domain_qemu_agent_command)
+{
+ php_libvirt_domain *domain=NULL;
+ zval *zdomain;
+ const char *cmd;
+ int cmd_len;
+ char *ret;
+ long timeout = -1;
+ long flags = 0;
+
+ GET_DOMAIN_FROM_ARGS("rs|ll", &zdomain, &cmd, &cmd_len,
&timeout, &flags);
+
+ ret = virDomainQemuAgentCommand(domain->domain, cmd, timeout, flags);
+ if (ret == NULL) RETURN_FALSE;
+
+ RETURN_STRING(ret, 1);
+}
+
+/*
* Function name: libvirt_domain_lookup_by_uuid_string
* Since version: 0.4.1(-1)
* Description: Function is used to get the domain by it's UUID that's
accepted in string format
diff --git a/src/libvirt-php.h b/src/libvirt-php.h
index 8dc5927..eb4b7f4 100644
--- a/src/libvirt-php.h
+++ b/src/libvirt-php.h
@@ -80,6 +80,7 @@
#include <libvirt/libvirt.h>
#include <libvirt/virterror.h>
+#include <libvirt/libvirt-qemu.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <fcntl.h>
@@ -423,6 +424,7 @@ PHP_FUNCTION(libvirt_domain_send_keys);
PHP_FUNCTION(libvirt_domain_send_pointer_event);
PHP_FUNCTION(libvirt_domain_get_metadata);
PHP_FUNCTION(libvirt_domain_set_metadata);
+PHP_FUNCTION(libvirt_domain_qemu_agent_command);
/* Domain snapshot functions */
PHP_FUNCTION(libvirt_domain_has_current_snapshot);
PHP_FUNCTION(libvirt_domain_snapshot_create);
--
2.3.3
Show replies by date
On 29.06.2015 11:04, Vasiliy Tolstov wrote:
add another missing libvirt command
Signed-off-by: Vasiliy Tolstov <v.tolstov(a)selfip.ru>
---
configure.ac | 3 +++
src/Makefile.am | 5 +++--
src/libvirt-php.c | 29 +++++++++++++++++++++++++++++
src/libvirt-php.h | 2 ++
4 files changed, 37 insertions(+), 2 deletions(-)
ACKed and pushed.
Michal