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.
18 lines
609 B
Ruby
18 lines
609 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "spec_helper"
|
|
|
|
RSpec.describe VmStorageVolume do
|
|
it "can render a device_path" do
|
|
vm = Vm.new.tap { _1.id = "eb3dbcb3-2c90-8b74-8fb4-d62a244d7ae5" }
|
|
expect(described_class.new(disk_index: 7, vm: vm).device_path).to eq("/dev/disk/by-id/virtio-vmxcyvsc_7")
|
|
end
|
|
|
|
it "returns correct spdk version if exists associated installation" do
|
|
si = SpdkInstallation.new(version: "some-version")
|
|
v = described_class.new(disk_index: 7)
|
|
allow(v).to receive(:spdk_installation).and_return(si)
|
|
expect(v.spdk_version).to eq("some-version")
|
|
end
|
|
end
|