[libvirt-users] add disk problems for domain

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. thanks in advance.
zhijun

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 flags VIR_DOMAIN_AFFECT_LIVE|VIR_DOMAIN_AFFECT_CONFIG of the C API (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
participants (2)
-
Eric Blake
-
zhijun liu