2008-02-20 15:34:52 +00:00
|
|
|
/*
|
|
|
|
* storage_backend.h: internal storage driver backend contract
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007-2008 Red Hat, Inc.
|
|
|
|
* Copyright (C) 2007-2008 Daniel P. Berrange
|
|
|
|
*
|
|
|
|
* 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
* Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_STORAGE_BACKEND_H__
|
|
|
|
#define __VIR_STORAGE_BACKEND_H__
|
|
|
|
|
2008-11-17 11:19:33 +00:00
|
|
|
#include "internal.h"
|
2008-02-20 15:34:52 +00:00
|
|
|
#include "storage_conf.h"
|
2008-08-27 20:05:58 +00:00
|
|
|
|
|
|
|
typedef char * (*virStorageBackendFindPoolSources)(virConnectPtr conn, const char *srcSpec, unsigned int flags);
|
2008-02-20 15:34:52 +00:00
|
|
|
typedef int (*virStorageBackendStartPool)(virConnectPtr conn, virStoragePoolObjPtr pool);
|
|
|
|
typedef int (*virStorageBackendBuildPool)(virConnectPtr conn, virStoragePoolObjPtr pool, unsigned int flags);
|
|
|
|
typedef int (*virStorageBackendRefreshPool)(virConnectPtr conn, virStoragePoolObjPtr pool);
|
|
|
|
typedef int (*virStorageBackendStopPool)(virConnectPtr conn, virStoragePoolObjPtr pool);
|
|
|
|
typedef int (*virStorageBackendDeletePool)(virConnectPtr conn, virStoragePoolObjPtr pool, unsigned int flags);
|
|
|
|
|
2009-04-17 19:12:37 +00:00
|
|
|
typedef int (*virStorageBackendBuildVol)(virConnectPtr conn, virStorageVolDefPtr vol);
|
2008-02-20 15:34:52 +00:00
|
|
|
typedef int (*virStorageBackendCreateVol)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol);
|
|
|
|
typedef int (*virStorageBackendRefreshVol)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol);
|
|
|
|
typedef int (*virStorageBackendDeleteVol)(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol, unsigned int flags);
|
2009-05-19 13:37:51 +00:00
|
|
|
typedef int (*virStorageBackendBuildVolFrom)(virConnectPtr conn, virStorageVolDefPtr origvol, virStorageVolDefPtr newvol, unsigned int flags);
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2009-07-16 16:09:26 +00:00
|
|
|
/* File creation/cloning functions used for cloning between backends */
|
|
|
|
int virStorageBackendCreateRaw(virConnectPtr conn,
|
|
|
|
virStorageVolDefPtr vol,
|
2009-07-16 16:27:07 +00:00
|
|
|
virStorageVolDefPtr inputvol,
|
|
|
|
unsigned int flags);
|
|
|
|
virStorageBackendBuildVolFrom
|
2009-07-16 16:09:26 +00:00
|
|
|
virStorageBackendGetBuildVolFromFunction(virConnectPtr conn,
|
|
|
|
virStorageVolDefPtr vol,
|
|
|
|
virStorageVolDefPtr inputvol);
|
|
|
|
int virStorageBackendFindFSImageTool(char **tool);
|
2009-07-16 16:27:07 +00:00
|
|
|
virStorageBackendBuildVolFrom
|
|
|
|
virStorageBackendFSImageToolTypeToFunc(virConnectPtr conn,
|
|
|
|
int tool_type);
|
2009-07-16 16:09:26 +00:00
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
|
|
|
|
typedef struct _virStorageBackend virStorageBackend;
|
|
|
|
typedef virStorageBackend *virStorageBackendPtr;
|
|
|
|
|
|
|
|
struct _virStorageBackend {
|
|
|
|
int type;
|
|
|
|
|
2008-08-27 20:05:58 +00:00
|
|
|
virStorageBackendFindPoolSources findPoolSources;
|
2008-02-20 15:34:52 +00:00
|
|
|
virStorageBackendStartPool startPool;
|
|
|
|
virStorageBackendBuildPool buildPool;
|
|
|
|
virStorageBackendRefreshPool refreshPool;
|
|
|
|
virStorageBackendStopPool stopPool;
|
|
|
|
virStorageBackendDeletePool deletePool;
|
|
|
|
|
2009-04-17 19:12:37 +00:00
|
|
|
virStorageBackendBuildVol buildVol;
|
2009-05-19 13:37:51 +00:00
|
|
|
virStorageBackendBuildVolFrom buildVolFrom;
|
2008-02-20 15:34:52 +00:00
|
|
|
virStorageBackendCreateVol createVol;
|
|
|
|
virStorageBackendRefreshVol refreshVol;
|
|
|
|
virStorageBackendDeleteVol deleteVol;
|
|
|
|
};
|
|
|
|
|
|
|
|
virStorageBackendPtr virStorageBackendForType(int type);
|
2008-11-17 11:19:33 +00:00
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2008-02-20 15:38:29 +00:00
|
|
|
int virStorageBackendUpdateVolInfo(virConnectPtr conn,
|
|
|
|
virStorageVolDefPtr vol,
|
|
|
|
int withCapacity);
|
|
|
|
|
2009-01-27 18:30:03 +00:00
|
|
|
int virStorageBackendUpdateVolTargetInfo(virConnectPtr conn,
|
|
|
|
virStorageVolTargetPtr target,
|
|
|
|
unsigned long long *allocation,
|
|
|
|
unsigned long long *capacity);
|
|
|
|
int virStorageBackendUpdateVolTargetInfoFD(virConnectPtr conn,
|
|
|
|
virStorageVolTargetPtr target,
|
|
|
|
int fd,
|
|
|
|
unsigned long long *allocation,
|
|
|
|
unsigned long long *capacity);
|
2008-02-20 15:38:29 +00:00
|
|
|
|
2008-11-28 07:50:20 +00:00
|
|
|
void virStorageBackendWaitForDevices(virConnectPtr conn);
|
|
|
|
|
2008-02-20 15:38:29 +00:00
|
|
|
char *virStorageBackendStablePath(virConnectPtr conn,
|
|
|
|
virStoragePoolObjPtr pool,
|
2008-11-03 11:37:11 +00:00
|
|
|
const char *devpath);
|
2008-02-20 15:38:29 +00:00
|
|
|
|
|
|
|
typedef int (*virStorageBackendListVolRegexFunc)(virConnectPtr conn,
|
|
|
|
virStoragePoolObjPtr pool,
|
|
|
|
char **const groups,
|
|
|
|
void *data);
|
|
|
|
typedef int (*virStorageBackendListVolNulFunc)(virConnectPtr conn,
|
|
|
|
virStoragePoolObjPtr pool,
|
|
|
|
size_t n_tokens,
|
|
|
|
char **const groups,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
int virStorageBackendRunProgRegex(virConnectPtr conn,
|
|
|
|
virStoragePoolObjPtr pool,
|
2008-06-24 14:30:25 +00:00
|
|
|
const char *const*prog,
|
2008-02-20 15:38:29 +00:00
|
|
|
int nregex,
|
|
|
|
const char **regex,
|
|
|
|
int *nvars,
|
|
|
|
virStorageBackendListVolRegexFunc func,
|
2008-06-17 12:45:24 +00:00
|
|
|
void *data,
|
|
|
|
int *exitstatus);
|
2008-02-20 15:38:29 +00:00
|
|
|
|
|
|
|
int virStorageBackendRunProgNul(virConnectPtr conn,
|
|
|
|
virStoragePoolObjPtr pool,
|
|
|
|
const char **prog,
|
|
|
|
size_t n_columns,
|
|
|
|
virStorageBackendListVolNulFunc func,
|
|
|
|
void *data);
|
2008-02-20 15:34:52 +00:00
|
|
|
|
2009-06-17 08:38:17 +00:00
|
|
|
void virWaitForDevices(virConnectPtr conn);
|
|
|
|
|
2008-02-20 15:34:52 +00:00
|
|
|
#endif /* __VIR_STORAGE_BACKEND_H__ */
|