Skip to content

Commit

Permalink
Merge branch 'release/2.1.7' of github.com:UPC/ravada into release/2.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiejol committed Dec 12, 2023
2 parents 754dd0a + 3ebb5da commit 138dacd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/Ravada/VM/KVM.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ sub _domain_create_common {
$self->_xml_add_guest_agent($xml);
$self->_xml_clean_machine_type($xml) if !$self->is_local;
$self->_xml_add_sysinfo_entry($xml, hostname => $args{name});
$self->_xml_fix_nvram($xml, $args{name});

my $dom;

Expand Down Expand Up @@ -1997,6 +1998,12 @@ sub _xml_add_uefi($self, $doc, $name) {
$nvram->appendText("/var/lib/libvirt/qemu/nvram/$name.fd");
}
sub _xml_fix_nvram($self, $xml, $name) {
my ($nvram) =$xml->findnodes("/domain/os/nvram/text()");
return if !$nvram;
$nvram->setData("/var/lib/libvirt/qemu/nvram/$name.fd");
}
sub _xml_remove_cpu {
my $doc = shift;
my ($domain) = $doc->findnodes('/domain') or confess "Missing node domain";
Expand Down
36 changes: 36 additions & 0 deletions t/kvm/uefi.t
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,39 @@ sub test_drives($doc) {
}
}

sub test_nvram($vm) {
my $name = new_domain_name();
my $id_iso = search_id_iso('Alpine');

my $req = Ravada::Request->create_domain(
name => $name
,vm => $vm->type
,id_iso => $id_iso
,id_owner => user_admin->id
,memory => 512 * 1024
,disk => 1024 * 1024
,options => { uefi => 1, machine => 'q35' }
);
wait_request();
my $domain = $vm->search_domain($name);
ok($domain);
my $config = $domain->xml_description();
my $doc = XML::LibXML->load_xml(string => $config);
my ($nvram) = $doc->findnodes("/domain/os/nvram");
ok($nvram,"Expecting /domain/os/nvram");

$domain->prepare_base(user_admin);

my $clone = $domain->clone(user => user_admin, name => new_domain_name);
my $config_clone = $clone->xml_description();
my $doc_clone = XML::LibXML->load_xml(string => $config_clone);
my ($nvram_clone) = $doc_clone->findnodes("/domain/os/nvram");
ok($nvram_clone,"Expecting /domain/os/nvram");
isnt($nvram_clone->toString, $nvram->toString);

remove_domain($domain);
}

########################################################################

init();
Expand All @@ -348,13 +381,16 @@ for my $vm_name ( 'KVM' ) {
diag($msg) if !$vm;
skip $msg,10 if !$vm;

test_nvram($vm);

test_threads($vm);

test_isos($vm);
test_req_machine_types($vm);
test_req_machine_types2($vm);
test_machine_types($vm);
test_uefi($vm);

}
}

Expand Down

0 comments on commit 138dacd

Please sign in to comment.