mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-29 17:15:23 +00:00
55ea7be7d9
For stateless, client side drivers, it is never correct to probe for secondary drivers. It is only ever appropriate to use the secondary driver that is associated with the hypervisor in question. As a result the ESX & HyperV drivers have both been forced to do hacks where they register no-op drivers for the ones they don't implement. For stateful, server side drivers, we always just want to use the same built-in shared driver. The exception is virtualbox which is really a stateless driver and so wants to use its own server side secondary drivers. To deal with this virtualbox has to be built as 3 separate loadable modules to allow registration to work in the right order. This can all be simplified by introducing a new struct recording the precise set of secondary drivers each hypervisor driver wants struct _virConnectDriver { virHypervisorDriverPtr hypervisorDriver; virInterfaceDriverPtr interfaceDriver; virNetworkDriverPtr networkDriver; virNodeDeviceDriverPtr nodeDeviceDriver; virNWFilterDriverPtr nwfilterDriver; virSecretDriverPtr secretDriver; virStorageDriverPtr storageDriver; }; Instead of registering the hypervisor driver, we now just register a virConnectDriver instead. This allows us to remove all probing of secondary drivers. Once we have chosen the primary driver, we immediately know the correct secondary drivers to use. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
256 lines
8.8 KiB
C
256 lines
8.8 KiB
C
/*
|
|
* driver-storage.h: entry points for storage drivers
|
|
*
|
|
* Copyright (C) 2006-2014 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __VIR_DRIVER_STORAGE_H__
|
|
# define __VIR_DRIVER_STORAGE_H__
|
|
|
|
# ifndef __VIR_DRIVER_H_INCLUDES___
|
|
# error "Don't include this file directly, only use driver.h"
|
|
# endif
|
|
|
|
typedef int
|
|
(*virDrvConnectNumOfStoragePools)(virConnectPtr conn);
|
|
|
|
typedef int
|
|
(*virDrvConnectListStoragePools)(virConnectPtr conn,
|
|
char **const names,
|
|
int maxnames);
|
|
|
|
typedef int
|
|
(*virDrvConnectNumOfDefinedStoragePools)(virConnectPtr conn);
|
|
|
|
typedef int
|
|
(*virDrvConnectListDefinedStoragePools)(virConnectPtr conn,
|
|
char **const names,
|
|
int maxnames);
|
|
|
|
typedef int
|
|
(*virDrvConnectListAllStoragePools)(virConnectPtr conn,
|
|
virStoragePoolPtr **pools,
|
|
unsigned int flags);
|
|
|
|
typedef char *
|
|
(*virDrvConnectFindStoragePoolSources)(virConnectPtr conn,
|
|
const char *type,
|
|
const char *srcSpec,
|
|
unsigned int flags);
|
|
|
|
typedef virStoragePoolPtr
|
|
(*virDrvStoragePoolLookupByName)(virConnectPtr conn,
|
|
const char *name);
|
|
|
|
typedef virStoragePoolPtr
|
|
(*virDrvStoragePoolLookupByUUID)(virConnectPtr conn,
|
|
const unsigned char *uuid);
|
|
|
|
typedef virStoragePoolPtr
|
|
(*virDrvStoragePoolLookupByVolume)(virStorageVolPtr vol);
|
|
|
|
typedef virStoragePoolPtr
|
|
(*virDrvStoragePoolCreateXML)(virConnectPtr conn,
|
|
const char *xmlDesc,
|
|
unsigned int flags);
|
|
|
|
typedef virStoragePoolPtr
|
|
(*virDrvStoragePoolDefineXML)(virConnectPtr conn,
|
|
const char *xmlDesc,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolUndefine)(virStoragePoolPtr pool);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolBuild)(virStoragePoolPtr pool,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolCreate)(virStoragePoolPtr pool,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolDestroy)(virStoragePoolPtr pool);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolDelete)(virStoragePoolPtr pool,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolRefresh)(virStoragePoolPtr pool,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolGetInfo)(virStoragePoolPtr vol,
|
|
virStoragePoolInfoPtr info);
|
|
|
|
typedef char *
|
|
(*virDrvStoragePoolGetXMLDesc)(virStoragePoolPtr pool,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolGetAutostart)(virStoragePoolPtr pool,
|
|
int *autostart);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolSetAutostart)(virStoragePoolPtr pool,
|
|
int autostart);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolNumOfVolumes)(virStoragePoolPtr pool);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolListVolumes)(virStoragePoolPtr pool,
|
|
char **const names,
|
|
int maxnames);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolListAllVolumes)(virStoragePoolPtr pool,
|
|
virStorageVolPtr **vols,
|
|
unsigned int flags);
|
|
|
|
typedef virStorageVolPtr
|
|
(*virDrvStorageVolLookupByName)(virStoragePoolPtr pool,
|
|
const char *name);
|
|
|
|
typedef virStorageVolPtr
|
|
(*virDrvStorageVolLookupByKey)(virConnectPtr pool,
|
|
const char *key);
|
|
|
|
typedef virStorageVolPtr
|
|
(*virDrvStorageVolLookupByPath)(virConnectPtr pool,
|
|
const char *path);
|
|
|
|
typedef virStorageVolPtr
|
|
(*virDrvStorageVolCreateXML)(virStoragePoolPtr pool,
|
|
const char *xmldesc,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStorageVolDelete)(virStorageVolPtr vol,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStorageVolWipe)(virStorageVolPtr vol,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStorageVolWipePattern)(virStorageVolPtr vol,
|
|
unsigned int algorithm,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStorageVolGetInfo)(virStorageVolPtr vol,
|
|
virStorageVolInfoPtr info);
|
|
|
|
typedef char *
|
|
(*virDrvStorageVolGetXMLDesc)(virStorageVolPtr pool,
|
|
unsigned int flags);
|
|
|
|
typedef char *
|
|
(*virDrvStorageVolGetPath)(virStorageVolPtr vol);
|
|
|
|
typedef virStorageVolPtr
|
|
(*virDrvStorageVolCreateXMLFrom)(virStoragePoolPtr pool,
|
|
const char *xmldesc,
|
|
virStorageVolPtr clonevol,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStorageVolDownload)(virStorageVolPtr vol,
|
|
virStreamPtr stream,
|
|
unsigned long long offset,
|
|
unsigned long long length,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStorageVolUpload)(virStorageVolPtr vol,
|
|
virStreamPtr stream,
|
|
unsigned long long offset,
|
|
unsigned long long length,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStorageVolResize)(virStorageVolPtr vol,
|
|
unsigned long long capacity,
|
|
unsigned int flags);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolIsActive)(virStoragePoolPtr pool);
|
|
|
|
typedef int
|
|
(*virDrvStoragePoolIsPersistent)(virStoragePoolPtr pool);
|
|
|
|
|
|
|
|
typedef struct _virStorageDriver virStorageDriver;
|
|
typedef virStorageDriver *virStorageDriverPtr;
|
|
|
|
/**
|
|
* _virStorageDriver:
|
|
*
|
|
* Structure associated to a storage driver, defining the various
|
|
* entry points for it.
|
|
*/
|
|
struct _virStorageDriver {
|
|
const char *name; /* the name of the driver */
|
|
virDrvConnectNumOfStoragePools connectNumOfStoragePools;
|
|
virDrvConnectListStoragePools connectListStoragePools;
|
|
virDrvConnectNumOfDefinedStoragePools connectNumOfDefinedStoragePools;
|
|
virDrvConnectListDefinedStoragePools connectListDefinedStoragePools;
|
|
virDrvConnectListAllStoragePools connectListAllStoragePools;
|
|
virDrvConnectFindStoragePoolSources connectFindStoragePoolSources;
|
|
virDrvStoragePoolLookupByName storagePoolLookupByName;
|
|
virDrvStoragePoolLookupByUUID storagePoolLookupByUUID;
|
|
virDrvStoragePoolLookupByVolume storagePoolLookupByVolume;
|
|
virDrvStoragePoolCreateXML storagePoolCreateXML;
|
|
virDrvStoragePoolDefineXML storagePoolDefineXML;
|
|
virDrvStoragePoolBuild storagePoolBuild;
|
|
virDrvStoragePoolUndefine storagePoolUndefine;
|
|
virDrvStoragePoolCreate storagePoolCreate;
|
|
virDrvStoragePoolDestroy storagePoolDestroy;
|
|
virDrvStoragePoolDelete storagePoolDelete;
|
|
virDrvStoragePoolRefresh storagePoolRefresh;
|
|
virDrvStoragePoolGetInfo storagePoolGetInfo;
|
|
virDrvStoragePoolGetXMLDesc storagePoolGetXMLDesc;
|
|
virDrvStoragePoolGetAutostart storagePoolGetAutostart;
|
|
virDrvStoragePoolSetAutostart storagePoolSetAutostart;
|
|
virDrvStoragePoolNumOfVolumes storagePoolNumOfVolumes;
|
|
virDrvStoragePoolListVolumes storagePoolListVolumes;
|
|
virDrvStoragePoolListAllVolumes storagePoolListAllVolumes;
|
|
virDrvStorageVolLookupByName storageVolLookupByName;
|
|
virDrvStorageVolLookupByKey storageVolLookupByKey;
|
|
virDrvStorageVolLookupByPath storageVolLookupByPath;
|
|
virDrvStorageVolCreateXML storageVolCreateXML;
|
|
virDrvStorageVolCreateXMLFrom storageVolCreateXMLFrom;
|
|
virDrvStorageVolDownload storageVolDownload;
|
|
virDrvStorageVolUpload storageVolUpload;
|
|
virDrvStorageVolDelete storageVolDelete;
|
|
virDrvStorageVolWipe storageVolWipe;
|
|
virDrvStorageVolWipePattern storageVolWipePattern;
|
|
virDrvStorageVolGetInfo storageVolGetInfo;
|
|
virDrvStorageVolGetXMLDesc storageVolGetXMLDesc;
|
|
virDrvStorageVolGetPath storageVolGetPath;
|
|
virDrvStorageVolResize storageVolResize;
|
|
virDrvStoragePoolIsActive storagePoolIsActive;
|
|
virDrvStoragePoolIsPersistent storagePoolIsPersistent;
|
|
};
|
|
|
|
|
|
#endif /* __VIR_DRIVER_STORAGE_H__ */
|