[libvirt] [PATCH] fix a bug of sheepdog storage driver

Don't try to refresh Sheepdog volume if creating volume fails. Signed-off-by: Harry Wei <harryxiyou@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; } -- 1.7.0.4

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

On 02/08/2013 12:26 AM, Osier Yang wrote:
On 2013年02月08日 14:48, harryxiyou@gmail.com wrote:
Your 'From:' line didn't match your 'Signed-off-by:' line. That makes our generated AUTHORS file look strange. I would suggest doing: git config --global sendemail.from 'Harry Wei <harryxiyou@gmail.com>' so that future patches sent through 'git send-email' have the correct envelope settings, and/or edit your gmail settings to associate a name with your address (I'm not sure which of those two steps will matter, or if both are needed). Meanwhile, I touched up the authorship information on this commit. I tweaked the subject line to: sheepdog: skip refresh on creation failure so that it is more informative. Theoretically, ALL patches should either fix a bug or add a feature, so claiming that a patch "fixes a bug" is redundant. Knowing a bit about WHAT was fixed makes the one-line summary much more useful.
Don't try to refresh Sheepdog volume if creating volume fails.
Signed-off-by: Harry Wei<harryxiyou@gmail.com>
---
ACK.
Patch now pushed; congratulations on finally getting it right, and hopefully next time isn't quite so difficult. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Sat, Feb 9, 2013 at 5:40 AM, Eric Blake <eblake@redhat.com> wrote:
On 02/08/2013 12:26 AM, Osier Yang wrote:
On 2013年02月08日 14:48, harryxiyou@gmail.com wrote:
Your 'From:' line didn't match your 'Signed-off-by:' line. That makes our generated AUTHORS file look strange. I would suggest doing:
git config --global sendemail.from 'Harry Wei <harryxiyou@gmail.com>'
Thanks, i will execute this command for me.
so that future patches sent through 'git send-email' have the correct envelope settings, and/or edit your gmail settings to associate a name with your address (I'm not sure which of those two steps will matter, or if both are needed). Meanwhile, I touched up the authorship information on this commit.
I tweaked the subject line to:
sheepdog: skip refresh on creation failure
It looks better, thanks.
so that it is more informative. Theoretically, ALL patches should either fix a bug or add a feature, so claiming that a patch "fixes a bug" is redundant. Knowing a bit about WHAT was fixed makes the one-line summary much more useful.
Thanks, i will give more informative one-line summary for later patches.
Don't try to refresh Sheepdog volume if creating volume fails.
Signed-off-by: Harry Wei<harryxiyou@gmail.com>
---
ACK.
Patch now pushed; congratulations on finally getting it right, and hopefully next time isn't quite so difficult.
Thanks for your jobs ;-) -- Thanks Harry Wei
participants (4)
-
Eric Blake
-
harryxiyou
-
harryxiyou@gmail.com
-
Osier Yang