
于 2011年03月10日 15:29, Daniel Veillard 写道:
On Thu, Mar 10, 2011 at 03:08:28PM +0800, Osier Yang wrote:
For newer qemu-img, the help string for "backing file format" is "[-F backing_fmt]".
Fix the wrong logic error by commit e997c268.
* src/storage/storage_backend.c --- src/storage/storage_backend.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 0751fde..6d8e8b0 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -595,7 +595,8 @@ static int virStorageBackendQEMUImgBackingFormat(const char *qemuimg)
start = strstr(help, " create "); end = strstr(start, "\n"); - if ((tmp = strstr(start, "-F fmt"))&& tmp< end) + if (((tmp = strstr(start, "-F fmt"))&& tmp< end) || + ((tmp = strstr(start, "-F backing_fmt"))&& tmp< end)) ret = QEMU_IMG_BACKING_FORMAT_FLAG; else if ((tmp = strstr(start, "[-o options]"))&& tmp< end) ret = QEMU_IMG_BACKING_FORMAT_OPTIONS; @@ -757,7 +758,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, };
if (vol->target.encryption != NULL) { - if (imgformat == QEMU_IMG_BACKING_FORMAT_FLAG) { + if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS) { imgargv[8] = "-o"; imgargv[9] = "encryption=on"; } else { @@ -837,7 +838,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn, };
if (vol->target.encryption != NULL) { - if (imgformat == QEMU_IMG_BACKING_FORMAT_FLAG) { + if (imgformat == QEMU_IMG_BACKING_FORMAT_OPTIONS) { imgargv[6] = "-o"; imgargv[7] = "encryption=on"; } else {
Okay, this makes sense, ACK
Daniel
Thanks, pushed. Regards Osier