In #1524 we changed rhizome to be able to download versioned boot images. In this change, we actually use that infrastructure. To download a versioned boot image, one can do: ``` > vmh.download_boot_image("ubuntu-jammy", version: "20240319") ``` After this has been done, all VMs on that host which want to use the `ubuntu-jammy` image will use the latest boot image. This allows us to be able to download new image versions without impacting previous VMs at all. Previous VMs will continue to use the older images. As follow up items: * VmHost setup will include downloading some default images (e.g. `ubuntu-jammy`) with explicit. vm_setup won't download the images automatically. * We will enforce to use versioned images always * Add a program to remove unused images
29 lines
658 B
Ruby
29 lines
658 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative "../model"
|
|
|
|
class VmStorageVolume < Sequel::Model
|
|
many_to_one :vm
|
|
many_to_one :spdk_installation
|
|
many_to_one :storage_device
|
|
many_to_one :key_encryption_key_1, class: :StorageKeyEncryptionKey
|
|
many_to_one :key_encryption_key_2, class: :StorageKeyEncryptionKey
|
|
many_to_one :boot_image
|
|
|
|
plugin :association_dependencies, key_encryption_key_1: :destroy, key_encryption_key_2: :destroy
|
|
|
|
include ResourceMethods
|
|
|
|
def device_id
|
|
"#{vm.inhost_name}_#{disk_index}"
|
|
end
|
|
|
|
def device_path
|
|
"/dev/disk/by-id/virtio-#{device_id}"
|
|
end
|
|
|
|
def spdk_version
|
|
spdk_installation.version
|
|
end
|
|
end
|