mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-05 12:35:20 +00:00
remote generator, client: Handle functions with multiple return values
This commit is contained in:
parent
a1c891ec1e
commit
abd05a07ae
@ -754,14 +754,9 @@ elsif ($opt_k) {
|
|||||||
"AuthPolkit",
|
"AuthPolkit",
|
||||||
|
|
||||||
"CPUBaseline",
|
"CPUBaseline",
|
||||||
"DomainBlockStats",
|
|
||||||
"DomainCreate",
|
"DomainCreate",
|
||||||
"DomainDestroy",
|
"DomainDestroy",
|
||||||
"DomainGetAutostart",
|
"DomainGetAutostart",
|
||||||
"DomainGetBlockInfo",
|
|
||||||
"DomainGetInfo",
|
|
||||||
"DomainGetJobInfo",
|
|
||||||
"DomainInterfaceStats",
|
|
||||||
"DomainMigrateFinish",
|
"DomainMigrateFinish",
|
||||||
"NWFilterDefineXML", # public API and XDR protocol mismatch
|
"NWFilterDefineXML", # public API and XDR protocol mismatch
|
||||||
"DomainMigratePerform",
|
"DomainMigratePerform",
|
||||||
@ -775,8 +770,6 @@ elsif ($opt_k) {
|
|||||||
"ListDefinedInterfaces",
|
"ListDefinedInterfaces",
|
||||||
"ListNWFilters",
|
"ListNWFilters",
|
||||||
"SupportsFeature",
|
"SupportsFeature",
|
||||||
"StorageVolGetInfo",
|
|
||||||
"StoragePoolGetInfo",
|
|
||||||
"NodeListDevices",
|
"NodeListDevices",
|
||||||
"NodeGetCellsFreeMemory",
|
"NodeGetCellsFreeMemory",
|
||||||
"ListDefinedNetworks",
|
"ListDefinedNetworks",
|
||||||
@ -786,7 +779,6 @@ elsif ($opt_k) {
|
|||||||
"NetworkGetAutostart",
|
"NetworkGetAutostart",
|
||||||
"StoragePoolGetAutostart",
|
"StoragePoolGetAutostart",
|
||||||
"SecretSetValue",
|
"SecretSetValue",
|
||||||
"NodeGetInfo",
|
|
||||||
"GetURI",
|
"GetURI",
|
||||||
"ListInterfaces",
|
"ListInterfaces",
|
||||||
"ListDefinedStoragePools",
|
"ListDefinedStoragePools",
|
||||||
@ -834,16 +826,13 @@ elsif ($opt_k) {
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# handle arguments to the function
|
||||||
my @args_list = ();
|
my @args_list = ();
|
||||||
my @vars_list = ();
|
my @vars_list = ();
|
||||||
my @setters_list = ();
|
my @setters_list = ();
|
||||||
my @ret_list = ();
|
|
||||||
my $priv_src = "conn";
|
my $priv_src = "conn";
|
||||||
my $priv_name = "privateData";
|
my $priv_name = "privateData";
|
||||||
my $call_args = "&args";
|
my $call_args = "&args";
|
||||||
my $call_ret = "&ret";
|
|
||||||
my $single_ret_var = "int rv = -1";
|
|
||||||
my $single_ret_type = "int";
|
|
||||||
|
|
||||||
if ($call->{args} eq "void") {
|
if ($call->{args} eq "void") {
|
||||||
$call_args = "NULL";
|
$call_args = "NULL";
|
||||||
@ -940,6 +929,10 @@ elsif ($opt_k) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! @args_list) {
|
||||||
|
push(@args_list, "virConnectPtr conn");
|
||||||
|
}
|
||||||
|
|
||||||
# fix priv_name for the NumOf* functions
|
# fix priv_name for the NumOf* functions
|
||||||
if ($priv_name eq "privateData" and
|
if ($priv_name eq "privateData" and
|
||||||
!($call->{ProcName} =~ m/Domains/) and
|
!($call->{ProcName} =~ m/Domains/) and
|
||||||
@ -949,13 +942,36 @@ elsif ($opt_k) {
|
|||||||
$priv_name = "${prefix}PrivateData";
|
$priv_name = "${prefix}PrivateData";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# handle return values of the function
|
||||||
|
my @ret_list = ();
|
||||||
|
my $call_ret = "&ret";
|
||||||
|
my $single_ret_var = "int rv = -1";
|
||||||
|
my $single_ret_type = "int";
|
||||||
|
my $multi_ret = 0;
|
||||||
|
|
||||||
|
if ($call->{ret} ne "void" and
|
||||||
|
scalar(@{$call->{ret_members}}) > 1) {
|
||||||
|
$multi_ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($call->{ret} eq "void") {
|
if ($call->{ret} eq "void") {
|
||||||
$call_ret = "NULL";
|
$call_ret = "NULL";
|
||||||
} else {
|
} else {
|
||||||
push(@vars_list, "$call->{ret} ret");
|
push(@vars_list, "$call->{ret} ret");
|
||||||
|
|
||||||
foreach my $ret_member (@{$call->{ret_members}}) {
|
foreach my $ret_member (@{$call->{ret_members}}) {
|
||||||
if ($ret_member =~ m/remote_nonnull_string (\S+);/) {
|
if ($multi_ret) {
|
||||||
|
if ($ret_member =~ m/(char|short|int|hyper) (\S+)\[\S+\];/) {
|
||||||
|
push(@ret_list, "memcpy(result->$2, ret.$2, sizeof result->$2);");
|
||||||
|
} elsif ($ret_member =~ m/char (\S+);/ or
|
||||||
|
$ret_member =~ m/short (\S+);/ or
|
||||||
|
$ret_member =~ m/int (\S+);/ or
|
||||||
|
$ret_member =~ m/hyper (\S+);/) {
|
||||||
|
push(@ret_list, "result->$1 = ret.$1;");
|
||||||
|
} else {
|
||||||
|
die "unhandled type for multi-return-value: $ret_member";
|
||||||
|
}
|
||||||
|
} elsif ($ret_member =~ m/remote_nonnull_string (\S+);/) {
|
||||||
push(@ret_list, "rv = ret.$1;");
|
push(@ret_list, "rv = ret.$1;");
|
||||||
$single_ret_var = "char *rv = NULL";
|
$single_ret_var = "char *rv = NULL";
|
||||||
$single_ret_type = "char *";
|
$single_ret_type = "char *";
|
||||||
@ -1001,8 +1017,21 @@ elsif ($opt_k) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! @args_list) {
|
# select struct type for multi-return-value functions
|
||||||
push(@args_list, "virConnectPtr conn");
|
if ($multi_ret) {
|
||||||
|
my $last_arg;
|
||||||
|
my $struct_name = $call->{ProcName};
|
||||||
|
$struct_name =~ s/Get//;
|
||||||
|
|
||||||
|
if ($call->{ProcName} eq "DomainGetBlockInfo") {
|
||||||
|
$last_arg = pop(@args_list);
|
||||||
|
}
|
||||||
|
|
||||||
|
push(@args_list, "vir${struct_name}Ptr result");
|
||||||
|
|
||||||
|
if (defined $last_arg) {
|
||||||
|
push(@args_list, $last_arg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# print function
|
# print function
|
||||||
@ -1051,7 +1080,9 @@ elsif ($opt_k) {
|
|||||||
print " ";
|
print " ";
|
||||||
print join("\n ", @ret_list);
|
print join("\n ", @ret_list);
|
||||||
print "\n";
|
print "\n";
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if ($multi_ret or !@ret_list) {
|
||||||
print " rv = 0;\n";
|
print " rv = 0;\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,37 @@ done:
|
|||||||
|
|
||||||
/* remoteDispatchDomainBlockPeek has to be implemented manually */
|
/* remoteDispatchDomainBlockPeek has to be implemented manually */
|
||||||
|
|
||||||
/* remoteDispatchDomainBlockStats has to be implemented manually */
|
static int
|
||||||
|
remoteDomainBlockStats(virDomainPtr dom, const char *path, virDomainBlockStatsPtr result)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = dom->conn->privateData;
|
||||||
|
remote_domain_block_stats_args args;
|
||||||
|
remote_domain_block_stats_ret ret;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_domain(&args.dom, dom);
|
||||||
|
args.path = (char *)path;
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof ret);
|
||||||
|
|
||||||
|
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_STATS,
|
||||||
|
(xdrproc_t)xdr_remote_domain_block_stats_args, (char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_domain_block_stats_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
result->rd_req = ret.rd_req;
|
||||||
|
result->rd_bytes = ret.rd_bytes;
|
||||||
|
result->wr_req = ret.wr_req;
|
||||||
|
result->wr_bytes = ret.wr_bytes;
|
||||||
|
result->errs = ret.errs;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDomainCoreDump(virDomainPtr dom, const char *to, int flags)
|
remoteDomainCoreDump(virDomainPtr dom, const char *to, int flags)
|
||||||
@ -293,11 +323,105 @@ done:
|
|||||||
|
|
||||||
/* remoteDispatchDomainGetBlkioParameters has to be implemented manually */
|
/* remoteDispatchDomainGetBlkioParameters has to be implemented manually */
|
||||||
|
|
||||||
/* remoteDispatchDomainGetBlockInfo has to be implemented manually */
|
static int
|
||||||
|
remoteDomainGetBlockInfo(virDomainPtr dom, const char *path, virDomainBlockInfoPtr result, unsigned int flags)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = dom->conn->privateData;
|
||||||
|
remote_domain_get_block_info_args args;
|
||||||
|
remote_domain_get_block_info_ret ret;
|
||||||
|
|
||||||
/* remoteDispatchDomainGetInfo has to be implemented manually */
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
/* remoteDispatchDomainGetJobInfo has to be implemented manually */
|
make_nonnull_domain(&args.dom, dom);
|
||||||
|
args.path = (char *)path;
|
||||||
|
args.flags = flags;
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof ret);
|
||||||
|
|
||||||
|
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLOCK_INFO,
|
||||||
|
(xdrproc_t)xdr_remote_domain_get_block_info_args, (char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_domain_get_block_info_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
result->allocation = ret.allocation;
|
||||||
|
result->capacity = ret.capacity;
|
||||||
|
result->physical = ret.physical;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDomainGetInfo(virDomainPtr dom, virDomainInfoPtr result)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = dom->conn->privateData;
|
||||||
|
remote_domain_get_info_args args;
|
||||||
|
remote_domain_get_info_ret ret;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_domain(&args.dom, dom);
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof ret);
|
||||||
|
|
||||||
|
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_INFO,
|
||||||
|
(xdrproc_t)xdr_remote_domain_get_info_args, (char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_domain_get_info_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
result->state = ret.state;
|
||||||
|
result->maxMem = ret.maxMem;
|
||||||
|
result->memory = ret.memory;
|
||||||
|
result->nrVirtCpu = ret.nrVirtCpu;
|
||||||
|
result->cpuTime = ret.cpuTime;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDomainGetJobInfo(virDomainPtr dom, virDomainJobInfoPtr result)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = dom->conn->privateData;
|
||||||
|
remote_domain_get_job_info_args args;
|
||||||
|
remote_domain_get_job_info_ret ret;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_domain(&args.dom, dom);
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof ret);
|
||||||
|
|
||||||
|
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_JOB_INFO,
|
||||||
|
(xdrproc_t)xdr_remote_domain_get_job_info_args, (char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_domain_get_job_info_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
result->type = ret.type;
|
||||||
|
result->timeElapsed = ret.timeElapsed;
|
||||||
|
result->timeRemaining = ret.timeRemaining;
|
||||||
|
result->dataTotal = ret.dataTotal;
|
||||||
|
result->dataProcessed = ret.dataProcessed;
|
||||||
|
result->dataRemaining = ret.dataRemaining;
|
||||||
|
result->memTotal = ret.memTotal;
|
||||||
|
result->memProcessed = ret.memProcessed;
|
||||||
|
result->memRemaining = ret.memRemaining;
|
||||||
|
result->fileTotal = ret.fileTotal;
|
||||||
|
result->fileProcessed = ret.fileProcessed;
|
||||||
|
result->fileRemaining = ret.fileRemaining;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
remoteDomainGetMaxMemory(virDomainPtr dom)
|
remoteDomainGetMaxMemory(virDomainPtr dom)
|
||||||
@ -468,7 +592,40 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remoteDispatchDomainInterfaceStats has to be implemented manually */
|
static int
|
||||||
|
remoteDomainInterfaceStats(virDomainPtr dom, const char *path, virDomainInterfaceStatsPtr result)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = dom->conn->privateData;
|
||||||
|
remote_domain_interface_stats_args args;
|
||||||
|
remote_domain_interface_stats_ret ret;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_domain(&args.dom, dom);
|
||||||
|
args.path = (char *)path;
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof ret);
|
||||||
|
|
||||||
|
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_INTERFACE_STATS,
|
||||||
|
(xdrproc_t)xdr_remote_domain_interface_stats_args, (char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_domain_interface_stats_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
result->rx_bytes = ret.rx_bytes;
|
||||||
|
result->rx_packets = ret.rx_packets;
|
||||||
|
result->rx_errs = ret.rx_errs;
|
||||||
|
result->rx_drop = ret.rx_drop;
|
||||||
|
result->tx_bytes = ret.tx_bytes;
|
||||||
|
result->tx_packets = ret.tx_packets;
|
||||||
|
result->tx_errs = ret.tx_errs;
|
||||||
|
result->tx_drop = ret.tx_drop;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDomainIsActive(virDomainPtr dom)
|
remoteDomainIsActive(virDomainPtr dom)
|
||||||
@ -2143,7 +2300,36 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remoteDispatchNodeGetInfo has to be implemented manually */
|
static int
|
||||||
|
remoteNodeGetInfo(virConnectPtr conn, virNodeInfoPtr result)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = conn->privateData;
|
||||||
|
remote_node_get_info_ret ret;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof ret);
|
||||||
|
|
||||||
|
if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_INFO,
|
||||||
|
(xdrproc_t)xdr_void, (char *)NULL,
|
||||||
|
(xdrproc_t)xdr_remote_node_get_info_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
memcpy(result->model, ret.model, sizeof result->model);
|
||||||
|
result->memory = ret.memory;
|
||||||
|
result->cpus = ret.cpus;
|
||||||
|
result->mhz = ret.mhz;
|
||||||
|
result->nodes = ret.nodes;
|
||||||
|
result->sockets = ret.sockets;
|
||||||
|
result->cores = ret.cores;
|
||||||
|
result->threads = ret.threads;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
/* remoteDispatchNodeGetSecurityModel has to be implemented manually */
|
/* remoteDispatchNodeGetSecurityModel has to be implemented manually */
|
||||||
|
|
||||||
@ -2831,7 +3017,35 @@ done:
|
|||||||
|
|
||||||
/* remoteDispatchStoragePoolGetAutostart has to be implemented manually */
|
/* remoteDispatchStoragePoolGetAutostart has to be implemented manually */
|
||||||
|
|
||||||
/* remoteDispatchStoragePoolGetInfo has to be implemented manually */
|
static int
|
||||||
|
remoteStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr result)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = pool->conn->storagePrivateData;
|
||||||
|
remote_storage_pool_get_info_args args;
|
||||||
|
remote_storage_pool_get_info_ret ret;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_storage_pool(&args.pool, pool);
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof ret);
|
||||||
|
|
||||||
|
if (call(pool->conn, priv, 0, REMOTE_PROC_STORAGE_POOL_GET_INFO,
|
||||||
|
(xdrproc_t)xdr_remote_storage_pool_get_info_args, (char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_storage_pool_get_info_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
result->state = ret.state;
|
||||||
|
result->capacity = ret.capacity;
|
||||||
|
result->allocation = ret.allocation;
|
||||||
|
result->available = ret.available;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteStoragePoolIsActive(virStoragePoolPtr pool)
|
remoteStoragePoolIsActive(virStoragePoolPtr pool)
|
||||||
@ -3177,7 +3391,34 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remoteDispatchStorageVolGetInfo has to be implemented manually */
|
static int
|
||||||
|
remoteStorageVolGetInfo(virStorageVolPtr vol, virStorageVolInfoPtr result)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = vol->conn->storagePrivateData;
|
||||||
|
remote_storage_vol_get_info_args args;
|
||||||
|
remote_storage_vol_get_info_ret ret;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
make_nonnull_storage_vol(&args.vol, vol);
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof ret);
|
||||||
|
|
||||||
|
if (call(vol->conn, priv, 0, REMOTE_PROC_STORAGE_VOL_GET_INFO,
|
||||||
|
(xdrproc_t)xdr_remote_storage_vol_get_info_args, (char *)&args,
|
||||||
|
(xdrproc_t)xdr_remote_storage_vol_get_info_ret, (char *)&ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
result->type = ret.type;
|
||||||
|
result->capacity = ret.capacity;
|
||||||
|
result->allocation = ret.allocation;
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
remoteStorageVolGetPath(virStorageVolPtr vol)
|
remoteStorageVolGetPath(virStorageVolPtr vol)
|
||||||
|
@ -1810,37 +1810,6 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
remoteNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_node_get_info_ret ret;
|
|
||||||
struct private_data *priv = conn->privateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_INFO,
|
|
||||||
(xdrproc_t) xdr_void, (char *) NULL,
|
|
||||||
(xdrproc_t) xdr_remote_node_get_info_ret, (char *) &ret) == -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
if (virStrcpyStatic(info->model, ret.model) == NULL)
|
|
||||||
goto done;
|
|
||||||
info->memory = ret.memory;
|
|
||||||
info->cpus = ret.cpus;
|
|
||||||
info->mhz = ret.mhz;
|
|
||||||
info->nodes = ret.nodes;
|
|
||||||
info->sockets = ret.sockets;
|
|
||||||
info->cores = ret.cores;
|
|
||||||
info->threads = ret.threads;
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteNodeGetCellsFreeMemory(virConnectPtr conn,
|
remoteNodeGetCellsFreeMemory(virConnectPtr conn,
|
||||||
unsigned long long *freeMems,
|
unsigned long long *freeMems,
|
||||||
@ -2290,37 +2259,6 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
remoteDomainGetInfo (virDomainPtr domain, virDomainInfoPtr info)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_domain_get_info_args args;
|
|
||||||
remote_domain_get_info_ret ret;
|
|
||||||
struct private_data *priv = domain->conn->privateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
make_nonnull_domain (&args.dom, domain);
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_INFO,
|
|
||||||
(xdrproc_t) xdr_remote_domain_get_info_args, (char *) &args,
|
|
||||||
(xdrproc_t) xdr_remote_domain_get_info_ret, (char *) &ret) == -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
info->state = ret.state;
|
|
||||||
info->maxMem = ret.maxMem;
|
|
||||||
info->memory = ret.memory;
|
|
||||||
info->nrVirtCpu = ret.nrVirtCpu;
|
|
||||||
info->cpuTime = ret.cpuTime;
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDomainPinVcpu (virDomainPtr domain,
|
remoteDomainPinVcpu (virDomainPtr domain,
|
||||||
unsigned int vcpu,
|
unsigned int vcpu,
|
||||||
@ -3034,78 +2972,6 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
remoteDomainBlockStats (virDomainPtr domain, const char *path,
|
|
||||||
struct _virDomainBlockStats *stats)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_domain_block_stats_args args;
|
|
||||||
remote_domain_block_stats_ret ret;
|
|
||||||
struct private_data *priv = domain->conn->privateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
make_nonnull_domain (&args.dom, domain);
|
|
||||||
args.path = (char *) path;
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_STATS,
|
|
||||||
(xdrproc_t) xdr_remote_domain_block_stats_args, (char *) &args,
|
|
||||||
(xdrproc_t) xdr_remote_domain_block_stats_ret, (char *) &ret)
|
|
||||||
== -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
stats->rd_req = ret.rd_req;
|
|
||||||
stats->rd_bytes = ret.rd_bytes;
|
|
||||||
stats->wr_req = ret.wr_req;
|
|
||||||
stats->wr_bytes = ret.wr_bytes;
|
|
||||||
stats->errs = ret.errs;
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
remoteDomainInterfaceStats (virDomainPtr domain, const char *path,
|
|
||||||
struct _virDomainInterfaceStats *stats)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_domain_interface_stats_args args;
|
|
||||||
remote_domain_interface_stats_ret ret;
|
|
||||||
struct private_data *priv = domain->conn->privateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
make_nonnull_domain (&args.dom, domain);
|
|
||||||
args.path = (char *) path;
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_INTERFACE_STATS,
|
|
||||||
(xdrproc_t) xdr_remote_domain_interface_stats_args,
|
|
||||||
(char *) &args,
|
|
||||||
(xdrproc_t) xdr_remote_domain_interface_stats_ret,
|
|
||||||
(char *) &ret) == -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
stats->rx_bytes = ret.rx_bytes;
|
|
||||||
stats->rx_packets = ret.rx_packets;
|
|
||||||
stats->rx_errs = ret.rx_errs;
|
|
||||||
stats->rx_drop = ret.rx_drop;
|
|
||||||
stats->tx_bytes = ret.tx_bytes;
|
|
||||||
stats->tx_packets = ret.tx_packets;
|
|
||||||
stats->tx_errs = ret.tx_errs;
|
|
||||||
stats->tx_drop = ret.tx_drop;
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDomainMemoryStats (virDomainPtr domain,
|
remoteDomainMemoryStats (virDomainPtr domain,
|
||||||
struct _virDomainMemoryStat *stats,
|
struct _virDomainMemoryStat *stats,
|
||||||
@ -3253,40 +3119,6 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
remoteDomainGetBlockInfo (virDomainPtr domain,
|
|
||||||
const char *path,
|
|
||||||
virDomainBlockInfoPtr info,
|
|
||||||
unsigned int flags)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_domain_get_block_info_args args;
|
|
||||||
remote_domain_get_block_info_ret ret;
|
|
||||||
struct private_data *priv = domain->conn->privateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
make_nonnull_domain (&args.dom, domain);
|
|
||||||
args.path = (char*)path;
|
|
||||||
args.flags = flags;
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLOCK_INFO,
|
|
||||||
(xdrproc_t) xdr_remote_domain_get_block_info_args, (char *) &args,
|
|
||||||
(xdrproc_t) xdr_remote_domain_get_block_info_ret, (char *) &ret) == -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
info->allocation = ret.allocation;
|
|
||||||
info->capacity = ret.capacity;
|
|
||||||
info->physical = ret.physical;
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
||||||
@ -3900,36 +3732,6 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
remoteStoragePoolGetInfo (virStoragePoolPtr pool, virStoragePoolInfoPtr info)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_storage_pool_get_info_args args;
|
|
||||||
remote_storage_pool_get_info_ret ret;
|
|
||||||
struct private_data *priv = pool->conn->storagePrivateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
make_nonnull_storage_pool (&args.pool, pool);
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (pool->conn, priv, 0, REMOTE_PROC_STORAGE_POOL_GET_INFO,
|
|
||||||
(xdrproc_t) xdr_remote_storage_pool_get_info_args, (char *) &args,
|
|
||||||
(xdrproc_t) xdr_remote_storage_pool_get_info_ret, (char *) &ret) == -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
info->state = ret.state;
|
|
||||||
info->capacity = ret.capacity;
|
|
||||||
info->allocation = ret.allocation;
|
|
||||||
info->available = ret.available;
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteStoragePoolGetAutostart (virStoragePoolPtr pool, int *autostart)
|
remoteStoragePoolGetAutostart (virStoragePoolPtr pool, int *autostart)
|
||||||
{
|
{
|
||||||
@ -4014,35 +3816,6 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
remoteStorageVolGetInfo (virStorageVolPtr vol, virStorageVolInfoPtr info)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_storage_vol_get_info_args args;
|
|
||||||
remote_storage_vol_get_info_ret ret;
|
|
||||||
struct private_data *priv = vol->conn->storagePrivateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
make_nonnull_storage_vol (&args.vol, vol);
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (vol->conn, priv, 0, REMOTE_PROC_STORAGE_VOL_GET_INFO,
|
|
||||||
(xdrproc_t) xdr_remote_storage_vol_get_info_args, (char *) &args,
|
|
||||||
(xdrproc_t) xdr_remote_storage_vol_get_info_ret, (char *) &ret) == -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
info->type = ret.type;
|
|
||||||
info->capacity = ret.capacity;
|
|
||||||
info->allocation = ret.allocation;
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------*/
|
||||||
|
|
||||||
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
static virDrvOpenStatus ATTRIBUTE_NONNULL (1)
|
||||||
@ -6226,45 +5999,6 @@ done:
|
|||||||
return cpu;
|
return cpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
remoteDomainGetJobInfo (virDomainPtr domain, virDomainJobInfoPtr info)
|
|
||||||
{
|
|
||||||
int rv = -1;
|
|
||||||
remote_domain_get_job_info_args args;
|
|
||||||
remote_domain_get_job_info_ret ret;
|
|
||||||
struct private_data *priv = domain->conn->privateData;
|
|
||||||
|
|
||||||
remoteDriverLock(priv);
|
|
||||||
|
|
||||||
make_nonnull_domain (&args.dom, domain);
|
|
||||||
|
|
||||||
memset (&ret, 0, sizeof ret);
|
|
||||||
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_JOB_INFO,
|
|
||||||
(xdrproc_t) xdr_remote_domain_get_job_info_args, (char *) &args,
|
|
||||||
(xdrproc_t) xdr_remote_domain_get_job_info_ret, (char *) &ret) == -1)
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
info->type = ret.type;
|
|
||||||
info->timeElapsed = ret.timeElapsed;
|
|
||||||
info->timeRemaining = ret.timeRemaining;
|
|
||||||
info->dataTotal = ret.dataTotal;
|
|
||||||
info->dataProcessed = ret.dataProcessed;
|
|
||||||
info->dataRemaining = ret.dataRemaining;
|
|
||||||
info->memTotal = ret.memTotal;
|
|
||||||
info->memProcessed = ret.memProcessed;
|
|
||||||
info->memRemaining = ret.memRemaining;
|
|
||||||
info->fileTotal = ret.fileTotal;
|
|
||||||
info->fileProcessed = ret.fileProcessed;
|
|
||||||
info->fileRemaining = ret.fileRemaining;
|
|
||||||
|
|
||||||
rv = 0;
|
|
||||||
|
|
||||||
done:
|
|
||||||
remoteDriverUnlock(priv);
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDomainSnapshotListNames (virDomainPtr domain, char **const names,
|
remoteDomainSnapshotListNames (virDomainPtr domain, char **const names,
|
||||||
int maxnames, unsigned int flags)
|
int maxnames, unsigned int flags)
|
||||||
|
Loading…
Reference in New Issue
Block a user