2017-03-07 15:18:01 -05:00
|
|
|
/*
|
|
|
|
* virstorageobj.h: internal storage pool and volume objects handling
|
|
|
|
* (derived from storage_conf.h)
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2018-12-13 14:53:50 +00:00
|
|
|
#ifndef LIBVIRT_VIRSTORAGEOBJ_H
|
|
|
|
# define LIBVIRT_VIRSTORAGEOBJ_H
|
2017-03-07 15:18:01 -05:00
|
|
|
|
|
|
|
# include "internal.h"
|
|
|
|
|
|
|
|
# include "storage_conf.h"
|
|
|
|
|
2019-01-10 07:23:26 -05:00
|
|
|
# include "capabilities.h"
|
|
|
|
|
2017-03-07 15:18:01 -05:00
|
|
|
typedef struct _virStoragePoolObj virStoragePoolObj;
|
|
|
|
typedef virStoragePoolObj *virStoragePoolObjPtr;
|
|
|
|
|
|
|
|
typedef struct _virStoragePoolObjList virStoragePoolObjList;
|
|
|
|
typedef virStoragePoolObjList *virStoragePoolObjListPtr;
|
|
|
|
|
|
|
|
typedef struct _virStorageDriverState virStorageDriverState;
|
|
|
|
typedef virStorageDriverState *virStorageDriverStatePtr;
|
|
|
|
|
|
|
|
struct _virStorageDriverState {
|
|
|
|
virMutex lock;
|
|
|
|
|
2017-10-07 07:24:24 -04:00
|
|
|
virStoragePoolObjListPtr pools;
|
2017-03-07 15:18:01 -05:00
|
|
|
|
|
|
|
char *configDir;
|
|
|
|
char *autostartDir;
|
|
|
|
char *stateDir;
|
|
|
|
bool privileged;
|
|
|
|
|
|
|
|
/* Immutable pointer, self-locking APIs */
|
|
|
|
virObjectEventStatePtr storageEventState;
|
2019-01-10 07:23:26 -05:00
|
|
|
|
|
|
|
/* Immutable pointer, read only after initialized */
|
|
|
|
virCapsPtr caps;
|
2017-03-07 15:18:01 -05:00
|
|
|
};
|
|
|
|
|
2017-03-07 15:44:41 -05:00
|
|
|
typedef bool
|
|
|
|
(*virStoragePoolObjListFilter)(virConnectPtr conn,
|
|
|
|
virStoragePoolDefPtr def);
|
2017-03-07 15:18:01 -05:00
|
|
|
|
2017-05-08 16:02:36 -04:00
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolObjNew(void);
|
|
|
|
|
2017-10-08 09:09:09 -04:00
|
|
|
void
|
|
|
|
virStoragePoolObjEndAPI(virStoragePoolObjPtr *obj);
|
|
|
|
|
2017-05-07 07:56:03 -04:00
|
|
|
virStoragePoolDefPtr
|
|
|
|
virStoragePoolObjGetDef(virStoragePoolObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjSetDef(virStoragePoolObjPtr obj,
|
|
|
|
virStoragePoolDefPtr def);
|
|
|
|
|
|
|
|
virStoragePoolDefPtr
|
|
|
|
virStoragePoolObjGetNewDef(virStoragePoolObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjDefUseNewDef(virStoragePoolObjPtr obj);
|
|
|
|
|
2017-09-19 08:55:43 -04:00
|
|
|
const char *
|
2017-05-07 07:56:03 -04:00
|
|
|
virStoragePoolObjGetConfigFile(virStoragePoolObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjSetConfigFile(virStoragePoolObjPtr obj,
|
|
|
|
char *configFile);
|
|
|
|
|
2017-09-19 08:55:43 -04:00
|
|
|
const char *
|
2017-05-07 07:56:03 -04:00
|
|
|
virStoragePoolObjGetAutostartLink(virStoragePoolObjPtr obj);
|
|
|
|
|
|
|
|
bool
|
|
|
|
virStoragePoolObjIsActive(virStoragePoolObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjSetActive(virStoragePoolObjPtr obj,
|
|
|
|
bool active);
|
|
|
|
|
|
|
|
bool
|
|
|
|
virStoragePoolObjIsAutostart(virStoragePoolObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjSetAutostart(virStoragePoolObjPtr obj,
|
2017-08-19 08:16:18 -04:00
|
|
|
bool autostart);
|
2017-05-07 07:56:03 -04:00
|
|
|
|
|
|
|
unsigned int
|
|
|
|
virStoragePoolObjGetAsyncjobs(virStoragePoolObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjIncrAsyncjobs(virStoragePoolObjPtr obj);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjDecrAsyncjobs(virStoragePoolObjPtr obj);
|
2017-03-07 15:18:01 -05:00
|
|
|
|
2017-03-07 15:44:41 -05:00
|
|
|
int
|
2017-03-07 16:10:38 -05:00
|
|
|
virStoragePoolObjLoadAllConfigs(virStoragePoolObjListPtr pools,
|
|
|
|
const char *configDir,
|
|
|
|
const char *autostartDir);
|
2017-03-07 15:18:01 -05:00
|
|
|
|
2017-03-07 15:44:41 -05:00
|
|
|
int
|
2017-03-07 16:10:38 -05:00
|
|
|
virStoragePoolObjLoadAllState(virStoragePoolObjListPtr pools,
|
|
|
|
const char *stateDir);
|
2017-03-07 15:44:41 -05:00
|
|
|
|
2017-03-07 15:18:01 -05:00
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools,
|
|
|
|
const unsigned char *uuid);
|
2017-03-07 15:44:41 -05:00
|
|
|
|
2017-03-07 15:18:01 -05:00
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
|
|
|
|
const char *name);
|
2017-03-07 15:44:41 -05:00
|
|
|
|
2017-05-09 08:05:16 -04:00
|
|
|
int
|
|
|
|
virStoragePoolObjAddVol(virStoragePoolObjPtr obj,
|
|
|
|
virStorageVolDefPtr voldef);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjRemoveVol(virStoragePoolObjPtr obj,
|
|
|
|
virStorageVolDefPtr voldef);
|
|
|
|
|
|
|
|
size_t
|
|
|
|
virStoragePoolObjGetVolumesCount(virStoragePoolObjPtr obj);
|
|
|
|
|
2017-05-09 08:18:33 -04:00
|
|
|
typedef int
|
|
|
|
(*virStorageVolObjListIterator)(virStorageVolDefPtr voldef,
|
|
|
|
const void *opaque);
|
|
|
|
|
|
|
|
int
|
|
|
|
virStoragePoolObjForEachVolume(virStoragePoolObjPtr obj,
|
|
|
|
virStorageVolObjListIterator iter,
|
|
|
|
const void *opaque);
|
|
|
|
|
|
|
|
typedef bool
|
|
|
|
(*virStorageVolObjListSearcher)(virStorageVolDefPtr voldef,
|
|
|
|
const void *opaque);
|
|
|
|
|
|
|
|
virStorageVolDefPtr
|
|
|
|
virStoragePoolObjSearchVolume(virStoragePoolObjPtr obj,
|
|
|
|
virStorageVolObjListSearcher iter,
|
|
|
|
const void *opaque);
|
|
|
|
|
2017-03-07 15:18:01 -05:00
|
|
|
virStorageVolDefPtr
|
2017-05-05 15:12:59 -04:00
|
|
|
virStorageVolDefFindByKey(virStoragePoolObjPtr obj,
|
2017-03-07 15:18:01 -05:00
|
|
|
const char *key);
|
2017-03-07 15:44:41 -05:00
|
|
|
|
2017-03-07 15:18:01 -05:00
|
|
|
virStorageVolDefPtr
|
2017-05-05 15:12:59 -04:00
|
|
|
virStorageVolDefFindByPath(virStoragePoolObjPtr obj,
|
2017-03-07 15:18:01 -05:00
|
|
|
const char *path);
|
2017-03-07 15:44:41 -05:00
|
|
|
|
2017-03-07 15:18:01 -05:00
|
|
|
virStorageVolDefPtr
|
2017-05-05 15:12:59 -04:00
|
|
|
virStorageVolDefFindByName(virStoragePoolObjPtr obj,
|
2017-03-07 15:18:01 -05:00
|
|
|
const char *name);
|
|
|
|
|
2017-03-07 15:44:41 -05:00
|
|
|
void
|
2017-05-05 15:12:59 -04:00
|
|
|
virStoragePoolObjClearVols(virStoragePoolObjPtr obj);
|
2017-03-07 15:18:01 -05:00
|
|
|
|
2017-03-20 10:13:27 -04:00
|
|
|
typedef bool
|
|
|
|
(*virStoragePoolVolumeACLFilter)(virConnectPtr conn,
|
|
|
|
virStoragePoolDefPtr pool,
|
|
|
|
virStorageVolDefPtr def);
|
|
|
|
|
|
|
|
int
|
2017-05-09 07:00:41 -04:00
|
|
|
virStoragePoolObjNumOfVolumes(virStoragePoolObjPtr obj,
|
2017-03-20 10:13:27 -04:00
|
|
|
virConnectPtr conn,
|
2017-08-16 09:26:59 -04:00
|
|
|
virStoragePoolVolumeACLFilter filter);
|
2017-03-20 10:13:27 -04:00
|
|
|
|
2017-03-20 12:16:26 -04:00
|
|
|
int
|
2017-05-09 07:00:41 -04:00
|
|
|
virStoragePoolObjVolumeGetNames(virStoragePoolObjPtr obj,
|
2017-03-20 12:16:26 -04:00
|
|
|
virConnectPtr conn,
|
2017-08-16 09:26:59 -04:00
|
|
|
virStoragePoolVolumeACLFilter filter,
|
2017-03-20 12:16:26 -04:00
|
|
|
char **const names,
|
|
|
|
int maxnames);
|
|
|
|
|
2017-03-20 13:48:47 -04:00
|
|
|
int
|
|
|
|
virStoragePoolObjVolumeListExport(virConnectPtr conn,
|
2017-05-09 07:00:41 -04:00
|
|
|
virStoragePoolObjPtr obj,
|
2017-03-20 13:48:47 -04:00
|
|
|
virStorageVolPtr **vols,
|
2017-08-16 09:26:59 -04:00
|
|
|
virStoragePoolVolumeACLFilter filter);
|
2017-03-20 13:48:47 -04:00
|
|
|
|
2017-03-07 15:18:01 -05:00
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
|
2018-08-17 12:30:08 +02:00
|
|
|
virStoragePoolDefPtr def,
|
|
|
|
bool check_active);
|
2017-03-07 15:18:01 -05:00
|
|
|
|
2017-03-07 15:44:41 -05:00
|
|
|
int
|
|
|
|
virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
|
2017-05-05 15:12:59 -04:00
|
|
|
virStoragePoolObjPtr obj,
|
2017-03-07 15:44:41 -05:00
|
|
|
virStoragePoolDefPtr def);
|
|
|
|
|
|
|
|
int
|
2017-05-05 15:12:59 -04:00
|
|
|
virStoragePoolObjDeleteDef(virStoragePoolObjPtr obj);
|
2017-03-07 15:44:41 -05:00
|
|
|
|
2017-03-21 06:30:46 -04:00
|
|
|
typedef bool (*virStoragePoolObjListACLFilter)(virConnectPtr conn,
|
|
|
|
virStoragePoolDefPtr def);
|
|
|
|
|
|
|
|
int
|
|
|
|
virStoragePoolObjNumOfStoragePools(virStoragePoolObjListPtr pools,
|
|
|
|
virConnectPtr conn,
|
|
|
|
bool wantActive,
|
2017-08-16 09:26:59 -04:00
|
|
|
virStoragePoolObjListACLFilter filter);
|
2017-03-21 06:30:46 -04:00
|
|
|
|
2017-03-21 09:15:18 -04:00
|
|
|
int
|
|
|
|
virStoragePoolObjGetNames(virStoragePoolObjListPtr pools,
|
|
|
|
virConnectPtr conn,
|
|
|
|
bool wantActive,
|
2017-08-16 09:26:59 -04:00
|
|
|
virStoragePoolObjListACLFilter filter,
|
2017-03-21 09:15:18 -04:00
|
|
|
char **const names,
|
|
|
|
int maxnames);
|
|
|
|
|
2017-03-07 15:44:41 -05:00
|
|
|
void
|
2017-05-05 15:12:59 -04:00
|
|
|
virStoragePoolObjFree(virStoragePoolObjPtr obj);
|
2017-03-07 15:44:41 -05:00
|
|
|
|
2017-10-08 08:14:56 -04:00
|
|
|
typedef void
|
|
|
|
(*virStoragePoolObjListIterator)(virStoragePoolObjPtr obj,
|
|
|
|
const void *opaque);
|
|
|
|
|
|
|
|
void
|
|
|
|
virStoragePoolObjListForEach(virStoragePoolObjListPtr pools,
|
|
|
|
virStoragePoolObjListIterator iter,
|
|
|
|
const void *opaque);
|
|
|
|
|
2017-10-08 08:44:31 -04:00
|
|
|
typedef bool
|
|
|
|
(*virStoragePoolObjListSearcher)(virStoragePoolObjPtr obj,
|
|
|
|
const void *opaque);
|
|
|
|
|
|
|
|
virStoragePoolObjPtr
|
|
|
|
virStoragePoolObjListSearch(virStoragePoolObjListPtr pools,
|
|
|
|
virStoragePoolObjListSearcher searcher,
|
|
|
|
const void *opaque);
|
|
|
|
|
2017-10-07 07:24:24 -04:00
|
|
|
virStoragePoolObjListPtr
|
|
|
|
virStoragePoolObjListNew(void);
|
|
|
|
|
2017-03-07 15:44:41 -05:00
|
|
|
void
|
|
|
|
virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
|
2017-05-05 15:12:59 -04:00
|
|
|
virStoragePoolObjPtr obj);
|
2017-03-07 15:18:01 -05:00
|
|
|
|
2017-03-07 15:44:41 -05:00
|
|
|
int
|
|
|
|
virStoragePoolObjListExport(virConnectPtr conn,
|
2017-03-21 10:07:46 -04:00
|
|
|
virStoragePoolObjListPtr poolobjs,
|
2017-03-07 15:44:41 -05:00
|
|
|
virStoragePoolPtr **pools,
|
|
|
|
virStoragePoolObjListFilter filter,
|
|
|
|
unsigned int flags);
|
2017-03-07 15:18:01 -05:00
|
|
|
|
2018-12-13 14:53:50 +00:00
|
|
|
#endif /* LIBVIRT_VIRSTORAGEOBJ_H */
|