在 2012-10-10三的 15:00 +0100,Daniel P. Berrange写道: > On Mon, Oct 08, 2012 at 08:05:21PM -0600, Eric Blake wrote: > > On 10/08/2012 07:51 PM, liguang wrote: > > > this hook aimed at migration only, it supposed > > > to be used as a helper of migrate --copy-storage-* > > > features to remove the unreasonable limitation > > > of pre-exist disk images at migration target. > > > someone can add more functions to hook files. > > > > NACK. Instead of writing a hook that runs outside of libvirt and has to > > be installed to be of use, we should instead fix libvirt to do the file > > creation itself. That is, you should be patching > > src/qemu/qemu_migration.c to detect when copy-storage-* has been passed, > > and to then pre-create the proper empty files and give them correct > > SELinux labels. > > Correctly doing auto-creation of disk images on the target host is > alot more complicated that you might assume, and the hook script > here misses alot of the hard bits > > - If the migration fails, you need to clean up these disk images > you just created, because the data in them may be incomplete > or corrupt. > > - If the source image is using encryption, then the target image > should use encryption too > > - If the source image uses a backing file, then when incremental > copy is requested, we might need to maintain the backing store. > > - if the migration API did not have either of the --copy-* > flags set we should not be doing any creation of disk images > > - We need to handling of non-file based disk images, because > even block devices may be local-only. > > - If the user passed a custom XML for the target that differs > from the source, this may affect decisions we need to make > above wrt encryption or backing files > > Finally, we should *not* do auto-creation by default - we need to > add a new migrate flag to allow apps to turn it on, only if they > want it. > > Daniel perfect consideration! suppose this situation, I create disk images qemu needed at target by qemu-img create -f 'format' 'image' 'size', then virsh migrate --copy-storage-* everything runs smoothly, so, as i stated before, this patch limited to create-image-by-hand alleviation. -- liguang lig.fnst@xxxxxxxxxxxxxx FNST linux kernel team -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list