int virStreamFree(virStreamPtr st);
+int virDomainIsActive(virDomainPtr dom);
+int virDomainIsPersistent(virDomainPtr dom);
+
+int virNetworkIsActive(virNetworkPtr net);
+int virNetworkIsPersistent(virNetworkPtr net);
+
+int virStoragePoolIsActive(virStoragePoolPtr pool);
+int virStoragePoolIsPersistent(virStoragePoolPtr pool);
+
+int virInterfaceIsActive(virInterfacePtr iface);
+
+int virConnectIsEncrypted(virConnectPtr conn);
+int virConnectIsSecure(virConnectPtr conn);
+
+
+
#ifdef __cplusplus
}
#endif
unsigned long resource,
const char *dom_xml);
+typedef int
+ (*virDrvConnectIsEncrypted)(virConnectPtr conn);
+typedef int
+ (*virDrvConnectIsSecure)(virConnectPtr conn);
+typedef int
+ (*virDrvDomainIsActive)(virDomainPtr dom);
+typedef int
+ (*virDrvDomainIsPersistent)(virDomainPtr dom);
+
/**
* _virDriver:
*
virDrvNodeDeviceReAttach nodeDeviceReAttach;
virDrvNodeDeviceReset nodeDeviceReset;
virDrvDomainMigratePrepareTunnel domainMigratePrepareTunnel;
+ virDrvConnectIsEncrypted isEncrypted;
+ virDrvConnectIsSecure isSecure;
+ virDrvDomainIsActive domainIsActive;
+ virDrvDomainIsPersistent domainIsPersistent;
};
typedef int
(*virDrvNetworkSetAutostart) (virNetworkPtr network,
int autostart);
+typedef int
+ (*virDrvNetworkIsActive)(virNetworkPtr net);
+typedef int
+ (*virDrvNetworkIsPersistent)(virNetworkPtr net);
+
+
typedef struct _virNetworkDriver virNetworkDriver;
typedef virNetworkDriver *virNetworkDriverPtr;
virDrvNetworkGetBridgeName networkGetBridgeName;
virDrvNetworkGetAutostart networkGetAutostart;
virDrvNetworkSetAutostart networkSetAutostart;
+ virDrvNetworkIsActive networkIsActive;
+ virDrvNetworkIsPersistent networkIsPersistent;
};
/*-------*/
(*virDrvInterfaceDestroy) (virInterfacePtr iface,
unsigned int flags);
+typedef int
+ (*virDrvInterfaceIsActive)(virInterfacePtr iface);
+
+
typedef struct _virInterfaceDriver virInterfaceDriver;
typedef virInterfaceDriver *virInterfaceDriverPtr;
virDrvInterfaceUndefine interfaceUndefine;
virDrvInterfaceCreate interfaceCreate;
virDrvInterfaceDestroy interfaceDestroy;
+ virDrvInterfaceIsActive interfaceIsActive;
};
virStorageVolPtr clone,
unsigned int flags);
+typedef int
+ (*virDrvStoragePoolIsActive)(virStoragePoolPtr pool);
+typedef int
+ (*virDrvStoragePoolIsPersistent)(virStoragePoolPtr pool);
+
+
typedef struct _virStorageDriver virStorageDriver;
typedef virStorageDriver *virStorageDriverPtr;
virDrvStorageVolGetInfo volGetInfo;
virDrvStorageVolGetXMLDesc volGetXMLDesc;
virDrvStorageVolGetPath volGetPath;
+ virDrvStoragePoolIsActive poolIsActive;
+ virDrvStoragePoolIsPersistent poolIsPersistent;
};
#ifdef WITH_LIBVIRTD
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
interfaceUndefine, /* interfaceUndefine */
interfaceCreate, /* interfaceCreate */
interfaceDestroy, /* interfaceDestroy */
+ NULL, /* interfaceIsActive */
};
int interfaceRegister(void) {
return (-1);
return (0);
}
+
+
+/**
+ * virDomainIsActive:
+ * @dom: pointer to the domain object
+ *
+ * Determine if the domain is currently running
+ *
+ * Returns 1 if running, 0 if inactive, -1 on error
+ */
+int virDomainIsActive(virDomainPtr dom)
+{
+ DEBUG("dom=%p", dom);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_DOMAIN(dom)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (dom->conn->driver->domainIsActive) {
+ int ret;
+ ret = dom->conn->driver->domainIsActive(dom);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(dom->conn);
+ return -1;
+}
+
+/**
+ * virDomainIsPersistent:
+ * @dom: pointer to the domain object
+ *
+ * Determine if the domain has a persistent configuration
+ * which means it will still exist after shutting down
+ *
+ * Returns 1 if persistent, 0 if transient, -1 on error
+ */
+int virDomainIsPersistent(virDomainPtr dom)
+{
+ DEBUG("dom=%p", dom);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_DOMAIN(dom)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (dom->conn->driver->domainIsPersistent) {
+ int ret;
+ ret = dom->conn->driver->domainIsPersistent(dom);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(dom->conn);
+ return -1;
+}
+
+/**
+ * virNetworkIsActive:
+ * @net: pointer to the network object
+ *
+ * Determine if the network is currently running
+ *
+ * Returns 1 if running, 0 if inactive, -1 on error
+ */
+int virNetworkIsActive(virNetworkPtr net)
+{
+ DEBUG("net=%p", net);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_NETWORK(net)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (net->conn->networkDriver->networkIsActive) {
+ int ret;
+ ret = net->conn->networkDriver->networkIsActive(net);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(net->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(net->conn);
+ return -1;
+}
+
+
+/**
+ * virNetworkIsPersistent:
+ * @net: pointer to the network object
+ *
+ * Determine if the network has a persistent configuration
+ * which means it will still exist after shutting down
+ *
+ * Returns 1 if persistent, 0 if transient, -1 on error
+ */
+int virNetworkIsPersistent(virNetworkPtr net)
+{
+ DEBUG("net=%p", net);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_NETWORK(net)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (net->conn->networkDriver->networkIsPersistent) {
+ int ret;
+ ret = net->conn->networkDriver->networkIsPersistent(net);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(net->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(net->conn);
+ return -1;
+}
+
+
+/**
+ * virStoragePoolIsActive:
+ * @pool: pointer to the storage pool object
+ *
+ * Determine if the storage pool is currently running
+ *
+ * Returns 1 if running, 0 if inactive, -1 on error
+ */
+int virStoragePoolIsActive(virStoragePoolPtr pool)
+{
+ DEBUG("pool=%p", pool);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (pool->conn->storageDriver->poolIsActive) {
+ int ret;
+ ret = pool->conn->storageDriver->poolIsActive(pool);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(pool->conn);
+ return -1;
+}
+
+
+/**
+ * virStoragePoolIsPersistent:
+ * @pool: pointer to the storage pool object
+ *
+ * Determine if the storage pool has a persistent configuration
+ * which means it will still exist after shutting down
+ *
+ * Returns 1 if persistent, 0 if transient, -1 on error
+ */
+int virStoragePoolIsPersistent(virStoragePoolPtr pool)
+{
+ DEBUG("pool=%p", pool);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (pool->conn->storageDriver->poolIsPersistent) {
+ int ret;
+ ret = pool->conn->storageDriver->poolIsPersistent(pool);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(pool->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(pool->conn);
+ return -1;
+}
+
+
+/**
+ * virInterfaceIsActive:
+ * @iface: pointer to the interface object
+ *
+ * Determine if the interface is currently running
+ *
+ * Returns 1 if running, 0 if inactive, -1 on error
+ */
+int virInterfaceIsActive(virInterfacePtr iface)
+{
+ DEBUG("iface=%p", iface);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECTED_INTERFACE(iface)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (iface->conn->interfaceDriver->interfaceIsActive) {
+ int ret;
+ ret = iface->conn->interfaceDriver->interfaceIsActive(iface);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(iface->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(iface->conn);
+ return -1;
+}
+
+
+/**
+ * virConnectIsEncrypted:
+ * @conn: pointer to the connection object
+ *
+ * Determine if the connection to the hypervisor is encrypted
+ *
+ * Returns 1 if encrypted, 0 if not encrypted, -1 on error
+ */
+int virConnectIsEncrypted(virConnectPtr conn)
+{
+ DEBUG("conn=%p", conn);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (conn->driver->isEncrypted) {
+ int ret;
+ ret = conn->driver->isEncrypted(conn);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(conn);
+ return -1;
+}
+
+/**
+ * virConnectIsSecure:
+ * @conn: pointer to the connection object
+ *
+ * Determine if the connection to the hypervisor is secure
+ *
+ * A connection will be classed as secure if it is either
+ * encrypted, or running over a channel which is not exposed
+ * to eavesdropping (eg a UNIX domain socket, or pipe)
+ *
+ * Returns 1 if secure, 0 if secure, -1 on error
+ */
+int virConnectIsSecure(virConnectPtr conn)
+{
+ DEBUG("conn=%p", conn);
+
+ virResetLastError();
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+ if (conn->driver->isSecure) {
+ int ret;
+ ret = conn->driver->isSecure(conn);
+ if (ret < 0)
+ goto error;
+ return ret;
+ }
+
+ virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+error:
+ /* Copy to connection error object for back compatability */
+ virSetConnError(conn);
+ return -1;
+}
virDomainMigrateToURI;
} LIBVIRT_0.7.1;
+LIBVIRT_0.7.3 {
+ global:
+ virConnectIsEncrypted;
+ virConnectIsSecure;
+ virDomainIsActive;
+ virDomainIsPersistent;
+ virNetworkIsActive;
+ virNetworkIsPersistent;
+ virStoragePoolIsActive;
+ virStoragePoolIsPersistent;
+ virInterfaceIsActive;
+} LIBVIRT_0.7.2;
+
# .... define new API here using predicted next version number ....
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
static virStateDriver lxcStateDriver = {
networkGetBridgeName, /* networkGetBridgeName */
networkGetAutostart, /* networkGetAutostart */
networkSetAutostart, /* networkSetAutostart */
+ NULL, /* networkIsActive */
+ NULL, /* networkIsPersistent */
};
static virStateDriver networkStateDriver = {
NULL, /* nodeDeviceReAttach; */
NULL, /* nodeDeviceReset; */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
static virStateDriver oneStateDriver = {
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
int openvzRegister(void) {
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
int
qemudNodeDeviceReAttach, /* nodeDeviceReAttach */
qemudNodeDeviceReset, /* nodeDeviceReset */
qemudDomainMigratePrepareTunnel, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
remoteNodeDeviceReAttach, /* nodeDeviceReAttach */
remoteNodeDeviceReset, /* nodeDeviceReset */
remoteDomainMigratePrepareTunnel, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
static virNetworkDriver network_driver = {
.networkGetBridgeName = remoteNetworkGetBridgeName,
.networkGetAutostart = remoteNetworkGetAutostart,
.networkSetAutostart = remoteNetworkSetAutostart,
+ .networkIsActive = NULL,
+ .networkIsPersistent = NULL,
};
static virInterfaceDriver interface_driver = {
.interfaceUndefine = remoteInterfaceUndefine,
.interfaceCreate = remoteInterfaceCreate,
.interfaceDestroy = remoteInterfaceDestroy,
+ .interfaceIsActive = NULL, /* interfaceIsActive */
};
static virStorageDriver storage_driver = {
.volGetInfo = remoteStorageVolGetInfo,
.volGetXMLDesc = remoteStorageVolDumpXML,
.volGetPath = remoteStorageVolGetPath,
+
+ .poolIsActive = NULL, /* poolIsActive */
+ .poolIsPersistent = NULL, /* poolIsEncrypted */
};
static virSecretDriver secret_driver = {
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
static virNetworkDriver testNetworkDriver = {
testNetworkGetBridgeName, /* networkGetBridgeName */
testNetworkGetAutostart, /* networkGetAutostart */
testNetworkSetAutostart, /* networkSetAutostart */
+ NULL, /* networkIsActive */
+ NULL, /* networkIsPersistent */
};
static virInterfaceDriver testInterfaceDriver = {
testInterfaceUndefine, /* interfaceUndefine */
testInterfaceCreate, /* interfaceCreate */
testInterfaceDestroy, /* interfaceDestroy */
+ NULL, /* interfaceIsActive */
};
.volGetInfo = testStorageVolumeGetInfo,
.volGetXMLDesc = testStorageVolumeGetXMLDesc,
.volGetPath = testStorageVolumeGetPath,
+
+ .poolIsActive = NULL, /* poolIsActive */
+ .poolIsPersistent = NULL, /* poolIsPersistent */
};
static virDeviceMonitor testDevMonitor = {
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
NULL, /* nodeDeviceReAttach */
NULL, /* nodeDeviceReset */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPerrsistent */
};
virNetworkDriver NAME(NetworkDriver) = {
xenUnifiedNodeDeviceReAttach, /* nodeDeviceReAttach */
xenUnifiedNodeDeviceReset, /* nodeDeviceReset */
NULL, /* domainMigratePrepareTunnel */
+ NULL, /* isEncrypted */
+ NULL, /* isSecure */
+ NULL, /* domainIsActive */
+ NULL, /* domainIsPersistent */
};
/**