[pbs-devel] [PATCH v2 proxmox-backup 2/3] node: status: added bootmode

Gabriel Goller g.goller at proxmox.com
Mon Nov 27 09:26:41 CET 2023


On 11/24/23 15:20, Lukas Wagner wrote:

>
>
> On 11/24/23 13:02, Gabriel Goller wrote:
>>   +fn boot_mode_to_info(bm: boot_mode::BootModeInformation) -> 
>> BootModeInformation {
>> +    match bm {
>> +        boot_mode::BootModeInformation::Efi => 
>> BootModeInformation::Efi,
>> +        boot_mode::BootModeInformation::EfiSecureBoot => 
>> BootModeInformation::EfiSecureBoot,
>> +        boot_mode::BootModeInformation::Bios => 
>> BootModeInformation::Bios,
>> +    }
>> +}
>
> Mini nit: Maybe a From<boot_mode::BootModeInformation> impl would be a 
> bit more idiomatic?
Thought about this as well, but sadly the orphan rule ruins the day :(
I also don't want to import `proxmox_sys` in `pbs-api-types` or viceversa.
>
>> +
>>   #[api(
>>       input: {
>>           properties: {
>> @@ -79,6 +89,8 @@ async fn get_status(
>>         let disk = 
>> crate::tools::fs::fs_info_static(proxmox_lang::c_str!("/")).await?;
>>   +    let boot_info = boot_mode_to_info(boot_mode::boot_mode());
>> +
>>       Ok(NodeStatus {
>>           memory,
>>           swap,
>> @@ -96,6 +108,7 @@ async fn get_status(
>>           info: NodeInformation {
>>               fingerprint: crate::cert_info()?.fingerprint()?,
>>           },
>> +        boot_info,
>>       })
>>   }
>>   diff --git a/www/panel/NodeInfo.js b/www/panel/NodeInfo.js
>> index 2551c9a5..14f84a2e 100644
>> --- a/www/panel/NodeInfo.js
>> +++ b/www/panel/NodeInfo.js
>> @@ -147,6 +147,23 @@ Ext.define('PBS.NodeInfoPanel', {
>>           textField: 'kversion',
>>           value: '',
>>       },
>> +    {
>> +        colspan: 2,
>> +        title: gettext('Boot Mode'),
>> +        printBar: false,
>> +        textField: 'boot-info',
>> +        renderer: boot_mode => {
>> +            if (boot_mode === 'bios') {
>> +                return 'Legacy BIOS';
>> +            } else if (boot_mode === 'efi') {
>> +                return 'EFI';
>> +            } else if (boot_mode === 'efisecureboot') {
>> +                return 'EFI (Secure Boot)';
>> +            }
>> +            return Proxmox.Utils.unknownText;
>> +        },
>> +        value: '',
>> +    },
>>       {
>>           xtype: 'pmxNodeInfoRepoStatus',
>>           itemId: 'repositoryStatus',
>





More information about the pbs-devel mailing list