* add libvirt_domain_qemu_agent_command * fix install target, because before this all stuff goes to /usr/usr dir Signed-off-by: Vasiliy Tolstov <v.tolstov@xxxxxxxxx> --- configure.ac | 3 +++ src/Makefile.am | 19 ++++++++++--------- src/libvirt-php.c | 28 ++++++++++++++++++++++++++++ src/libvirt-php.h | 2 ++ 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 9e9fee0..0afa2e2 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,9 @@ PKG_PROG_PKG_CONFIG LIBVIRT_REQUIRED=0.6.2 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 cab0456..f270ec2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -6,10 +6,10 @@ WL=@WL@ SHLIB_FLAGS=@SHLIB_FLAGS@ install-exec-local: - $(MKDIR_P) $(DESTDIR)$(prefix)$(PHPEDIR) - $(MKDIR_P) $(DESTDIR)$(prefix)$(PHPCDIR) - $(INSTALL) -m 644 -D .libs/$(PACKAGE).so $(DESTDIR)$(prefix)$(PHPEDIR)/$(PACKAGE).so - $(INSTALL) -m 755 -d $(DESTDIR)$(prefix)$(PHPCDIR) + $(MKDIR_P) $(DESTDIR)$(PHPEDIR) + $(MKDIR_P) $(DESTDIR)$(PHPCDIR) + $(INSTALL) -m 644 -D .libs/$(PACKAGE).so $(DESTDIR)$(PHPEDIR)/$(PACKAGE).so + $(INSTALL) -m 755 -d $(DESTDIR)$(PHPCDIR) $(ECHO) "extension=$(PACKAGE).so" > libvirt-php.ini $(ECHO) >> libvirt-php.ini $(ECHO) "" >> libvirt-php.ini @@ -19,21 +19,22 @@ install-exec-local: $(ECHO) "libvirt.image_path=/var/lib/libvirt/images" >> libvirt-php.ini $(ECHO) "; Limit maximum number of libvirt connections" >> libvirt-php.ini $(ECHO) "libvirt.max_connections=5" >> libvirt-php.ini - $(INSTALL) -m 644 -D libvirt-php.ini $(DESTDIR)$(prefix)$(PHPCDIR)/$(PACKAGE).ini + $(INSTALL) -m 644 -D libvirt-php.ini $(DESTDIR)$(PHPCDIR)/$(PACKAGE).ini uninstall-local: - $(RM) -f $(DESTDIR)$(prefix)$(PHPCDIR)/$(PACKAGE).ini - $(RM) -f $(DESTDIR)$(prefix)$(PHPEDIR)/$(PACKAGE).so + $(RM) -f $(DESTDIR)$(PHPCDIR)/$(PACKAGE).ini + $(RM) -f $(DESTDIR)$(PHPEDIR)/$(PACKAGE).so 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 d46fbb9..161abca 100644 --- a/src/libvirt-php.c +++ b/src/libvirt-php.c @@ -161,6 +161,7 @@ static zend_function_entry libvirt_functions[] = { PHP_FE(libvirt_domain_send_keys, NULL) PHP_FE(libvirt_domain_send_pointer_event, NULL) PHP_FE(libvirt_domain_update_device, NULL) + PHP_FE(libvirt_domain_qemu_agent_command, NULL) /* Domain snapshot functions */ PHP_FE(libvirt_domain_has_current_snapshot, NULL) PHP_FE(libvirt_domain_snapshot_create, NULL) @@ -3943,6 +3944,33 @@ PHP_FUNCTION(libvirt_domain_get_name) } /* + 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]: ?? + 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|l|l", &zdomain, &cmd, &cmd_len, &timeout, &flags); + + ret = virDomainQemuAgentCommand(domain->domain, cmd, timeout, flags); + if (ret == NULL) RETURN_FALSE; + + RETURN_STRING(ret,0); +} + +/* Function name: libvirt_domain_get_uuid_string Since version: 0.4.1(-1) Description: Function is used to get the domain's UUID in string format diff --git a/src/libvirt-php.h b/src/libvirt-php.h index 7c9a229..1d9c6ab 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> @@ -427,6 +428,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 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list