Files
ubicloud/migrate/20231122_spdk_upgrade.rb
Hadi Moshayedi 1e1a274d97 Enable multiple SPDK installations
This is done by:
* Adding version information to SPDK files on the host. This includes:
  * Package installation path: `/opt/spdk` => `/opt/spdk-$version`
  * Hugetables path: `/home/spdk/hugetables` =>
  * `/home/spdk/hugetables.$version`
  * Hugetables mount: `home-spdk-hugetable` =>
  * `home-spdk-hugetables.$version`
  * Service file: `spdk.service` => `spdk-$version.service`
  * RPC socket: `/home/spdk/spdk.sock` => `/home/spdk/spdk-$version.sock`
* Keeping information about the installation about the installation in
* the SpdkInstallation table.
* Sending the SPDK version to be used with each storage volume data.

Since we have legacy servers which don't have the above version
information, the code has assumed `LEGACY_SPDK_VERSION` as SPDK version
of those installations, which maps the above information to old names
and paths. This can be removed after transitioning all servers.

Currently we allow at maximum 2 installations per host, which should be
enough when upgrading to a new host.

== REPL interactions ==
Specifying an SPDK version when setting up a host:

```
> Prog::Vm::HostNexus.assemble(new_host_ip, ... other params ...,
  spdk_version: "v23.09")
```

Installing a second SPDK installation on an existing host:

```
> Prog::Storage::SetupSpdk.setup("v23.09-ubi-0.1", start_service: true,
  allocation_weight: 10)
```

After this there will be two SPDK installations on the host, v23.09
which has weight 100, and the v23.09-ubi-0.1 which has weight 10. So
100/110 of new VMs will use the v23.09, and 10/110 of new VMs will use
v23.09-ubi-0.1.
2023-11-22 11:39:28 -08:00

1.1 KiB