-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
11 changed files
with
190 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "../model" | ||
|
||
class BootImage < Sequel::Model | ||
many_to_one :vm_host, key: :vm_host_id, class: :VmHost | ||
one_to_many :vm_storage_volumes, key: :boot_image_id, class: :VmStorageVolume | ||
|
||
include ResourceMethods | ||
|
||
def self.ubid_type | ||
UBID::TYPE_ETC | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
#!/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
unless (boot_image = ARGV.shift) | ||
puts "need boot_image as argument" | ||
require "json" | ||
require_relative "../../common/lib/util" | ||
require_relative "../lib/boot_image" | ||
|
||
unless (params = ARGV.shift) | ||
puts "need params as argument" | ||
exit 1 | ||
end | ||
|
||
custom_url = ARGV.shift | ||
params_json = JSON.parse(params) | ||
|
||
require_relative "../../common/lib/util" | ||
require_relative "../lib/boot_image" | ||
unless (boot_image = params_json["image_name"]) | ||
puts "need boot_image in params" | ||
exit 1 | ||
end | ||
|
||
# YYY: version will be mandatory in the future | ||
version = params_json["version"] | ||
url = params_json["url"] | ||
sha256sum = params_json["sha256sum"] | ||
|
||
certs = $stdin.read | ||
ca_path = "/usr/lib/ssl/certs/ubicloud_images_blob_storage_certs.crt" | ||
safe_write_to_file(ca_path, certs) | ||
|
||
BootImage.new(boot_image, nil).download(url: custom_url, ca_path: ca_path) | ||
BootImage.new(boot_image, version).download( | ||
url: url, ca_path: ca_path, sha256sum: sha256sum | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.