Don't try to refresh Sheepdog volume if creating volume fails. Signed-off-by: Harry Wei <harryxiyou@xxxxxxxxx> --- src/storage/storage_backend_sheepdog.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c index cd18f33..218284d 100644 --- a/src/storage/storage_backend_sheepdog.c +++ b/src/storage/storage_backend_sheepdog.c @@ -156,7 +156,7 @@ virStorageBackendSheepdogCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED, virStorageVolDefPtr vol) { - int ret; + int ret = -1; if (vol->target.encryption != NULL) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -167,10 +167,14 @@ virStorageBackendSheepdogCreateVol(virConnectPtr conn ATTRIBUTE_UNUSED, virCommandPtr cmd = virCommandNewArgList(COLLIE, "vdi", "create", vol->name, NULL); virCommandAddArgFormat(cmd, "%llu", vol->capacity); virStorageBackendSheepdogAddHostArg(cmd, pool); - ret = virCommandRun(cmd, NULL); + if (virCommandRun(cmd, NULL) < 0) + goto cleanup; - virStorageBackendSheepdogRefreshVol(conn, pool, vol); + if (virStorageBackendSheepdogRefreshVol(conn, pool, vol) < 0) + goto cleanup; + ret = 0; +cleanup: virCommandFree(cmd); return ret; } -- 1.7.0.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list