* [pve-devel] [PATCH container 1/1] Optional mapped devices at vm boot
[not found] <20241126015157.1107116-1-moddingfox@foxtek.us>
@ 2024-11-26 1:51 ` moddingfox via pve-devel
0 siblings, 0 replies; only message in thread
From: moddingfox via pve-devel @ 2024-11-26 1:51 UTC (permalink / raw)
To: pve-devel; +Cc: moddingfox, Tyst Marin
[-- Attachment #1: Type: message/rfc822, Size: 7589 bytes --]
From: moddingfox <moddingfox@gmail.com>
To: pve-devel@lists.proxmox.com
Cc: Tyst Marin <moddingfox@foxtek.us>
Subject: [PATCH container 1/1] Optional mapped devices at vm boot
Date: Tue, 26 Nov 2024 01:51:57 +0000
Message-ID: <20241126015157.1107116-2-moddingfox@foxtek.us>
From: Tyst Marin <moddingfox@foxtek.us>
This change intends to add support for optional mapped usb devices.
Currently if a mapped device is unplugged vm boot will fail, tihs will provide an option to ignore specified missing devices.
This keeps the default behavior while allowing for optional devices to be specified.
---
PVE/QemuServer/USB.pm | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/PVE/QemuServer/USB.pm b/PVE/QemuServer/USB.pm
index 017ef9c0..be2bef29 100644
--- a/PVE/QemuServer/USB.pm
+++ b/PVE/QemuServer/USB.pm
@@ -62,6 +62,12 @@ EODESCR
." is irrelevant (all devices are plugged into a xhci controller).",
default => 0,
},
+ bootwhenmissing => {
+ optional => 1,
+ type => 'boolean',
+ description => "Specifies whether given mapped usb device is optional at vm boot.",
+ default => 0,
+ },
};
PVE::JSONSchema::register_format('pve-qm-usb', $usb_fmt);
@@ -75,7 +81,7 @@ our $usbdesc = {
PVE::JSONSchema::register_standard_option("pve-qm-usb", $usbdesc);
sub parse_usb_device {
- my ($value, $mapping) = @_;
+ my ($value, $mapping, $bootwhenmissing) = @_;
return if $value && $mapping; # not a valid configuration
@@ -98,7 +104,11 @@ sub parse_usb_device {
PVE::Mapping::USB::assert_valid($mapping, $devices->[0]);
};
if (my $err = $@) {
- die "USB Mapping invalid (hardware probably changed): $err\n";
+ if (defined($bootwhenmissing) && $bootwhenmissing == 1) {
+ print "USB Mapping invalid (hardware probably changed): $err\n";
+ } else {
+ die "USB Mapping invalid (hardware probably changed): $err\n";
+ }
}
my $device = $devices->[0];
@@ -228,7 +238,7 @@ sub print_usbdevice_full {
$usbdevice .= ",port=$port" if defined($port);
}
- my $parsed = parse_usb_device($device->{host}, $device->{mapping});
+ my $parsed = parse_usb_device($device->{host}, $device->{mapping}, $device->{bootwhenmissing});
if (defined($parsed->{vendorid}) && defined($parsed->{productid})) {
$usbdevice .= ",vendorid=0x$parsed->{vendorid},productid=0x$parsed->{productid}";
--
2.39.5
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-11-26 10:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20241126015157.1107116-1-moddingfox@foxtek.us>
2024-11-26 1:51 ` [pve-devel] [PATCH container 1/1] Optional mapped devices at vm boot moddingfox via pve-devel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox