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

Re: [libvirt-users] add disk problems for domain

On 11/21/2012 04:09 AM, zhijun liu wrote:
> hi,all
> I use Java api `domain.attachDeviceFlags(xml, 0);` to add a disk for
> domain. the xml file like this:
>  <disk type='file' device='disk'>
>       <driver name='qemu' type='raw'/>
>       <source file='/dev/sp1353486595267/v1353488096262'/>
>       <target dev='vdb' bus='virtio'/>
>     </disk>
> then I use  command `virsh detach-disk $domain vdb` to remove the disk.
> what  I said above have no any errors.but the problem is when I restart
> this vm ,the  disk still exist,because I see it from the command `virsh
> dumpxml $domain` ,how to remove the disk from this domain persistently.

Use the flags argument.  By passing '0' (aka VIR_DOMAIN_AFFECT_CURRENT
in the C API counterpart), you are explicitly requesting that only the
current configuration be modified (for a running domain, that means you
are doing a one-time hotplug, but not to remember it for the next boot).
 If you want to simultaneously hotplug _and_ affect the next boot, you
need to instead pass whatever the Java binding is for the underlying
(sorry, I don't know the Java binding well enough to know what that
binding is).

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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