driver.h 23.8 KB
Newer Older
1
/*
2
 * driver.h: description of the set of interfaces provided by a
3 4 5 6 7 8
 *           entry point to the virtualization engine
 */

#ifndef __VIR_DRIVER_H__
#define __VIR_DRIVER_H__

9 10
#include <libxml/uri.h>

11 12 13 14
/*
 * List of registered drivers numbers
 */
typedef enum {
15 16 17
    VIR_DRV_XEN_UNIFIED = 1,
    VIR_DRV_TEST = 2,
    VIR_DRV_QEMU = 3,
18
    VIR_DRV_REMOTE = 4,
19
    VIR_DRV_OPENVZ = 5,
D
Daniel Veillard 已提交
20
    VIR_DRV_LXC = 6
21 22 23
} virDrvNo;


24 25 26 27 28 29 30 31 32 33 34 35 36 37
/* Status codes returned from driver open call. */
typedef enum {
    /* Opened successfully. */
    VIR_DRV_OPEN_SUCCESS = 0,

    /* 'name' is not for us. */
    VIR_DRV_OPEN_DECLINED = -1,

    /* 'name' is for us, but there was some error.  virConnectOpen will
     * return an error rather than continue probing the other drivers.
     */
    VIR_DRV_OPEN_ERROR = -2,
} virDrvOpenStatus;

38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
/* Feature detection.  This is a libvirt-private interface for determining
 * what features are supported by the driver.
 *
 * The remote driver passes features through to the real driver at the
 * remote end unmodified, except if you query a VIR_DRV_FEATURE_REMOTE*
 * feature.
 */
    /* Driver supports V1-style virDomainMigrate, ie. domainMigratePrepare/
     * domainMigratePerform/domainMigrateFinish.
     */
#define VIR_DRV_FEATURE_MIGRATION_V1 1

    /* Driver is not local. */
#define VIR_DRV_FEATURE_REMOTE 2

D
Daniel Veillard 已提交
53 54 55 56 57
    /* Driver supports V2-style virDomainMigrate, ie. domainMigratePrepare2/
     * domainMigratePerform/domainMigrateFinish2.
     */
#define VIR_DRV_FEATURE_MIGRATION_V2 3

58 59 60 61 62 63 64 65 66 67 68 69 70
/* Internal feature-detection macro.  Don't call drv->supports_feature
 * directly, because it may be NULL, use this macro instead.
 *
 * Note that you must check for errors.
 *
 * Returns:
 *   >= 1  Feature is supported.
 *   0     Feature is not supported.
 *   -1    Error.
 */
#define VIR_DRV_SUPPORTS_FEATURE(drv,conn,feature)                      \
    ((drv)->supports_feature ? (drv)->supports_feature((conn),(feature)) : 0)

71
typedef virDrvOpenStatus
72
        (*virDrvOpen)			(virConnectPtr conn,
73 74
                             virConnectAuthPtr auth,
                             int flags);
75
typedef int
76
        (*virDrvClose)			(virConnectPtr conn);
77
typedef int
D
Daniel P. Berrange 已提交
78
    (*virDrvDrvSupportsFeature) (virConnectPtr conn, int feature);
79
typedef const char *
80
        (*virDrvGetType)		(virConnectPtr conn);
81
typedef int
82 83
        (*virDrvGetVersion)		(virConnectPtr conn,
                                         unsigned long *hvVer);
84 85 86 87
typedef char *
    (*virDrvGetHostname)    (virConnectPtr conn);
typedef char *
    (*virDrvGetURI)         (virConnectPtr conn);
88
typedef int
89 90
        (*virDrvGetMaxVcpus)		(virConnectPtr conn,
                                         const char *type);
91
typedef int
92 93
        (*virDrvNodeGetInfo)		(virConnectPtr conn,
                                         virNodeInfoPtr info);
94
typedef char *
95
        (*virDrvGetCapabilities) (virConnectPtr conn);
96
typedef int
97 98 99
        (*virDrvListDomains)		(virConnectPtr conn,
                                         int *ids,
                                         int maxids);
100
typedef int
101
        (*virDrvNumOfDomains)		(virConnectPtr conn);
102
typedef virDomainPtr
103
        (*virDrvDomainCreateXML)	(virConnectPtr conn,
104 105
                                         const char *xmlDesc,
                                         unsigned int flags);
106
typedef virDomainPtr
107 108
        (*virDrvDomainLookupByID)	(virConnectPtr conn,
                                         int id);
109
typedef virDomainPtr
110 111
        (*virDrvDomainLookupByUUID)	(virConnectPtr conn,
                                         const unsigned char *uuid);
112
typedef virDomainPtr
113 114
        (*virDrvDomainLookupByName)	(virConnectPtr conn,
                                         const char *name);
115
typedef int
116
        (*virDrvDomainSuspend)		(virDomainPtr domain);
117
typedef int
118
        (*virDrvDomainResume)		(virDomainPtr domain);
119
typedef int
120
        (*virDrvDomainShutdown)		(virDomainPtr domain);
121
typedef int
122 123
        (*virDrvDomainReboot)		(virDomainPtr domain,
                                         unsigned int flags);
124
typedef int
125
        (*virDrvDomainDestroy)		(virDomainPtr domain);
126
typedef char *
127
        (*virDrvDomainGetOSType)	(virDomainPtr domain);
128
typedef unsigned long
129
        (*virDrvDomainGetMaxMemory)	(virDomainPtr domain);
130
typedef int
131 132
        (*virDrvDomainSetMaxMemory)	(virDomainPtr domain,
                                         unsigned long memory);
133
typedef int
134 135
        (*virDrvDomainSetMemory)	(virDomainPtr domain,
                                         unsigned long memory);
136
typedef int
137 138
        (*virDrvDomainGetInfo)		(virDomainPtr domain,
                                         virDomainInfoPtr info);
139
typedef int
140 141
        (*virDrvDomainSave)		(virDomainPtr domain,
                                         const char *to);
142
typedef int
143 144
        (*virDrvDomainRestore)		(virConnectPtr conn,
                                         const char *from);
D
Daniel Veillard 已提交
145
typedef int
146 147 148
        (*virDrvDomainCoreDump)		(virDomainPtr domain,
                                         const char *to,
                                         int flags);
149
typedef char *
150 151
        (*virDrvDomainDumpXML)		(virDomainPtr dom,
                                         int flags);
152
typedef int
153 154 155
        (*virDrvListDefinedDomains)	(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
156
typedef int
157
        (*virDrvNumOfDefinedDomains)	(virConnectPtr conn);
158
typedef int
159
        (*virDrvDomainCreate)		(virDomainPtr dom);
160
typedef virDomainPtr
161 162
        (*virDrvDomainDefineXML)	(virConnectPtr conn,
                                         const char *xml);
163
typedef int
164
        (*virDrvDomainUndefine)		(virDomainPtr dom);
165
typedef int
166 167
        (*virDrvDomainSetVcpus)		(virDomainPtr domain,
                                         unsigned int nvcpus);
168
typedef int
169 170 171 172
        (*virDrvDomainPinVcpu)		(virDomainPtr domain,
                                         unsigned int vcpu,
                                         unsigned char *cpumap,
                                         int maplen);
173
typedef int
174 175 176 177 178
        (*virDrvDomainGetVcpus)		(virDomainPtr domain,
                                         virVcpuInfoPtr info,
                                         int maxinfo,
                                         unsigned char *cpumaps,
                                         int maplen);
179
typedef int
180
        (*virDrvDomainGetMaxVcpus)	(virDomainPtr domain);
181
typedef int
182 183
        (*virDrvDomainAttachDevice)	(virDomainPtr domain,
                                         const char *xml);
184
typedef int
185 186
        (*virDrvDomainDetachDevice)	(virDomainPtr domain,
                                         const char *xml);
187
typedef int
188 189
        (*virDrvDomainGetAutostart)	(virDomainPtr domain,
                                         int *autostart);
190
typedef int
191 192
        (*virDrvDomainSetAutostart)	(virDomainPtr domain,
                                         int autostart);
193

194
typedef char *
195 196
        (*virDrvDomainGetSchedulerType)	(virDomainPtr domain,
                                         int *nparams);
197

198
typedef int
199 200 201 202
        (*virDrvDomainGetSchedulerParameters)
                                        (virDomainPtr domain,
                                         virSchedParameterPtr params,
                                         int *nparams);
203 204

typedef int
205 206 207 208
        (*virDrvDomainSetSchedulerParameters)
                                        (virDomainPtr domain,
                                         virSchedParameterPtr params,
                                         int nparams);
209

210 211 212 213 214 215 216 217 218 219 220
typedef int
    (*virDrvDomainBlockStats)
                    (virDomainPtr domain,
                     const char *path,
                     struct _virDomainBlockStats *stats);
typedef int
    (*virDrvDomainInterfaceStats)
                    (virDomainPtr domain,
                     const char *path,
                     struct _virDomainInterfaceStats *stats);

R
Richard W.M. Jones 已提交
221 222 223 224 225
typedef int
    (*virDrvDomainBlockPeek)
                    (virDomainPtr domain,
                     const char *path,
                     unsigned long long offset, size_t size,
226 227
                     void *buffer,
                     unsigned int flags);
R
Richard W.M. Jones 已提交
228

R
Richard W.M. Jones 已提交
229 230 231 232 233 234 235
typedef int
    (*virDrvDomainMemoryPeek)
                    (virDomainPtr domain,
                     unsigned long long start, size_t size,
                     void *buffer,
                     unsigned int flags);

236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
typedef int
    (*virDrvDomainMigratePrepare)
                    (virConnectPtr dconn,
                     char **cookie,
                     int *cookielen,
                     const char *uri_in,
                     char **uri_out,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource);

typedef int
    (*virDrvDomainMigratePerform)
                    (virDomainPtr domain,
                     const char *cookie,
                     int cookielen,
                     const char *uri,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource);

typedef virDomainPtr
    (*virDrvDomainMigrateFinish)
                    (virConnectPtr dconn,
                     const char *dname,
                     const char *cookie,
                     int cookielen,
                     const char *uri,
                     unsigned long flags);

266 267 268
typedef struct _virDriver virDriver;
typedef virDriver *virDriverPtr;

269 270 271 272 273 274 275
typedef int
    (*virDrvNodeGetCellsFreeMemory)
                    (virConnectPtr conn,
                     unsigned long long *freeMems,
                     int startCell,
                     int maxCells);

276 277
typedef unsigned long long
    (*virDrvNodeGetFreeMemory)
278
                    (virConnectPtr conn);
279

280 281 282 283
typedef int
    (*virDrvDomainEventRegister)
                    (virConnectPtr conn,
                     void *callback,
284 285
                     void *opaque,
                     virFreeCallback freecb);
286 287 288 289 290 291

typedef int
    (*virDrvDomainEventDeregister)
                    (virConnectPtr conn,
                     void *callback);

D
Daniel Veillard 已提交
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313
typedef int
    (*virDrvDomainMigratePrepare2)
                    (virConnectPtr dconn,
                     char **cookie,
                     int *cookielen,
                     const char *uri_in,
                     char **uri_out,
                     unsigned long flags,
                     const char *dname,
                     unsigned long resource,
                     const char *dom_xml);

typedef virDomainPtr
    (*virDrvDomainMigrateFinish2)
                    (virConnectPtr dconn,
                     const char *dname,
                     const char *cookie,
                     int cookielen,
                     const char *uri,
                     unsigned long flags,
                     int retcode);

314 315 316 317 318
/**
 * _virDriver:
 *
 * Structure associated to a virtualization driver, defining the various
 * entry points for it.
319 320 321 322 323 324
 *
 * All drivers must support the following fields/methods:
 *  - no
 *  - name
 *  - open
 *  - close
325 326
 */
struct _virDriver {
327 328 329 330 331
    int	       no;	/* the number virDrvNo */
    const char * name;	/* the name of the driver */
    unsigned long ver;	/* the version of the backend */
    virDrvOpen			open;
    virDrvClose			close;
D
Daniel P. Berrange 已提交
332
    virDrvDrvSupportsFeature   supports_feature;
333 334
    virDrvGetType			type;
    virDrvGetVersion		version;
335 336
    virDrvGetHostname       getHostname;
    virDrvGetURI            getURI;
337 338 339 340 341
    virDrvGetMaxVcpus		getMaxVcpus;
    virDrvNodeGetInfo		nodeGetInfo;
    virDrvGetCapabilities		getCapabilities;
    virDrvListDomains		listDomains;
    virDrvNumOfDomains		numOfDomains;
342
    virDrvDomainCreateXML		domainCreateXML;
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
    virDrvDomainLookupByID		domainLookupByID;
    virDrvDomainLookupByUUID	domainLookupByUUID;
    virDrvDomainLookupByName	domainLookupByName;
    virDrvDomainSuspend		domainSuspend;
    virDrvDomainResume		domainResume;
    virDrvDomainShutdown		domainShutdown;
    virDrvDomainReboot		domainReboot;
    virDrvDomainDestroy		domainDestroy;
    virDrvDomainGetOSType		domainGetOSType;
    virDrvDomainGetMaxMemory	domainGetMaxMemory;
    virDrvDomainSetMaxMemory	domainSetMaxMemory;
    virDrvDomainSetMemory		domainSetMemory;
    virDrvDomainGetInfo		domainGetInfo;
    virDrvDomainSave		domainSave;
    virDrvDomainRestore		domainRestore;
    virDrvDomainCoreDump		domainCoreDump;
    virDrvDomainSetVcpus		domainSetVcpus;
    virDrvDomainPinVcpu		domainPinVcpu;
    virDrvDomainGetVcpus		domainGetVcpus;
    virDrvDomainGetMaxVcpus		domainGetMaxVcpus;
    virDrvDomainDumpXML		domainDumpXML;
    virDrvListDefinedDomains	listDefinedDomains;
    virDrvNumOfDefinedDomains	numOfDefinedDomains;
    virDrvDomainCreate		domainCreate;
    virDrvDomainDefineXML           domainDefineXML;
    virDrvDomainUndefine            domainUndefine;
    virDrvDomainAttachDevice	domainAttachDevice;
    virDrvDomainDetachDevice	domainDetachDevice;
    virDrvDomainGetAutostart	domainGetAutostart;
    virDrvDomainSetAutostart	domainSetAutostart;
    virDrvDomainGetSchedulerType	domainGetSchedulerType;
    virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
    virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
376 377 378
    virDrvDomainMigratePrepare	domainMigratePrepare;
    virDrvDomainMigratePerform	domainMigratePerform;
    virDrvDomainMigrateFinish	domainMigrateFinish;
379 380
    virDrvDomainBlockStats      domainBlockStats;
    virDrvDomainInterfaceStats  domainInterfaceStats;
R
Richard W.M. Jones 已提交
381
    virDrvDomainBlockPeek	domainBlockPeek;
R
Richard W.M. Jones 已提交
382
    virDrvDomainMemoryPeek      domainMemoryPeek;
383 384
    virDrvNodeGetCellsFreeMemory	nodeGetCellsFreeMemory;
    virDrvNodeGetFreeMemory		getFreeMemory;
385 386
    virDrvDomainEventRegister         domainEventRegister;
    virDrvDomainEventDeregister       domainEventDeregister;
D
Daniel Veillard 已提交
387 388
    virDrvDomainMigratePrepare2	domainMigratePrepare2;
    virDrvDomainMigrateFinish2	domainMigrateFinish2;
389 390
};

391
typedef int
392
        (*virDrvNumOfNetworks)		(virConnectPtr conn);
393
typedef int
394 395 396
        (*virDrvListNetworks)		(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
397
typedef int
398
        (*virDrvNumOfDefinedNetworks)	(virConnectPtr conn);
399
typedef int
400 401 402
        (*virDrvListDefinedNetworks)	(virConnectPtr conn,
                                         char **const names,
                                         int maxnames);
403
typedef virNetworkPtr
404 405
        (*virDrvNetworkLookupByUUID)	(virConnectPtr conn,
                                         const unsigned char *uuid);
406
typedef virNetworkPtr
407 408
        (*virDrvNetworkLookupByName)	(virConnectPtr conn,
                                         const char *name);
409
typedef virNetworkPtr
410 411
        (*virDrvNetworkCreateXML)	(virConnectPtr conn,
                                         const char *xmlDesc);
412
typedef virNetworkPtr
413 414
        (*virDrvNetworkDefineXML)	(virConnectPtr conn,
                                         const char *xml);
415
typedef int
416
        (*virDrvNetworkUndefine)	(virNetworkPtr network);
417
typedef int
418
        (*virDrvNetworkCreate)		(virNetworkPtr network);
419
typedef int
420
        (*virDrvNetworkDestroy)		(virNetworkPtr network);
421
typedef char *
422 423
        (*virDrvNetworkDumpXML)		(virNetworkPtr network,
                                         int flags);
424
typedef char *
425
        (*virDrvNetworkGetBridgeName)	(virNetworkPtr network);
426
typedef int
427 428
        (*virDrvNetworkGetAutostart)	(virNetworkPtr network,
                                         int *autostart);
429
typedef int
430 431
        (*virDrvNetworkSetAutostart)	(virNetworkPtr network,
                                         int autostart);
432

433 434 435 436 437 438 439 440 441

typedef struct _virNetworkDriver virNetworkDriver;
typedef virNetworkDriver *virNetworkDriverPtr;

/**
 * _virNetworkDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
442 443 444 445
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
446 447
 */
struct _virNetworkDriver {
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
        const char * name;	/* the name of the driver */
        virDrvOpen			open;
        virDrvClose			close;
        virDrvNumOfNetworks		numOfNetworks;
        virDrvListNetworks		listNetworks;
        virDrvNumOfDefinedNetworks	numOfDefinedNetworks;
        virDrvListDefinedNetworks	listDefinedNetworks;
        virDrvNetworkLookupByUUID	networkLookupByUUID;
        virDrvNetworkLookupByName	networkLookupByName;
        virDrvNetworkCreateXML		networkCreateXML;
        virDrvNetworkDefineXML		networkDefineXML;
        virDrvNetworkUndefine		networkUndefine;
        virDrvNetworkCreate		networkCreate;
        virDrvNetworkDestroy		networkDestroy;
        virDrvNetworkDumpXML		networkDumpXML;
        virDrvNetworkGetBridgeName	networkGetBridgeName;
        virDrvNetworkGetAutostart	networkGetAutostart;
        virDrvNetworkSetAutostart	networkSetAutostart;
466 467
};

468 469 470 471 472 473 474 475 476 477 478 479 480

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);
481 482 483 484 485
typedef char *
    (*virDrvConnectFindStoragePoolSources)   (virConnectPtr conn,
                                              const char *type,
                                              const char *srcSpec,
                                              unsigned int flags);
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589
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 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
    (*virDrvStorageVolGetInfo)               (virStorageVolPtr vol,
                                              virStorageVolInfoPtr info);
typedef char *
    (*virDrvStorageVolGetXMLDesc)            (virStorageVolPtr pool,
                                              unsigned int flags);
typedef char *
    (*virDrvStorageVolGetPath)               (virStorageVolPtr vol);



typedef struct _virStorageDriver virStorageDriver;
typedef virStorageDriver *virStorageDriverPtr;

/**
 * _virStorageDriver:
 *
 * Structure associated to a network virtualization driver, defining the various
 * entry points for it.
 *
 * All drivers must support the following fields/methods:
 *  - open
 *  - close
 */
struct _virStorageDriver {
    const char * name;    /* the name of the driver */
    virDrvOpen            open;
    virDrvClose           close;

    virDrvConnectNumOfStoragePools numOfPools;
    virDrvConnectListStoragePools listPools;
    virDrvConnectNumOfDefinedStoragePools numOfDefinedPools;
    virDrvConnectListDefinedStoragePools listDefinedPools;
590
    virDrvConnectFindStoragePoolSources findPoolSources;
591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
    virDrvStoragePoolLookupByName poolLookupByName;
    virDrvStoragePoolLookupByUUID poolLookupByUUID;
    virDrvStoragePoolLookupByVolume poolLookupByVolume;
    virDrvStoragePoolCreateXML poolCreateXML;
    virDrvStoragePoolDefineXML poolDefineXML;
    virDrvStoragePoolBuild poolBuild;
    virDrvStoragePoolUndefine poolUndefine;
    virDrvStoragePoolCreate poolCreate;
    virDrvStoragePoolDestroy poolDestroy;
    virDrvStoragePoolDelete poolDelete;
    virDrvStoragePoolRefresh poolRefresh;
    virDrvStoragePoolGetInfo poolGetInfo;
    virDrvStoragePoolGetXMLDesc poolGetXMLDesc;
    virDrvStoragePoolGetAutostart poolGetAutostart;
    virDrvStoragePoolSetAutostart poolSetAutostart;
    virDrvStoragePoolNumOfVolumes poolNumOfVolumes;
    virDrvStoragePoolListVolumes poolListVolumes;

    virDrvStorageVolLookupByName volLookupByName;
    virDrvStorageVolLookupByKey volLookupByKey;
    virDrvStorageVolLookupByPath volLookupByPath;
    virDrvStorageVolCreateXML volCreateXML;
    virDrvStorageVolDelete volDelete;
    virDrvStorageVolGetInfo volGetInfo;
    virDrvStorageVolGetXMLDesc volGetXMLDesc;
    virDrvStorageVolGetPath volGetPath;
};

619
#ifdef WITH_LIBVIRTD
620 621 622 623 624 625 626 627 628 629 630 631 632 633
typedef int (*virDrvStateInitialize) (void);
typedef int (*virDrvStateCleanup) (void);
typedef int (*virDrvStateReload) (void);
typedef int (*virDrvStateActive) (void);

typedef struct _virStateDriver virStateDriver;
typedef virStateDriver *virStateDriverPtr;

struct _virStateDriver {
    virDrvStateInitialize  initialize;
    virDrvStateCleanup     cleanup;
    virDrvStateReload      reload;
    virDrvStateActive      active;
};
A
Atsushi SAKAI 已提交
634
#endif
635 636 637 638 639 640 641

/*
 * Registration
 * TODO: also need ways to (des)activate a given driver
 *       lookup based on the URI given in a virConnectOpen(ReadOnly)
 */
int virRegisterDriver(virDriverPtr);
642
int virRegisterNetworkDriver(virNetworkDriverPtr);
643
int virRegisterStorageDriver(virStorageDriverPtr);
A
Atsushi SAKAI 已提交
644
#ifdef WITH_LIBVIRTD
645
int virRegisterStateDriver(virStateDriverPtr);
A
Atsushi SAKAI 已提交
646
#endif
647 648

#endif /* __VIR_DRIVER_H__ */