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

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

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 redhat com
> 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'/>

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 Novotny <minovotn redhat com>, RHCE
Virtualization Team (xen userspace), Red Hat

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