Cray-HPE / gru

A utility for reading and modifying BMCs (e.g. iLO, RMMC) using RedFish (gofish).
MIT License
6 stars 2 forks source link

Fixes #29 #28 #27 #32

Closed rustydb closed 9 months ago

rustydb commented 11 months ago

Summary and Scope

Issue Type

Until this is no longer a "work in progress," see the commits for information.

Risks and Mitigations

Filed two new bugs discovered while tested that existed before these changes:

rustydb commented 10 months ago

Will fix the failing tests, still debating how I want to reconcile them. The test failures are limited to the output for --json when using the BIOS decoder.

rustydb commented 9 months ago

Needs a fix to non-json output for bios set, the "attributes" and "pending" keys are missing.

ncn-m001:~/doomslayer # grep -oP 'ncn-w\d{3}-mgmt' /etc/hosts | gru bios set -f ilo.yaml
Asynchronously updating [    5] hosts ...
ncn-w001-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        AutoPowerOn                             : AlwaysPowerOff
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-w002-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        AutoPowerOn                             : AlwaysPowerOff
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-w003-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        AutoPowerOn                             : AlwaysPowerOff
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-w004-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        AutoPowerOn                             : AlwaysPowerOff
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-w005-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-m001:~/doomslayer # grep -oP 'ncn-w\d{3}-mgmt' /etc/hosts | gru -j bios set -f ilo.yaml
{
  "ncn-w001-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "AutoPowerOn": "AlwaysPowerOff",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  },
  "ncn-w002-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "AutoPowerOn": "AlwaysPowerOff",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  },
  "ncn-w003-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "AutoPowerOn": "AlwaysPowerOff",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  },
  "ncn-w004-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "AutoPowerOn": "AlwaysPowerOff",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  },
  "ncn-w005-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  }
}
rustydb commented 9 months ago

Also need to change ResetType to something else, like "IssuedCommand"

ncn-m001:~/doomslayer # gru chassis power on ncn-w005-mgmt
Asynchronously updating [    1] hosts ...
ncn-w005-mgmt:
        PreviousPowerState                      : Off
        ResetType                               : On
rustydb commented 9 months ago

There seems to be an issue with the Gigabyte vendor when using bios get --V

redbull-management:~/doomslayer # gru bios get --virtualization ncn-h002-mgmt
Asynchronously querying [    1] hosts ...
ncn-h002-mgmt:
    ProcessorVmxEnable                      : 1
    ProcessorX2apic                         : 1
    SRIOVEnable                             : 1
    VTdSupport                              : 1
redbull-management:~/doomslayer # gru bios get --virtualization surtur-ncn-m001-mgmt.hpc.amslabs.hpecorp.net drax-ncn-m001-mgmt.hpc.amslabs.hpecorp.net
Asynchronously querying [    2] hosts ...
drax-ncn-m001-mgmt.hpc.amslabs.hpecorp.net:
    Error                                   : unable to determine manufaturer for virtualization shortcut
surtur-ncn-m001-mgmt.hpc.amslabs.hpecorp.net:
    ProcAmdIOMMU                            : Enabled
    ProcAmdVirtualization                   : Enabled
    ProcX2Apic                              : Auto
    Sriov                                   : Enabled
jacobsalmela commented 9 months ago

I noticed a panic in the simulator, too, but won't give it a lot of attention since it doesn't panic on a real machine.

rustydb commented 9 months ago

New panic occurs when --insecure is false and an SSL error occurs.

redbull-management:~/doomslayer # gru bios get ncn-h002-mgmt
Asynchronously querying [    1] hosts ...
ncn-h002-mgmt:
panic: reflect: call of reflect.Value.NumField on ptr Value

goroutine 1 [running]:
reflect.flag.mustBe(...)
    /Users/rusty/.goenv/versions/1.20.1/src/reflect/value.go:223
reflect.Value.NumField({0x8e3500?, 0xc0001c2d80?, 0x7ffc55073b6a?})
    /Users/rusty/.goenv/versions/1.20.1/src/reflect/value.go:2041 +0x8d
github.com/Cray-HPE/gru/pkg/cmd/cli.MapPrint(0xc000241740)
    /Users/rusty/gitstuffs/cray-shasta/gru/pkg/cmd/cli/cli.go:148 +0x4db
github.com/Cray-HPE/gru/pkg/cmd/cli/bios.NewBiosGetCommand.func1(0xc00025c600?, {0xc000242d90?, 0x1?, 0x1?})
    /Users/rusty/gitstuffs/cray-shasta/gru/pkg/cmd/cli/bios/get.go:54 +0x45
github.com/spf13/cobra.(*Command).execute(0xc00025c600, {0xc000242d60, 0x1, 0x1})
    /Users/rusty/gitstuffs/cray-shasta/gru/vendor/github.com/spf13/cobra/command.go:987 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0xc00025c000)
    /Users/rusty/gitstuffs/cray-shasta/gru/vendor/github.com/spf13/cobra/command.go:1115 +0x425
github.com/spf13/cobra.(*Command).Execute(0x7ffc55073b5d?)
    /Users/rusty/gitstuffs/cray-shasta/gru/vendor/github.com/spf13/cobra/command.go:1039 +0x19
main.main()
    /Users/rusty/gitstuffs/cray-shasta/gru/cmd/gru/main.go:38 +0x3b
rustydb commented 9 months ago

New panic occurs when --insecure is false and an SSL error occurs.

redbull-management:~/doomslayer # gru bios get ncn-h002-mgmt
Asynchronously querying [    1] hosts ...
ncn-h002-mgmt:
panic: reflect: call of reflect.Value.NumField on ptr Value

goroutine 1 [running]:
reflect.flag.mustBe(...)
  /Users/rusty/.goenv/versions/1.20.1/src/reflect/value.go:223
reflect.Value.NumField({0x8e3500?, 0xc0001c2d80?, 0x7ffc55073b6a?})
  /Users/rusty/.goenv/versions/1.20.1/src/reflect/value.go:2041 +0x8d
github.com/Cray-HPE/gru/pkg/cmd/cli.MapPrint(0xc000241740)
  /Users/rusty/gitstuffs/cray-shasta/gru/pkg/cmd/cli/cli.go:148 +0x4db
github.com/Cray-HPE/gru/pkg/cmd/cli/bios.NewBiosGetCommand.func1(0xc00025c600?, {0xc000242d90?, 0x1?, 0x1?})
  /Users/rusty/gitstuffs/cray-shasta/gru/pkg/cmd/cli/bios/get.go:54 +0x45
github.com/spf13/cobra.(*Command).execute(0xc00025c600, {0xc000242d60, 0x1, 0x1})
  /Users/rusty/gitstuffs/cray-shasta/gru/vendor/github.com/spf13/cobra/command.go:987 +0xa91
github.com/spf13/cobra.(*Command).ExecuteC(0xc00025c000)
  /Users/rusty/gitstuffs/cray-shasta/gru/vendor/github.com/spf13/cobra/command.go:1115 +0x425
github.com/spf13/cobra.(*Command).Execute(0x7ffc55073b5d?)
  /Users/rusty/gitstuffs/cray-shasta/gru/vendor/github.com/spf13/cobra/command.go:1039 +0x19
main.main()
  /Users/rusty/gitstuffs/cray-shasta/gru/cmd/gru/main.go:38 +0x3b

Fixed in 9612932

rustydb commented 9 months ago

There seems to be an issue with the Gigabyte vendor when using bios get --V

redbull-management:~/doomslayer # gru bios get --virtualization ncn-h002-mgmt
Asynchronously querying [    1] hosts ...
ncn-h002-mgmt:
  ProcessorVmxEnable                      : 1
  ProcessorX2apic                         : 1
  SRIOVEnable                             : 1
  VTdSupport                              : 1
redbull-management:~/doomslayer # gru bios get --virtualization surtur-ncn-m001-mgmt.hpc.amslabs.hpecorp.net drax-ncn-m001-mgmt.hpc.amslabs.hpecorp.net
Asynchronously querying [    2] hosts ...
drax-ncn-m001-mgmt.hpc.amslabs.hpecorp.net:
  Error                                   : unable to determine manufaturer for virtualization shortcut
surtur-ncn-m001-mgmt.hpc.amslabs.hpecorp.net:
  ProcAmdIOMMU                            : Enabled
  ProcAmdVirtualization                   : Enabled
  ProcX2Apic                              : Auto
  Sriov                                   : Enabled

Fixed.

rustydb commented 9 months ago

Also need to change ResetType to something else, like "IssuedCommand"

ncn-m001:~/doomslayer # gru chassis power on ncn-w005-mgmt
Asynchronously updating [    1] hosts ...
ncn-w005-mgmt:
        PreviousPowerState                      : Off
        ResetType                               : On

Fixed.

rustydb commented 9 months ago

Needs a fix to non-json output for bios set, the "attributes" and "pending" keys are missing.

ncn-m001:~/doomslayer # grep -oP 'ncn-w\d{3}-mgmt' /etc/hosts | gru bios set -f ilo.yaml
Asynchronously updating [    5] hosts ...
ncn-w001-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        AutoPowerOn                             : AlwaysPowerOff
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-w002-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        AutoPowerOn                             : AlwaysPowerOff
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-w003-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        AutoPowerOn                             : AlwaysPowerOff
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-w004-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        AutoPowerOn                             : AlwaysPowerOff
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-w005-mgmt:
        AutoPowerOn                             : AlwaysPowerOff
        BootMode                                : Uefi
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
        ProcX2Apic                              : Auto
        Sriov                                   : Enabled
        ProcAmdIOMMU                            : Enabled
        ProcAmdVirtualization                   : Enabled
ncn-m001:~/doomslayer # grep -oP 'ncn-w\d{3}-mgmt' /etc/hosts | gru -j bios set -f ilo.yaml
{
  "ncn-w001-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "AutoPowerOn": "AlwaysPowerOff",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  },
  "ncn-w002-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "AutoPowerOn": "AlwaysPowerOff",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  },
  "ncn-w003-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "AutoPowerOn": "AlwaysPowerOff",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  },
  "ncn-w004-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "AutoPowerOn": "AlwaysPowerOff",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  },
  "ncn-w005-mgmt": {
    "attributes": {
      "AutoPowerOn": "AlwaysPowerOff",
      "BootMode": "Uefi",
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled",
      "ProcX2Apic": "Auto",
      "Sriov": "Enabled"
    },
    "pending": {
      "ProcAmdIOMMU": "Enabled",
      "ProcAmdVirtualization": "Enabled"
    }
  }
}

Fixed.