Commit 064c5f76 authored by Vasiliy Tolstov's avatar Vasiliy Tolstov Committed by Michal Privoznik

qemu-agent-command] add libvirt_domain_qemu_agent_command

add another missing libvirt command
Signed-off-by: Vasiliy Tolstov's avatarVasiliy Tolstov <v.tolstov@selfip.ru>
parent 151b01c7
......@@ -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
......
......@@ -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
......
......@@ -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}
};
......@@ -3610,6 +3612,33 @@ PHP_FUNCTION(libvirt_domain_lookup_by_uuid)
ZEND_REGISTER_RESOURCE(return_value, res_domain, le_libvirt_domain);
}
/*
* 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)
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment