Hi Yukihiro,
On Thu, Jun 02, 2011 at 06:26:27AM +0000, warp.kawada(a)gmail.com wrote:
screenshot of remote host is available.
get_domain_object make so many error to message log, so you had
better not use .
I must admit I don't fully understand the problem you are having,
do you mean that when trying to use the PHP binding for the new
API to get the screenshots you were having errors ? What kind of
errors and could you describe the context a bit, it will help
understanding the issue and verifying your patch,
Michal could you have a look ? Seems the patch changes the way to
lookup the domain, and tries to provide non-local access but I'm
not 100% sure,
thanks !
Daniel
diff --git a/examples/libvirt.php b/examples/libvirt.php
index 1ca71b6..bf903f6 100644
--- a/examples/libvirt.php
+++ b/examples/libvirt.php
@@ -29,9 +29,9 @@
}
function domain_get_screenshot($domain) {
- $dom = $this->get_domain_object($domain);
-
- $tmp = libvirt_domain_get_screenshot($dom);
+ $dom = libvirt_domain_lookup_by_uuid_string($this->conn, $domain);
+ $hostname = $this->get_hostname();
+ $tmp = libvirt_domain_get_screenshot($dom, $hostname);
return ($tmp) ? $tmp : $this->_set_last_error();
}
diff --git a/src/libvirt-php.cb/src/libvirt-php.c
index 87e0467..4a53e33 100644
--- a/src/libvirt-php.c
+++ b/src/libvirt-php.c
@@ -1880,6 +1880,7 @@ PHP_FUNCTION(libvirt_domain_get_screenshot)
int port = -1;
int scancode = 10;
char *path;
+ char *hostname;
path = get_feature_binary("screenshot");
if (access(path, X_OK) != 0) {
@@ -1887,7 +1888,7 @@ PHP_FUNCTION(libvirt_domain_get_screenshot)
RETURN_FALSE;
}
- GET_DOMAIN_FROM_ARGS("r|l",&zdomain, &scancode);
+ GET_DOMAIN_FROM_ARGS("rs|l",&zdomain, &hostname, &scancode);
xml=virDomainGetXMLDesc(domain->domain, 0);
if (xml==NULL) {
@@ -1912,10 +1913,16 @@ PHP_FUNCTION(libvirt_domain_get_screenshot)
RETURN_FALSE;
if (childpid == 0) {
+ char *prm = NULL;
char tmpp[8] = { 0 };
-
+
snprintf(tmpp, sizeof(tmpp), ":%d", port);
- retval = execlp(path, basename(path), tmpp, file, NULL);
+ prm = emalloc((sizeof(tmpp) + sizeof(hostname)) * sizeof(char));
+ sprintf(prm, "%s%s", hostname, tmpp);
+
+ retval = execlp(path, basename(path), prm, file, NULL);
+
+ free(prm);
_exit( retval );
}
else {
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
--
Daniel Veillard | libxml Gnome XML XSLT toolkit
http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine
http://rpmfind.net/
http://veillard.com/ | virtualization library
http://libvirt.org/