Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTL-1560 Support Single Disk Servers (labs) or VMs #14

Merged

Conversation

rustydb
Copy link
Contributor

@rustydb rustydb commented Nov 19, 2021

Summary and Scope

Issue Type
  • RFE Pull Request

This adds support for single disk systems, such as lab-benches or simple
GCP nodes. Setting metal.disks=1 will add --force to the mdadm commands,
allowing them to construct a RAID with out additional members.

Prerequisites

  • I have included documentation in my PR (or it is not required)
  • I tested this on internal system (x) (if yes, please include results or a description of the test)

Idempotency

Risks and Mitigations

This is a tunable item, administrators should not set metal.disks=1 unless they're debugging or running a bench system. The intent here is to enable virtualization such as VBox and GCP to use simpler partition schemes. That being said, if an admin sets this it'll remove all redundancy.

README.md Outdated Show resolved Hide resolved
@rustydb rustydb force-pushed the MTL-1560-support-single-disk-for-easier-virtualization branch from afe769d to 0556191 Compare November 19, 2021 17:33
@rustydb rustydb force-pushed the MTL-1560-support-single-disk-for-easier-virtualization branch from 0556191 to adc53db Compare November 19, 2021 18:23
@rustydb
Copy link
Contributor Author

rustydb commented Nov 19, 2021

Saw the expected, default behavior on metal.

Testing metal.disks=1 now.

@rustydb
Copy link
Contributor Author

rustydb commented Nov 19, 2021

Saw the expected, default behavior on metal.

Testing metal.disks=1 now.

Worked, behold a single-disk RAID (again this is foolish but useful for simpler VMs for mocks/tests)

Downside is that it broke the ephemeral disk, it never was created (see sdb and sdc, the two other disks in the system are unused).

That is actually a compatibility problem in the other two modules (dracut-metal-dmk8s, dracut-metal-luksetcd). I think that is scope-creep to fix those modules, since this function is really only intended for GCP and labs/benches the partitions don't necessarily need to exist for the system to work.

ncn-w002 login: root
Password:
=================     ===============    ==================
\\ . . . . . . .\\   //. . . . . . .\\  |\\. . . . . . . .\\
||. . ._____. . .|| ||. . ._____. . .|| | || . ._____. . .||
|| . .||   ||. _-|| ||-_ .||   \|____|/ | ||-_.||   || . .||
||. . ||   ||-'  || ||  `-||            | ||  `||   ||. . ||
|| . _||   ||    || ||    \|___-'\___   | ||   ||   || . .||
||_-' ||   ||    || ||               |\ | ||   ||   ||'-__||
||    ||   || .===' `===.         .==='.' /==. ||   ||    ||
||    ||   |/    _-'  '_`.==..==='_-'   '-_    \|   ||    ||
||    |/   |/ _-'       `-_/''\_-'         '-_ \|   \|    ||
||.===.'    ''                                      '.===.||
=='    '                                            '    '==
\   _-'                                              '-_   /
 `''                                                    ''`

ncn-w002:~ # lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                    7:0    0   4.6G  1 loop  /run/rootfsbase
loop1                    7:1    0   3.2G  0 loop
└─live-overlay-pool    254:0    0    32G  0 dm
loop2                    7:2    0    32G  0 loop
└─live-overlay-pool    254:0    0    32G  0 dm
sda                      8:0    0 447.1G  0 disk
├─sda1                   8:1    0   476M  0 part
│ └─md127                9:127  0 475.9M  0 raid1
├─sda2                   8:2    0  22.8G  0 part
│ └─md126                9:126  0  22.8G  0 raid1 /run/initramfs/live
├─sda3                   8:3    0 139.7G  0 part
│ └─md125                9:125  0 139.6G  0 raid1 /run/initramfs/overlayfs
└─sda4                   8:4    0 139.7G  0 part
  └─md124                9:124  0 139.6G  0 raid1
    └─metalvg0-CRAYSDU 254:1    0   100G  0 lvm
sdb                      8:16   0 447.1G  0 disk
sdc                      8:32   0   1.7T  0 disk

@heemstra , I think this could merge given no one is instructed to use metal.disks=1 and the system still works without the ephemeral disk (but a full CSM install would fall apart pretty quickly after it finished). Should this wait until the other two modules are fixed or can it go in now?

@rustydb
Copy link
Contributor Author

rustydb commented Nov 23, 2021

Saw the expected, default behavior on metal.
Testing metal.disks=1 now.

Worked, behold a single-disk RAID (again this is foolish but useful for simpler VMs for mocks/tests)

Downside is that it broke the ephemeral disk, it never was created (see sdb and sdc, the two other disks in the system are unused).

That is actually a compatibility problem in the other two modules (dracut-metal-dmk8s, dracut-metal-luksetcd). I think that is scope-creep to fix those modules, since this function is really only intended for GCP and labs/benches the partitions don't necessarily need to exist for the system to work.

ncn-w002 login: root
Password:
=================     ===============    ==================
\\ . . . . . . .\\   //. . . . . . .\\  |\\. . . . . . . .\\
||. . ._____. . .|| ||. . ._____. . .|| | || . ._____. . .||
|| . .||   ||. _-|| ||-_ .||   \|____|/ | ||-_.||   || . .||
||. . ||   ||-'  || ||  `-||            | ||  `||   ||. . ||
|| . _||   ||    || ||    \|___-'\___   | ||   ||   || . .||
||_-' ||   ||    || ||               |\ | ||   ||   ||'-__||
||    ||   || .===' `===.         .==='.' /==. ||   ||    ||
||    ||   |/    _-'  '_`.==..==='_-'   '-_    \|   ||    ||
||    |/   |/ _-'       `-_/''\_-'         '-_ \|   \|    ||
||.===.'    ''                                      '.===.||
=='    '                                            '    '==
\   _-'                                              '-_   /
 `''                                                    ''`

ncn-w002:~ # lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                    7:0    0   4.6G  1 loop  /run/rootfsbase
loop1                    7:1    0   3.2G  0 loop
└─live-overlay-pool    254:0    0    32G  0 dm
loop2                    7:2    0    32G  0 loop
└─live-overlay-pool    254:0    0    32G  0 dm
sda                      8:0    0 447.1G  0 disk
├─sda1                   8:1    0   476M  0 part
│ └─md127                9:127  0 475.9M  0 raid1
├─sda2                   8:2    0  22.8G  0 part
│ └─md126                9:126  0  22.8G  0 raid1 /run/initramfs/live
├─sda3                   8:3    0 139.7G  0 part
│ └─md125                9:125  0 139.6G  0 raid1 /run/initramfs/overlayfs
└─sda4                   8:4    0 139.7G  0 part
  └─md124                9:124  0 139.6G  0 raid1
    └─metalvg0-CRAYSDU 254:1    0   100G  0 lvm
sdb                      8:16   0 447.1G  0 disk
sdc                      8:32   0   1.7T  0 disk

@heemstra , I think this could merge given no one is instructed to use metal.disks=1 and the system still works without the ephemeral disk (but a full CSM install would fall apart pretty quickly after it finished). Should this wait until the other two modules are fixed or can it go in now?

Trying this again to make sure I didn't forget to wipe, but I am 99% certain I wiped.

@rustydb
Copy link
Contributor Author

rustydb commented Nov 23, 2021

Saw the expected, default behavior on metal.
Testing metal.disks=1 now.

Worked, behold a single-disk RAID (again this is foolish but useful for simpler VMs for mocks/tests)
Downside is that it broke the ephemeral disk, it never was created (see sdb and sdc, the two other disks in the system are unused).
That is actually a compatibility problem in the other two modules (dracut-metal-dmk8s, dracut-metal-luksetcd). I think that is scope-creep to fix those modules, since this function is really only intended for GCP and labs/benches the partitions don't necessarily need to exist for the system to work.

ncn-w002 login: root
Password:
=================     ===============    ==================
\\ . . . . . . .\\   //. . . . . . .\\  |\\. . . . . . . .\\
||. . ._____. . .|| ||. . ._____. . .|| | || . ._____. . .||
|| . .||   ||. _-|| ||-_ .||   \|____|/ | ||-_.||   || . .||
||. . ||   ||-'  || ||  `-||            | ||  `||   ||. . ||
|| . _||   ||    || ||    \|___-'\___   | ||   ||   || . .||
||_-' ||   ||    || ||               |\ | ||   ||   ||'-__||
||    ||   || .===' `===.         .==='.' /==. ||   ||    ||
||    ||   |/    _-'  '_`.==..==='_-'   '-_    \|   ||    ||
||    |/   |/ _-'       `-_/''\_-'         '-_ \|   \|    ||
||.===.'    ''                                      '.===.||
=='    '                                            '    '==
\   _-'                                              '-_   /
 `''                                                    ''`

ncn-w002:~ # lsblk
NAME                   MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                    7:0    0   4.6G  1 loop  /run/rootfsbase
loop1                    7:1    0   3.2G  0 loop
└─live-overlay-pool    254:0    0    32G  0 dm
loop2                    7:2    0    32G  0 loop
└─live-overlay-pool    254:0    0    32G  0 dm
sda                      8:0    0 447.1G  0 disk
├─sda1                   8:1    0   476M  0 part
│ └─md127                9:127  0 475.9M  0 raid1
├─sda2                   8:2    0  22.8G  0 part
│ └─md126                9:126  0  22.8G  0 raid1 /run/initramfs/live
├─sda3                   8:3    0 139.7G  0 part
│ └─md125                9:125  0 139.6G  0 raid1 /run/initramfs/overlayfs
└─sda4                   8:4    0 139.7G  0 part
  └─md124                9:124  0 139.6G  0 raid1
    └─metalvg0-CRAYSDU 254:1    0   100G  0 lvm
sdb                      8:16   0 447.1G  0 disk
sdc                      8:32   0   1.7T  0 disk

@heemstra , I think this could merge given no one is instructed to use metal.disks=1 and the system still works without the ephemeral disk (but a full CSM install would fall apart pretty quickly after it finished). Should this wait until the other two modules are fixed or can it go in now?

Trying this again to make sure I didn't forget to wipe, but I am 99% certain I wiped.

I see what is wrong, these line is allowing more than 1 disk to show up and the first disk that does show up is too small.

Either the code can loop over the disks, or have handling for metal.disks=1.

@rustydb
Copy link
Contributor Author

rustydb commented Nov 23, 2021

I have a change to the metal-lib.sh lib (42da7cc) that'll provides a new resolve function, this resolve function is a dependency supporting these needed bugfix changes:

This is confirmed fixed on workers:

redbull-ncn-m001-pit:/var/www/ncn-m003 # ssh ncn-w001
Warning: Permanently added 'ncn-w001,10.252.1.7' (ECDSA) to the list of known hosts.
=================     ===============    ==================
\\ . . . . . . .\\   //. . . . . . .\\  |\\. . . . . . . .\\
||. . ._____. . .|| ||. . ._____. . .|| | || . ._____. . .||
|| . .||   ||. _-|| ||-_ .||   \|____|/ | ||-_.||   || . .||
||. . ||   ||-'  || ||  `-||            | ||  `||   ||. . ||
|| . _||   ||    || ||    \|___-'\___   | ||   ||   || . .||
||_-' ||   ||    || ||               |\ | ||   ||   ||'-__||
||    ||   || .===' `===.         .==='.' /==. ||   ||    ||
||    ||   |/    _-'  '_`.==..==='_-'   '-_    \|   ||    ||
||    |/   |/ _-'       `-_/''\_-'         '-_ \|   \|    ||
||.===.'    ''                                      '.===.||
=='    '                                            '    '==
\   _-'                                              '-_   /
 `''                                                    ''`

ncn-w001:~ # lsblk
NAME                       MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                        7:0    0   4.6G  1 loop  /run/rootfsbase
loop1                        7:1    0   3.2G  0 loop
└─live-overlay-pool        254:0    0    32G  0 dm
loop2                        7:2    0    32G  0 loop
└─live-overlay-pool        254:0    0    32G  0 dm
sda                          8:0    0 447.1G  0 disk
├─sda1                       8:1    0   476M  0 part
│ └─md127                    9:127  0 475.9M  0 raid1
├─sda2                       8:2    0  22.8G  0 part
│ └─md126                    9:126  0  22.8G  0 raid1 /run/initramfs/live
├─sda3                       8:3    0 139.7G  0 part
│ └─md125                    9:125  0 139.6G  0 raid1 /run/initramfs/overlayfs
└─sda4                       8:4    0 139.7G  0 part
  └─md124                    9:124  0 139.6G  0 raid1
    └─metalvg0-CRAYS3CACHE 254:1    0   100G  0 lvm   /var/lib/s3fs_cache
sdb                          8:16   0   1.7T  0 disk
├─sdb1                       8:17   0  69.8G  0 part  /run/containerd
├─sdb2                       8:18   0 645.5G  0 part  /run/lib-containerd
└─sdb3                       8:19   0 178.8G  0 part  /var/lib/kubelet
sdc                          8:32   0 447.1G  0 disk

@rustydb rustydb force-pushed the MTL-1560-support-single-disk-for-easier-virtualization branch from 8bd86d7 to 42da7cc Compare November 23, 2021 18:12
This adds support for single disk systems, such as lab-benches or simple
GCP nodes. Setting metal.disks=1 will add --force to the mdadm commands,
allowing them to construct a RAID with out additional members.

A new library function is added to assist in returning the right disk
despite what metal.disks is set to. Specifically, the 2nd-level dracut
modules from metal were exiting too early when metal.disks=1 was set.
The early exist was due to those modules not checking every disk, they
assumed they'd always get the last disk.
@rustydb rustydb force-pushed the MTL-1560-support-single-disk-for-easier-virtualization branch from 42da7cc to 8b36d25 Compare November 23, 2021 18:19
@rustydb
Copy link
Contributor Author

rustydb commented Nov 23, 2021

I have a change to the metal-lib.sh lib (42da7cc) that'll provides a new resolve function, this resolve function is a dependency supporting these needed bugfix changes:

This is confirmed fixed on workers:

redbull-ncn-m001-pit:/var/www/ncn-m003 # ssh ncn-w001
Warning: Permanently added 'ncn-w001,10.252.1.7' (ECDSA) to the list of known hosts.
=================     ===============    ==================
\\ . . . . . . .\\   //. . . . . . .\\  |\\. . . . . . . .\\
||. . ._____. . .|| ||. . ._____. . .|| | || . ._____. . .||
|| . .||   ||. _-|| ||-_ .||   \|____|/ | ||-_.||   || . .||
||. . ||   ||-'  || ||  `-||            | ||  `||   ||. . ||
|| . _||   ||    || ||    \|___-'\___   | ||   ||   || . .||
||_-' ||   ||    || ||               |\ | ||   ||   ||'-__||
||    ||   || .===' `===.         .==='.' /==. ||   ||    ||
||    ||   |/    _-'  '_`.==..==='_-'   '-_    \|   ||    ||
||    |/   |/ _-'       `-_/''\_-'         '-_ \|   \|    ||
||.===.'    ''                                      '.===.||
=='    '                                            '    '==
\   _-'                                              '-_   /
 `''                                                    ''`

ncn-w001:~ # lsblk
NAME                       MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                        7:0    0   4.6G  1 loop  /run/rootfsbase
loop1                        7:1    0   3.2G  0 loop
└─live-overlay-pool        254:0    0    32G  0 dm
loop2                        7:2    0    32G  0 loop
└─live-overlay-pool        254:0    0    32G  0 dm
sda                          8:0    0 447.1G  0 disk
├─sda1                       8:1    0   476M  0 part
│ └─md127                    9:127  0 475.9M  0 raid1
├─sda2                       8:2    0  22.8G  0 part
│ └─md126                    9:126  0  22.8G  0 raid1 /run/initramfs/live
├─sda3                       8:3    0 139.7G  0 part
│ └─md125                    9:125  0 139.6G  0 raid1 /run/initramfs/overlayfs
└─sda4                       8:4    0 139.7G  0 part
  └─md124                    9:124  0 139.6G  0 raid1
    └─metalvg0-CRAYS3CACHE 254:1    0   100G  0 lvm   /var/lib/s3fs_cache
sdb                          8:16   0   1.7T  0 disk
├─sdb1                       8:17   0  69.8G  0 part  /run/containerd
├─sdb2                       8:18   0 645.5G  0 part  /run/lib-containerd
└─sdb3                       8:19   0 178.8G  0 part  /var/lib/kubelet
sdc                          8:32   0 447.1G  0 disk

Also confirmed working on masters:

ncn-m003 login: root
Password:
=================     ===============    ==================
\\ . . . . . . .\\   //. . . . . . .\\  |\\. . . . . . . .\\
||. . ._____. . .|| ||. . ._____. . .|| | || . ._____. . .||
|| . .||   ||. _-|| ||-_ .||   \|____|/ | ||-_.||   || . .||
||. . ||   ||-'  || ||  `-||            | ||  `||   ||. . ||
|| . _||   ||    || ||    \|___-'\___   | ||   ||   || . .||
||_-' ||   ||    || ||               |\ | ||   ||   ||'-__||
||    ||   || .===' `===.         .==='.' /==. ||   ||    ||
||    ||   |/    _-'  '_`.==..==='_-'   '-_    \|   ||    ||
||    |/   |/ _-'       `-_/''\_-'         '-_ \|   \|    ||
||.===.'    ''                                      '.===.||
=='    '                                            '    '==
\   _-'                                              '-_   /
 `''                                                    ''`

ncn-m003:~ # lsblk
NAME                       MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0                        7:0    0   4.6G  1 loop  /run/rootfsbase
loop1                        7:1    0   3.2G  0 loop
└─live-overlay-pool        254:2    0    32G  0 dm
loop2                        7:2    0    32G  0 loop
└─live-overlay-pool        254:2    0    32G  0 dm
sda                          8:0    0 447.1G  0 disk
├─sda1                       8:1    0   476M  0 part
│ └─md127                    9:127  0 475.9M  0 raid1
├─sda2                       8:2    0  22.8G  0 part
│ └─md126                    9:126  0  22.8G  0 raid1 /run/initramfs/live
├─sda3                       8:3    0 139.7G  0 part
│ └─md125                    9:125  0 139.6G  0 raid1 /run/initramfs/overlayfs
└─sda4                       8:4    0 139.7G  0 part
  └─md124                    9:124  0 139.6G  0 raid1
    └─metalvg0-CRAYS3CACHE 254:3    0   100G  0 lvm   /var/lib/s3fs_cache
sdb                          8:16   0 447.1G  0 disk
sdc                          8:32   0 447.1G  0 disk
└─ETCDLVM                  254:0    0 447.1G  0 crypt
  └─etcdvg0-ETCDK8S        254:1    0    32G  0 lvm   /run/lib-etcd

@rustydb rustydb merged commit b0d9d95 into main Nov 23, 2021
@rustydb rustydb deleted the MTL-1560-support-single-disk-for-easier-virtualization branch November 23, 2021 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants