提交 a5a383ad 编写于 作者: W Wido den Hollander 提交者: Ján Tomko

rbd: Set r variable so it can be returned should an error occur

This was reported in bug #1298024 where r would be filled with the
return code of rbd_open().

Should rbd_snap_unprotect() fail for any reason the virReportSystemError
call would return 'Success' since rbd_open() succeeded.

https://bugzilla.redhat.com/show_bug.cgi?id=1298024Signed-off-by: NWido den Hollander <wido@widodh.nl>
上级 7f866e54
......@@ -473,7 +473,8 @@ static int virStorageBackendRBDCleanupSnapshots(rados_ioctx_t ioctx,
if (snap_count > 0) {
for (i = 0; i < snap_count; i++) {
if (rbd_snap_is_protected(image, snaps[i].name, &protected)) {
r = rbd_snap_is_protected(image, snaps[i].name, &protected);
if (r < 0) {
virReportSystemError(-r, _("failed to verify if snapshot '%s/%s@%s' is protected"),
source->name, vol->name,
snaps[i].name);
......@@ -485,7 +486,8 @@ static int virStorageBackendRBDCleanupSnapshots(rados_ioctx_t ioctx,
"unprotected", source->name, vol->name,
snaps[i].name);
if (rbd_snap_unprotect(image, snaps[i].name) < 0) {
r = rbd_snap_unprotect(image, snaps[i].name);
if (r < 0) {
virReportSystemError(-r, _("failed to unprotect snapshot '%s/%s@%s'"),
source->name, vol->name,
snaps[i].name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册