mirror of https://gitee.com/openkylin/libvirt.git
storage: Move the virStorageBackendFileSystem{Start|Stop} API's
Just moving code around with minor adjustment to have the Stop code combine with the Unmount code since all the Stop code did was call the Unmount code.
This commit is contained in:
parent
572eda12ad
commit
e26c21629e
|
@ -536,16 +536,43 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @conn connection to report errors against
|
||||||
|
* @pool storage pool to start
|
||||||
|
*
|
||||||
|
* Starts a directory or FS based storage pool. The underlying source
|
||||||
|
* device will be mounted for FS based pools.
|
||||||
|
*
|
||||||
|
* Returns 0 on success, -1 on error
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
virStorageBackendFileSystemStart(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
|
virStoragePoolObjPtr pool)
|
||||||
|
{
|
||||||
|
if (pool->def->type != VIR_STORAGE_POOL_DIR &&
|
||||||
|
virStorageBackendFileSystemMount(pool) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @conn connection to report errors against
|
||||||
* @pool storage pool to unmount
|
* @pool storage pool to unmount
|
||||||
*
|
*
|
||||||
|
* Stops a file storage pool. The underlying source device is unmounted
|
||||||
|
* for FS based pools. Any cached data about volumes is released.
|
||||||
|
*
|
||||||
* Ensure that a FS storage pool is not mounted on its target location.
|
* Ensure that a FS storage pool is not mounted on its target location.
|
||||||
* If already unmounted, this is a no-op.
|
* If already unmounted, this is a no-op.
|
||||||
*
|
*
|
||||||
* Returns 0 if successfully unmounted, -1 on error
|
* Returns 0 if successfully unmounted, -1 on error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool)
|
virStorageBackendFileSystemStop(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
|
virStoragePoolObjPtr pool)
|
||||||
{
|
{
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
@ -598,29 +625,6 @@ virStorageBackendFileSystemCheck(virStoragePoolObjPtr pool,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WITH_STORAGE_FS
|
|
||||||
/**
|
|
||||||
* @conn connection to report errors against
|
|
||||||
* @pool storage pool to start
|
|
||||||
*
|
|
||||||
* Starts a directory or FS based storage pool. The underlying source
|
|
||||||
* device will be mounted for FS based pools.
|
|
||||||
*
|
|
||||||
* Returns 0 on success, -1 on error
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
virStorageBackendFileSystemStart(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|
||||||
virStoragePoolObjPtr pool)
|
|
||||||
{
|
|
||||||
if (pool->def->type != VIR_STORAGE_POOL_DIR &&
|
|
||||||
virStorageBackendFileSystemMount(pool) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* WITH_STORAGE_FS */
|
|
||||||
|
|
||||||
|
|
||||||
/* some platforms don't support mkfs */
|
/* some platforms don't support mkfs */
|
||||||
#ifdef MKFS
|
#ifdef MKFS
|
||||||
static int
|
static int
|
||||||
|
@ -946,28 +950,6 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @conn connection to report errors against
|
|
||||||
* @pool storage pool to stop
|
|
||||||
*
|
|
||||||
* Stops a file storage pool. The underlying source device is unmounted
|
|
||||||
* for FS based pools. Any cached data about volumes is released.
|
|
||||||
*
|
|
||||||
* Returns 0 on success, -1 on error.
|
|
||||||
*/
|
|
||||||
#if WITH_STORAGE_FS
|
|
||||||
static int
|
|
||||||
virStorageBackendFileSystemStop(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|
||||||
virStoragePoolObjPtr pool)
|
|
||||||
{
|
|
||||||
if (virStorageBackendFileSystemUnmount(pool) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif /* WITH_STORAGE_FS */
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @conn connection to report errors against
|
* @conn connection to report errors against
|
||||||
* @pool storage pool to delete
|
* @pool storage pool to delete
|
||||||
|
|
Loading…
Reference in New Issue