Displaying 4 results from an estimated 4 matches for "libvirt_domain_disk_add".
2019 Aug 01
3
Detach disk from VM - virsh (working) vs. PHP (not working)
...est2
everything works well.
If i use a PHP, there is „complicated“ way and „simple“ way:
1, complicated:
libvirt_domain_destroy($domain);
libvirt_domain_undefine($domain);
$xml = domain_create_xml($name,$uuid,$memory,$cpu,$vnc,$mac);
$domain = libvirt_domain_define_xml($server->conn, $xml);
libvirt_domain_disk_add($domain, "/users/".$name.".img", "vdb", "virtio", "qcow2", NULL);
libvirt_domain_create($domain);
(or instead libvirt_domain_disk_add i can define disk directly in XML)
But in this case, the server will not boot (GRUB error)
2, simple:
libvirt_d...
2019 Aug 02
2
Re: Detach disk from VM - virsh (working) vs. PHP (not working)
...is „complicated“ way and „simple“ way:
>> 1, complicated:
>> libvirt_domain_destroy($domain);
>> libvirt_domain_undefine($domain);
>> $xml = domain_create_xml($name,$uuid,$memory,$cpu,$vnc,$mac);
>> $domain = libvirt_domain_define_xml($server->conn, $xml);
>> libvirt_domain_disk_add($domain, "/users/".$name.".img", "vdb", "virtio", "qcow2", NULL);
>> libvirt_domain_create($domain);
>> (or instead libvirt_domain_disk_add i can define disk directly in XML)
>> But in this case, the server will not boot (GRUB erro...
2019 Aug 02
0
Re: Detach disk from VM - virsh (working) vs. PHP (not working)
...there is „complicated“ way and „simple“ way:
>
> 1, complicated:
>
> libvirt_domain_destroy($domain);
> libvirt_domain_undefine($domain);
>
> $xml = domain_create_xml($name,$uuid,$memory,$cpu,$vnc,$mac);
> $domain = libvirt_domain_define_xml($server->conn, $xml);
> libvirt_domain_disk_add($domain, "/users/".$name.".img", "vdb", "virtio", "qcow2", NULL);
> libvirt_domain_create($domain);
>
> (or instead libvirt_domain_disk_add i can define disk directly in XML)
>
> But in this case, the server will not boot (GRUB erro...
2019 Aug 03
0
Re: Detach disk from VM - virsh (working) vs. PHP (not working)
...ound: no target device vdb
Ah, of coure. I overlooked that virDomainDetachDeviceFlags() is called
with VIR_DOMAIN_AFFECT_CONFIG, which means that live configuration is
not affected and if the disk you're trying to detach exists only in live
XML then the API fails. The same problem was found in
libvirt_domain_disk_add, libvirt_domain_nic_add and
libvirt_domain_nic_remove.
I've pushed the fixes to the master. Thanks for the report.
Michal