2011-05-13 10:00:56 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use File::Find;
|
|
|
|
|
|
|
|
die "syntax: $0 SRCDIR\n" unless int(@ARGV) == 1;
|
|
|
|
|
|
|
|
my $srcdir = shift @ARGV;
|
|
|
|
|
|
|
|
my $symslibvirt = "$srcdir/libvirt_public.syms";
|
|
|
|
my $symsqemu = "$srcdir/libvirt_qemu.syms";
|
Introduce an LXC specific public API & library
This patch introduces support for LXC specific public APIs. In
common with what was done for QEMU, this creates a libvirt_lxc.so
library and libvirt/libvirt-lxc.h header file.
The actual APIs are
int virDomainLxcOpenNamespace(virDomainPtr domain,
int **fdlist,
unsigned int flags);
int virDomainLxcEnterNamespace(virDomainPtr domain,
unsigned int nfdlist,
int *fdlist,
unsigned int *noldfdlist,
int **oldfdlist,
unsigned int flags);
which provide a way to use the setns() system call to move the
calling process into the container's namespace. It is not
practical to write in a generically applicable manner. The
nearest that we could get to such an API would be an API which
allows to pass a command + argv to be executed inside a
container. Even if we had such a generic API, this LXC specific
API is still useful, because it allows the caller to maintain
the current process context, in particular any I/O streams they
have open.
NB the virDomainLxcEnterNamespace() API is special in that it
runs client side, so does not involve the internal driver API.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-12-21 13:15:19 +00:00
|
|
|
my $symslxc = "$srcdir/libvirt_lxc.syms";
|
2014-11-11 16:28:26 +00:00
|
|
|
my @drivertable = (
|
|
|
|
"$srcdir/driver-hypervisor.h",
|
|
|
|
"$srcdir/driver-interface.h",
|
|
|
|
"$srcdir/driver-network.h",
|
|
|
|
"$srcdir/driver-nodedev.h",
|
|
|
|
"$srcdir/driver-nwfilter.h",
|
|
|
|
"$srcdir/driver-secret.h",
|
|
|
|
"$srcdir/driver-state.h",
|
|
|
|
"$srcdir/driver-storage.h",
|
|
|
|
"$srcdir/driver-stream.h",
|
|
|
|
);
|
2011-05-13 10:00:56 +00:00
|
|
|
|
|
|
|
my %groupheaders = (
|
2014-10-16 09:25:59 +00:00
|
|
|
"virHypervisorDriver" => "Hypervisor APIs",
|
2011-05-13 10:00:56 +00:00
|
|
|
"virNetworkDriver" => "Virtual Network APIs",
|
|
|
|
"virInterfaceDriver" => "Host Interface APIs",
|
2013-04-23 10:15:48 +00:00
|
|
|
"virNodeDeviceDriver" => "Host Device APIs",
|
2011-05-13 10:00:56 +00:00
|
|
|
"virStorageDriver" => "Storage Pool APIs",
|
|
|
|
"virSecretDriver" => "Secret APIs",
|
|
|
|
"virNWFilterDriver" => "Network Filter APIs",
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
my @srcs;
|
|
|
|
find({
|
|
|
|
wanted => sub {
|
2014-08-20 16:17:07 +00:00
|
|
|
if (m!$srcdir/.*/\w+_(driver|common|tmpl|monitor|hal|udev)\.c$!) {
|
2012-07-27 12:51:28 +00:00
|
|
|
push @srcs, $_ if $_ !~ /vbox_driver\.c/;
|
|
|
|
}
|
2011-05-13 10:00:56 +00:00
|
|
|
}, no_chdir => 1}, $srcdir);
|
|
|
|
my $line;
|
|
|
|
|
|
|
|
# Get the list of all public APIs and their corresponding version
|
|
|
|
|
|
|
|
my %apis;
|
|
|
|
open FILE, "<$symslibvirt"
|
|
|
|
or die "cannot read $symslibvirt: $!";
|
|
|
|
|
|
|
|
my $vers;
|
|
|
|
my $prevvers;
|
|
|
|
while (defined($line = <FILE>)) {
|
|
|
|
chomp $line;
|
|
|
|
next if $line =~ /^\s*#/;
|
|
|
|
next if $line =~ /^\s*$/;
|
|
|
|
next if $line =~ /^\s*(global|local):/;
|
|
|
|
if ($line =~ /^\s*LIBVIRT_(\d+\.\d+\.\d+)\s*{\s*$/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
if (defined $vers) {
|
|
|
|
die "malformed syms file";
|
|
|
|
}
|
|
|
|
$vers = $1;
|
2011-05-13 10:00:56 +00:00
|
|
|
} elsif ($line =~ /\s*}\s*;\s*$/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
if (defined $prevvers) {
|
|
|
|
die "malformed syms file";
|
|
|
|
}
|
|
|
|
$prevvers = $vers;
|
|
|
|
$vers = undef;
|
2011-05-13 10:00:56 +00:00
|
|
|
} elsif ($line =~ /\s*}\s*LIBVIRT_(\d+\.\d+\.\d+)\s*;\s*$/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
if ($1 ne $prevvers) {
|
|
|
|
die "malformed syms file $1 != $vers";
|
|
|
|
}
|
|
|
|
$prevvers = $vers;
|
|
|
|
$vers = undef;
|
2011-05-13 10:00:56 +00:00
|
|
|
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
$apis{$1} = $vers;
|
2011-05-13 10:00:56 +00:00
|
|
|
} else {
|
2012-07-27 12:51:28 +00:00
|
|
|
die "unexpected data $line\n";
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close FILE;
|
|
|
|
|
|
|
|
|
|
|
|
# And the same for the QEMU specific APIs
|
|
|
|
|
|
|
|
open FILE, "<$symsqemu"
|
|
|
|
or die "cannot read $symsqemu: $!";
|
|
|
|
|
|
|
|
$prevvers = undef;
|
|
|
|
$vers = undef;
|
|
|
|
while (defined($line = <FILE>)) {
|
|
|
|
chomp $line;
|
|
|
|
next if $line =~ /^\s*#/;
|
|
|
|
next if $line =~ /^\s*$/;
|
|
|
|
next if $line =~ /^\s*(global|local):/;
|
|
|
|
if ($line =~ /^\s*LIBVIRT_QEMU_(\d+\.\d+\.\d+)\s*{\s*$/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
if (defined $vers) {
|
|
|
|
die "malformed syms file";
|
|
|
|
}
|
|
|
|
$vers = $1;
|
2011-05-13 10:00:56 +00:00
|
|
|
} elsif ($line =~ /\s*}\s*;\s*$/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
if (defined $prevvers) {
|
|
|
|
die "malformed syms file";
|
|
|
|
}
|
|
|
|
$prevvers = $vers;
|
|
|
|
$vers = undef;
|
2011-05-13 10:00:56 +00:00
|
|
|
} elsif ($line =~ /\s*}\s*LIBVIRT_QEMU_(\d+\.\d+\.\d+)\s*;\s*$/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
if ($1 ne $prevvers) {
|
|
|
|
die "malformed syms file $1 != $vers";
|
|
|
|
}
|
|
|
|
$prevvers = $vers;
|
|
|
|
$vers = undef;
|
2011-05-13 10:00:56 +00:00
|
|
|
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
$apis{$1} = $vers;
|
2011-05-13 10:00:56 +00:00
|
|
|
} else {
|
2012-07-27 12:51:28 +00:00
|
|
|
die "unexpected data $line\n";
|
Introduce an LXC specific public API & library
This patch introduces support for LXC specific public APIs. In
common with what was done for QEMU, this creates a libvirt_lxc.so
library and libvirt/libvirt-lxc.h header file.
The actual APIs are
int virDomainLxcOpenNamespace(virDomainPtr domain,
int **fdlist,
unsigned int flags);
int virDomainLxcEnterNamespace(virDomainPtr domain,
unsigned int nfdlist,
int *fdlist,
unsigned int *noldfdlist,
int **oldfdlist,
unsigned int flags);
which provide a way to use the setns() system call to move the
calling process into the container's namespace. It is not
practical to write in a generically applicable manner. The
nearest that we could get to such an API would be an API which
allows to pass a command + argv to be executed inside a
container. Even if we had such a generic API, this LXC specific
API is still useful, because it allows the caller to maintain
the current process context, in particular any I/O streams they
have open.
NB the virDomainLxcEnterNamespace() API is special in that it
runs client side, so does not involve the internal driver API.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-12-21 13:15:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close FILE;
|
|
|
|
|
|
|
|
|
|
|
|
# And the same for the LXC specific APIs
|
|
|
|
|
|
|
|
open FILE, "<$symslxc"
|
|
|
|
or die "cannot read $symslxc: $!";
|
|
|
|
|
|
|
|
$prevvers = undef;
|
|
|
|
$vers = undef;
|
|
|
|
while (defined($line = <FILE>)) {
|
|
|
|
chomp $line;
|
|
|
|
next if $line =~ /^\s*#/;
|
|
|
|
next if $line =~ /^\s*$/;
|
|
|
|
next if $line =~ /^\s*(global|local):/;
|
|
|
|
if ($line =~ /^\s*LIBVIRT_LXC_(\d+\.\d+\.\d+)\s*{\s*$/) {
|
|
|
|
if (defined $vers) {
|
|
|
|
die "malformed syms file";
|
|
|
|
}
|
|
|
|
$vers = $1;
|
|
|
|
} elsif ($line =~ /\s*}\s*;\s*$/) {
|
|
|
|
if (defined $prevvers) {
|
|
|
|
die "malformed syms file";
|
|
|
|
}
|
|
|
|
$prevvers = $vers;
|
|
|
|
$vers = undef;
|
|
|
|
} elsif ($line =~ /\s*}\s*LIBVIRT_LXC_(\d+\.\d+\.\d+)\s*;\s*$/) {
|
|
|
|
if ($1 ne $prevvers) {
|
|
|
|
die "malformed syms file $1 != $vers";
|
|
|
|
}
|
|
|
|
$prevvers = $vers;
|
|
|
|
$vers = undef;
|
|
|
|
} elsif ($line =~ /\s*(\w+)\s*;\s*$/) {
|
|
|
|
$apis{$1} = $vers;
|
|
|
|
} else {
|
|
|
|
die "unexpected data $line\n";
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
close FILE;
|
|
|
|
|
|
|
|
|
|
|
|
# Some special things which aren't public APIs,
|
|
|
|
# but we want to report
|
2013-04-22 17:25:01 +00:00
|
|
|
$apis{virConnectSupportsFeature} = "0.3.2";
|
2011-05-13 10:00:56 +00:00
|
|
|
$apis{virDomainMigratePrepare} = "0.3.2";
|
|
|
|
$apis{virDomainMigratePerform} = "0.3.2";
|
|
|
|
$apis{virDomainMigrateFinish} = "0.3.2";
|
|
|
|
$apis{virDomainMigratePrepare2} = "0.5.0";
|
|
|
|
$apis{virDomainMigrateFinish2} = "0.5.0";
|
|
|
|
$apis{virDomainMigratePrepareTunnel} = "0.7.2";
|
|
|
|
|
|
|
|
$apis{virDomainMigrateBegin3} = "0.9.2";
|
|
|
|
$apis{virDomainMigratePrepare3} = "0.9.2";
|
|
|
|
$apis{virDomainMigratePrepareTunnel3} = "0.9.2";
|
|
|
|
$apis{virDomainMigratePerform3} = "0.9.2";
|
|
|
|
$apis{virDomainMigrateFinish3} = "0.9.2";
|
Introduce yet another migration version in API.
Migration just seems to go from bad to worse. We already had to
introduce a second migration protocol when adding the QEMU driver,
since the one from Xen was insufficiently flexible to cope with
passing the data the QEMU driver required.
It turns out that this protocol still has some flaws that we
need to address. The current sequence is
* Src: DumpXML
- Generate XML to pass to dst
* Dst: Prepare
- Get ready to accept incoming VM
- Generate optional cookie to pass to src
* Src: Perform
- Start migration and wait for send completion
- Kill off VM if successful, resume if failed
* Dst: Finish
- Wait for recv completion and check status
- Kill off VM if unsuccessful
The problems with this are:
- Since the first step is a generic 'DumpXML' call, we can't
add in other migration specific data. eg, we can't include
any VM lease data from lock manager plugins
- Since the first step is a generic 'DumpXML' call, we can't
emit any 'migration begin' event on the source, or have
any hook that runs right at the start of the process
- Since there is no final step on the source, if the Finish
method fails to receive all migration data & has to kill
the VM, then there's no way to resume the original VM
on the source
This patch attempts to introduce a version 3 that uses the
improved 5 step sequence
* Src: Begin
- Generate XML to pass to dst
- Generate optional cookie to pass to dst
* Dst: Prepare
- Get ready to accept incoming VM
- Generate optional cookie to pass to src
* Src: Perform
- Start migration and wait for send completion
- Generate optional cookie to pass to dst
* Dst: Finish
- Wait for recv completion and check status
- Kill off VM if failed, resume if success
- Generate optional cookie to pass to src
* Src: Confirm
- Kill off VM if success, resume if failed
The API is designed to allow both input and output cookies
in all methods where applicable. This lets us pass around
arbitrary extra driver specific data between src & dst during
migration. Combined with the extra 'Begin' method this lets
us pass lease information from source to dst at the start of
migration
Moving the killing of the source VM out of Perform and
into Confirm, means we can now recover if the dst host
can't successfully Finish receiving migration data.
2010-11-02 12:43:44 +00:00
|
|
|
$apis{virDomainMigrateConfirm3} = "0.9.2";
|
2011-05-13 10:00:56 +00:00
|
|
|
|
2013-05-20 14:59:08 +00:00
|
|
|
$apis{virDomainMigrateBegin3Params} = "1.1.0";
|
|
|
|
$apis{virDomainMigratePrepare3Params} = "1.1.0";
|
|
|
|
$apis{virDomainMigratePrepareTunnel3Params} = "1.1.0";
|
|
|
|
$apis{virDomainMigratePerform3Params} = "1.1.0";
|
|
|
|
$apis{virDomainMigrateFinish3Params} = "1.1.0";
|
|
|
|
$apis{virDomainMigrateConfirm3Params} = "1.1.0";
|
|
|
|
|
2011-05-13 10:00:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Now we want to get the mapping between public APIs
|
|
|
|
# and driver struct fields. This lets us later match
|
|
|
|
# update the driver impls with the public APis.
|
|
|
|
|
|
|
|
# Group name -> hash of APIs { fields -> api name }
|
|
|
|
my %groups;
|
|
|
|
my $ingrp;
|
2014-11-11 16:28:26 +00:00
|
|
|
foreach my $drivertable (@drivertable) {
|
|
|
|
open FILE, "<$drivertable"
|
|
|
|
or die "cannot read $drivertable: $!";
|
|
|
|
|
|
|
|
while (defined($line = <FILE>)) {
|
|
|
|
if ($line =~ /struct _(vir\w*Driver)/) {
|
|
|
|
my $grp = $1;
|
|
|
|
if ($grp ne "virStateDriver" &&
|
|
|
|
$grp ne "virStreamDriver") {
|
|
|
|
$ingrp = $grp;
|
|
|
|
warn "[$ingrp]";
|
|
|
|
$groups{$ingrp} = { apis => {}, drivers => {} };
|
|
|
|
}
|
|
|
|
} elsif ($ingrp) {
|
|
|
|
if ($line =~ /^\s*vir(?:Drv)(\w+)\s+(\w+);\s*$/) {
|
|
|
|
my $field = $2;
|
|
|
|
my $name = $1;
|
|
|
|
|
|
|
|
my $api;
|
|
|
|
if (exists $apis{"vir$name"}) {
|
|
|
|
$api = "vir$name";
|
|
|
|
} elsif ($name =~ /\w+(Open|Close)/) {
|
|
|
|
next;
|
|
|
|
} else {
|
|
|
|
die "driver $name does not have a public API";
|
|
|
|
}
|
|
|
|
$groups{$ingrp}->{apis}->{$field} = $api;
|
|
|
|
} elsif ($line =~ /};/) {
|
|
|
|
$ingrp = undef;
|
2012-07-27 12:51:28 +00:00
|
|
|
}
|
|
|
|
}
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
|
2014-11-11 16:28:26 +00:00
|
|
|
close FILE;
|
|
|
|
}
|
2011-05-13 10:00:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Finally, we read all the primary driver files and extract
|
|
|
|
# the driver API tables from each one.
|
|
|
|
|
|
|
|
foreach my $src (@srcs) {
|
|
|
|
open FILE, "<$src" or
|
2012-07-27 12:51:28 +00:00
|
|
|
die "cannot read $src: $!";
|
2011-05-13 10:00:56 +00:00
|
|
|
|
|
|
|
$ingrp = undef;
|
|
|
|
my $impl;
|
|
|
|
while (defined($line = <FILE>)) {
|
2012-07-27 12:51:28 +00:00
|
|
|
if (!$ingrp) {
|
|
|
|
foreach my $grp (keys %groups) {
|
|
|
|
if ($line =~ /^\s*(?:static\s+)?$grp\s+(\w+)\s*=\s*{/ ||
|
|
|
|
$line =~ /^\s*(?:static\s+)?$grp\s+NAME\(\w+\)\s*=\s*{/) {
|
|
|
|
$ingrp = $grp;
|
|
|
|
$impl = $src;
|
|
|
|
|
|
|
|
if ($impl =~ m,.*/node_device_(\w+)\.c,) {
|
|
|
|
$impl = $1;
|
|
|
|
} else {
|
|
|
|
$impl =~ s,.*/(\w+?)_((\w+)_)?(\w+)\.c,$1,;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($groups{$ingrp}->{drivers}->{$impl}) {
|
|
|
|
die "Group $ingrp already contains $impl";
|
|
|
|
}
|
|
|
|
|
|
|
|
$groups{$ingrp}->{drivers}->{$impl} = {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
if ($line =~ m!\s*\.(\w+)\s*=\s*(\w+)\s*,?\s*(?:/\*\s*(\d+\.\d+\.\d+)\s*\*/\s*)?$!) {
|
|
|
|
my $api = $1;
|
|
|
|
my $meth = $2;
|
|
|
|
my $vers = $3;
|
|
|
|
|
|
|
|
next if $api eq "no" || $api eq "name";
|
|
|
|
|
|
|
|
die "Method $meth in $src is missing version" unless defined $vers;
|
|
|
|
|
|
|
|
die "Driver method for $api is NULL in $src" if $meth eq "NULL";
|
|
|
|
|
|
|
|
if (!exists($groups{$ingrp}->{apis}->{$api})) {
|
2013-04-23 12:49:21 +00:00
|
|
|
next if $api =~ /\w(Open|Close)/;
|
|
|
|
|
2012-07-27 12:51:28 +00:00
|
|
|
die "Found unexpected method $api in $ingrp\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$groups{$ingrp}->{drivers}->{$impl}->{$api} = $vers;
|
|
|
|
if ($api eq "domainMigratePrepare" ||
|
|
|
|
$api eq "domainMigratePrepare2" ||
|
|
|
|
$api eq "domainMigratePrepare3") {
|
|
|
|
$groups{$ingrp}->{drivers}->{$impl}->{"domainMigrate"} = $vers
|
|
|
|
unless $groups{$ingrp}->{drivers}->{$impl}->{"domainMigrate"};
|
|
|
|
}
|
|
|
|
|
|
|
|
} elsif ($line =~ /}/) {
|
|
|
|
$ingrp = undef;
|
|
|
|
}
|
|
|
|
}
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
close FILE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# The '.open' driver method is used for 3 public APIs, so we
|
|
|
|
# have a bit of manual fixup todo with the per-driver versioning
|
|
|
|
# and support matrix
|
|
|
|
|
2014-11-11 16:28:26 +00:00
|
|
|
$groups{virHypervisorDriver}->{apis}->{"openAuth"} = "virConnectOpenAuth";
|
|
|
|
$groups{virHypervisorDriver}->{apis}->{"openReadOnly"} = "virConnectOpenReadOnly";
|
|
|
|
$groups{virHypervisorDriver}->{apis}->{"domainMigrate"} = "virDomainMigrate";
|
2011-05-13 10:00:56 +00:00
|
|
|
|
|
|
|
my $openAuthVers = (0 * 1000 * 1000) + (4 * 1000) + 0;
|
|
|
|
|
2014-11-11 16:28:26 +00:00
|
|
|
foreach my $drv (keys %{$groups{"virHypervisorDriver"}->{drivers}}) {
|
|
|
|
my $openVersStr = $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpen"};
|
2011-05-13 10:00:56 +00:00
|
|
|
my $openVers;
|
|
|
|
if ($openVersStr =~ /(\d+)\.(\d+)\.(\d+)/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
$openVers = ($1 * 1000 * 1000) + ($2 * 1000) + $3;
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# virConnectOpenReadOnly always matches virConnectOpen version
|
2014-11-11 16:28:26 +00:00
|
|
|
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenReadOnly"} =
|
|
|
|
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpen"};
|
2011-05-13 10:00:56 +00:00
|
|
|
|
|
|
|
# virConnectOpenAuth is always 0.4.0 if the driver existed
|
|
|
|
# before this time, otherwise it matches the version of
|
|
|
|
# the driver's virConnectOpen entry
|
|
|
|
if ($openVersStr eq "Y" ||
|
2012-07-27 12:51:28 +00:00
|
|
|
$openVers >= $openAuthVers) {
|
2014-11-11 16:28:26 +00:00
|
|
|
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAuth"} = $openVersStr;
|
2011-05-13 10:00:56 +00:00
|
|
|
} else {
|
2014-11-11 16:28:26 +00:00
|
|
|
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"connectOpenAuth"} = "0.4.0";
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Another special case for the virDomainCreateLinux which was replaced
|
|
|
|
# with virDomainCreateXML
|
2014-11-11 16:28:26 +00:00
|
|
|
$groups{virHypervisorDriver}->{apis}->{"domainCreateLinux"} = "virDomainCreateLinux";
|
2011-05-13 10:00:56 +00:00
|
|
|
|
|
|
|
my $createAPIVers = (0 * 1000 * 1000) + (0 * 1000) + 3;
|
|
|
|
|
2014-11-11 16:28:26 +00:00
|
|
|
foreach my $drv (keys %{$groups{"virHypervisorDriver"}->{drivers}}) {
|
|
|
|
my $createVersStr = $groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateXML"};
|
2011-05-13 10:00:56 +00:00
|
|
|
next unless defined $createVersStr;
|
|
|
|
my $createVers;
|
|
|
|
if ($createVersStr =~ /(\d+)\.(\d+)\.(\d+)/) {
|
2012-07-27 12:51:28 +00:00
|
|
|
$createVers = ($1 * 1000 * 1000) + ($2 * 1000) + $3;
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# virCreateLinux is always 0.0.3 if the driver existed
|
|
|
|
# before this time, otherwise it matches the version of
|
|
|
|
# the driver's virCreateXML entry
|
|
|
|
if ($createVersStr eq "Y" ||
|
2012-07-27 12:51:28 +00:00
|
|
|
$createVers >= $createAPIVers) {
|
2014-11-11 16:28:26 +00:00
|
|
|
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = $createVersStr;
|
2011-05-13 10:00:56 +00:00
|
|
|
} else {
|
2014-11-11 16:28:26 +00:00
|
|
|
$groups{"virHypervisorDriver"}->{drivers}->{$drv}->{"domainCreateLinux"} = "0.0.3";
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Finally we generate the HTML file with the tables
|
|
|
|
|
|
|
|
print <<EOF;
|
2013-05-07 10:18:10 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
2011-05-13 10:00:56 +00:00
|
|
|
<head>
|
|
|
|
<title>libvirt API support matrix</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>libvirt API support matrix</h1>
|
|
|
|
|
|
|
|
<ul id="toc"></ul>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
This page documents which <a href="html/">libvirt calls</a> work on
|
|
|
|
which libvirt drivers / hypervisors, and which version the API appeared
|
|
|
|
in.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2014-11-11 16:28:26 +00:00
|
|
|
foreach my $grp (sort { $a cmp $b } keys %groups) {
|
2011-05-13 10:00:56 +00:00
|
|
|
print "<h2><a name=\"$grp\">", $groupheaders{$grp}, "</a></h2>\n";
|
|
|
|
print <<EOF;
|
|
|
|
<table class="top_table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>API</th>
|
|
|
|
<th>Version</th>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
foreach my $drv (sort { $a cmp $b } keys %{$groups{$grp}->{drivers}}) {
|
2012-07-27 12:51:28 +00:00
|
|
|
print " <th>$drv</th>\n";
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
my $row = 0;
|
|
|
|
foreach my $field (sort {
|
2012-07-27 12:51:28 +00:00
|
|
|
$groups{$grp}->{apis}->{$a}
|
|
|
|
cmp
|
|
|
|
$groups{$grp}->{apis}->{$b}
|
|
|
|
} keys %{$groups{$grp}->{apis}}) {
|
|
|
|
my $api = $groups{$grp}->{apis}->{$field};
|
|
|
|
my $vers = $apis{$api};
|
|
|
|
print <<EOF;
|
2011-05-13 10:00:56 +00:00
|
|
|
<tr>
|
|
|
|
<td><a href=\"html/libvirt-libvirt.html#$api\">$api</a></td>
|
|
|
|
<td>$vers</td>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
foreach my $drv (sort {$a cmp $b } keys %{$groups{$grp}->{drivers}}) {
|
2012-07-27 12:51:28 +00:00
|
|
|
if (exists $groups{$grp}->{drivers}->{$drv}->{$field}) {
|
|
|
|
print "<td>", $groups{$grp}->{drivers}->{$drv}->{$field}, "</td>\n";
|
|
|
|
} else {
|
|
|
|
print "<td></td>\n";
|
|
|
|
}
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
|
2012-07-27 12:51:28 +00:00
|
|
|
print <<EOF;
|
2011-05-13 10:00:56 +00:00
|
|
|
</tr>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
$row++;
|
|
|
|
if (($row % 15) == 0) {
|
|
|
|
print <<EOF;
|
|
|
|
<tr>
|
|
|
|
<th>API</th>
|
|
|
|
<th>Version</th>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
foreach my $drv (sort { $a cmp $b } keys %{$groups{$grp}->{drivers}}) {
|
2012-07-27 12:51:28 +00:00
|
|
|
print " <th>$drv</th>\n";
|
2011-05-13 10:00:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
</tr>
|
|
|
|
EOF
|
2012-07-27 12:51:28 +00:00
|
|
|
}
|
2011-05-13 10:00:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
print <<EOF;
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOF
|