mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: Move virStorageBackendFileSystemGetPoolSource
Move into storage_util for reuse by test harness Signed-off-by: John Ferlan <jferlan@redhat.com> ACKed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
728b9ed61a
commit
1f6ca26d72
@ -245,39 +245,6 @@ virStorageBackendFileSystemIsValid(virStoragePoolObjPtr pool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* virStorageBackendFileSystemGetPoolSource
|
|
||||||
* @pool: storage pool object pointer
|
|
||||||
*
|
|
||||||
* Allocate/return a string representing the FS storage pool source.
|
|
||||||
* It is up to the caller to VIR_FREE the allocated string
|
|
||||||
*/
|
|
||||||
static char *
|
|
||||||
virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool)
|
|
||||||
{
|
|
||||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
|
||||||
char *src = NULL;
|
|
||||||
|
|
||||||
if (def->type == VIR_STORAGE_POOL_NETFS) {
|
|
||||||
if (def->source.format == VIR_STORAGE_POOL_NETFS_CIFS) {
|
|
||||||
if (virAsprintf(&src, "//%s/%s",
|
|
||||||
def->source.hosts[0].name,
|
|
||||||
def->source.dir) < 0)
|
|
||||||
return NULL;
|
|
||||||
} else {
|
|
||||||
if (virAsprintf(&src, "%s:%s",
|
|
||||||
def->source.hosts[0].name,
|
|
||||||
def->source.dir) < 0)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (VIR_STRDUP(src, def->source.devices[0].path) < 0)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
return src;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @pool storage pool to check for status
|
* @pool storage pool to check for status
|
||||||
*
|
*
|
||||||
|
@ -4228,6 +4228,39 @@ virStorageBackendZeroPartitionTable(const char *path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virStorageBackendFileSystemGetPoolSource
|
||||||
|
* @pool: storage pool object pointer
|
||||||
|
*
|
||||||
|
* Allocate/return a string representing the FS storage pool source.
|
||||||
|
* It is up to the caller to VIR_FREE the allocated string
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool)
|
||||||
|
{
|
||||||
|
virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
|
||||||
|
char *src = NULL;
|
||||||
|
|
||||||
|
if (def->type == VIR_STORAGE_POOL_NETFS) {
|
||||||
|
if (def->source.format == VIR_STORAGE_POOL_NETFS_CIFS) {
|
||||||
|
if (virAsprintf(&src, "//%s/%s",
|
||||||
|
def->source.hosts[0].name,
|
||||||
|
def->source.dir) < 0)
|
||||||
|
return NULL;
|
||||||
|
} else {
|
||||||
|
if (virAsprintf(&src, "%s:%s",
|
||||||
|
def->source.hosts[0].name,
|
||||||
|
def->source.dir) < 0)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (VIR_STRDUP(src, def->source.devices[0].path) < 0)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virCommandPtr
|
virCommandPtr
|
||||||
virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
||||||
const char *src)
|
const char *src)
|
||||||
|
@ -177,6 +177,9 @@ int
|
|||||||
virStorageBackendZeroPartitionTable(const char *path,
|
virStorageBackendZeroPartitionTable(const char *path,
|
||||||
unsigned long long size);
|
unsigned long long size);
|
||||||
|
|
||||||
|
char *
|
||||||
|
virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool);
|
||||||
|
|
||||||
virCommandPtr
|
virCommandPtr
|
||||||
virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
|
||||||
const char *src);
|
const char *src);
|
||||||
|
Loading…
Reference in New Issue
Block a user