On 2013年02月08日 14:48, harryxiyou(a)gmail.com wrote:
Don't try to refresh Sheepdog volume if creating volume fails.
Signed-off-by: Harry Wei<harryxiyou(a)gmail.com>
---
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;
}
ACK.