Re: [libvirt-php] API to add/remove disk to/from domain

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

 



On 04/01/2011 11:11 AM, Conor Murphy wrote:
> Hi,
>
> How do I add/remove a disk to a domain using the libvirt-php API?
>
> Thanks,
> Conor
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list
Hi Conor,
you have to edit the domain XML file manually, there's no API yet.
Please see the example scripts in the examples directory of the cloned
repository. On the main page there is option to edit the domain XML
description but you have to have the domain stopped (not running) to
change the domain XML description.

Adding the new disk is done using the:

    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/home/mig/images/kvm/winxp.img'/>
      <target dev='hda' bus='ide'/>
    </disk>

definition where /driver/@type is the type of the driver to be used for
the image - raw is the standard image but you can also put qcow2 image
there if supported by your hypervisor/emulator (e.g. QEMU). By target
you can define the device presented to the guest and bus type (i.e. IDE
or SCSI) and after this you can start up the guest with the
configuration mentioned there. You can pass the address element there as
well but you don't have to since it's generated automatically when omited.

Michal

-- 
Michal Novotny <minovotn@xxxxxxxxxx>, RHCE
Virtualization Team (xen userspace), Red Hat

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]