PHP Warning: libvirt_domain_new(): Cannot get installation XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Despite great success at using php-libvirt with other functions, I have been entirely unsuccessful in getting it to create a new domain/machine. Any time I do, and with virtually anything I try, I get the above error message. 

Running PHP 7.4 (remi) on otherwise stock AlmaLinux.
[root@sb4 html]# cat /etc/redhat-release
AlmaLinux release 8.5 (Arctic Sphynx

[root@sb4 html]# rpm -qa php php-fpm php-libvirt nginx
php-7.4.28-1.el8.remi.x86_64
nginx-1.14.1-9.module_el8.3.0+2165+af250afe.alma.x86_64
php-fpm-7.4.28-1.el8.remi.x86_64
php-libvirt-0.5.5-1.el8.remi.7.4.x86_64
12 XEON 
E312xx cores, 24 w/HT, 192GB RAM, etc. 


When I run it, I find in php-fpm www.error-log: 

[24-Mar-2022 20:05:51 UTC] PHP Warning:  libvirt_domain_new(): Cannot get installation XML in /var/www/html/manage.php on line 190

Matching message onscreen: Warning: libvirt_domain_new(): Cannot get installation XML in /var/www/html/manage.php on line 191

Here's the offending code: 

$networks = [

    'mac' => '52:54:00:06:a7:df',

    'network' => 'default',

    'model' =>  'e1000',

    ];

$disks = [

    'path' => "/var/lib/libvirt/images/myvm.qcow2",

    'driver' => 'qcow2',

    'bus' => 'ide',

    'dev' => 'hda',

    'size' => '40G',

    'flags' => null,

    ];

  error_reporting(-1);

$result = libvirt_domain_new(

    $conn,

    'myvm', // name of the new domain

    null, // optional architecture string, can be NULL to get default (or false)

    2048, // number of megabytes of RAM to be allocated for domain

    8192, // maximum number of megabytes of RAM to be allocated for domain

    2, // number of VCPUs to be allocated to domain

    '/var/www/html/AlmaLinux-8.4-x86_64-dvd.iso', // installation ISO image for$

    $disks, // array of disk devices for domain

    $networks,

    null

    );

I've tried various values for $disks and $networks, setting error reporting to -1 (display anything and everything), journalctl -f on both the webserver and the virt host, etc but was never able to see any error other than this one. 


I've also been looking in the source code file for anything obvious, and I've been utterly unsuccessful in changing the error message. For example, inserting an invalid path for the ISO image doesn't result in an error message that it *looks* like it should be throwing errors about invalid ISO image. 


In fact, I've even tried passing ALL NULL/EMPTY VALUES and with the exception of the $conn connection variable, I only get this "Cannot get installation XML" error message: 

$result = libvirt_domain_new(
    $conn,
    null,
    null,
    null,
    null,
    null,
    null,
    [],
    []
    );


Shouldn't I at least be seeing a message like "Name is 'myvm', memMB is 2048, maxmemMB is 8192" ?


https://github.com/php/pecl-virtualization-libvirt/blob/master/src/libvirt-php.c


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux