mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-14 08:35:15 +00:00
Implmentation of new APIs to checking state/persistence of objects
This implements the virConnectIsSecure, virConnectIsEncrypted, virDomainIsPersistent, virDomainIsActive, virNetworkIsActive, virNetworkIsPersistent, virStoragePoolIsActive, virStoragePoolIsPersistent, virInterfaceIsActive APIs in (nearly) all drivers. Exceptions are: phyp: missing domainIsActive/Persistent esx: missing domainIsPersistent opennebula: missing domainIsActive/Persistent * src/remote/remote_protocol.x: Define remote wire ABI for newly added APIs. * daemon/remote_dispatch*.h: Re-generated from remote_protocol.x * src/esx/esx_driver.c, src/lxc/lxc_driver.c, src/network/bridge_driver.c, src/opennebula/one_driver.c, src/openvz/openvz_conf.c, src/openvz/openvz_driver.c, src/phyp/phyp_driver.c, src/remote/remote_driver.c, src/storage/storage_driver.c, src/test/test_driver.c, src/uml/uml_driver.c, src/vbox/vbox_tmpl.c, src/xen/xen_driver.c, src/xen/xen_driver.h, src/xen/xen_inotify.c, src/xen/xen_inotify.h: Implement all the new APIs where possible
This commit is contained in:
parent
c04498b305
commit
cabc2cc98f
202
daemon/remote.c
202
daemon/remote.c
@ -5001,6 +5001,208 @@ remoteDispatchSecretLookupByUsage (struct qemud_server *server ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int remoteDispatchDomainIsActive(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error *err,
|
||||||
|
remote_domain_is_active_args *args,
|
||||||
|
remote_domain_is_active_ret *ret)
|
||||||
|
{
|
||||||
|
virDomainPtr domain;
|
||||||
|
|
||||||
|
domain = get_nonnull_domain(conn, args->dom);
|
||||||
|
if (domain == NULL) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret->active = virDomainIsActive(domain);
|
||||||
|
|
||||||
|
if (ret->active < 0) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int remoteDispatchDomainIsPersistent(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error *err,
|
||||||
|
remote_domain_is_persistent_args *args,
|
||||||
|
remote_domain_is_persistent_ret *ret)
|
||||||
|
{
|
||||||
|
virDomainPtr domain;
|
||||||
|
|
||||||
|
domain = get_nonnull_domain(conn, args->dom);
|
||||||
|
if (domain == NULL) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret->persistent = virDomainIsPersistent(domain);
|
||||||
|
|
||||||
|
if (ret->persistent < 0) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int remoteDispatchInterfaceIsActive(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error *err,
|
||||||
|
remote_interface_is_active_args *args,
|
||||||
|
remote_interface_is_active_ret *ret)
|
||||||
|
{
|
||||||
|
virInterfacePtr iface;
|
||||||
|
|
||||||
|
iface = get_nonnull_interface(conn, args->iface);
|
||||||
|
if (iface == NULL) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret->active = virInterfaceIsActive(iface);
|
||||||
|
|
||||||
|
if (ret->active < 0) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int remoteDispatchNetworkIsActive(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error *err,
|
||||||
|
remote_network_is_active_args *args,
|
||||||
|
remote_network_is_active_ret *ret)
|
||||||
|
{
|
||||||
|
virNetworkPtr network;
|
||||||
|
|
||||||
|
network = get_nonnull_network(conn, args->net);
|
||||||
|
if (network == NULL) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret->active = virNetworkIsActive(network);
|
||||||
|
|
||||||
|
if (ret->active < 0) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int remoteDispatchNetworkIsPersistent(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error *err,
|
||||||
|
remote_network_is_persistent_args *args,
|
||||||
|
remote_network_is_persistent_ret *ret)
|
||||||
|
{
|
||||||
|
virNetworkPtr network;
|
||||||
|
|
||||||
|
network = get_nonnull_network(conn, args->net);
|
||||||
|
if (network == NULL) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret->persistent = virNetworkIsPersistent(network);
|
||||||
|
|
||||||
|
if (ret->persistent < 0) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int remoteDispatchStoragePoolIsActive(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error *err,
|
||||||
|
remote_storage_pool_is_active_args *args,
|
||||||
|
remote_storage_pool_is_active_ret *ret)
|
||||||
|
{
|
||||||
|
virStoragePoolPtr pool;
|
||||||
|
|
||||||
|
pool = get_nonnull_storage_pool(conn, args->pool);
|
||||||
|
if (pool == NULL) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret->active = virStoragePoolIsActive(pool);
|
||||||
|
|
||||||
|
if (ret->active < 0) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int remoteDispatchStoragePoolIsPersistent(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error *err,
|
||||||
|
remote_storage_pool_is_persistent_args *args,
|
||||||
|
remote_storage_pool_is_persistent_ret *ret)
|
||||||
|
{
|
||||||
|
virStoragePoolPtr pool;
|
||||||
|
|
||||||
|
pool = get_nonnull_storage_pool(conn, args->pool);
|
||||||
|
if (pool == NULL) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret->persistent = virStoragePoolIsPersistent(pool);
|
||||||
|
|
||||||
|
if (ret->persistent < 0) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int remoteDispatchIsSecure(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||||
|
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||||
|
remote_error *err,
|
||||||
|
void *args ATTRIBUTE_UNUSED,
|
||||||
|
remote_is_secure_ret *ret)
|
||||||
|
{
|
||||||
|
ret->secure = virConnectIsSecure(conn);
|
||||||
|
|
||||||
|
if (ret->secure < 0) {
|
||||||
|
remoteDispatchConnError(err, conn);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*----- Helpers. -----*/
|
/*----- Helpers. -----*/
|
||||||
|
|
||||||
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
/* get_nonnull_domain and get_nonnull_network turn an on-wire
|
||||||
|
@ -126,3 +126,10 @@
|
|||||||
remote_secret_undefine_args val_remote_secret_undefine_args;
|
remote_secret_undefine_args val_remote_secret_undefine_args;
|
||||||
remote_secret_lookup_by_usage_args val_remote_secret_lookup_by_usage_args;
|
remote_secret_lookup_by_usage_args val_remote_secret_lookup_by_usage_args;
|
||||||
remote_domain_migrate_prepare_tunnel_args val_remote_domain_migrate_prepare_tunnel_args;
|
remote_domain_migrate_prepare_tunnel_args val_remote_domain_migrate_prepare_tunnel_args;
|
||||||
|
remote_domain_is_active_args val_remote_domain_is_active_args;
|
||||||
|
remote_domain_is_persistent_args val_remote_domain_is_persistent_args;
|
||||||
|
remote_network_is_active_args val_remote_network_is_active_args;
|
||||||
|
remote_network_is_persistent_args val_remote_network_is_persistent_args;
|
||||||
|
remote_storage_pool_is_active_args val_remote_storage_pool_is_active_args;
|
||||||
|
remote_storage_pool_is_persistent_args val_remote_storage_pool_is_persistent_args;
|
||||||
|
remote_interface_is_active_args val_remote_interface_is_active_args;
|
||||||
|
@ -226,6 +226,22 @@ static int remoteDispatchDomainInterfaceStats(
|
|||||||
remote_error *err,
|
remote_error *err,
|
||||||
remote_domain_interface_stats_args *args,
|
remote_domain_interface_stats_args *args,
|
||||||
remote_domain_interface_stats_ret *ret);
|
remote_domain_interface_stats_ret *ret);
|
||||||
|
static int remoteDispatchDomainIsActive(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
remote_domain_is_active_args *args,
|
||||||
|
remote_domain_is_active_ret *ret);
|
||||||
|
static int remoteDispatchDomainIsPersistent(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
remote_domain_is_persistent_args *args,
|
||||||
|
remote_domain_is_persistent_ret *ret);
|
||||||
static int remoteDispatchDomainLookupById(
|
static int remoteDispatchDomainLookupById(
|
||||||
struct qemud_server *server,
|
struct qemud_server *server,
|
||||||
struct qemud_client *client,
|
struct qemud_client *client,
|
||||||
@ -514,6 +530,14 @@ static int remoteDispatchInterfaceGetXmlDesc(
|
|||||||
remote_error *err,
|
remote_error *err,
|
||||||
remote_interface_get_xml_desc_args *args,
|
remote_interface_get_xml_desc_args *args,
|
||||||
remote_interface_get_xml_desc_ret *ret);
|
remote_interface_get_xml_desc_ret *ret);
|
||||||
|
static int remoteDispatchInterfaceIsActive(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
remote_interface_is_active_args *args,
|
||||||
|
remote_interface_is_active_ret *ret);
|
||||||
static int remoteDispatchInterfaceLookupByMacString(
|
static int remoteDispatchInterfaceLookupByMacString(
|
||||||
struct qemud_server *server,
|
struct qemud_server *server,
|
||||||
struct qemud_client *client,
|
struct qemud_client *client,
|
||||||
@ -538,6 +562,14 @@ static int remoteDispatchInterfaceUndefine(
|
|||||||
remote_error *err,
|
remote_error *err,
|
||||||
remote_interface_undefine_args *args,
|
remote_interface_undefine_args *args,
|
||||||
void *ret);
|
void *ret);
|
||||||
|
static int remoteDispatchIsSecure(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
void *args,
|
||||||
|
remote_is_secure_ret *ret);
|
||||||
static int remoteDispatchListDefinedDomains(
|
static int remoteDispatchListDefinedDomains(
|
||||||
struct qemud_server *server,
|
struct qemud_server *server,
|
||||||
struct qemud_client *client,
|
struct qemud_client *client,
|
||||||
@ -666,6 +698,22 @@ static int remoteDispatchNetworkGetBridgeName(
|
|||||||
remote_error *err,
|
remote_error *err,
|
||||||
remote_network_get_bridge_name_args *args,
|
remote_network_get_bridge_name_args *args,
|
||||||
remote_network_get_bridge_name_ret *ret);
|
remote_network_get_bridge_name_ret *ret);
|
||||||
|
static int remoteDispatchNetworkIsActive(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
remote_network_is_active_args *args,
|
||||||
|
remote_network_is_active_ret *ret);
|
||||||
|
static int remoteDispatchNetworkIsPersistent(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
remote_network_is_persistent_args *args,
|
||||||
|
remote_network_is_persistent_ret *ret);
|
||||||
static int remoteDispatchNetworkLookupByName(
|
static int remoteDispatchNetworkLookupByName(
|
||||||
struct qemud_server *server,
|
struct qemud_server *server,
|
||||||
struct qemud_client *client,
|
struct qemud_client *client,
|
||||||
@ -1034,6 +1082,22 @@ static int remoteDispatchStoragePoolGetInfo(
|
|||||||
remote_error *err,
|
remote_error *err,
|
||||||
remote_storage_pool_get_info_args *args,
|
remote_storage_pool_get_info_args *args,
|
||||||
remote_storage_pool_get_info_ret *ret);
|
remote_storage_pool_get_info_ret *ret);
|
||||||
|
static int remoteDispatchStoragePoolIsActive(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
remote_storage_pool_is_active_args *args,
|
||||||
|
remote_storage_pool_is_active_ret *ret);
|
||||||
|
static int remoteDispatchStoragePoolIsPersistent(
|
||||||
|
struct qemud_server *server,
|
||||||
|
struct qemud_client *client,
|
||||||
|
virConnectPtr conn,
|
||||||
|
remote_message_header *hdr,
|
||||||
|
remote_error *err,
|
||||||
|
remote_storage_pool_is_persistent_args *args,
|
||||||
|
remote_storage_pool_is_persistent_ret *ret);
|
||||||
static int remoteDispatchStoragePoolListVolumes(
|
static int remoteDispatchStoragePoolListVolumes(
|
||||||
struct qemud_server *server,
|
struct qemud_server *server,
|
||||||
struct qemud_client *client,
|
struct qemud_client *client,
|
||||||
|
@ -106,3 +106,11 @@
|
|||||||
remote_secret_get_xml_desc_ret val_remote_secret_get_xml_desc_ret;
|
remote_secret_get_xml_desc_ret val_remote_secret_get_xml_desc_ret;
|
||||||
remote_secret_get_value_ret val_remote_secret_get_value_ret;
|
remote_secret_get_value_ret val_remote_secret_get_value_ret;
|
||||||
remote_secret_lookup_by_usage_ret val_remote_secret_lookup_by_usage_ret;
|
remote_secret_lookup_by_usage_ret val_remote_secret_lookup_by_usage_ret;
|
||||||
|
remote_is_secure_ret val_remote_is_secure_ret;
|
||||||
|
remote_domain_is_active_ret val_remote_domain_is_active_ret;
|
||||||
|
remote_domain_is_persistent_ret val_remote_domain_is_persistent_ret;
|
||||||
|
remote_network_is_active_ret val_remote_network_is_active_ret;
|
||||||
|
remote_network_is_persistent_ret val_remote_network_is_persistent_ret;
|
||||||
|
remote_storage_pool_is_active_ret val_remote_storage_pool_is_active_ret;
|
||||||
|
remote_storage_pool_is_persistent_ret val_remote_storage_pool_is_persistent_ret;
|
||||||
|
remote_interface_is_active_ret val_remote_interface_is_active_ret;
|
||||||
|
@ -747,3 +747,43 @@
|
|||||||
.args_filter = (xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel_args,
|
.args_filter = (xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel_args,
|
||||||
.ret_filter = (xdrproc_t) xdr_void,
|
.ret_filter = (xdrproc_t) xdr_void,
|
||||||
},
|
},
|
||||||
|
{ /* IsSecure => 149 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchIsSecure,
|
||||||
|
.args_filter = (xdrproc_t) xdr_void,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_is_secure_ret,
|
||||||
|
},
|
||||||
|
{ /* DomainIsActive => 150 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchDomainIsActive,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_domain_is_active_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_domain_is_active_ret,
|
||||||
|
},
|
||||||
|
{ /* DomainIsPersistent => 151 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchDomainIsPersistent,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_domain_is_persistent_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_domain_is_persistent_ret,
|
||||||
|
},
|
||||||
|
{ /* NetworkIsActive => 152 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchNetworkIsActive,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_network_is_active_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_network_is_active_ret,
|
||||||
|
},
|
||||||
|
{ /* NetworkIsPersistent => 153 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchNetworkIsPersistent,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_network_is_persistent_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_network_is_persistent_ret,
|
||||||
|
},
|
||||||
|
{ /* StoragePoolIsActive => 154 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchStoragePoolIsActive,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_storage_pool_is_active_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_storage_pool_is_active_ret,
|
||||||
|
},
|
||||||
|
{ /* StoragePoolIsPersistent => 155 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchStoragePoolIsPersistent,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_storage_pool_is_persistent_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_storage_pool_is_persistent_ret,
|
||||||
|
},
|
||||||
|
{ /* InterfaceIsActive => 156 */
|
||||||
|
.fn = (dispatch_fn) remoteDispatchInterfaceIsActive,
|
||||||
|
.args_filter = (xdrproc_t) xdr_remote_interface_is_active_args,
|
||||||
|
.ret_filter = (xdrproc_t) xdr_remote_interface_is_active_ret,
|
||||||
|
},
|
||||||
|
@ -504,6 +504,30 @@ esxClose(virConnectPtr conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
esxIsSecure(virConnectPtr conn)
|
||||||
|
{
|
||||||
|
esxPrivate *priv = (esxPrivate *)conn->privateData;
|
||||||
|
|
||||||
|
if (STRCASEEQ(priv->transport, "https")) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
esxIsEncrypted(virConnectPtr conn)
|
||||||
|
{
|
||||||
|
esxPrivate *priv = (esxPrivate *)conn->privateData;
|
||||||
|
|
||||||
|
if (STRCASEEQ(priv->transport, "https")) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static esxVI_Boolean
|
static esxVI_Boolean
|
||||||
esxSupportsVMotion(virConnectPtr conn)
|
esxSupportsVMotion(virConnectPtr conn)
|
||||||
@ -1235,6 +1259,89 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
esxDomainIsActive(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
esxPrivate *priv = (esxPrivate *)dom->conn->privateData;
|
||||||
|
esxVI_String *propertyNameList = NULL;
|
||||||
|
esxVI_ObjectContent *virtualMachineList = NULL;
|
||||||
|
esxVI_ObjectContent *virtualMachine = NULL;
|
||||||
|
esxVI_VirtualMachinePowerState powerState;
|
||||||
|
int id_candidate = -1;
|
||||||
|
char *name_candidate = NULL;
|
||||||
|
unsigned char uuid_candidate[VIR_UUID_BUFLEN];
|
||||||
|
char uuid_string[VIR_UUID_STRING_BUFLEN];
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if (esxVI_EnsureSession(dom->conn, priv->host) < 0) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esxVI_String_AppendValueListToList(dom->conn, &propertyNameList,
|
||||||
|
"configStatus\0"
|
||||||
|
"name\0"
|
||||||
|
"runtime.powerState\0"
|
||||||
|
"config.uuid\0") < 0 ||
|
||||||
|
esxVI_LookupObjectContentByType(dom->conn, priv->host, priv->host->vmFolder,
|
||||||
|
"VirtualMachine", propertyNameList,
|
||||||
|
esxVI_Boolean_True,
|
||||||
|
&virtualMachineList) < 0) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (virtualMachine = virtualMachineList; virtualMachine != NULL;
|
||||||
|
virtualMachine = virtualMachine->_next) {
|
||||||
|
VIR_FREE(name_candidate);
|
||||||
|
|
||||||
|
if (esxVI_GetVirtualMachineIdentity(dom->conn, virtualMachine,
|
||||||
|
&id_candidate, &name_candidate,
|
||||||
|
uuid_candidate) < 0) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (memcmp(dom->uuid, uuid_candidate,
|
||||||
|
VIR_UUID_BUFLEN * sizeof(unsigned char)) != 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (esxVI_GetVirtualMachinePowerState(dom->conn, virtualMachine,
|
||||||
|
&powerState) < 0) {
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Only running/suspended virtual machines have an ID != -1 */
|
||||||
|
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
|
||||||
|
ret = 1;
|
||||||
|
} else {
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == -1) {
|
||||||
|
virUUIDFormat(dom->uuid, uuid_string);
|
||||||
|
|
||||||
|
ESX_ERROR(dom->conn, VIR_ERR_NO_DOMAIN, "No domain with UUID '%s'",
|
||||||
|
uuid_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
esxVI_String_Free(&propertyNameList);
|
||||||
|
esxVI_ObjectContent_Free(&virtualMachineList);
|
||||||
|
VIR_FREE(name_candidate);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
esxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* ESX has no concept of transient domains, so
|
||||||
|
* all of them are persistent */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
esxDomainSuspend(virDomainPtr domain)
|
esxDomainSuspend(virDomainPtr domain)
|
||||||
@ -3313,10 +3420,10 @@ static virDriver esxDriver = {
|
|||||||
NULL, /* nodeDeviceReAttach */
|
NULL, /* nodeDeviceReAttach */
|
||||||
NULL, /* nodeDeviceReset */
|
NULL, /* nodeDeviceReset */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
esxIsEncrypted, /* isEncrypted */
|
||||||
NULL, /* isSecure */
|
esxIsSecure, /* isSecure */
|
||||||
NULL, /* domainIsActive */
|
esxDomainIsActive, /* domainIsActive */
|
||||||
NULL, /* domainIsPersistent */
|
esxDomainIsPersistent, /* domainIsPersistent */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,6 +128,21 @@ static int lxcClose(virConnectPtr conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int lxcIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Trivially secure, since always inside the daemon */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int lxcIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Not encrypted, but remote driver takes care of that */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *lxcGetCapabilities(virConnectPtr conn) {
|
static char *lxcGetCapabilities(virConnectPtr conn) {
|
||||||
lxc_driver_t *driver = conn->privateData;
|
lxc_driver_t *driver = conn->privateData;
|
||||||
char *xml;
|
char *xml;
|
||||||
@ -218,6 +233,51 @@ cleanup:
|
|||||||
return dom;
|
return dom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int lxcDomainIsActive(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
lxc_driver_t *driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
lxcDriverLock(driver);
|
||||||
|
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
|
lxcDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
lxcError(dom->conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virDomainObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int lxcDomainIsPersistent(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
lxc_driver_t *driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
lxcDriverLock(driver);
|
||||||
|
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
|
lxcDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
lxcError(dom->conn, NULL, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->persistent;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int lxcListDomains(virConnectPtr conn, int *ids, int nids) {
|
static int lxcListDomains(virConnectPtr conn, int *ids, int nids) {
|
||||||
lxc_driver_t *driver = conn->privateData;
|
lxc_driver_t *driver = conn->privateData;
|
||||||
int n;
|
int n;
|
||||||
@ -2278,10 +2338,10 @@ static virDriver lxcDriver = {
|
|||||||
NULL, /* nodeDeviceReAttach */
|
NULL, /* nodeDeviceReAttach */
|
||||||
NULL, /* nodeDeviceReset */
|
NULL, /* nodeDeviceReset */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
lxcIsEncrypted,
|
||||||
NULL, /* isSecure */
|
lxcIsSecure,
|
||||||
NULL, /* domainIsActive */
|
lxcDomainIsActive,
|
||||||
NULL, /* domainIsPersistent */
|
lxcDomainIsPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
static virStateDriver lxcStateDriver = {
|
static virStateDriver lxcStateDriver = {
|
||||||
|
@ -1177,6 +1177,50 @@ static int networkListDefinedNetworks(virConnectPtr conn, char **const names, in
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int networkIsActive(virNetworkPtr net)
|
||||||
|
{
|
||||||
|
struct network_driver *driver = net->conn->privateData;
|
||||||
|
virNetworkObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
networkDriverLock(driver);
|
||||||
|
obj = virNetworkFindByUUID(&driver->networks, net->uuid);
|
||||||
|
networkDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
networkReportError(net->conn, NULL, NULL, VIR_ERR_NO_NETWORK, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virNetworkObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virNetworkObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int networkIsPersistent(virNetworkPtr net)
|
||||||
|
{
|
||||||
|
struct network_driver *driver = net->conn->privateData;
|
||||||
|
virNetworkObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
networkDriverLock(driver);
|
||||||
|
obj = virNetworkFindByUUID(&driver->networks, net->uuid);
|
||||||
|
networkDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
networkReportError(net->conn, NULL, NULL, VIR_ERR_NO_NETWORK, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->persistent;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virNetworkObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virNetworkPtr networkCreate(virConnectPtr conn, const char *xml) {
|
static virNetworkPtr networkCreate(virConnectPtr conn, const char *xml) {
|
||||||
struct network_driver *driver = conn->networkPrivateData;
|
struct network_driver *driver = conn->networkPrivateData;
|
||||||
virNetworkDefPtr def;
|
virNetworkDefPtr def;
|
||||||
@ -1264,7 +1308,7 @@ static int networkUndefine(virNetworkPtr net) {
|
|||||||
|
|
||||||
network = virNetworkFindByUUID(&driver->networks, net->uuid);
|
network = virNetworkFindByUUID(&driver->networks, net->uuid);
|
||||||
if (!network) {
|
if (!network) {
|
||||||
networkReportError(net->conn, NULL, net, VIR_ERR_INVALID_DOMAIN,
|
networkReportError(net->conn, NULL, net, VIR_ERR_INVALID_NETWORK,
|
||||||
"%s", _("no network with matching uuid"));
|
"%s", _("no network with matching uuid"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1515,8 +1559,8 @@ static virNetworkDriver networkDriver = {
|
|||||||
networkGetBridgeName, /* networkGetBridgeName */
|
networkGetBridgeName, /* networkGetBridgeName */
|
||||||
networkGetAutostart, /* networkGetAutostart */
|
networkGetAutostart, /* networkGetAutostart */
|
||||||
networkSetAutostart, /* networkSetAutostart */
|
networkSetAutostart, /* networkSetAutostart */
|
||||||
NULL, /* networkIsActive */
|
networkIsActive,
|
||||||
NULL, /* networkIsPersistent */
|
networkIsPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
static virStateDriver networkStateDriver = {
|
static virStateDriver networkStateDriver = {
|
||||||
|
@ -90,6 +90,21 @@ static int oneClose(virConnectPtr conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int oneIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Not encrypted because it uses HTTP, not HTTPs */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int oneIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Not secure because it uses HTTP, not HTTPs */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virDomainPtr oneDomainLookupByID(virConnectPtr conn,
|
static virDomainPtr oneDomainLookupByID(virConnectPtr conn,
|
||||||
int id)
|
int id)
|
||||||
{
|
{
|
||||||
@ -761,8 +776,8 @@ static virDriver oneDriver = {
|
|||||||
NULL, /* nodeDeviceReAttach; */
|
NULL, /* nodeDeviceReAttach; */
|
||||||
NULL, /* nodeDeviceReset; */
|
NULL, /* nodeDeviceReset; */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
oneIsEncrypted,
|
||||||
NULL, /* isSecure */
|
oneIsSecure,
|
||||||
NULL, /* domainIsActive */
|
NULL, /* domainIsActive */
|
||||||
NULL, /* domainIsPersistent */
|
NULL, /* domainIsPersistent */
|
||||||
};
|
};
|
||||||
|
@ -478,6 +478,8 @@ int openvzLoadDomains(struct openvz_driver *driver) {
|
|||||||
dom->refs = 1;
|
dom->refs = 1;
|
||||||
dom->pid = veid;
|
dom->pid = veid;
|
||||||
dom->def->id = dom->state == VIR_DOMAIN_SHUTOFF ? -1 : veid;
|
dom->def->id = dom->state == VIR_DOMAIN_SHUTOFF ? -1 : veid;
|
||||||
|
/* XXX OpenVZ doesn't appear to have concept of a transient domain */
|
||||||
|
dom->persistent = 1;
|
||||||
|
|
||||||
if (virAsprintf(&dom->def->name, "%i", veid) < 0)
|
if (virAsprintf(&dom->def->name, "%i", veid) < 0)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
@ -420,6 +420,50 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int openvzDomainIsActive(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
struct openvz_driver *driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
openvzDriverLock(driver);
|
||||||
|
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
|
openvzDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
openvzError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virDomainObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int openvzDomainIsPersistent(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
struct openvz_driver *driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
openvzDriverLock(driver);
|
||||||
|
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
|
openvzDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
openvzError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->persistent;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *openvzDomainDumpXML(virDomainPtr dom, int flags) {
|
static char *openvzDomainDumpXML(virDomainPtr dom, int flags) {
|
||||||
struct openvz_driver *driver = dom->conn->privateData;
|
struct openvz_driver *driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
@ -785,6 +829,7 @@ openvzDomainDefineXML(virConnectPtr conn, const char *xml)
|
|||||||
&driver->domains, vmdef)))
|
&driver->domains, vmdef)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
vmdef = NULL;
|
vmdef = NULL;
|
||||||
|
vm->persistent = 1;
|
||||||
|
|
||||||
if (openvzSetInitialConfig(conn, vm->def) < 0) {
|
if (openvzSetInitialConfig(conn, vm->def) < 0) {
|
||||||
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
|
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -864,6 +909,9 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
|
|||||||
&driver->domains, vmdef)))
|
&driver->domains, vmdef)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
vmdef = NULL;
|
vmdef = NULL;
|
||||||
|
/* All OpenVZ domains seem to be persistent - this is a bit of a violation
|
||||||
|
* of this libvirt API which is intended for transient domain creation */
|
||||||
|
vm->persistent = 1;
|
||||||
|
|
||||||
if (openvzSetInitialConfig(conn, vm->def) < 0) {
|
if (openvzSetInitialConfig(conn, vm->def) < 0) {
|
||||||
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
|
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -1222,6 +1270,16 @@ static const char *openvzGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
|||||||
return "OpenVZ";
|
return "OpenVZ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int openvzIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
||||||
|
/* Encryption is not relevant / applicable to way we talk to openvz */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int openvzIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
||||||
|
/* We run CLI tools directly so this is secure */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static char *openvzGetCapabilities(virConnectPtr conn) {
|
static char *openvzGetCapabilities(virConnectPtr conn) {
|
||||||
struct openvz_driver *driver = conn->privateData;
|
struct openvz_driver *driver = conn->privateData;
|
||||||
char *ret;
|
char *ret;
|
||||||
@ -1471,10 +1529,10 @@ static virDriver openvzDriver = {
|
|||||||
NULL, /* nodeDeviceReAttach */
|
NULL, /* nodeDeviceReAttach */
|
||||||
NULL, /* nodeDeviceReset */
|
NULL, /* nodeDeviceReset */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
openvzIsEncrypted,
|
||||||
NULL, /* isSecure */
|
openvzIsSecure,
|
||||||
NULL, /* domainIsActive */
|
openvzDomainIsActive,
|
||||||
NULL, /* domainIsPersistent */
|
openvzDomainIsPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
int openvzRegister(void) {
|
int openvzRegister(void) {
|
||||||
|
@ -221,6 +221,23 @@ phypClose(virConnectPtr conn)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
phypIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Phyp uses an SSH tunnel, so is always encrypted */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
phypIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Phyp uses an SSH tunnel, so is always secure */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LIBSSH2_SESSION *
|
LIBSSH2_SESSION *
|
||||||
openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
|
||||||
int *internal_socket)
|
int *internal_socket)
|
||||||
@ -1625,8 +1642,8 @@ virDriver phypDriver = {
|
|||||||
NULL, /* nodeDeviceReAttach */
|
NULL, /* nodeDeviceReAttach */
|
||||||
NULL, /* nodeDeviceReset */
|
NULL, /* nodeDeviceReset */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
phypIsEncrypted,
|
||||||
NULL, /* isSecure */
|
phypIsSecure,
|
||||||
NULL, /* domainIsActive */
|
NULL, /* domainIsActive */
|
||||||
NULL, /* domainIsPersistent */
|
NULL, /* domainIsPersistent */
|
||||||
};
|
};
|
||||||
|
@ -2522,6 +2522,19 @@ static const char *qemudGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int qemuIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Trivially secure, since always inside the daemon */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int qemuIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Not encrypted, but remote driver takes care of that */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int kvmGetMaxVCPUs(void) {
|
static int kvmGetMaxVCPUs(void) {
|
||||||
int maxvcpus = 1;
|
int maxvcpus = 1;
|
||||||
|
|
||||||
@ -2734,6 +2747,50 @@ cleanup:
|
|||||||
return dom;
|
return dom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int qemuDomainIsActive(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
qemuDriverLock(driver);
|
||||||
|
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
|
qemuDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
qemudReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virDomainObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int qemuDomainIsPersistent(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
struct qemud_driver *driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
qemuDriverLock(driver);
|
||||||
|
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
|
qemuDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
qemudReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->persistent;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int qemudGetVersion(virConnectPtr conn, unsigned long *version) {
|
static int qemudGetVersion(virConnectPtr conn, unsigned long *version) {
|
||||||
struct qemud_driver *driver = conn->privateData;
|
struct qemud_driver *driver = conn->privateData;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -7465,10 +7522,10 @@ static virDriver qemuDriver = {
|
|||||||
qemudNodeDeviceReAttach, /* nodeDeviceReAttach */
|
qemudNodeDeviceReAttach, /* nodeDeviceReAttach */
|
||||||
qemudNodeDeviceReset, /* nodeDeviceReset */
|
qemudNodeDeviceReset, /* nodeDeviceReset */
|
||||||
qemudDomainMigratePrepareTunnel, /* domainMigratePrepareTunnel */
|
qemudDomainMigratePrepareTunnel, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
qemuIsEncrypted,
|
||||||
NULL, /* isSecure */
|
qemuIsSecure,
|
||||||
NULL, /* domainIsActive */
|
qemuDomainIsActive,
|
||||||
NULL, /* domainIsPersistent */
|
qemuDomainIsPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ struct private_data {
|
|||||||
int watch; /* File handle watch */
|
int watch; /* File handle watch */
|
||||||
pid_t pid; /* PID of tunnel process */
|
pid_t pid; /* PID of tunnel process */
|
||||||
int uses_tls; /* TLS enabled on socket? */
|
int uses_tls; /* TLS enabled on socket? */
|
||||||
|
int is_secure; /* Secure if TLS or SASL or UNIX sockets */
|
||||||
gnutls_session_t session; /* GnuTLS session (if uses_tls != 0). */
|
gnutls_session_t session; /* GnuTLS session (if uses_tls != 0). */
|
||||||
char *type; /* Cached return from remoteType. */
|
char *type; /* Cached return from remoteType. */
|
||||||
int counter; /* Generates serial numbers for RPC. */
|
int counter; /* Generates serial numbers for RPC. */
|
||||||
@ -574,6 +575,7 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
case trans_tls:
|
case trans_tls:
|
||||||
if (initialise_gnutls (conn) == -1) goto failed;
|
if (initialise_gnutls (conn) == -1) goto failed;
|
||||||
priv->uses_tls = 1;
|
priv->uses_tls = 1;
|
||||||
|
priv->is_secure = 1;
|
||||||
|
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
case trans_tcp: {
|
case trans_tcp: {
|
||||||
@ -691,6 +693,7 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
addr.sun_path[0] = '\0';
|
addr.sun_path[0] = '\0';
|
||||||
|
|
||||||
autostart_retry:
|
autostart_retry:
|
||||||
|
priv->is_secure = 1;
|
||||||
priv->sock = socket (AF_UNIX, SOCK_STREAM, 0);
|
priv->sock = socket (AF_UNIX, SOCK_STREAM, 0);
|
||||||
if (priv->sock == -1) {
|
if (priv->sock == -1) {
|
||||||
virReportSystemError(conn, errno, "%s",
|
virReportSystemError(conn, errno, "%s",
|
||||||
@ -771,6 +774,8 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
for (j = 0; j < (nr_args-1); j++)
|
for (j = 0; j < (nr_args-1); j++)
|
||||||
if (cmd_argv[j] == NULL)
|
if (cmd_argv[j] == NULL)
|
||||||
goto out_of_memory;
|
goto out_of_memory;
|
||||||
|
|
||||||
|
priv->is_secure = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*FALLTHROUGH*/
|
/*FALLTHROUGH*/
|
||||||
@ -797,6 +802,10 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
close (sv[1]);
|
close (sv[1]);
|
||||||
priv->sock = sv[0];
|
priv->sock = sv[0];
|
||||||
priv->pid = pid;
|
priv->pid = pid;
|
||||||
|
|
||||||
|
/* Do not set 'is_secure' flag since we can't guarentee
|
||||||
|
* an external program is secure, and this flag must be
|
||||||
|
* pessimistic */
|
||||||
}
|
}
|
||||||
#else /* WIN32 */
|
#else /* WIN32 */
|
||||||
|
|
||||||
@ -1564,6 +1573,72 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int remoteIsSecure(virConnectPtr conn)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = conn->privateData;
|
||||||
|
remote_is_secure_ret ret;
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
memset (&ret, 0, sizeof ret);
|
||||||
|
if (call (conn, priv, 0, REMOTE_PROC_IS_SECURE,
|
||||||
|
(xdrproc_t) xdr_void, (char *) NULL,
|
||||||
|
(xdrproc_t) xdr_remote_is_secure_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
/* We claim to be secure, if the remote driver
|
||||||
|
* transport itself is secure, and the remote
|
||||||
|
* HV connection is secure
|
||||||
|
*
|
||||||
|
* ie, we don't want to claim to be secure if the
|
||||||
|
* remote driver is used to connect to a XenD
|
||||||
|
* driver using unencrypted HTTP:/// access
|
||||||
|
*/
|
||||||
|
rv = priv->is_secure && ret.secure ? 1 : 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int remoteIsEncrypted(virConnectPtr conn)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
int encrypted = 0;
|
||||||
|
struct private_data *priv = conn->privateData;
|
||||||
|
remote_is_secure_ret ret;
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
memset (&ret, 0, sizeof ret);
|
||||||
|
if (call (conn, priv, 0, REMOTE_PROC_IS_SECURE,
|
||||||
|
(xdrproc_t) xdr_void, (char *) NULL,
|
||||||
|
(xdrproc_t) xdr_remote_is_secure_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
if (priv->uses_tls)
|
||||||
|
encrypted = 1;
|
||||||
|
#if HAVE_SASL
|
||||||
|
else if (priv->saslconn)
|
||||||
|
encrypted = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* We claim to be encrypted, if the remote driver
|
||||||
|
* transport itself is encrypted, and the remote
|
||||||
|
* HV connection is secure.
|
||||||
|
*
|
||||||
|
* Yes, we really don't check the remote 'encrypted'
|
||||||
|
* option, since it will almost always be false,
|
||||||
|
* even if secure (eg UNIX sockets).
|
||||||
|
*/
|
||||||
|
rv = encrypted && ret.secure ? 1 : 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteGetMaxVcpus (virConnectPtr conn, const char *type)
|
remoteGetMaxVcpus (virConnectPtr conn, const char *type)
|
||||||
{
|
{
|
||||||
@ -1775,6 +1850,54 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDomainIsActive(virDomainPtr domain)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_domain_is_active_args args;
|
||||||
|
remote_domain_is_active_ret ret;
|
||||||
|
struct private_data *priv = domain->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_domain (&args.dom, domain);
|
||||||
|
|
||||||
|
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_IS_ACTIVE,
|
||||||
|
(xdrproc_t) xdr_remote_domain_is_active_args, (char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_domain_is_active_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
rv = ret.active;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDomainIsPersistent(virDomainPtr domain)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_domain_is_persistent_args args;
|
||||||
|
remote_domain_is_persistent_ret ret;
|
||||||
|
struct private_data *priv = domain->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_domain (&args.dom, domain);
|
||||||
|
|
||||||
|
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_IS_PERSISTENT,
|
||||||
|
(xdrproc_t) xdr_remote_domain_is_persistent_args, (char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_domain_is_persistent_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
rv = ret.persistent;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
remoteDomainCreateXML (virConnectPtr conn,
|
remoteDomainCreateXML (virConnectPtr conn,
|
||||||
const char *xmlDesc,
|
const char *xmlDesc,
|
||||||
@ -3601,6 +3724,54 @@ done:
|
|||||||
return net;
|
return net;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteNetworkIsActive(virNetworkPtr network)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_network_is_active_args args;
|
||||||
|
remote_network_is_active_ret ret;
|
||||||
|
struct private_data *priv = network->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_network (&args.net, network);
|
||||||
|
|
||||||
|
if (call (network->conn, priv, 0, REMOTE_PROC_NETWORK_IS_ACTIVE,
|
||||||
|
(xdrproc_t) xdr_remote_network_is_active_args, (char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_network_is_active_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
rv = ret.active;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteNetworkIsPersistent(virNetworkPtr network)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_network_is_persistent_args args;
|
||||||
|
remote_network_is_persistent_ret ret;
|
||||||
|
struct private_data *priv = network->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_network (&args.net, network);
|
||||||
|
|
||||||
|
if (call (network->conn, priv, 0, REMOTE_PROC_NETWORK_IS_PERSISTENT,
|
||||||
|
(xdrproc_t) xdr_remote_network_is_persistent_args, (char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_network_is_persistent_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
rv = ret.persistent;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static virNetworkPtr
|
static virNetworkPtr
|
||||||
remoteNetworkCreateXML (virConnectPtr conn, const char *xmlDesc)
|
remoteNetworkCreateXML (virConnectPtr conn, const char *xmlDesc)
|
||||||
{
|
{
|
||||||
@ -4107,6 +4278,32 @@ done:
|
|||||||
return iface;
|
return iface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteInterfaceIsActive(virInterfacePtr iface)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_interface_is_active_args args;
|
||||||
|
remote_interface_is_active_ret ret;
|
||||||
|
struct private_data *priv = iface->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_interface (&args.iface, iface);
|
||||||
|
|
||||||
|
if (call (iface->conn, priv, 0, REMOTE_PROC_INTERFACE_IS_ACTIVE,
|
||||||
|
(xdrproc_t) xdr_remote_interface_is_active_args, (char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_interface_is_active_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
rv = ret.active;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
remoteInterfaceGetXMLDesc (virInterfacePtr iface,
|
remoteInterfaceGetXMLDesc (virInterfacePtr iface,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
@ -4587,6 +4784,55 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteStoragePoolIsActive(virStoragePoolPtr pool)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_storage_pool_is_active_args args;
|
||||||
|
remote_storage_pool_is_active_ret ret;
|
||||||
|
struct private_data *priv = pool->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_storage_pool (&args.pool, pool);
|
||||||
|
|
||||||
|
if (call (pool->conn, priv, 0, REMOTE_PROC_STORAGE_POOL_IS_ACTIVE,
|
||||||
|
(xdrproc_t) xdr_remote_storage_pool_is_active_args, (char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_storage_pool_is_active_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
rv = ret.active;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteStoragePoolIsPersistent(virStoragePoolPtr pool)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
remote_storage_pool_is_persistent_args args;
|
||||||
|
remote_storage_pool_is_persistent_ret ret;
|
||||||
|
struct private_data *priv = pool->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_storage_pool (&args.pool, pool);
|
||||||
|
|
||||||
|
if (call (pool->conn, priv, 0, REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT,
|
||||||
|
(xdrproc_t) xdr_remote_storage_pool_is_persistent_args, (char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_storage_pool_is_persistent_ret, (char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
rv = ret.persistent;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virStoragePoolPtr
|
static virStoragePoolPtr
|
||||||
remoteStoragePoolCreateXML (virConnectPtr conn, const char *xmlDesc, unsigned int flags)
|
remoteStoragePoolCreateXML (virConnectPtr conn, const char *xmlDesc, unsigned int flags)
|
||||||
{
|
{
|
||||||
@ -6297,6 +6543,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int in_open,
|
|||||||
_("negotiation SSF %d was not strong enough"), ssf);
|
_("negotiation SSF %d was not strong enough"), ssf);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
priv->is_secure = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG0("SASL authentication complete");
|
DEBUG0("SASL authentication complete");
|
||||||
@ -8554,10 +8801,10 @@ static virDriver remote_driver = {
|
|||||||
remoteNodeDeviceReAttach, /* nodeDeviceReAttach */
|
remoteNodeDeviceReAttach, /* nodeDeviceReAttach */
|
||||||
remoteNodeDeviceReset, /* nodeDeviceReset */
|
remoteNodeDeviceReset, /* nodeDeviceReset */
|
||||||
remoteDomainMigratePrepareTunnel, /* domainMigratePrepareTunnel */
|
remoteDomainMigratePrepareTunnel, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
remoteIsEncrypted, /* isEncrypted */
|
||||||
NULL, /* isSecure */
|
remoteIsSecure, /* isSecure */
|
||||||
NULL, /* domainIsActive */
|
remoteDomainIsActive, /* domainIsActive */
|
||||||
NULL, /* domainIsPersistent */
|
remoteDomainIsPersistent, /* domainIsPersistent */
|
||||||
};
|
};
|
||||||
|
|
||||||
static virNetworkDriver network_driver = {
|
static virNetworkDriver network_driver = {
|
||||||
@ -8579,8 +8826,8 @@ static virNetworkDriver network_driver = {
|
|||||||
.networkGetBridgeName = remoteNetworkGetBridgeName,
|
.networkGetBridgeName = remoteNetworkGetBridgeName,
|
||||||
.networkGetAutostart = remoteNetworkGetAutostart,
|
.networkGetAutostart = remoteNetworkGetAutostart,
|
||||||
.networkSetAutostart = remoteNetworkSetAutostart,
|
.networkSetAutostart = remoteNetworkSetAutostart,
|
||||||
.networkIsActive = NULL,
|
.networkIsActive = remoteNetworkIsActive,
|
||||||
.networkIsPersistent = NULL,
|
.networkIsPersistent = remoteNetworkIsPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
static virInterfaceDriver interface_driver = {
|
static virInterfaceDriver interface_driver = {
|
||||||
@ -8598,7 +8845,7 @@ static virInterfaceDriver interface_driver = {
|
|||||||
.interfaceUndefine = remoteInterfaceUndefine,
|
.interfaceUndefine = remoteInterfaceUndefine,
|
||||||
.interfaceCreate = remoteInterfaceCreate,
|
.interfaceCreate = remoteInterfaceCreate,
|
||||||
.interfaceDestroy = remoteInterfaceDestroy,
|
.interfaceDestroy = remoteInterfaceDestroy,
|
||||||
.interfaceIsActive = NULL, /* interfaceIsActive */
|
.interfaceIsActive = remoteInterfaceIsActive,
|
||||||
};
|
};
|
||||||
|
|
||||||
static virStorageDriver storage_driver = {
|
static virStorageDriver storage_driver = {
|
||||||
@ -8637,9 +8884,8 @@ static virStorageDriver storage_driver = {
|
|||||||
.volGetInfo = remoteStorageVolGetInfo,
|
.volGetInfo = remoteStorageVolGetInfo,
|
||||||
.volGetXMLDesc = remoteStorageVolDumpXML,
|
.volGetXMLDesc = remoteStorageVolDumpXML,
|
||||||
.volGetPath = remoteStorageVolGetPath,
|
.volGetPath = remoteStorageVolGetPath,
|
||||||
|
.poolIsActive = remoteStoragePoolIsActive,
|
||||||
.poolIsActive = NULL, /* poolIsActive */
|
.poolIsPersistent = remoteStoragePoolIsPersistent,
|
||||||
.poolIsPersistent = NULL, /* poolIsEncrypted */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static virSecretDriver secret_driver = {
|
static virSecretDriver secret_driver = {
|
||||||
|
@ -2712,6 +2712,141 @@ xdr_remote_domain_migrate_prepare_tunnel_args (XDR *xdrs, remote_domain_migrate_
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_is_secure_ret (XDR *xdrs, remote_is_secure_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->secure))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_domain_is_active_args (XDR *xdrs, remote_domain_is_active_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_domain_is_active_ret (XDR *xdrs, remote_domain_is_active_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->active))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_domain_is_persistent_args (XDR *xdrs, remote_domain_is_persistent_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_domain (xdrs, &objp->dom))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_domain_is_persistent_ret (XDR *xdrs, remote_domain_is_persistent_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->persistent))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_network_is_active_args (XDR *xdrs, remote_network_is_active_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_network (xdrs, &objp->net))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_network_is_active_ret (XDR *xdrs, remote_network_is_active_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->active))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_network_is_persistent_args (XDR *xdrs, remote_network_is_persistent_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_network (xdrs, &objp->net))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_network_is_persistent_ret (XDR *xdrs, remote_network_is_persistent_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->persistent))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_storage_pool_is_active_args (XDR *xdrs, remote_storage_pool_is_active_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_storage_pool (xdrs, &objp->pool))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_storage_pool_is_active_ret (XDR *xdrs, remote_storage_pool_is_active_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->active))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_storage_pool_is_persistent_args (XDR *xdrs, remote_storage_pool_is_persistent_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_storage_pool (xdrs, &objp->pool))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_storage_pool_is_persistent_ret (XDR *xdrs, remote_storage_pool_is_persistent_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->persistent))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_interface_is_active_args (XDR *xdrs, remote_interface_is_active_args *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_remote_nonnull_interface (xdrs, &objp->iface))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool_t
|
||||||
|
xdr_remote_interface_is_active_ret (XDR *xdrs, remote_interface_is_active_ret *objp)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!xdr_int (xdrs, &objp->active))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
bool_t
|
bool_t
|
||||||
xdr_remote_procedure (XDR *xdrs, remote_procedure *objp)
|
xdr_remote_procedure (XDR *xdrs, remote_procedure *objp)
|
||||||
{
|
{
|
||||||
|
@ -1537,6 +1537,80 @@ struct remote_domain_migrate_prepare_tunnel_args {
|
|||||||
};
|
};
|
||||||
typedef struct remote_domain_migrate_prepare_tunnel_args remote_domain_migrate_prepare_tunnel_args;
|
typedef struct remote_domain_migrate_prepare_tunnel_args remote_domain_migrate_prepare_tunnel_args;
|
||||||
|
|
||||||
|
struct remote_is_secure_ret {
|
||||||
|
int secure;
|
||||||
|
};
|
||||||
|
typedef struct remote_is_secure_ret remote_is_secure_ret;
|
||||||
|
|
||||||
|
struct remote_domain_is_active_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
};
|
||||||
|
typedef struct remote_domain_is_active_args remote_domain_is_active_args;
|
||||||
|
|
||||||
|
struct remote_domain_is_active_ret {
|
||||||
|
int active;
|
||||||
|
};
|
||||||
|
typedef struct remote_domain_is_active_ret remote_domain_is_active_ret;
|
||||||
|
|
||||||
|
struct remote_domain_is_persistent_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
};
|
||||||
|
typedef struct remote_domain_is_persistent_args remote_domain_is_persistent_args;
|
||||||
|
|
||||||
|
struct remote_domain_is_persistent_ret {
|
||||||
|
int persistent;
|
||||||
|
};
|
||||||
|
typedef struct remote_domain_is_persistent_ret remote_domain_is_persistent_ret;
|
||||||
|
|
||||||
|
struct remote_network_is_active_args {
|
||||||
|
remote_nonnull_network net;
|
||||||
|
};
|
||||||
|
typedef struct remote_network_is_active_args remote_network_is_active_args;
|
||||||
|
|
||||||
|
struct remote_network_is_active_ret {
|
||||||
|
int active;
|
||||||
|
};
|
||||||
|
typedef struct remote_network_is_active_ret remote_network_is_active_ret;
|
||||||
|
|
||||||
|
struct remote_network_is_persistent_args {
|
||||||
|
remote_nonnull_network net;
|
||||||
|
};
|
||||||
|
typedef struct remote_network_is_persistent_args remote_network_is_persistent_args;
|
||||||
|
|
||||||
|
struct remote_network_is_persistent_ret {
|
||||||
|
int persistent;
|
||||||
|
};
|
||||||
|
typedef struct remote_network_is_persistent_ret remote_network_is_persistent_ret;
|
||||||
|
|
||||||
|
struct remote_storage_pool_is_active_args {
|
||||||
|
remote_nonnull_storage_pool pool;
|
||||||
|
};
|
||||||
|
typedef struct remote_storage_pool_is_active_args remote_storage_pool_is_active_args;
|
||||||
|
|
||||||
|
struct remote_storage_pool_is_active_ret {
|
||||||
|
int active;
|
||||||
|
};
|
||||||
|
typedef struct remote_storage_pool_is_active_ret remote_storage_pool_is_active_ret;
|
||||||
|
|
||||||
|
struct remote_storage_pool_is_persistent_args {
|
||||||
|
remote_nonnull_storage_pool pool;
|
||||||
|
};
|
||||||
|
typedef struct remote_storage_pool_is_persistent_args remote_storage_pool_is_persistent_args;
|
||||||
|
|
||||||
|
struct remote_storage_pool_is_persistent_ret {
|
||||||
|
int persistent;
|
||||||
|
};
|
||||||
|
typedef struct remote_storage_pool_is_persistent_ret remote_storage_pool_is_persistent_ret;
|
||||||
|
|
||||||
|
struct remote_interface_is_active_args {
|
||||||
|
remote_nonnull_interface iface;
|
||||||
|
};
|
||||||
|
typedef struct remote_interface_is_active_args remote_interface_is_active_args;
|
||||||
|
|
||||||
|
struct remote_interface_is_active_ret {
|
||||||
|
int active;
|
||||||
|
};
|
||||||
|
typedef struct remote_interface_is_active_ret remote_interface_is_active_ret;
|
||||||
#define REMOTE_PROGRAM 0x20008086
|
#define REMOTE_PROGRAM 0x20008086
|
||||||
#define REMOTE_PROTOCOL_VERSION 1
|
#define REMOTE_PROTOCOL_VERSION 1
|
||||||
|
|
||||||
@ -1689,6 +1763,14 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_SECRET_UNDEFINE = 146,
|
REMOTE_PROC_SECRET_UNDEFINE = 146,
|
||||||
REMOTE_PROC_SECRET_LOOKUP_BY_USAGE = 147,
|
REMOTE_PROC_SECRET_LOOKUP_BY_USAGE = 147,
|
||||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL = 148,
|
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL = 148,
|
||||||
|
REMOTE_PROC_IS_SECURE = 149,
|
||||||
|
REMOTE_PROC_DOMAIN_IS_ACTIVE = 150,
|
||||||
|
REMOTE_PROC_DOMAIN_IS_PERSISTENT = 151,
|
||||||
|
REMOTE_PROC_NETWORK_IS_ACTIVE = 152,
|
||||||
|
REMOTE_PROC_NETWORK_IS_PERSISTENT = 153,
|
||||||
|
REMOTE_PROC_STORAGE_POOL_IS_ACTIVE = 154,
|
||||||
|
REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT = 155,
|
||||||
|
REMOTE_PROC_INTERFACE_IS_ACTIVE = 156,
|
||||||
};
|
};
|
||||||
typedef enum remote_procedure remote_procedure;
|
typedef enum remote_procedure remote_procedure;
|
||||||
|
|
||||||
@ -1970,6 +2052,21 @@ extern bool_t xdr_remote_secret_undefine_args (XDR *, remote_secret_undefine_ar
|
|||||||
extern bool_t xdr_remote_secret_lookup_by_usage_args (XDR *, remote_secret_lookup_by_usage_args*);
|
extern bool_t xdr_remote_secret_lookup_by_usage_args (XDR *, remote_secret_lookup_by_usage_args*);
|
||||||
extern bool_t xdr_remote_secret_lookup_by_usage_ret (XDR *, remote_secret_lookup_by_usage_ret*);
|
extern bool_t xdr_remote_secret_lookup_by_usage_ret (XDR *, remote_secret_lookup_by_usage_ret*);
|
||||||
extern bool_t xdr_remote_domain_migrate_prepare_tunnel_args (XDR *, remote_domain_migrate_prepare_tunnel_args*);
|
extern bool_t xdr_remote_domain_migrate_prepare_tunnel_args (XDR *, remote_domain_migrate_prepare_tunnel_args*);
|
||||||
|
extern bool_t xdr_remote_is_secure_ret (XDR *, remote_is_secure_ret*);
|
||||||
|
extern bool_t xdr_remote_domain_is_active_args (XDR *, remote_domain_is_active_args*);
|
||||||
|
extern bool_t xdr_remote_domain_is_active_ret (XDR *, remote_domain_is_active_ret*);
|
||||||
|
extern bool_t xdr_remote_domain_is_persistent_args (XDR *, remote_domain_is_persistent_args*);
|
||||||
|
extern bool_t xdr_remote_domain_is_persistent_ret (XDR *, remote_domain_is_persistent_ret*);
|
||||||
|
extern bool_t xdr_remote_network_is_active_args (XDR *, remote_network_is_active_args*);
|
||||||
|
extern bool_t xdr_remote_network_is_active_ret (XDR *, remote_network_is_active_ret*);
|
||||||
|
extern bool_t xdr_remote_network_is_persistent_args (XDR *, remote_network_is_persistent_args*);
|
||||||
|
extern bool_t xdr_remote_network_is_persistent_ret (XDR *, remote_network_is_persistent_ret*);
|
||||||
|
extern bool_t xdr_remote_storage_pool_is_active_args (XDR *, remote_storage_pool_is_active_args*);
|
||||||
|
extern bool_t xdr_remote_storage_pool_is_active_ret (XDR *, remote_storage_pool_is_active_ret*);
|
||||||
|
extern bool_t xdr_remote_storage_pool_is_persistent_args (XDR *, remote_storage_pool_is_persistent_args*);
|
||||||
|
extern bool_t xdr_remote_storage_pool_is_persistent_ret (XDR *, remote_storage_pool_is_persistent_ret*);
|
||||||
|
extern bool_t xdr_remote_interface_is_active_args (XDR *, remote_interface_is_active_args*);
|
||||||
|
extern bool_t xdr_remote_interface_is_active_ret (XDR *, remote_interface_is_active_ret*);
|
||||||
extern bool_t xdr_remote_procedure (XDR *, remote_procedure*);
|
extern bool_t xdr_remote_procedure (XDR *, remote_procedure*);
|
||||||
extern bool_t xdr_remote_message_type (XDR *, remote_message_type*);
|
extern bool_t xdr_remote_message_type (XDR *, remote_message_type*);
|
||||||
extern bool_t xdr_remote_message_status (XDR *, remote_message_status*);
|
extern bool_t xdr_remote_message_status (XDR *, remote_message_status*);
|
||||||
@ -2225,6 +2322,21 @@ extern bool_t xdr_remote_secret_undefine_args ();
|
|||||||
extern bool_t xdr_remote_secret_lookup_by_usage_args ();
|
extern bool_t xdr_remote_secret_lookup_by_usage_args ();
|
||||||
extern bool_t xdr_remote_secret_lookup_by_usage_ret ();
|
extern bool_t xdr_remote_secret_lookup_by_usage_ret ();
|
||||||
extern bool_t xdr_remote_domain_migrate_prepare_tunnel_args ();
|
extern bool_t xdr_remote_domain_migrate_prepare_tunnel_args ();
|
||||||
|
extern bool_t xdr_remote_is_secure_ret ();
|
||||||
|
extern bool_t xdr_remote_domain_is_active_args ();
|
||||||
|
extern bool_t xdr_remote_domain_is_active_ret ();
|
||||||
|
extern bool_t xdr_remote_domain_is_persistent_args ();
|
||||||
|
extern bool_t xdr_remote_domain_is_persistent_ret ();
|
||||||
|
extern bool_t xdr_remote_network_is_active_args ();
|
||||||
|
extern bool_t xdr_remote_network_is_active_ret ();
|
||||||
|
extern bool_t xdr_remote_network_is_persistent_args ();
|
||||||
|
extern bool_t xdr_remote_network_is_persistent_ret ();
|
||||||
|
extern bool_t xdr_remote_storage_pool_is_active_args ();
|
||||||
|
extern bool_t xdr_remote_storage_pool_is_active_ret ();
|
||||||
|
extern bool_t xdr_remote_storage_pool_is_persistent_args ();
|
||||||
|
extern bool_t xdr_remote_storage_pool_is_persistent_ret ();
|
||||||
|
extern bool_t xdr_remote_interface_is_active_args ();
|
||||||
|
extern bool_t xdr_remote_interface_is_active_ret ();
|
||||||
extern bool_t xdr_remote_procedure ();
|
extern bool_t xdr_remote_procedure ();
|
||||||
extern bool_t xdr_remote_message_type ();
|
extern bool_t xdr_remote_message_type ();
|
||||||
extern bool_t xdr_remote_message_status ();
|
extern bool_t xdr_remote_message_status ();
|
||||||
|
@ -1362,6 +1362,73 @@ struct remote_domain_migrate_prepare_tunnel_args {
|
|||||||
remote_nonnull_string dom_xml;
|
remote_nonnull_string dom_xml;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct remote_is_secure_ret {
|
||||||
|
int secure;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct remote_domain_is_active_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_is_active_ret {
|
||||||
|
int active;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct remote_domain_is_persistent_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_is_persistent_ret {
|
||||||
|
int persistent;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct remote_network_is_active_args {
|
||||||
|
remote_nonnull_network net;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_network_is_active_ret {
|
||||||
|
int active;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_network_is_persistent_args {
|
||||||
|
remote_nonnull_network net;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_network_is_persistent_ret {
|
||||||
|
int persistent;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct remote_storage_pool_is_active_args {
|
||||||
|
remote_nonnull_storage_pool pool;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_storage_pool_is_active_ret {
|
||||||
|
int active;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_storage_pool_is_persistent_args {
|
||||||
|
remote_nonnull_storage_pool pool;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_storage_pool_is_persistent_ret {
|
||||||
|
int persistent;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct remote_interface_is_active_args {
|
||||||
|
remote_nonnull_interface iface;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_interface_is_active_ret {
|
||||||
|
int active;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*----- Protocol. -----*/
|
/*----- Protocol. -----*/
|
||||||
|
|
||||||
/* Define the program number, protocol version and procedure numbers here. */
|
/* Define the program number, protocol version and procedure numbers here. */
|
||||||
@ -1518,12 +1585,11 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_INTERFACE_DESTROY = 134,
|
REMOTE_PROC_INTERFACE_DESTROY = 134,
|
||||||
REMOTE_PROC_DOMAIN_XML_FROM_NATIVE = 135,
|
REMOTE_PROC_DOMAIN_XML_FROM_NATIVE = 135,
|
||||||
REMOTE_PROC_DOMAIN_XML_TO_NATIVE = 136,
|
REMOTE_PROC_DOMAIN_XML_TO_NATIVE = 136,
|
||||||
|
|
||||||
REMOTE_PROC_NUM_OF_DEFINED_INTERFACES = 137,
|
REMOTE_PROC_NUM_OF_DEFINED_INTERFACES = 137,
|
||||||
REMOTE_PROC_LIST_DEFINED_INTERFACES = 138,
|
REMOTE_PROC_LIST_DEFINED_INTERFACES = 138,
|
||||||
|
|
||||||
REMOTE_PROC_NUM_OF_SECRETS = 139,
|
REMOTE_PROC_NUM_OF_SECRETS = 139,
|
||||||
REMOTE_PROC_LIST_SECRETS = 140,
|
REMOTE_PROC_LIST_SECRETS = 140,
|
||||||
|
|
||||||
REMOTE_PROC_SECRET_LOOKUP_BY_UUID = 141,
|
REMOTE_PROC_SECRET_LOOKUP_BY_UUID = 141,
|
||||||
REMOTE_PROC_SECRET_DEFINE_XML = 142,
|
REMOTE_PROC_SECRET_DEFINE_XML = 142,
|
||||||
REMOTE_PROC_SECRET_GET_XML_DESC = 143,
|
REMOTE_PROC_SECRET_GET_XML_DESC = 143,
|
||||||
@ -1531,11 +1597,24 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_SECRET_GET_VALUE = 145,
|
REMOTE_PROC_SECRET_GET_VALUE = 145,
|
||||||
REMOTE_PROC_SECRET_UNDEFINE = 146,
|
REMOTE_PROC_SECRET_UNDEFINE = 146,
|
||||||
REMOTE_PROC_SECRET_LOOKUP_BY_USAGE = 147,
|
REMOTE_PROC_SECRET_LOOKUP_BY_USAGE = 147,
|
||||||
|
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL = 148,
|
||||||
|
REMOTE_PROC_IS_SECURE = 149,
|
||||||
|
REMOTE_PROC_DOMAIN_IS_ACTIVE = 150,
|
||||||
|
|
||||||
REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL = 148
|
REMOTE_PROC_DOMAIN_IS_PERSISTENT = 151,
|
||||||
|
REMOTE_PROC_NETWORK_IS_ACTIVE = 152,
|
||||||
|
REMOTE_PROC_NETWORK_IS_PERSISTENT = 153,
|
||||||
|
REMOTE_PROC_STORAGE_POOL_IS_ACTIVE = 154,
|
||||||
|
REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT = 155,
|
||||||
|
REMOTE_PROC_INTERFACE_IS_ACTIVE = 156
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Notice how the entries are grouped in sets of 10 ?
|
||||||
|
* Nice isn't it. Please keep it this way when adding more.
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RPC wire format
|
* RPC wire format
|
||||||
*
|
*
|
||||||
|
@ -466,6 +466,49 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int storagePoolIsActive(virStoragePoolPtr net)
|
||||||
|
{
|
||||||
|
virStorageDriverStatePtr driver = net->conn->privateData;
|
||||||
|
virStoragePoolObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
storageDriverLock(driver);
|
||||||
|
obj = virStoragePoolObjFindByUUID(&driver->pools, net->uuid);
|
||||||
|
storageDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
virStorageReportError(net->conn, VIR_ERR_NO_STORAGE_POOL, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virStoragePoolObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virStoragePoolObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int storagePoolIsPersistent(virStoragePoolPtr net)
|
||||||
|
{
|
||||||
|
virStorageDriverStatePtr driver = net->conn->privateData;
|
||||||
|
virStoragePoolObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
storageDriverLock(driver);
|
||||||
|
obj = virStoragePoolObjFindByUUID(&driver->pools, net->uuid);
|
||||||
|
storageDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
virStorageReportError(net->conn, VIR_ERR_NO_STORAGE_POOL, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->configFile ? 1 : 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virStoragePoolObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virStoragePoolPtr
|
static virStoragePoolPtr
|
||||||
storagePoolCreate(virConnectPtr conn,
|
storagePoolCreate(virConnectPtr conn,
|
||||||
const char *xml,
|
const char *xml,
|
||||||
@ -1742,6 +1785,9 @@ static virStorageDriver storageDriver = {
|
|||||||
.volGetInfo = storageVolumeGetInfo,
|
.volGetInfo = storageVolumeGetInfo,
|
||||||
.volGetXMLDesc = storageVolumeGetXMLDesc,
|
.volGetXMLDesc = storageVolumeGetXMLDesc,
|
||||||
.volGetPath = storageVolumeGetPath,
|
.volGetPath = storageVolumeGetPath,
|
||||||
|
|
||||||
|
.poolIsActive = storagePoolIsActive,
|
||||||
|
.poolIsPersistent = storagePoolIsPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1188,6 +1188,16 @@ static int testGetVersion(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int testIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int testIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int testGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
|
static int testGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||||
const char *type ATTRIBUTE_UNUSED)
|
const char *type ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
@ -1227,6 +1237,48 @@ static int testNumOfDomains(virConnectPtr conn)
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int testDomainIsActive(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
testConnPtr privconn = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
testDriverLock(privconn);
|
||||||
|
obj = virDomainFindByUUID(&privconn->domains, dom->uuid);
|
||||||
|
testDriverUnlock(privconn);
|
||||||
|
if (!obj) {
|
||||||
|
testError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virDomainObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int testDomainIsPersistent(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
testConnPtr privconn = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
testDriverLock(privconn);
|
||||||
|
obj = virDomainFindByUUID(&privconn->domains, dom->uuid);
|
||||||
|
testDriverUnlock(privconn);
|
||||||
|
if (!obj) {
|
||||||
|
testError(dom->conn, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->persistent;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static virDomainPtr
|
static virDomainPtr
|
||||||
testDomainCreateXML(virConnectPtr conn, const char *xml,
|
testDomainCreateXML(virConnectPtr conn, const char *xml,
|
||||||
unsigned int flags ATTRIBUTE_UNUSED)
|
unsigned int flags ATTRIBUTE_UNUSED)
|
||||||
@ -2778,6 +2830,50 @@ no_memory:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int testNetworkIsActive(virNetworkPtr net)
|
||||||
|
{
|
||||||
|
testConnPtr privconn = net->conn->privateData;
|
||||||
|
virNetworkObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
testDriverLock(privconn);
|
||||||
|
obj = virNetworkFindByUUID(&privconn->networks, net->uuid);
|
||||||
|
testDriverUnlock(privconn);
|
||||||
|
if (!obj) {
|
||||||
|
testError(net->conn, VIR_ERR_NO_NETWORK, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virNetworkObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virNetworkObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int testNetworkIsPersistent(virNetworkPtr net)
|
||||||
|
{
|
||||||
|
testConnPtr privconn = net->conn->privateData;
|
||||||
|
virNetworkObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
testDriverLock(privconn);
|
||||||
|
obj = virNetworkFindByUUID(&privconn->networks, net->uuid);
|
||||||
|
testDriverUnlock(privconn);
|
||||||
|
if (!obj) {
|
||||||
|
testError(net->conn, VIR_ERR_NO_NETWORK, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->persistent;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virNetworkObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static virNetworkPtr testNetworkCreate(virConnectPtr conn, const char *xml) {
|
static virNetworkPtr testNetworkCreate(virConnectPtr conn, const char *xml) {
|
||||||
testConnPtr privconn = conn->privateData;
|
testConnPtr privconn = conn->privateData;
|
||||||
virNetworkDefPtr def;
|
virNetworkDefPtr def;
|
||||||
@ -3194,6 +3290,28 @@ cleanup:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int testInterfaceIsActive(virInterfacePtr iface)
|
||||||
|
{
|
||||||
|
testConnPtr privconn = iface->conn->privateData;
|
||||||
|
virInterfaceObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
testDriverLock(privconn);
|
||||||
|
obj = virInterfaceFindByName(&privconn->ifaces, iface->name);
|
||||||
|
testDriverUnlock(privconn);
|
||||||
|
if (!obj) {
|
||||||
|
testError(iface->conn, VIR_ERR_NO_INTERFACE, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virInterfaceObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virInterfaceObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *testInterfaceGetXMLDesc(virInterfacePtr iface,
|
static char *testInterfaceGetXMLDesc(virInterfacePtr iface,
|
||||||
unsigned int flags ATTRIBUTE_UNUSED)
|
unsigned int flags ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
@ -3338,6 +3456,7 @@ cleanup:
|
|||||||
* Storage Driver routines
|
* Storage Driver routines
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
static int testStoragePoolObjSetDefaults(virConnectPtr conn,
|
static int testStoragePoolObjSetDefaults(virConnectPtr conn,
|
||||||
virStoragePoolObjPtr pool) {
|
virStoragePoolObjPtr pool) {
|
||||||
|
|
||||||
@ -3369,6 +3488,7 @@ static int testStorageClose(virConnectPtr conn) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static virStoragePoolPtr
|
static virStoragePoolPtr
|
||||||
testStoragePoolLookupByUUID(virConnectPtr conn,
|
testStoragePoolLookupByUUID(virConnectPtr conn,
|
||||||
const unsigned char *uuid) {
|
const unsigned char *uuid) {
|
||||||
@ -3514,6 +3634,50 @@ no_memory:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int testStoragePoolIsActive(virStoragePoolPtr pool)
|
||||||
|
{
|
||||||
|
testConnPtr privconn = pool->conn->privateData;
|
||||||
|
virStoragePoolObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
testDriverLock(privconn);
|
||||||
|
obj = virStoragePoolObjFindByUUID(&privconn->pools, pool->uuid);
|
||||||
|
testDriverUnlock(privconn);
|
||||||
|
if (!obj) {
|
||||||
|
testError(pool->conn, VIR_ERR_NO_STORAGE_POOL, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virStoragePoolObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virStoragePoolObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int testStoragePoolIsPersistent(virStoragePoolPtr pool)
|
||||||
|
{
|
||||||
|
testConnPtr privconn = pool->conn->privateData;
|
||||||
|
virStoragePoolObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
testDriverLock(privconn);
|
||||||
|
obj = virStoragePoolObjFindByUUID(&privconn->pools, pool->uuid);
|
||||||
|
testDriverUnlock(privconn);
|
||||||
|
if (!obj) {
|
||||||
|
testError(pool->conn, VIR_ERR_NO_STORAGE_POOL, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->configFile ? 1 : 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virStoragePoolObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
testStoragePoolStart(virStoragePoolPtr pool,
|
testStoragePoolStart(virStoragePoolPtr pool,
|
||||||
unsigned int flags ATTRIBUTE_UNUSED) {
|
unsigned int flags ATTRIBUTE_UNUSED) {
|
||||||
@ -5064,10 +5228,10 @@ static virDriver testDriver = {
|
|||||||
NULL, /* nodeDeviceReAttach */
|
NULL, /* nodeDeviceReAttach */
|
||||||
NULL, /* nodeDeviceReset */
|
NULL, /* nodeDeviceReset */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
testIsEncrypted, /* isEncrypted */
|
||||||
NULL, /* isSecure */
|
testIsSecure, /* isEncrypted */
|
||||||
NULL, /* domainIsActive */
|
testDomainIsActive, /* domainIsActive */
|
||||||
NULL, /* domainIsPersistent */
|
testDomainIsPersistent, /* domainIsPersistent */
|
||||||
};
|
};
|
||||||
|
|
||||||
static virNetworkDriver testNetworkDriver = {
|
static virNetworkDriver testNetworkDriver = {
|
||||||
@ -5089,8 +5253,8 @@ static virNetworkDriver testNetworkDriver = {
|
|||||||
testNetworkGetBridgeName, /* networkGetBridgeName */
|
testNetworkGetBridgeName, /* networkGetBridgeName */
|
||||||
testNetworkGetAutostart, /* networkGetAutostart */
|
testNetworkGetAutostart, /* networkGetAutostart */
|
||||||
testNetworkSetAutostart, /* networkSetAutostart */
|
testNetworkSetAutostart, /* networkSetAutostart */
|
||||||
NULL, /* networkIsActive */
|
testNetworkIsActive, /* networkIsActive */
|
||||||
NULL, /* networkIsPersistent */
|
testNetworkIsPersistent, /* networkIsPersistent */
|
||||||
};
|
};
|
||||||
|
|
||||||
static virInterfaceDriver testInterfaceDriver = {
|
static virInterfaceDriver testInterfaceDriver = {
|
||||||
@ -5108,7 +5272,7 @@ static virInterfaceDriver testInterfaceDriver = {
|
|||||||
testInterfaceUndefine, /* interfaceUndefine */
|
testInterfaceUndefine, /* interfaceUndefine */
|
||||||
testInterfaceCreate, /* interfaceCreate */
|
testInterfaceCreate, /* interfaceCreate */
|
||||||
testInterfaceDestroy, /* interfaceDestroy */
|
testInterfaceDestroy, /* interfaceDestroy */
|
||||||
NULL, /* interfaceIsActive */
|
testInterfaceIsActive, /* interfaceIsActive */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -5149,9 +5313,8 @@ static virStorageDriver testStorageDriver = {
|
|||||||
.volGetInfo = testStorageVolumeGetInfo,
|
.volGetInfo = testStorageVolumeGetInfo,
|
||||||
.volGetXMLDesc = testStorageVolumeGetXMLDesc,
|
.volGetXMLDesc = testStorageVolumeGetXMLDesc,
|
||||||
.volGetPath = testStorageVolumeGetPath,
|
.volGetPath = testStorageVolumeGetPath,
|
||||||
|
.poolIsActive = testStoragePoolIsActive,
|
||||||
.poolIsActive = NULL, /* poolIsActive */
|
.poolIsPersistent = testStoragePoolIsPersistent,
|
||||||
.poolIsPersistent = NULL, /* poolIsPersistent */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static virDeviceMonitor testDevMonitor = {
|
static virDeviceMonitor testDevMonitor = {
|
||||||
|
@ -999,6 +999,20 @@ static const char *umlGetType(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int umlIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Trivially secure, since always inside the daemon */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int umlIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
/* Not encrypted, but remote driver takes care of that */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *umlGetCapabilities(virConnectPtr conn) {
|
static char *umlGetCapabilities(virConnectPtr conn) {
|
||||||
struct uml_driver *driver = (struct uml_driver *)conn->privateData;
|
struct uml_driver *driver = (struct uml_driver *)conn->privateData;
|
||||||
char *xml;
|
char *xml;
|
||||||
@ -1122,6 +1136,51 @@ cleanup:
|
|||||||
return dom;
|
return dom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int umlDomainIsActive(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
struct uml_driver *driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
umlDriverLock(driver);
|
||||||
|
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
|
umlDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
umlReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = virDomainObjIsActive(obj);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int umlDomainIsPersistent(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
struct uml_driver *driver = dom->conn->privateData;
|
||||||
|
virDomainObjPtr obj;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
umlDriverLock(driver);
|
||||||
|
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||||
|
umlDriverUnlock(driver);
|
||||||
|
if (!obj) {
|
||||||
|
umlReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
ret = obj->persistent;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (obj)
|
||||||
|
virDomainObjUnlock(obj);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int umlGetVersion(virConnectPtr conn, unsigned long *version) {
|
static int umlGetVersion(virConnectPtr conn, unsigned long *version) {
|
||||||
struct uml_driver *driver = conn->privateData;
|
struct uml_driver *driver = conn->privateData;
|
||||||
struct utsname ut;
|
struct utsname ut;
|
||||||
@ -1824,10 +1883,10 @@ static virDriver umlDriver = {
|
|||||||
NULL, /* nodeDeviceReAttach */
|
NULL, /* nodeDeviceReAttach */
|
||||||
NULL, /* nodeDeviceReset */
|
NULL, /* nodeDeviceReset */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
umlIsEncrypted,
|
||||||
NULL, /* isSecure */
|
umlIsSecure,
|
||||||
NULL, /* domainIsActive */
|
umlDomainIsActive,
|
||||||
NULL, /* domainIsPersistent */
|
umlDomainIsPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -591,6 +591,16 @@ static int vboxGetVersion(virConnectPtr conn, unsigned long *version) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vboxIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
||||||
|
/* Driver is using local, non-network based transport */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int vboxIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED) {
|
||||||
|
/* No encryption is needed, or used on the local transport*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int vboxGetMaxVcpus(virConnectPtr conn, const char *type ATTRIBUTE_UNUSED) {
|
static int vboxGetMaxVcpus(virConnectPtr conn, const char *type ATTRIBUTE_UNUSED) {
|
||||||
vboxGlobalData *data = conn->privateData;
|
vboxGlobalData *data = conn->privateData;
|
||||||
PRUint32 maxCPUCount = 0;
|
PRUint32 maxCPUCount = 0;
|
||||||
@ -1014,6 +1024,93 @@ static virDomainPtr vboxDomainLookupByName(virConnectPtr conn, const char *name)
|
|||||||
return dom;
|
return dom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int vboxDomainIsActive(virDomainPtr dom) {
|
||||||
|
nsresult rc;
|
||||||
|
vboxGlobalData *data = dom->conn->privateData;
|
||||||
|
IMachine **machines = NULL;
|
||||||
|
PRUint32 machineCnt = 0;
|
||||||
|
vboxIID *iid = NULL;
|
||||||
|
char *machineNameUtf8 = NULL;
|
||||||
|
PRUnichar *machineNameUtf16 = NULL;
|
||||||
|
unsigned char iidl[VIR_UUID_BUFLEN];
|
||||||
|
int i, matched = 0;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if(data->vboxObj) {
|
||||||
|
rc = data->vboxObj->vtbl->GetMachines(data->vboxObj, &machineCnt, &machines);
|
||||||
|
if (NS_FAILED(rc)) {
|
||||||
|
vboxError(dom->conn, VIR_ERR_INTERNAL_ERROR,"%s, rc=%08x",
|
||||||
|
"Could not get list of machines",(unsigned)rc);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < machineCnt; ++i) {
|
||||||
|
IMachine *machine = machines[i];
|
||||||
|
PRBool isAccessible = PR_FALSE;
|
||||||
|
|
||||||
|
if (!machine)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||||
|
if (isAccessible) {
|
||||||
|
|
||||||
|
machine->vtbl->GetId(machine, &iid);
|
||||||
|
if (!iid)
|
||||||
|
continue;
|
||||||
|
vboxIIDToUUID(iidl, iid);
|
||||||
|
vboxIIDUnalloc(iid);
|
||||||
|
|
||||||
|
if (memcmp(dom->uuid, iidl, VIR_UUID_BUFLEN) == 0) {
|
||||||
|
|
||||||
|
PRUint32 state;
|
||||||
|
|
||||||
|
matched = 1;
|
||||||
|
|
||||||
|
machine->vtbl->GetName(machine, &machineNameUtf16);
|
||||||
|
data->pFuncs->pfnUtf16ToUtf8(machineNameUtf16, &machineNameUtf8);
|
||||||
|
|
||||||
|
machine->vtbl->GetState(machine, &state);
|
||||||
|
|
||||||
|
if ((state == MachineState_Starting) ||
|
||||||
|
(state == MachineState_Running) ||
|
||||||
|
(state == MachineState_Stuck) ||
|
||||||
|
(state == MachineState_Stopping) ||
|
||||||
|
(state == MachineState_Saving) ||
|
||||||
|
(state == MachineState_Restoring) ||
|
||||||
|
(state == MachineState_Discarding) ||
|
||||||
|
(state == MachineState_Paused) )
|
||||||
|
ret = 1;
|
||||||
|
else
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matched == 1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Do the cleanup and take care you dont leak any memory */
|
||||||
|
if (machineNameUtf8)
|
||||||
|
data->pFuncs->pfnUtf8Free(machineNameUtf8);
|
||||||
|
if (machineNameUtf16)
|
||||||
|
data->pFuncs->pfnComUnallocMem(machineNameUtf16);
|
||||||
|
for (i = 0; i < machineCnt; ++i) {
|
||||||
|
if (machines[i])
|
||||||
|
machines[i]->vtbl->nsisupports.Release((nsISupports *)machines[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int vboxDomainIsPersistent(virDomainPtr dom ATTRIBUTE_UNUSED) {
|
||||||
|
/* XXX All domains appear to be persistent. Is this true ? */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int vboxDomainSuspend(virDomainPtr dom) {
|
static int vboxDomainSuspend(virDomainPtr dom) {
|
||||||
nsresult rc;
|
nsresult rc;
|
||||||
vboxGlobalData *data = dom->conn->privateData;
|
vboxGlobalData *data = dom->conn->privateData;
|
||||||
@ -6469,10 +6566,10 @@ virDriver NAME(Driver) = {
|
|||||||
NULL, /* nodeDeviceReAttach */
|
NULL, /* nodeDeviceReAttach */
|
||||||
NULL, /* nodeDeviceReset */
|
NULL, /* nodeDeviceReset */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
vboxIsEncrypted,
|
||||||
NULL, /* isSecure */
|
vboxIsSecure,
|
||||||
NULL, /* domainIsActive */
|
vboxDomainIsActive,
|
||||||
NULL, /* domainIsPerrsistent */
|
vboxDomainIsPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
virNetworkDriver NAME(NetworkDriver) = {
|
virNetworkDriver NAME(NetworkDriver) = {
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "node_device_conf.h"
|
#include "node_device_conf.h"
|
||||||
#include "pci.h"
|
#include "pci.h"
|
||||||
|
#include "uuid.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_XEN
|
#define VIR_FROM_THIS VIR_FROM_XEN
|
||||||
|
|
||||||
@ -485,6 +486,26 @@ xenUnifiedGetVersion (virConnectPtr conn, unsigned long *hvVer)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
xenUnifiedIsEncrypted(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
xenUnifiedIsSecure(virConnectPtr conn)
|
||||||
|
{
|
||||||
|
GET_PRIVATE(conn);
|
||||||
|
int ret = 1;
|
||||||
|
|
||||||
|
/* All drivers are secure, except for XenD over TCP */
|
||||||
|
if (priv->opened[XEN_UNIFIED_XEND_OFFSET] &&
|
||||||
|
priv->addrfamily != AF_UNIX)
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
|
xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
|
||||||
{
|
{
|
||||||
@ -727,6 +748,75 @@ xenUnifiedDomainLookupByName (virConnectPtr conn,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
xenUnifiedDomainIsActive(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
virDomainPtr currdom;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
/* ID field in dom may be outdated, so re-lookup */
|
||||||
|
currdom = xenUnifiedDomainLookupByUUID(dom->conn, dom->uuid);
|
||||||
|
|
||||||
|
if (currdom) {
|
||||||
|
ret = currdom->id == -1 ? 0 : 1;
|
||||||
|
virDomainFree(currdom);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
xenUnifiedDomainisPersistent(virDomainPtr dom)
|
||||||
|
{
|
||||||
|
GET_PRIVATE(dom->conn);
|
||||||
|
virDomainPtr currdom = NULL;
|
||||||
|
int ret = -1;
|
||||||
|
|
||||||
|
if (priv->opened[XEN_UNIFIED_XM_OFFSET]) {
|
||||||
|
/* Old Xen, pre-inactive domain management.
|
||||||
|
* If the XM driver can see the guest, it is definitely persistent */
|
||||||
|
currdom = xenXMDomainLookupByUUID(dom->conn, dom->uuid);
|
||||||
|
if (currdom)
|
||||||
|
ret = 1;
|
||||||
|
else
|
||||||
|
ret = 0;
|
||||||
|
} else {
|
||||||
|
/* New Xen with inactive domain management */
|
||||||
|
if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) {
|
||||||
|
currdom = xenDaemonLookupByUUID(dom->conn, dom->uuid);
|
||||||
|
if (currdom) {
|
||||||
|
if (currdom->id == -1) {
|
||||||
|
/* If its inactive, then trivially, it must be persistent */
|
||||||
|
ret = 1;
|
||||||
|
} else {
|
||||||
|
char *path;
|
||||||
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
|
|
||||||
|
/* If its running there's no official way to tell, so we
|
||||||
|
* go behind xend's back & look at the config dir */
|
||||||
|
|
||||||
|
virUUIDFormat(dom->uuid, uuidstr);
|
||||||
|
if (virAsprintf(&path, "%s/%s", XEND_DOMAINS_DIR, uuidstr) < 0) {
|
||||||
|
virReportOOMError(NULL);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (access(path, R_OK) == 0)
|
||||||
|
ret = 1;
|
||||||
|
else if (errno == ENOENT)
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (currdom)
|
||||||
|
virDomainFree(currdom);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenUnifiedDomainSuspend (virDomainPtr dom)
|
xenUnifiedDomainSuspend (virDomainPtr dom)
|
||||||
{
|
{
|
||||||
@ -1709,10 +1799,10 @@ static virDriver xenUnifiedDriver = {
|
|||||||
xenUnifiedNodeDeviceReAttach, /* nodeDeviceReAttach */
|
xenUnifiedNodeDeviceReAttach, /* nodeDeviceReAttach */
|
||||||
xenUnifiedNodeDeviceReset, /* nodeDeviceReset */
|
xenUnifiedNodeDeviceReset, /* nodeDeviceReset */
|
||||||
NULL, /* domainMigratePrepareTunnel */
|
NULL, /* domainMigratePrepareTunnel */
|
||||||
NULL, /* isEncrypted */
|
xenUnifiedIsEncrypted,
|
||||||
NULL, /* isSecure */
|
xenUnifiedIsSecure,
|
||||||
NULL, /* domainIsActive */
|
xenUnifiedDomainIsActive,
|
||||||
NULL, /* domainIsPersistent */
|
xenUnifiedDomainisPersistent,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,6 +49,8 @@ extern int xenRegister (void);
|
|||||||
#define XEN_CONFIG_FORMAT_XM "xen-xm"
|
#define XEN_CONFIG_FORMAT_XM "xen-xm"
|
||||||
#define XEN_CONFIG_FORMAT_SEXPR "xen-sxpr"
|
#define XEN_CONFIG_FORMAT_SEXPR "xen-sxpr"
|
||||||
|
|
||||||
|
#define XEND_DOMAINS_DIR "/var/lib/xend/domains"
|
||||||
|
|
||||||
/* _xenUnifiedDriver:
|
/* _xenUnifiedDriver:
|
||||||
*
|
*
|
||||||
* Entry points into the underlying Xen drivers. This structure
|
* Entry points into the underlying Xen drivers. This structure
|
||||||
|
@ -47,8 +47,6 @@
|
|||||||
virReportErrorHelper(NULL, VIR_FROM_XEN_INOTIFY, code, __FILE__, \
|
virReportErrorHelper(NULL, VIR_FROM_XEN_INOTIFY, code, __FILE__, \
|
||||||
__FUNCTION__, __LINE__, fmt)
|
__FUNCTION__, __LINE__, fmt)
|
||||||
|
|
||||||
#define LIBVIRTD_DOMAINS_DIR "/var/lib/xend/domains"
|
|
||||||
|
|
||||||
struct xenUnifiedDriver xenInotifyDriver = {
|
struct xenUnifiedDriver xenInotifyDriver = {
|
||||||
xenInotifyOpen, /* open */
|
xenInotifyOpen, /* open */
|
||||||
xenInotifyClose, /* close */
|
xenInotifyClose, /* close */
|
||||||
@ -126,7 +124,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
|
|||||||
* a filename in the manner:
|
* a filename in the manner:
|
||||||
* /var/lib/xend/domains/<uuid>/
|
* /var/lib/xend/domains/<uuid>/
|
||||||
*/
|
*/
|
||||||
uuid_str = filename + strlen(LIBVIRTD_DOMAINS_DIR) + 1;
|
uuid_str = filename + strlen(XEND_DOMAINS_DIR) + 1;
|
||||||
|
|
||||||
if (virUUIDParse(uuid_str, rawuuid) < 0) {
|
if (virUUIDParse(uuid_str, rawuuid) < 0) {
|
||||||
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -200,7 +198,7 @@ static int
|
|||||||
xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn,
|
xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn,
|
||||||
const char *fname) {
|
const char *fname) {
|
||||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
const char *uuidstr = fname + strlen(LIBVIRTD_DOMAINS_DIR) + 1;
|
const char *uuidstr = fname + strlen(XEND_DOMAINS_DIR) + 1;
|
||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -395,7 +393,7 @@ xenInotifyOpen(virConnectPtr conn,
|
|||||||
priv->useXenConfigCache = 1;
|
priv->useXenConfigCache = 1;
|
||||||
} else {
|
} else {
|
||||||
/* /var/lib/xend/domains/<uuid>/config.sxp */
|
/* /var/lib/xend/domains/<uuid>/config.sxp */
|
||||||
priv->configDir = LIBVIRTD_DOMAINS_DIR;
|
priv->configDir = XEND_DOMAINS_DIR;
|
||||||
priv->useXenConfigCache = 0;
|
priv->useXenConfigCache = 0;
|
||||||
|
|
||||||
if (VIR_ALLOC(priv->configInfoList) < 0) {
|
if (VIR_ALLOC(priv->configInfoList) < 0) {
|
||||||
|
@ -31,4 +31,5 @@ virDrvOpenStatus xenInotifyOpen (virConnectPtr conn,
|
|||||||
virConnectAuthPtr auth,
|
virConnectAuthPtr auth,
|
||||||
int flags);
|
int flags);
|
||||||
int xenInotifyClose (virConnectPtr conn);
|
int xenInotifyClose (virConnectPtr conn);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user