TritonDataCenter / smartos-live

For more information, please see http://smartos.org/ For any questions that aren't answered there, please join the SmartOS discussion list: https://smartos.topicbox.com/groups/smartos-discuss
1.57k stars 244 forks source link

OS-8206 Enable piadm(1M) to detect and install on-disk iPXE on Triton CNs #960

Closed danmcd closed 3 years ago

danmcd commented 3 years ago

Stubs, and the ability to detect a Triton CN. Do not use yet save to test "yes I'm on a CN" vs. "No I'm not on a CN".

danmcd commented 3 years ago

Test run from this morning using the latest piadm per this PR:

[root@larry (kebecloud) ~]# /tmp/piadm list
PI STAMP               BOOTABLE FILESYSTEM            BOOT IMAGE NOW  NEXT 
20200930T173623Z       zones/boot                     next       no   no  
ipxe                   zones/boot                     next       no   yes 
[root@larry (kebecloud) ~]# /tmp/piadm -v list
PI STAMP               BOOTABLE FILESYSTEM            BOOT IMAGE NOW  NEXT 
20200930T173623Z       zones/boot                     next       no   no  
ipxe(20200626T133005Z) zones/boot                     next       no   yes 
[root@larry (kebecloud) ~]# zfs list -t all | grep boot
zones/boot                                         600M   284G   304M  /zones/boot
zones/boot@baseline                                297M      -   300M  -
[root@larry (kebecloud) ~]# zfs rollback zones/boot@baseline
[root@larry (kebecloud) ~]# /tmp/piadm -v list
PI STAMP               BOOTABLE FILESYSTEM            BOOT IMAGE NOW  NEXT 
20200910T155139Z       zones/boot                     none       no   no  
ipxe(20200219T112943Z) zones/boot                     next       no   yes 
[root@larry (kebecloud) ~]# 
[root@larry (kebecloud) ~]# /tmp/piadm -v bootable
zones                          ==> BIOS 
[root@larry (kebecloud) ~]# /tmp/piadm -v bootable -e
To enable a pool for booting, please specify at last a pool

Usage: piadm [-v] <command> [command-specific arguments]

    piadm activate|assign <PI-stamp> [ZFS-pool-name]
    piadm avail
    piadm bootable [-d] [-e [-i <source>]] [-r] [ZFS-pool-name]
    piadm install <source> [ZFS-pool-name]
    piadm list <-H> [ZFS-pool-name]
    piadm remove <PI-stamp> [ZFS-pool-name]
    piadm update [ZFS-pool-name]

[root@larry (kebecloud) ~]# /tmp/piadm -v bootable -e zones
Pool zones appears to be bootable.
Use 'piadm update' to update the CN's iPXE and backup PI.
[root@larry (kebecloud) ~]# /tmp/piadm -v update
Selecting lone boot pool zones by default.
Updating backup PI to 20201002T173911Z
Installing as a backup Platform image PI stamp 20201002T173911Z
making platform-20201002T173911Z directories
Pulling unix
Pulling boot_archive
Pulling boot_archive.hash
Pulling boot_archive.manifest
Pulling boot_archive.gitstatus
...success installing 20201002T173911Z
Updating iPXE provided by headnode (ver: 20200626T133005Z)
Updating boot provided by headnode (ver: 20200930T173623Z)
[root@larry (kebecloud) ~]# /tmp/piadm -v update
Selecting lone boot pool zones by default.
No updates needed for iPXE and its loader.
If you think there should be an update, run
'sdcadm experimental update-gz-tools' on your Triton Head Node
[root@larry (kebecloud) ~]# /tmp/piadm update
[root@larry (kebecloud) ~]# echo $?
0
[root@larry (kebecloud) ~]# /tmp/piadm -v list
PI STAMP               BOOTABLE FILESYSTEM            BOOT IMAGE NOW  NEXT 
20201002T173911Z       zones/boot                     none       yes  no  
ipxe(20200626T133005Z) zones/boot                     next       no   yes 
[root@larry (kebecloud) ~]# /tmp/piadm list
PI STAMP               BOOTABLE FILESYSTEM            BOOT IMAGE NOW  NEXT 
20201002T173911Z       zones/boot                     none       yes  no  
ipxe                   zones/boot                     next       no   yes 
[root@larry (kebecloud) ~]# 
danmcd commented 3 years ago

Prior testing has given me confidence enough to promote this out of draft.

bahamat commented 3 years ago

I think this is looking really good. 3 things to note:

  1. Triton nodes never used CD for booting
  2. KEBE comments
  3. shellcheck cleanup
danmcd commented 3 years ago

Need to re-run tests (initial batches were quite helpful, thanks @bahamat), verify no regressions, etc. etc., and then request IA.

danmcd commented 3 years ago

Darn it, while inspecting the diffs to write the test plan, I found a missing bit. It will be tested as part of the final batch of tests test-plan. (Sorry @bahamat )

danmcd commented 3 years ago

Last changes (including one below about rsync) were inspired by field-testing against missing PIs that were booted (and then deleted by the head node).

papertigers commented 3 years ago

If @bahamas10 has time I'd defer to him about quoting things vs what shellcheck says. He's the resident bash expert.