mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
storage: RBD: do not return error when deleting non-existent volume
RBD API returns negative value of errno, in that case we can silently ignore if RBD tries to delete a non-existent volume, just like FS backend does.
This commit is contained in:
parent
4749d82a8b
commit
c8be606bae
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* storage_backend_rbd.c: storage backend for RBD (RADOS Block Device) handling
|
* storage_backend_rbd.c: storage backend for RBD (RADOS Block Device) handling
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013-2014 Red Hat, Inc.
|
* Copyright (C) 2013-2015 Red Hat, Inc.
|
||||||
* Copyright (C) 2012 Wido den Hollander
|
* Copyright (C) 2012 Wido den Hollander
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
@ -426,7 +426,7 @@ static int virStorageBackendRBDDeleteVol(virConnectPtr conn,
|
|||||||
VIR_DEBUG("Removing RBD image %s/%s", pool->def->source.name, vol->name);
|
VIR_DEBUG("Removing RBD image %s/%s", pool->def->source.name, vol->name);
|
||||||
|
|
||||||
if (flags & VIR_STORAGE_VOL_DELETE_ZEROED)
|
if (flags & VIR_STORAGE_VOL_DELETE_ZEROED)
|
||||||
VIR_WARN("%s", _("This storage backend does not supported zeroed removal of volumes"));
|
VIR_WARN("%s", _("This storage backend does not support zeroed removal of volumes"));
|
||||||
|
|
||||||
if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
|
if (virStorageBackendRBDOpenRADOSConn(&ptr, conn, &pool->def->source) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -435,7 +435,7 @@ static int virStorageBackendRBDDeleteVol(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
r = rbd_remove(ptr.ioctx, vol->name);
|
r = rbd_remove(ptr.ioctx, vol->name);
|
||||||
if (r < 0) {
|
if (r < 0 && (-r) != ENOENT) {
|
||||||
virReportSystemError(-r, _("failed to remove volume '%s/%s'"),
|
virReportSystemError(-r, _("failed to remove volume '%s/%s'"),
|
||||||
pool->def->source.name, vol->name);
|
pool->def->source.name, vol->name);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user