
Using the following php: version 8.1.13 php-libvirt: version 0.5.6 (build 2) libvirt 8.7.0 QEMU 7.1.0 virsh capabilities works fine. <os_type>hvm</os_type> <arch name='x86_64'> <wordsize>64</wordsize> <emulator>/usr/bin/qemu-system-x86_64</emulator> <machine maxCpus='255'>pc-i440fx-7.1</machine> <machine canonical='pc-i440fx-7.1' maxCpus='255'>pc</machine> <machine maxCpus='288'>pc-q35-5.2</machine> <machine maxCpus='255'>pc-i440fx-2.12</machine> <machine maxCpus='255'>pc-i440fx-2.0</machine> <machine maxCpus='255'>pc-i440fx-6.2</machine> <machine maxCpus='288'>pc-q35-4.2</machine> <machine maxCpus='255'>pc-i440fx-2.5</machine> <machine maxCpus='255'>pc-i440fx-4.2</machine> <machine maxCpus='255'>pc-i440fx-5.2</machine> <machine maxCpus='255' deprecated='yes'>pc-i440fx-1.5</machine> <machine maxCpus='255'>pc-q35-2.7</machine> <machine maxCpus='288'>pc-q35-7.1</machine> <machine canonical='pc-q35-7.1' maxCpus='288'>q35</machine> <machine maxCpus='255'>pc-i440fx-2.2</machine> <machine maxCpus='255'>pc-i440fx-2.7</machine> <machine maxCpus='288'>pc-q35-6.1</machine> <machine maxCpus='255'>pc-q35-2.4</machine> <machine maxCpus='288'>pc-q35-2.10</machine> <machine maxCpus='1'>x-remote</machine> <machine maxCpus='288'>pc-q35-5.1</machine> <machine maxCpus='255' deprecated='yes'>pc-i440fx-1.7</machine> <machine maxCpus='288'>pc-q35-2.9</machine> <machine maxCpus='255'>pc-i440fx-2.11</machine> <machine maxCpus='288'>pc-q35-3.1</machine> <machine maxCpus='255'>pc-i440fx-6.1</machine> <machine maxCpus='288'>pc-q35-4.1</machine> <machine maxCpus='255'>pc-i440fx-2.4</machine> <machine maxCpus='255'>pc-i440fx-4.1</machine> <machine maxCpus='255'>pc-i440fx-5.1</machine> <machine maxCpus='255'>pc-i440fx-2.9</machine> <machine maxCpus='1'>isapc</machine> <machine maxCpus='255' deprecated='yes'>pc-i440fx-1.4</machine> <machine maxCpus='255'>pc-q35-2.6</machine> <machine maxCpus='255'>pc-i440fx-3.1</machine> <machine maxCpus='288'>pc-q35-2.12</machine> <machine maxCpus='288'>pc-q35-7.0</machine> <machine maxCpus='255'>pc-i440fx-2.1</machine> <machine maxCpus='288'>pc-q35-6.0</machine> <machine maxCpus='255'>pc-i440fx-2.6</machine> <machine maxCpus='288'>pc-q35-4.0.1</machine> <machine maxCpus='255'>pc-i440fx-7.0</machine> <machine maxCpus='255' deprecated='yes'>pc-i440fx-1.6</machine> <machine maxCpus='288'>pc-q35-5.0</machine> <machine maxCpus='288'>pc-q35-2.8</machine> <machine maxCpus='255'>pc-i440fx-2.10</machine> <machine maxCpus='288'>pc-q35-3.0</machine> <machine maxCpus='255'>pc-i440fx-6.0</machine> <machine maxCpus='288'>pc-q35-4.0</machine> <machine maxCpus='288'>microvm</machine> <machine maxCpus='255'>pc-i440fx-2.3</machine> <machine maxCpus='255'>pc-i440fx-4.0</machine> <machine maxCpus='255'>pc-i440fx-5.0</machine> <machine maxCpus='255'>pc-i440fx-2.8</machine> <machine maxCpus='288'>pc-q35-6.2</machine> <machine maxCpus='255'>pc-q35-2.5</machine> <machine maxCpus='255'>pc-i440fx-3.0</machine> <machine maxCpus='288'>pc-q35-2.11</machine> <domain type='qemu'/> <domain type='kvm'/> </arch> Any known issues with php 8 for this function, others seem to be working fine.

On 12/4/22 18:18, Simon Fairweather wrote:
Using the following
php: version 8.1.13 php-libvirt: version 0.5.6 (build 2)
libvirt 8.7.0 QEMU 7.1.0
virsh capabilities works fine.
Any known issues with php 8 for this function, others seem to be working fine.
Hey, I haven't tried php-8 yet. What is the problem you're seeing? Looking into the source code, the only thing that libvirt_connect_get_machine_types() does is it fetches capabilities (libvirt_connect_get_capabilities()) and then runs couple of XPATHs to construct an associative array of supported machine types. The same can be achieved in plain PHP. Michal

Thanks for your reply Michal, looks like it is a php array processing issue which I am looking into. On Mon, Dec 5, 2022 at 9:51 AM Michal Prívozník <mprivozn@redhat.com> wrote:
On 12/4/22 18:18, Simon Fairweather wrote:
Using the following
php: version 8.1.13 php-libvirt: version 0.5.6 (build 2)
libvirt 8.7.0 QEMU 7.1.0
virsh capabilities works fine.
Any known issues with php 8 for this function, others seem to be working fine.
Hey, I haven't tried php-8 yet. What is the problem you're seeing? Looking into the source code, the only thing that libvirt_connect_get_machine_types() does is it fetches capabilities (libvirt_connect_get_capabilities()) and then runs couple of XPATHs to construct an associative array of supported machine types. The same can be achieved in plain PHP.
Michal

Hi Michal, There is an issue with keys generated in the function adding null to the end of each key, I have created an issue with a patch from Eric at LimeTech. https://gitlab.com/libvirt/libvirt-php/-/issues/7 my testing. $tmp = libvirt_connect_get_machine_types($lv->get_connection()); $key = "ppc\0" ; var_dump(bin2hex(($key)) ); var_dump( $tmp[$key]) ; Regards Simon On Mon, Dec 5, 2022 at 10:44 AM Simon Fairweather < simon.n.fairweather@gmail.com> wrote:
Thanks for your reply Michal, looks like it is a php array processing issue which I am looking into.
On Mon, Dec 5, 2022 at 9:51 AM Michal Prívozník <mprivozn@redhat.com> wrote:
On 12/4/22 18:18, Simon Fairweather wrote:
Using the following
php: version 8.1.13 php-libvirt: version 0.5.6 (build 2)
libvirt 8.7.0 QEMU 7.1.0
virsh capabilities works fine.
Any known issues with php 8 for this function, others seem to be working fine.
Hey, I haven't tried php-8 yet. What is the problem you're seeing? Looking into the source code, the only thing that libvirt_connect_get_machine_types() does is it fetches capabilities (libvirt_connect_get_capabilities()) and then runs couple of XPATHs to construct an associative array of supported machine types. The same can be achieved in plain PHP.
Michal

On 12/6/22 09:41, Simon Fairweather wrote:
Hi Michal,
There is an issue with keys generated in the function adding null to the end of each key, I have created an issue with a patch from Eric at LimeTech.
https://gitlab.com/libvirt/libvirt-php/-/issues/7 <https://gitlab.com/libvirt/libvirt-php/-/issues/7>
my testing.
Yep, this is a genuine bug. I've merged the fix now. Michal

Great, thanks! On Tue, 6 Dec 2022, 10:02 am Michal Prívozník, <mprivozn@redhat.com> wrote:
On 12/6/22 09:41, Simon Fairweather wrote:
Hi Michal,
There is an issue with keys generated in the function adding null to the end of each key, I have created an issue with a patch from Eric at LimeTech.
https://gitlab.com/libvirt/libvirt-php/-/issues/7 <https://gitlab.com/libvirt/libvirt-php/-/issues/7>
my testing.
Yep, this is a genuine bug. I've merged the fix now.
Michal

When will 0.5.7 be released? On Tue, Dec 6, 2022 at 10:02 AM Michal Prívozník <mprivozn@redhat.com> wrote:
On 12/6/22 09:41, Simon Fairweather wrote:
Hi Michal,
There is an issue with keys generated in the function adding null to the end of each key, I have created an issue with a patch from Eric at LimeTech.
https://gitlab.com/libvirt/libvirt-php/-/issues/7 <https://gitlab.com/libvirt/libvirt-php/-/issues/7>
my testing.
Yep, this is a genuine bug. I've merged the fix now.
Michal

On 12/6/22 13:57, Simon Fairweather wrote:
When will 0.5.7 be released?
Yeah, I should probably do the release soon as there is a lot of changes. But firstly, I'd like to get rid of imagick dependency as it's not strictly needed (only used in examples/ for downscaling the screenshots of running domains). Let me see how quickly I can do that. The only problem is, that QEMU feeds us PPM which is not wired to PHP really. Michal

Thanks for the update. What does this mean? The only problem is that QEMU feeds us PPM which is not wired to PHP really. We are using this patch to remove imageMagik as it is not required for our needs. Eric - I strip out the requirement for ImageMagick because of all the dependancies needed for that peice. ImageMagick is only used for libvirt's screenshot API calls which we dont even take advantage of in the unRAID web UI. --- a/configure.ac 2016-10-05 22:20:39.172968837 -0500 +++ b/configure.ac 2016-10-05 22:21:05.645301252 -0500 @@ -172,8 +172,6 @@ LIBVIRT_CHECK_PHP_EXTENSIONDIR LIBVIRT_CHECK_PHP_CONFDIR -LIBVIRT_CHECK_PHP_EXTENSION([imagick]) - OS=`uname` if test "$OS" = "Darwin"; then WL=-Wl, --- a/libvirt-php.spec.in 2017-07-10 10:24:11.103930093 -0500 +++ b/libvirt-php.spec.in 2017-07-10 10:24:46.596915873 -0500 @@ -27,7 +27,6 @@ BuildRequires: libvirt-devel >= %{req_libvirt_version} BuildRequires: libxml2-devel BuildRequires: libxslt -BuildRequires: php-pecl-imagick %if 0%{?suse_version} BuildRequires: xhtml-dtd %else On Tue, Dec 6, 2022 at 1:06 PM Michal Prívozník <mprivozn@redhat.com> wrote:
On 12/6/22 13:57, Simon Fairweather wrote:
When will 0.5.7 be released?
Yeah, I should probably do the release soon as there is a lot of changes. But firstly, I'd like to get rid of imagick dependency as it's not strictly needed (only used in examples/ for downscaling the screenshots of running domains). Let me see how quickly I can do that. The only problem is, that QEMU feeds us PPM which is not wired to PHP really.
Michal

On 12/6/22 20:13, Simon Fairweather wrote:
Thanks for the update. What does this mean?
The only problem is that QEMU feeds us PPM which is not wired to PHP really.
We are using this patch to remove imageMagik as it is not required for our needs. Eric - I strip out the requirement for ImageMagick because of all the dependancies needed for that peice. ImageMagick is only used for libvirt's screenshot API calls which we dont even take advantage of in the unRAID web UI. --- a/configure.ac <http://configure.ac> 2016-10-05 22:20:39.172968837 -0500 +++ b/configure.ac <http://configure.ac> 2016-10-05 22:21:05.645301252 -0500 @@ -172,8 +172,6 @@ LIBVIRT_CHECK_PHP_EXTENSIONDIR LIBVIRT_CHECK_PHP_CONFDIR -LIBVIRT_CHECK_PHP_EXTENSION([imagick]) -
Yeah, pretty much every distro uses this patch. The problem is, without imagick the examples won't work: libvirt-php.git/tests $ php -n -c php.ini -S localhost:8080 ../examples/index.php BUT, here's what I can do. I just found out that QEMU added support for taking screenshots in PNG format, so I can fix libvirt to prefer that (PPM is not very well supported anyway - I haven't found a browser that would render it) and drop imagick completely. Then I can do the release and distros can then just drop the patch. Michal

On Wed, Dec 07, 2022 at 11:02:45AM +0100, Michal Prívozník wrote:
On 12/6/22 20:13, Simon Fairweather wrote:
Thanks for the update. What does this mean?
The only problem is that QEMU feeds us PPM which is not wired to PHP really.
We are using this patch to remove imageMagik as it is not required for our needs. Eric - I strip out the requirement for ImageMagick because of all the dependancies needed for that peice. ImageMagick is only used for libvirt's screenshot API calls which we dont even take advantage of in the unRAID web UI. --- a/configure.ac <http://configure.ac> 2016-10-05 22:20:39.172968837 -0500 +++ b/configure.ac <http://configure.ac> 2016-10-05 22:21:05.645301252 -0500 @@ -172,8 +172,6 @@ LIBVIRT_CHECK_PHP_EXTENSIONDIR LIBVIRT_CHECK_PHP_CONFDIR -LIBVIRT_CHECK_PHP_EXTENSION([imagick]) -
Yeah, pretty much every distro uses this patch. The problem is, without imagick the examples won't work:
libvirt-php.git/tests $ php -n -c php.ini -S localhost:8080 ../examples/index.php
BUT, here's what I can do. I just found out that QEMU added support for taking screenshots in PNG format, so I can fix libvirt to prefer that (PPM is not very well supported anyway - I haven't found a browser that would render it) and drop imagick completely. Then I can do the release and distros can then just drop the patch.
FWIW, it should be relatively easy to display a PPM using a bit of javascript and a HTML <canvas> element, as a PPM is essentially just raw bitmap data. Parsing the PPM heaer is trivial, and then at most you have a simple pixel format conversion todo. Might not be the fastest, but doable. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Awesome, thanks! On Wed, Dec 7, 2022 at 10:02 AM Michal Prívozník <mprivozn@redhat.com> wrote:
On 12/6/22 20:13, Simon Fairweather wrote:
Thanks for the update. What does this mean?
The only problem is that QEMU feeds us PPM which is not wired to PHP really.
We are using this patch to remove imageMagik as it is not required for our needs. Eric - I strip out the requirement for ImageMagick because of all the dependancies needed for that peice. ImageMagick is only used for libvirt's screenshot API calls which we dont even take advantage of in the unRAID web UI. --- a/configure.ac <http://configure.ac> 2016-10-05 22:20:39.172968837 -0500 +++ b/configure.ac <http://configure.ac> 2016-10-05 22:21:05.645301252 -0500 @@ -172,8 +172,6 @@ LIBVIRT_CHECK_PHP_EXTENSIONDIR LIBVIRT_CHECK_PHP_CONFDIR
-LIBVIRT_CHECK_PHP_EXTENSION([imagick]) -
Yeah, pretty much every distro uses this patch. The problem is, without imagick the examples won't work:
libvirt-php.git/tests $ php -n -c php.ini -S localhost:8080 ../examples/index.php
BUT, here's what I can do. I just found out that QEMU added support for taking screenshots in PNG format, so I can fix libvirt to prefer that (PPM is not very well supported anyway - I haven't found a browser that would render it) and drop imagick completely. Then I can do the release and distros can then just drop the patch.
Michal

On 12/7/22 11:27, Simon Fairweather wrote:
Awesome, thanks!
Aaand it's done. https://libvirt.org/sources/php/ Michal

Great, thanks! On Wed, Dec 7, 2022 at 2:48 PM Michal Prívozník <mprivozn@redhat.com> wrote:
On 12/7/22 11:27, Simon Fairweather wrote:
Awesome, thanks!
Aaand it's done.
https://libvirt.org/sources/php/
Michal
participants (3)
-
Daniel P. Berrangé
-
Michal Prívozník
-
Simon Fairweather