mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
storage: backend: Refactor registration of the backend drivers
Add APIs that allow to dynamically register driver backends so that the list of available drivers does not need to be known during compile time. This will allow us to modularize the storage driver on runtime.
This commit is contained in:
parent
633b7592d6
commit
f813fe810f
@ -72,67 +72,106 @@
|
|||||||
|
|
||||||
VIR_LOG_INIT("storage.storage_backend");
|
VIR_LOG_INIT("storage.storage_backend");
|
||||||
|
|
||||||
static virStorageBackendPtr backends[] = {
|
#define VIR_STORAGE_BACKENDS_MAX 20
|
||||||
#if WITH_STORAGE_DIR
|
|
||||||
&virStorageBackendDirectory,
|
static virStorageBackendPtr virStorageBackends[VIR_STORAGE_BACKENDS_MAX];
|
||||||
#endif
|
static size_t virStorageBackendsCount;
|
||||||
#if WITH_STORAGE_FS
|
static virStorageFileBackendPtr virStorageFileBackends[VIR_STORAGE_BACKENDS_MAX];
|
||||||
&virStorageBackendFileSystem,
|
static size_t virStorageFileBackendsCount;
|
||||||
&virStorageBackendNetFileSystem,
|
|
||||||
|
#define VIR_STORAGE_BACKEND_REGISTER(name) \
|
||||||
|
if (name() < 0) \
|
||||||
|
return -1
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendDriversRegister(void)
|
||||||
|
{
|
||||||
|
#if WITH_STORAGE_DIR || WITH_STORAGE_FS
|
||||||
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendFsRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_LVM
|
#if WITH_STORAGE_LVM
|
||||||
&virStorageBackendLogical,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendLogicalRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_ISCSI
|
#if WITH_STORAGE_ISCSI
|
||||||
&virStorageBackendISCSI,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendISCSIRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_SCSI
|
#if WITH_STORAGE_SCSI
|
||||||
&virStorageBackendSCSI,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendSCSIRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_MPATH
|
#if WITH_STORAGE_MPATH
|
||||||
&virStorageBackendMpath,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendMpathRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_DISK
|
#if WITH_STORAGE_DISK
|
||||||
&virStorageBackendDisk,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendDiskRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_RBD
|
#if WITH_STORAGE_RBD
|
||||||
&virStorageBackendRBD,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendRBDRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_SHEEPDOG
|
#if WITH_STORAGE_SHEEPDOG
|
||||||
&virStorageBackendSheepdog,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendSheepdogRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_GLUSTER
|
#if WITH_STORAGE_GLUSTER
|
||||||
&virStorageBackendGluster,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendGlusterRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_ZFS
|
#if WITH_STORAGE_ZFS
|
||||||
&virStorageBackendZFS,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendZFSRegister);
|
||||||
#endif
|
#endif
|
||||||
#if WITH_STORAGE_VSTORAGE
|
#if WITH_STORAGE_VSTORAGE
|
||||||
&virStorageBackendVstorage,
|
VIR_STORAGE_BACKEND_REGISTER(virStorageBackendVstorageRegister);
|
||||||
#endif
|
#endif
|
||||||
NULL
|
|
||||||
};
|
return 0;
|
||||||
|
}
|
||||||
|
#undef VIR_STORAGE_BACKEND_REGISTER
|
||||||
|
|
||||||
|
|
||||||
static virStorageFileBackendPtr fileBackends[] = {
|
int
|
||||||
#if WITH_STORAGE_FS
|
virStorageBackendRegister(virStorageBackendPtr backend)
|
||||||
&virStorageFileBackendFile,
|
{
|
||||||
&virStorageFileBackendBlock,
|
VIR_DEBUG("Registering storage backend '%s'",
|
||||||
#endif
|
virStorageTypeToString(backend->type));
|
||||||
#if WITH_STORAGE_GLUSTER
|
|
||||||
&virStorageFileBackendGluster,
|
if (virStorageBackendsCount >= VIR_STORAGE_BACKENDS_MAX) {
|
||||||
#endif
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
NULL
|
_("Too many drivers, cannot register storage backend '%s'"),
|
||||||
};
|
virStorageTypeToString(backend->type));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
virStorageBackends[virStorageBackendsCount] = backend;
|
||||||
|
virStorageBackendsCount++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendFileRegister(virStorageFileBackendPtr backend)
|
||||||
|
{
|
||||||
|
VIR_DEBUG("Registering storage file backend '%s' protocol '%s'",
|
||||||
|
virStorageTypeToString(backend->type),
|
||||||
|
virStorageNetProtocolTypeToString(backend->protocol));
|
||||||
|
|
||||||
|
if (virStorageFileBackendsCount >= VIR_STORAGE_BACKENDS_MAX) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Too many drivers, cannot register storage file "
|
||||||
|
"backend '%s'"),
|
||||||
|
virStorageTypeToString(backend->type));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
virStorageFileBackends[virStorageFileBackendsCount] = backend;
|
||||||
|
virStorageFileBackendsCount++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
virStorageBackendPtr
|
virStorageBackendPtr
|
||||||
virStorageBackendForType(int type)
|
virStorageBackendForType(int type)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; backends[i]; i++)
|
for (i = 0; i < virStorageBackendsCount; i++)
|
||||||
if (backends[i]->type == type)
|
if (virStorageBackends[i]->type == type)
|
||||||
return backends[i];
|
return virStorageBackends[i];
|
||||||
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("missing backend for pool type %d (%s)"),
|
_("missing backend for pool type %d (%s)"),
|
||||||
@ -148,13 +187,13 @@ virStorageFileBackendForTypeInternal(int type,
|
|||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; fileBackends[i]; i++) {
|
for (i = 0; i < virStorageFileBackendsCount; i++) {
|
||||||
if (fileBackends[i]->type == type) {
|
if (virStorageFileBackends[i]->type == type) {
|
||||||
if (type == VIR_STORAGE_TYPE_NETWORK &&
|
if (type == VIR_STORAGE_TYPE_NETWORK &&
|
||||||
fileBackends[i]->protocol != protocol)
|
virStorageFileBackends[i]->protocol != protocol)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
return fileBackends[i];
|
return virStorageFileBackends[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,4 +198,9 @@ struct _virStorageFileBackend {
|
|||||||
virStorageFileBackendChown storageFileChown;
|
virStorageFileBackendChown storageFileChown;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int virStorageBackendDriversRegister(void);
|
||||||
|
|
||||||
|
int virStorageBackendRegister(virStorageBackendPtr backend);
|
||||||
|
int virStorageBackendFileRegister(virStorageFileBackendPtr backend);
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_H__ */
|
||||||
|
@ -937,3 +937,10 @@ virStorageBackend virStorageBackendDisk = {
|
|||||||
.downloadVol = virStorageBackendVolDownloadLocal,
|
.downloadVol = virStorageBackendVolDownloadLocal,
|
||||||
.wipeVol = virStorageBackendDiskVolWipe,
|
.wipeVol = virStorageBackendDiskVolWipe,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendDiskRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendDisk);
|
||||||
|
}
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_DISK_H__
|
#ifndef __VIR_STORAGE_BACKEND_DISK_H__
|
||||||
# define __VIR_STORAGE_BACKEND_DISK_H__
|
# define __VIR_STORAGE_BACKEND_DISK_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendDiskRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendDisk;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_DISK_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_DISK_H__ */
|
||||||
|
@ -884,3 +884,30 @@ virStorageFileBackend virStorageFileBackendDir = {
|
|||||||
|
|
||||||
.storageFileGetUniqueIdentifier = virStorageFileBackendFileGetUniqueIdentifier,
|
.storageFileGetUniqueIdentifier = virStorageFileBackendFileGetUniqueIdentifier,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendFsRegister(void)
|
||||||
|
{
|
||||||
|
if (virStorageBackendRegister(&virStorageBackendDirectory) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
#if WITH_STORAGE_FS
|
||||||
|
if (virStorageBackendRegister(&virStorageBackendFileSystem) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virStorageBackendRegister(&virStorageBackendNetFileSystem) < 0)
|
||||||
|
return -1;
|
||||||
|
#endif /* WITH_STORAGE_FS */
|
||||||
|
|
||||||
|
if (virStorageBackendFileRegister(&virStorageFileBackendFile) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virStorageBackendFileRegister(&virStorageFileBackendBlock) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virStorageBackendFileRegister(&virStorageFileBackendDir) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -24,15 +24,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_FS_H__
|
#ifndef __VIR_STORAGE_BACKEND_FS_H__
|
||||||
# define __VIR_STORAGE_BACKEND_FS_H__
|
# define __VIR_STORAGE_BACKEND_FS_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendFsRegister(void);
|
||||||
|
|
||||||
# if WITH_STORAGE_FS
|
|
||||||
extern virStorageBackend virStorageBackendFileSystem;
|
|
||||||
extern virStorageBackend virStorageBackendNetFileSystem;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendDirectory;
|
|
||||||
|
|
||||||
extern virStorageFileBackend virStorageFileBackendFile;
|
|
||||||
extern virStorageFileBackend virStorageFileBackendBlock;
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_FS_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_FS_H__ */
|
||||||
|
@ -843,6 +843,17 @@ virStorageFileBackend virStorageFileBackendGluster = {
|
|||||||
.storageFileChown = virStorageFileBackendGlusterChown,
|
.storageFileChown = virStorageFileBackendGlusterChown,
|
||||||
|
|
||||||
.storageFileGetUniqueIdentifier = virStorageFileBackendGlusterGetUniqueIdentifier,
|
.storageFileGetUniqueIdentifier = virStorageFileBackendGlusterGetUniqueIdentifier,
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendGlusterRegister(void)
|
||||||
|
{
|
||||||
|
if (virStorageBackendRegister(&virStorageBackendGluster) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (virStorageBackendFileRegister(&virStorageFileBackendGluster) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -22,9 +22,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_GLUSTER_H__
|
#ifndef __VIR_STORAGE_BACKEND_GLUSTER_H__
|
||||||
# define __VIR_STORAGE_BACKEND_GLUSTER_H__
|
# define __VIR_STORAGE_BACKEND_GLUSTER_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendGlusterRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendGluster;
|
|
||||||
extern virStorageFileBackend virStorageFileBackendGluster;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_GLUSTER_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_GLUSTER_H__ */
|
||||||
|
@ -437,3 +437,10 @@ virStorageBackend virStorageBackendISCSI = {
|
|||||||
.downloadVol = virStorageBackendVolDownloadLocal,
|
.downloadVol = virStorageBackendVolDownloadLocal,
|
||||||
.wipeVol = virStorageBackendVolWipeLocal,
|
.wipeVol = virStorageBackendVolWipeLocal,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendISCSIRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendISCSI);
|
||||||
|
}
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_ISCSI_H__
|
#ifndef __VIR_STORAGE_BACKEND_ISCSI_H__
|
||||||
# define __VIR_STORAGE_BACKEND_ISCSI_H__
|
# define __VIR_STORAGE_BACKEND_ISCSI_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendISCSIRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendISCSI;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_ISCSI_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_ISCSI_H__ */
|
||||||
|
@ -1112,3 +1112,10 @@ virStorageBackend virStorageBackendLogical = {
|
|||||||
.downloadVol = virStorageBackendVolDownloadLocal,
|
.downloadVol = virStorageBackendVolDownloadLocal,
|
||||||
.wipeVol = virStorageBackendLogicalVolWipe,
|
.wipeVol = virStorageBackendLogicalVolWipe,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendLogicalRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendLogical);
|
||||||
|
}
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_LOGICAL_H__
|
#ifndef __VIR_STORAGE_BACKEND_LOGICAL_H__
|
||||||
# define __VIR_STORAGE_BACKEND_LOGICAL_H__
|
# define __VIR_STORAGE_BACKEND_LOGICAL_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendLogicalRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendLogical;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_LOGICAL_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_LOGICAL_H__ */
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
#include "storage_conf.h"
|
#include "storage_conf.h"
|
||||||
#include "storage_backend.h"
|
#include "storage_backend.h"
|
||||||
|
#include "storage_backend_mpath.h"
|
||||||
#include "viralloc.h"
|
#include "viralloc.h"
|
||||||
#include "virlog.h"
|
#include "virlog.h"
|
||||||
#include "virfile.h"
|
#include "virfile.h"
|
||||||
@ -278,3 +279,10 @@ virStorageBackend virStorageBackendMpath = {
|
|||||||
.downloadVol = virStorageBackendVolDownloadLocal,
|
.downloadVol = virStorageBackendVolDownloadLocal,
|
||||||
.wipeVol = virStorageBackendVolWipeLocal,
|
.wipeVol = virStorageBackendVolWipeLocal,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendMpathRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendMpath);
|
||||||
|
}
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_MPATH_H__
|
#ifndef __VIR_STORAGE_BACKEND_MPATH_H__
|
||||||
# define __VIR_STORAGE_BACKEND_MPATH_H__
|
# define __VIR_STORAGE_BACKEND_MPATH_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendMpathRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendMpath;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_MPATH_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_MPATH_H__ */
|
||||||
|
@ -1294,3 +1294,10 @@ virStorageBackend virStorageBackendRBD = {
|
|||||||
.resizeVol = virStorageBackendRBDResizeVol,
|
.resizeVol = virStorageBackendRBDResizeVol,
|
||||||
.wipeVol = virStorageBackendRBDVolWipe
|
.wipeVol = virStorageBackendRBDVolWipe
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendRBDRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendRBD);
|
||||||
|
}
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_RBD_H__
|
#ifndef __VIR_STORAGE_BACKEND_RBD_H__
|
||||||
# define __VIR_STORAGE_BACKEND_RBD_H__
|
# define __VIR_STORAGE_BACKEND_RBD_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendRBDRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendRBD;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_RBD_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_RBD_H__ */
|
||||||
|
@ -544,3 +544,10 @@ virStorageBackend virStorageBackendSCSI = {
|
|||||||
.downloadVol = virStorageBackendVolDownloadLocal,
|
.downloadVol = virStorageBackendVolDownloadLocal,
|
||||||
.wipeVol = virStorageBackendVolWipeLocal,
|
.wipeVol = virStorageBackendVolWipeLocal,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendSCSIRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendSCSI);
|
||||||
|
}
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_SCSI_H__
|
#ifndef __VIR_STORAGE_BACKEND_SCSI_H__
|
||||||
# define __VIR_STORAGE_BACKEND_SCSI_H__
|
# define __VIR_STORAGE_BACKEND_SCSI_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendSCSIRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendSCSI;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_SCSI_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_SCSI_H__ */
|
||||||
|
@ -417,3 +417,10 @@ virStorageBackend virStorageBackendSheepdog = {
|
|||||||
.deleteVol = virStorageBackendSheepdogDeleteVol,
|
.deleteVol = virStorageBackendSheepdogDeleteVol,
|
||||||
.resizeVol = virStorageBackendSheepdogResizeVol,
|
.resizeVol = virStorageBackendSheepdogResizeVol,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendSheepdogRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendSheepdog);
|
||||||
|
}
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_SHEEPDOG_H__
|
#ifndef __VIR_STORAGE_BACKEND_SHEEPDOG_H__
|
||||||
# define __VIR_STORAGE_BACKEND_SHEEPDOG_H__
|
# define __VIR_STORAGE_BACKEND_SHEEPDOG_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendSheepdogRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendSheepdog;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_SHEEPDOG_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_SHEEPDOG_H__ */
|
||||||
|
@ -183,3 +183,10 @@ virStorageBackend virStorageBackendVstorage = {
|
|||||||
.downloadVol = virStorageBackendVolDownloadLocal,
|
.downloadVol = virStorageBackendVolDownloadLocal,
|
||||||
.wipeVol = virStorageBackendVolWipeLocal,
|
.wipeVol = virStorageBackendVolWipeLocal,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendVstorageRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendVstorage);
|
||||||
|
}
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_VSTORAGE_H__
|
#ifndef __VIR_STORAGE_BACKEND_VSTORAGE_H__
|
||||||
# define __VIR_STORAGE_BACKEND_VSTORAGE_H__
|
# define __VIR_STORAGE_BACKEND_VSTORAGE_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendVstorageRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendVstorage;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_VSTORAGE_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_VSTORAGE_H__ */
|
||||||
|
@ -467,3 +467,10 @@ virStorageBackend virStorageBackendZFS = {
|
|||||||
.uploadVol = virStorageBackendVolUploadLocal,
|
.uploadVol = virStorageBackendVolUploadLocal,
|
||||||
.downloadVol = virStorageBackendVolDownloadLocal,
|
.downloadVol = virStorageBackendVolDownloadLocal,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendZFSRegister(void)
|
||||||
|
{
|
||||||
|
return virStorageBackendRegister(&virStorageBackendZFS);
|
||||||
|
}
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#ifndef __VIR_STORAGE_BACKEND_ZFS_H__
|
#ifndef __VIR_STORAGE_BACKEND_ZFS_H__
|
||||||
# define __VIR_STORAGE_BACKEND_ZFS_H__
|
# define __VIR_STORAGE_BACKEND_ZFS_H__
|
||||||
|
|
||||||
# include "storage_backend.h"
|
int virStorageBackendZFSRegister(void);
|
||||||
|
|
||||||
extern virStorageBackend virStorageBackendZFS;
|
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_BACKEND_ZFS_H__ */
|
#endif /* __VIR_STORAGE_BACKEND_ZFS_H__ */
|
||||||
|
@ -2840,6 +2840,8 @@ static virStateDriver stateDriver = {
|
|||||||
|
|
||||||
int storageRegister(void)
|
int storageRegister(void)
|
||||||
{
|
{
|
||||||
|
if (virStorageBackendDriversRegister() < 0)
|
||||||
|
return -1;
|
||||||
if (virSetSharedStorageDriver(&storageDriver) < 0)
|
if (virSetSharedStorageDriver(&storageDriver) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
if (virRegisterStateDriver(&stateDriver) < 0)
|
if (virRegisterStateDriver(&stateDriver) < 0)
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "dirname.h"
|
#include "dirname.h"
|
||||||
|
|
||||||
#include "storage/storage_driver.h"
|
#include "storage/storage_driver.h"
|
||||||
|
#include "storage/storage_backend.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_NONE
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
||||||
|
|
||||||
@ -731,6 +732,9 @@ mymain(void)
|
|||||||
virStorageSourcePtr chain2; /* short for chain->backingStore */
|
virStorageSourcePtr chain2; /* short for chain->backingStore */
|
||||||
virStorageSourcePtr chain3; /* short for chain2->backingStore */
|
virStorageSourcePtr chain3; /* short for chain2->backingStore */
|
||||||
|
|
||||||
|
if (virStorageBackendDriversRegister() < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
/* Prep some files with qemu-img; if that is not found on PATH, or
|
/* Prep some files with qemu-img; if that is not found on PATH, or
|
||||||
* if it lacks support for qcow2 and qed, skip this test. */
|
* if it lacks support for qcow2 and qed, skip this test. */
|
||||||
if ((ret = testPrepImages()) != 0)
|
if ((ret = testPrepImages()) != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user