[libvirt] [PATCH] storage: Error out if the target is already mounted for netfs pool

mnt_fsname can not be the same, as we check the duplicate pool sources earlier before, means it can't be the same pool, moreover, a pool can't be started if it's already active anyway. So no reason to act as success. --- src/storage/storage_backend_fs.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index bde4528..87d9192 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -424,10 +424,10 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) { /* Short-circuit if already mounted */ if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 0) { - if (ret < 0) - return -1; - else - return 0; + virStorageReportError(VIR_ERR_OPERATION_INVALID, + _("Target '%s' is already mounted"), + pool->def->target.path); + return -1; } if (pool->def->type == VIR_STORAGE_POOL_NETFS) { -- 1.7.7.3

On 06/27/2012 08:31 AM, Osier Yang wrote:
mnt_fsname can not be the same, as we check the duplicate pool sources earlier before, means it can't be the same pool, moreover, a pool can't be started if it's already active anyway. So no reason to act as success. --- src/storage/storage_backend_fs.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 2012年06月28日 06:36, Eric Blake wrote:
On 06/27/2012 08:31 AM, Osier Yang wrote:
mnt_fsname can not be the same, as we check the duplicate pool sources earlier before, means it can't be the same pool, moreover, a pool can't be started if it's already active anyway. So no reason to act as success. --- src/storage/storage_backend_fs.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
ACK.
Thanks, pushed.
participants (2)
-
Eric Blake
-
Osier Yang