update qemu-server to 8.3.0+port3+pxcloud
This commit is contained in:
parent
30c005c6f3
commit
b33b2f31e4
@ -4,7 +4,7 @@ PKGNAME=$(basename $SCRIPT_DIR)
|
||||
|
||||
echo "This is $PKGNAME build scripts"
|
||||
|
||||
. ../common.sh
|
||||
source $SCRIPT_DIR/../common.sh
|
||||
|
||||
cd $SCRIPT_DIR/$PKGNAME
|
||||
cd $SCRIPT_DIR/$PKGNAME
|
||||
exec_build_make
|
||||
|
||||
@ -0,0 +1,410 @@
|
||||
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
|
||||
index c52f00d2..36e3f65c 100644
|
||||
--- a/PVE/API2/Qemu.pm
|
||||
+++ b/PVE/API2/Qemu.pm
|
||||
@@ -666,6 +666,8 @@ my $generaloptions = {
|
||||
'autostart' => 1,
|
||||
'bios' => 1,
|
||||
'description' => 1,
|
||||
+ 'initrd' =>1,
|
||||
+ 'kernel' =>1,
|
||||
'keyboard' => 1,
|
||||
'localtime' => 1,
|
||||
'migrate_downtime' => 1,
|
||||
@@ -1237,7 +1239,7 @@ __PACKAGE__->register_method({
|
||||
|
||||
my $machine_conf = PVE::QemuServer::Machine::parse_machine($conf->{machine});
|
||||
my $machine = $machine_conf->{type};
|
||||
- if (!$machine || $machine =~ m/^(?:pc|q35|virt)$/) {
|
||||
+ if (!$machine || $machine =~ m/^(?:pc|q35|virt|microvm)$/) {
|
||||
# always pin Windows' machine version on create, they get to easily confused
|
||||
if (PVE::QemuServer::Helpers::windows_version($conf->{ostype})) {
|
||||
$machine_conf->{type} = PVE::QemuServer::windows_get_pinned_machine_version($machine);
|
||||
@@ -1374,6 +1376,7 @@ __PACKAGE__->register_method({
|
||||
{ subdir => 'rrddata' },
|
||||
{ subdir => 'monitor' },
|
||||
{ subdir => 'agent' },
|
||||
+ { subdir => 'showcmd'},
|
||||
{ subdir => 'snapshot' },
|
||||
{ subdir => 'spiceproxy' },
|
||||
{ subdir => 'sendkey' },
|
||||
@@ -6219,4 +6222,30 @@ __PACKAGE__->register_method({
|
||||
return { socket => $socket };
|
||||
}});
|
||||
|
||||
+__PACKAGE__->register_method ({
|
||||
+ name => 'showcmd',
|
||||
+ path => '{vmid}/showcmd',
|
||||
+ method => 'GET',
|
||||
+ description => "Show command line which is used to start the VM (debug info).",
|
||||
+ parameters => {
|
||||
+ additionalProperties => 0,
|
||||
+ properties => {
|
||||
+ node => get_standard_option('pve-node'),
|
||||
+ vmid => get_standard_option('pve-vmid')
|
||||
+ },
|
||||
+ },
|
||||
+ permissions => {
|
||||
+ check => ['perm', '/vms/{vmid}', [ 'VM.Audit' ]],
|
||||
+ },
|
||||
+ returns => {
|
||||
+ type => "string"
|
||||
+ },
|
||||
+ code => sub {
|
||||
+ my ($param) = @_;
|
||||
+
|
||||
+ my $storecfg = PVE::Storage::config();
|
||||
+ my $cmdline = PVE::QemuServer::vm_commandline($storecfg, $param->{vmid}, $param->{snapshot});
|
||||
+ return "$cmdline";
|
||||
+ }});
|
||||
+
|
||||
1;
|
||||
diff --git a/PVE/API2/Qemu/Machine.pm b/PVE/API2/Qemu/Machine.pm
|
||||
index db6c3d80..6a1ad84d 100644
|
||||
--- a/PVE/API2/Qemu/Machine.pm
|
||||
+++ b/PVE/API2/Qemu/Machine.pm
|
||||
@@ -38,7 +38,7 @@ __PACKAGE__->register_method({
|
||||
},
|
||||
type => {
|
||||
type => 'string',
|
||||
- enum => ['q35', 'virt'],
|
||||
+ enum => ['q35', 'virt','i440fx','microvm'],
|
||||
description => "The machine type.",
|
||||
},
|
||||
version => {
|
||||
@@ -50,7 +50,7 @@ __PACKAGE__->register_method({
|
||||
},
|
||||
code => sub {
|
||||
my $machines = eval {
|
||||
- my $raw = file_get_contents('/usr/share/kvm/machine-versions-aarch64.json');
|
||||
+ my $raw = file_get_contents('/usr/share/kvm/machine-versions.json');
|
||||
return from_json($raw, { utf8 => 1 });
|
||||
};
|
||||
die "could not load supported machine versions - $@\n" if $@;
|
||||
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
|
||||
index 687135cf..088aaee1 100644
|
||||
--- a/PVE/QemuServer.pm
|
||||
+++ b/PVE/QemuServer.pm
|
||||
@@ -247,7 +247,7 @@ my $vga_fmt = {
|
||||
default => 'std',
|
||||
optional => 1,
|
||||
default_key => 1,
|
||||
- enum => [qw(cirrus qxl qxl2 qxl3 qxl4 none serial0 serial1 serial2 serial3 std virtio virtio-gl vmware ramfb)],
|
||||
+ enum => [qw(cirrus qxl qxl2 qxl3 qxl4 none serial0 serial1 serial2 serial3 std virtio virtio-gl vmware ramfb mdev)],
|
||||
},
|
||||
memory => {
|
||||
description => "Sets the VGA memory (in MiB). Has no effect with serial display.",
|
||||
@@ -577,6 +577,121 @@ EODESC
|
||||
type => 'boolean',
|
||||
description => "Enable/disable KVM hardware virtualization.",
|
||||
default => 1,
|
||||
+ },
|
||||
+ pxclouduser => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxcloud-user to access this vm.",
|
||||
+ },
|
||||
+ pxclouduuid => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxclouduuid.",
|
||||
+ },
|
||||
+ pxvdipolicy => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxvdi policy .",
|
||||
+ },
|
||||
+ pxvdipolicycontype => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxvdi connect policy .",
|
||||
+ enum => [qw(freerdp2 freerdp3 pciop blast spice)],
|
||||
+ },
|
||||
+ pxvdipolicynetwork => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxvdi freerdp netowrk policy.",
|
||||
+ enum => [qw(auto lan modem broadband broadband-low broadband-high wan)],
|
||||
+ },
|
||||
+ #pxvdi usb policy
|
||||
+ pxvdipolicyusb => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Set pxvdi usb policy.",
|
||||
+ default => 1,
|
||||
+ },
|
||||
+ #pxvdi sound policy
|
||||
+ pxvdipolicysound => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Set pxvdi sound policy.",
|
||||
+ default => 1,
|
||||
+ },
|
||||
+ pxvdipolicymic => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Set pxvdi mic policy.",
|
||||
+ default => 1,
|
||||
+ },
|
||||
+ pxvdipolicyclipboard => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Set pxvdi clipboard policy.",
|
||||
+ default => 1,
|
||||
+ },
|
||||
+ pxvdipolicybpp => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxvdi bpp policy.",
|
||||
+ enum => [qw(8 16 24 32)],
|
||||
+ },
|
||||
+ pxvdipolicydecode => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxvdi decode policy.",
|
||||
+ enum => [qw(440 420 400)],
|
||||
+ },
|
||||
+ pxvdipolicymenu => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Set pxvdi vmware menu bar policy.",
|
||||
+ default => 1,
|
||||
+ },
|
||||
+ pxvdipolicydrive => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Set pxvdi drive policy.",
|
||||
+ default => 1,
|
||||
+ },
|
||||
+ pxvdipolicymonitors => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Set pxvdi monitors policy.",
|
||||
+ default => 1,
|
||||
+ },
|
||||
+ pxvdipolicyprinter => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Set pxvdi printer policy.",
|
||||
+ default => 1,
|
||||
+ },
|
||||
+ pxvdimac => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxvdi mac.",
|
||||
+ },
|
||||
+ pxvdiip => {
|
||||
+ optional => 1,
|
||||
+ type => 'string',
|
||||
+ description => "Set pxvdi ip.",
|
||||
+ },
|
||||
+ noboot => {
|
||||
+ optional => 1,
|
||||
+ type => 'boolean',
|
||||
+ description => "Enable/disable VM start.",
|
||||
+ default => 0,
|
||||
+ },
|
||||
+ kernel =>{
|
||||
+ type => 'string', format => 'pve-volume-id',
|
||||
+ description => "microvm or linux direct boot kernel",
|
||||
+ optional => 1,
|
||||
+ },
|
||||
+ initrd =>{
|
||||
+ type => 'string', format => 'pve-volume-id',
|
||||
+ description => "microvm or linux direct boot initd",
|
||||
+ optional => 1,
|
||||
},
|
||||
tdf => {
|
||||
optional => 1,
|
||||
@@ -1751,11 +1866,18 @@ sub print_netdevice_full {
|
||||
|
||||
my $device = $net->{model};
|
||||
if ($net->{model} eq 'virtio') {
|
||||
- $device = 'virtio-net-pci';
|
||||
+ if ($machine_type =~ /microvm/ ){
|
||||
+ $device = 'virtio-net-device';
|
||||
+ }else{
|
||||
+ $device = 'virtio-net-pci';
|
||||
+ }
|
||||
};
|
||||
|
||||
my $pciaddr = print_pci_addr("$netid", $bridges, $arch, $machine_type);
|
||||
my $tmpstr = "$device,mac=$net->{macaddr},netdev=$netid$pciaddr,id=$netid";
|
||||
+ if ($machine_type =~ /microvm/ ){
|
||||
+ $tmpstr = "$device,mac=$net->{macaddr},netdev=$netid,id=$netid";
|
||||
+ }
|
||||
if ($net->{queues} && $net->{queues} > 1 && $net->{model} eq 'virtio'){
|
||||
# Consider we have N queues, the number of vectors needed is 2 * N + 2, i.e., one per in
|
||||
# and out of each queue plus one config interrupt and control vector queue
|
||||
@@ -1854,6 +1976,7 @@ my $vga_map = {
|
||||
'virtio' => 'virtio-vga',
|
||||
'virtio-gl' => 'virtio-gpu-gl',
|
||||
'ramfb' => 'ramfb',
|
||||
+ 'mdev' => 'mdev',
|
||||
};
|
||||
|
||||
sub print_vga_device {
|
||||
@@ -3401,7 +3524,7 @@ sub get_vm_machine {
|
||||
my $machine_conf = PVE::QemuServer::Machine::parse_machine($conf->{machine});
|
||||
my $machine = $forcemachine || $machine_conf->{type};
|
||||
|
||||
- if (!$machine || $machine =~ m/^(?:pc|q35|virt)$/) {
|
||||
+ if (!$machine || $machine =~ m/^(?:pc|q35|virt|microvm)$/) {
|
||||
$kvmversion //= kvm_user_version();
|
||||
# we must pin Windows VMs without a specific version to 5.1, as 5.2 fixed a bug in ACPI
|
||||
# layout which confuses windows quite a bit and may result in various regressions..
|
||||
@@ -3938,6 +4061,19 @@ sub config_to_command {
|
||||
|
||||
push @$cmd, '-no-reboot' if defined($conf->{reboot}) && $conf->{reboot} == 0;
|
||||
|
||||
+
|
||||
+ if ($conf->{kernel}){
|
||||
+ my $cfg = PVE::Storage::config();
|
||||
+ my $path = PVE::Storage::path ($cfg, $conf->{kernel});
|
||||
+ push @$cmd, '-kernel',$path;
|
||||
+ }
|
||||
+
|
||||
+ if ($conf->{initrd}){
|
||||
+ my $cfg = PVE::Storage::config();
|
||||
+ my $path = PVE::Storage::path ($cfg, $conf->{initrd});
|
||||
+ push @$cmd, '-initrd',$path;
|
||||
+ }
|
||||
+
|
||||
if ($vga->{type} && $vga->{type} !~ m/^serial\d+$/ && $vga->{type} ne 'none'){
|
||||
if ($vga->{type} eq 'ramfb'){
|
||||
push @$devices, '-device', 'ramfb';
|
||||
@@ -4001,7 +4137,11 @@ sub config_to_command {
|
||||
|
||||
if (!$guest_agent->{type} || $guest_agent->{type} eq 'virtio') {
|
||||
my $pciaddr = print_pci_addr("qga0", $bridges, $arch, $machine_type);
|
||||
- push @$devices, '-device', "virtio-serial,id=qga0$pciaddr";
|
||||
+ if ($machine_type =~ /microvm/){
|
||||
+ push @$devices, '-device', "virtio-serial,id=qga0";
|
||||
+ }else{
|
||||
+ push @$devices, '-device', "virtio-serial,id=qga0$pciaddr";
|
||||
+ }
|
||||
push @$devices, '-device', 'virtserialport,chardev=qga0,name=org.qemu.guest_agent.0';
|
||||
} elsif ($guest_agent->{type} eq 'isa') {
|
||||
push @$devices, '-device', "isa-serial,chardev=qga0";
|
||||
@@ -4084,6 +4224,11 @@ sub config_to_command {
|
||||
if (!defined($conf->{balloon}) || $conf->{balloon}) {
|
||||
my $pciaddr = print_pci_addr("balloon0", $bridges, $arch, $machine_type);
|
||||
my $ballooncmd = "virtio-balloon-pci,id=balloon0$pciaddr";
|
||||
+
|
||||
+ if ($machine_type =~ /microvm/){
|
||||
+ $ballooncmd = "virtio-balloon-device,id=balloon0";
|
||||
+ }
|
||||
+
|
||||
$ballooncmd .= ",free-page-reporting=on" if min_version($machine_version, 6, 2);
|
||||
push @$devices, '-device', $ballooncmd;
|
||||
}
|
||||
@@ -4247,7 +4392,9 @@ sub config_to_command {
|
||||
if ($q35) { # add after -readconfig pve-q35.cfg
|
||||
splice @$devices, 2, 0, '-device', $devstr;
|
||||
} else {
|
||||
- unshift @$devices, '-device', $devstr if $k > 0;
|
||||
+ if ($machine_type !~ /microvm/ ){
|
||||
+ unshift @$devices, '-device', $devstr if $k > 0;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4287,7 +4434,15 @@ sub config_to_command {
|
||||
|
||||
push @$cmd, @$devices;
|
||||
push @$cmd, '-rtc', join(',', @$rtcFlags) if scalar(@$rtcFlags);
|
||||
- push @$cmd, '-machine', join(',', @$machineFlags) if scalar(@$machineFlags);
|
||||
+
|
||||
+ if ($machine_type =~ /microvm/ && $arch ne 'x86_64'){
|
||||
+ die "microvm only support on x86_64!\n";
|
||||
+ }
|
||||
+ if ($machine_type =~ /microvm/ && $arch eq 'x86_64'){
|
||||
+ push @$cmd, '-machine','microvm,pit=off,pic=off,rtc=off,x-option-roms=on';
|
||||
+ }else{
|
||||
+ push @$cmd, '-machine', join(',', @$machineFlags) if scalar(@$machineFlags);
|
||||
+ }
|
||||
push @$cmd, '-global', join(',', @$globalFlags) if scalar(@$globalFlags);
|
||||
|
||||
if (my $vmstate = $conf->{vmstate}) {
|
||||
@@ -4427,6 +4582,11 @@ sub vm_deviceplug {
|
||||
|
||||
my $devicefull = "$scsihw_type,id=$deviceid$pciaddr";
|
||||
|
||||
+ if ($machine_type =~ /microvm/){
|
||||
+ $scsihw_type = 'virtio-scsi-device';
|
||||
+ $devicefull = "$scsihw_type,id=$deviceid";
|
||||
+ }
|
||||
+
|
||||
if($deviceid =~ m/^virtioscsi(\d+)$/ && $device->{iothread}) {
|
||||
qemu_iothread_add($vmid, $deviceid, $device);
|
||||
$devicefull .= ",iothread=iothread-$deviceid";
|
||||
@@ -5776,7 +5936,9 @@ sub vm_start {
|
||||
|
||||
die "you can't start a vm if it's a template\n"
|
||||
if !$params->{skiptemplate} && PVE::QemuConfig->is_template($conf);
|
||||
-
|
||||
+ if ($conf->{noboot}){
|
||||
+ die "VM can't start when noboot flag is true\n";
|
||||
+ }
|
||||
my $has_suspended_lock = PVE::QemuConfig->has_lock($conf, 'suspended');
|
||||
my $has_backup_lock = PVE::QemuConfig->has_lock($conf, 'backup');
|
||||
|
||||
diff --git a/PVE/QemuServer/Machine.pm b/PVE/QemuServer/Machine.pm
|
||||
index a3917dae..e2656c14 100644
|
||||
--- a/PVE/QemuServer/Machine.pm
|
||||
+++ b/PVE/QemuServer/Machine.pm
|
||||
@@ -18,7 +18,7 @@ my $machine_fmt = {
|
||||
default_key => 1,
|
||||
description => "Specifies the QEMU machine type.",
|
||||
type => 'string',
|
||||
- pattern => '(pc|pc(-i440fx)?-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|q35|pc-q35-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|virt(?:-\d+(\.\d+)+)?(\+pve\d+)?)',
|
||||
+ pattern => '(pc|pc(-i440fx)?-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|q35|microvm|pc-q35-\d+(\.\d+)+(\+pve\d+)?(\.pxe)?|virt(?:-\d+(\.\d+)+)?(\+pve\d+)?)',
|
||||
maxLength => 40,
|
||||
format_description => 'machine type',
|
||||
optional => 1,
|
||||
diff --git a/PVE/QemuServer/PCI.pm b/PVE/QemuServer/PCI.pm
|
||||
index 98141516..6eb23f7c 100644
|
||||
--- a/PVE/QemuServer/PCI.pm
|
||||
+++ b/PVE/QemuServer/PCI.pm
|
||||
@@ -46,6 +46,12 @@ EODESCR
|
||||
format => 'pve-configid',
|
||||
description => "The ID of a cluster wide mapping. Either this or the default-key 'host'"
|
||||
." must be set.",
|
||||
+ },
|
||||
+ ramfb => {
|
||||
+ type => 'boolean',
|
||||
+ description => "Show mdev device's ramfb",
|
||||
+ optional => 1,
|
||||
+ default => 0,
|
||||
},
|
||||
rombar => {
|
||||
type => 'boolean',
|
||||
@@ -853,6 +859,12 @@ sub print_hostpci_devices {
|
||||
my $mf_addr = $multifunction ? ".$j" : '';
|
||||
$devicestr .= ",id=${id}${mf_addr}${pciaddr}${mf_addr}";
|
||||
|
||||
+ my $mdevtype;
|
||||
+ $mdevtype = $d->{mdev} if $d->{mdev} ;
|
||||
+ if ($d->{mdev} && $mdevtype =~ /^(.*?)\-/) {
|
||||
+ $mdevtype =$1;
|
||||
+ }
|
||||
+
|
||||
if ($j == 0) {
|
||||
$devicestr .= ',rombar=0' if defined($d->{rombar}) && !$d->{rombar};
|
||||
$devicestr .= "$xvga";
|
||||
@@ -862,6 +874,15 @@ sub print_hostpci_devices {
|
||||
for my $option (qw(vendor-id device-id sub-vendor-id sub-device-id)) {
|
||||
$devicestr .= ",x-pci-$option=$d->{$option}" if $d->{$option};
|
||||
}
|
||||
+
|
||||
+ if ($vga->{type} eq 'mdev'){
|
||||
+ $devicestr .= ",display=on";
|
||||
+ if ($mdevtype eq "i915"){
|
||||
+ $devicestr .= ",x-igd-opregion=on" ;
|
||||
+ }
|
||||
+ $devicestr .= ",ramfb=on" if defined($d->{ramfb});
|
||||
+ $devicestr .= ",driver=vfio-pci-nohotplug";
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
@ -4,3 +4,4 @@ patches/003-fix-loongarch-nvram-and-acpi-issue.patch
|
||||
patches/changelog/001-update-to8.3.0+port1.patch
|
||||
patches/changelog/002-update-to8.3.0+port2.patch
|
||||
patches/changelog/003-update-to8.3.0+port3.patch
|
||||
patches/pxcloud/001-add-microvm-pxcloud.patch
|
||||
|
||||
Loading…
Reference in New Issue
Block a user