move OVF module over from qemu-server
Copy over the PVE::QemuServer::OVF module and relevant OVF tests from the qemu-server package/repo. We need it here for implementing the import content type support to generic directory based plugins. So it will also use PVE::Storage modules and thus anything higher, or a different package, makes things only harder for now. Put the OVF module under the new PVE::GuestImport module namespace. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> [ TL: rework commit message to avoid file endings and clarify intentions ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
bffcbe2662
commit
5005ff5ab9
71
src/test/run_ovf_tests.pl
Executable file
71
src/test/run_ovf_tests.pl
Executable file
@ -0,0 +1,71 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use lib qw(..); # prepend .. to @INC so we use the local version of PVE packages
|
||||
|
||||
use FindBin '$Bin';
|
||||
use PVE::GuestImport::OVF;
|
||||
use Test::More;
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
my $test_manifests = join ('/', $Bin, 'ovf_manifests');
|
||||
|
||||
print "parsing ovfs\n";
|
||||
|
||||
my $win2008 = eval { PVE::GuestImport::OVF::parse_ovf("$test_manifests/Win_2008_R2_two-disks.ovf") };
|
||||
if (my $err = $@) {
|
||||
fail('parse win2008');
|
||||
warn("error: $err\n");
|
||||
} else {
|
||||
ok('parse win2008');
|
||||
}
|
||||
my $win10 = eval { PVE::GuestImport::OVF::parse_ovf("$test_manifests/Win10-Liz.ovf") };
|
||||
if (my $err = $@) {
|
||||
fail('parse win10');
|
||||
warn("error: $err\n");
|
||||
} else {
|
||||
ok('parse win10');
|
||||
}
|
||||
my $win10noNs = eval { PVE::GuestImport::OVF::parse_ovf("$test_manifests/Win10-Liz_no_default_ns.ovf") };
|
||||
if (my $err = $@) {
|
||||
fail("parse win10 no default rasd NS");
|
||||
warn("error: $err\n");
|
||||
} else {
|
||||
ok('parse win10 no default rasd NS');
|
||||
}
|
||||
|
||||
print "testing disks\n";
|
||||
|
||||
is($win2008->{disks}->[0]->{disk_address}, 'scsi0', 'multidisk vm has the correct first disk controller');
|
||||
is($win2008->{disks}->[0]->{backing_file}, "$test_manifests/disk1.vmdk", 'multidisk vm has the correct first disk backing device');
|
||||
is($win2008->{disks}->[0]->{virtual_size}, 2048, 'multidisk vm has the correct first disk size');
|
||||
|
||||
is($win2008->{disks}->[1]->{disk_address}, 'scsi1', 'multidisk vm has the correct second disk controller');
|
||||
is($win2008->{disks}->[1]->{backing_file}, "$test_manifests/disk2.vmdk", 'multidisk vm has the correct second disk backing device');
|
||||
is($win2008->{disks}->[1]->{virtual_size}, 2048, 'multidisk vm has the correct second disk size');
|
||||
|
||||
is($win10->{disks}->[0]->{disk_address}, 'scsi0', 'single disk vm has the correct disk controller');
|
||||
is($win10->{disks}->[0]->{backing_file}, "$test_manifests/Win10-Liz-disk1.vmdk", 'single disk vm has the correct disk backing device');
|
||||
is($win10->{disks}->[0]->{virtual_size}, 2048, 'single disk vm has the correct size');
|
||||
|
||||
is($win10noNs->{disks}->[0]->{disk_address}, 'scsi0', 'single disk vm (no default rasd NS) has the correct disk controller');
|
||||
is($win10noNs->{disks}->[0]->{backing_file}, "$test_manifests/Win10-Liz-disk1.vmdk", 'single disk vm (no default rasd NS) has the correct disk backing device');
|
||||
is($win10noNs->{disks}->[0]->{virtual_size}, 2048, 'single disk vm (no default rasd NS) has the correct size');
|
||||
|
||||
print "\ntesting vm.conf extraction\n";
|
||||
|
||||
is($win2008->{qm}->{name}, 'Win2008-R2x64', 'win2008 VM name is correct');
|
||||
is($win2008->{qm}->{memory}, '2048', 'win2008 VM memory is correct');
|
||||
is($win2008->{qm}->{cores}, '1', 'win2008 VM cores are correct');
|
||||
|
||||
is($win10->{qm}->{name}, 'Win10-Liz', 'win10 VM name is correct');
|
||||
is($win10->{qm}->{memory}, '6144', 'win10 VM memory is correct');
|
||||
is($win10->{qm}->{cores}, '4', 'win10 VM cores are correct');
|
||||
|
||||
is($win10noNs->{qm}->{name}, 'Win10-Liz', 'win10 VM (no default rasd NS) name is correct');
|
||||
is($win10noNs->{qm}->{memory}, '6144', 'win10 VM (no default rasd NS) memory is correct');
|
||||
is($win10noNs->{qm}->{cores}, '4', 'win10 VM (no default rasd NS) cores are correct');
|
||||
|
||||
done_testing();
|
||||
Reference in New Issue
Block a user