storage: return -1 when fs pool can't be mounted

Don't reuse the return value of virStorageBackendFileSystemIsMounted.
If it's 0, we'd return it even if the mount command failed.

Also, don't report another error if it's -1, since one has already
been reported.

Introduced by 258e06c.

https://bugzilla.redhat.com/show_bug.cgi?id=981251
(cherry picked from commit 13fde7ceab)
This commit is contained in:
Ján Tomko 2013-07-11 12:36:59 +02:00
parent 914fedaa6b
commit 1fb6ded660

View File

@ -351,6 +351,7 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
pool->def->source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS); pool->def->source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS);
virCommandPtr cmd = NULL; virCommandPtr cmd = NULL;
int ret = -1; int ret = -1;
int rc;
if (pool->def->type == VIR_STORAGE_POOL_NETFS) { if (pool->def->type == VIR_STORAGE_POOL_NETFS) {
if (pool->def->source.nhost != 1) { if (pool->def->source.nhost != 1) {
@ -377,10 +378,12 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
} }
/* Short-circuit if already mounted */ /* Short-circuit if already mounted */
if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 0) { if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 0) {
virReportError(VIR_ERR_OPERATION_INVALID, if (rc == 1) {
_("Target '%s' is already mounted"), virReportError(VIR_ERR_OPERATION_INVALID,
pool->def->target.path); _("Target '%s' is already mounted"),
pool->def->target.path);
}
return -1; return -1;
} }