Commit 4ecffe66 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Add support for virConnectGetCPUModelNames API

Signed-off-by: 's avatarDaniel P. Berrange <berrange@redhat.com>
parent c823e058
......@@ -1907,6 +1907,27 @@ PREINIT:
OUTPUT:
RETVAL
void
get_cpu_model_names(con, arch, flags=0)
virConnectPtr con;
char *arch;
unsigned int flags;
PREINIT:
int nnames;
int i;
char **names = NULL;
PPCODE:
if ((nnames = virConnectGetCPUModelNames(con, arch, &names, flags)) < 0)
_croak_error();
EXTEND(SP, nnames);
for (i = 0 ; i < nnames ; i++) {
PUSHs(sv_2mortal(newSVpv(names[i], 0)));
free(names[i]);
}
Safefree(names);
int
get_max_vcpus(con, type)
......
#!/usr/bin/perl
use strict;
use warnings;
use Sys::Virt;
my $addr = @ARGV ? shift @ARGV : "";
my $hv = Sys::Virt->new(address => $addr, readonly => 1);
my $info = $hv->get_node_info();
my @models = $hv->get_cpu_model_names($info->{model});
print join ("\n", sort{ lc $a cmp lc $b } @models), "\n";
......@@ -1559,6 +1559,14 @@ implied by the model name.
=back
=item @names = $con->get_cpu_model_names($arch, $flags=0)
Get a list of valid CPU models names for the architecture
given by C<$arch>. The C<$arch> value should be one of the
architectures listed in the capabilities XML document.
The C<$flags> parameter is currently unused and defaults
to 0.
=item my $info = $con->get_node_security_model()
Returns a hash reference summarising the security model of the
......
......@@ -3,7 +3,7 @@
use strict;
use warnings;
use Test::More tests => 24;
use Test::More tests => 25;
use XML::XPath;
use XML::XPath::XMLParser;
use Sys::Hostname;
......@@ -77,3 +77,7 @@ SKIP: {
ok($conn->is_secure(), "connection is secure");
ok(!$conn->is_encrypted(), "connection is not encrypted");
my @models = $conn->get_cpu_model_names($info->{model});
ok($#models > -1, "got some cpu models");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment