Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
for version in v49.0 v51.1; do
for version in v49.0 v51.1 v51.2; do
for architecture in x86_64 aarch64; do
if [ "$architecture" = "x86_64" ]; then
asset="cloud-hypervisor-static"
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ $(XCADDY): | $(BIN_DIR)

install-tools: $(OAPI_CODEGEN) $(AIR) $(WIRE) $(XCADDY)

# Download Cloud Hypervisor binaries (both v49.0 and v51.1 for backwards-compatible upgrades)
# Download Cloud Hypervisor binaries (v49.0, v51.1 and v51.2 for backwards-compatible upgrades)
download-ch-binaries:
@echo "Downloading Cloud Hypervisor binaries..."
@mkdir -p lib/vmm/binaries/cloud-hypervisor/v49.0/{x86_64,aarch64}
@mkdir -p lib/vmm/binaries/cloud-hypervisor/v51.1/{x86_64,aarch64}
@mkdir -p lib/vmm/binaries/cloud-hypervisor/v51.2/{x86_64,aarch64}
@echo "Downloading v49.0..."
@curl -L -o lib/vmm/binaries/cloud-hypervisor/v49.0/x86_64/cloud-hypervisor \
https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/v49.0/cloud-hypervisor-static
Expand All @@ -50,6 +51,11 @@ download-ch-binaries:
https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/v51.1/cloud-hypervisor-static
@curl -L -o lib/vmm/binaries/cloud-hypervisor/v51.1/aarch64/cloud-hypervisor \
https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/v51.1/cloud-hypervisor-static-aarch64
@echo "Downloading v51.2..."
@curl -L -o lib/vmm/binaries/cloud-hypervisor/v51.2/x86_64/cloud-hypervisor \
https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/v51.2/cloud-hypervisor-static
@curl -L -o lib/vmm/binaries/cloud-hypervisor/v51.2/aarch64/cloud-hypervisor \
https://github.com/cloud-hypervisor/cloud-hypervisor/releases/download/v51.2/cloud-hypervisor-static-aarch64
@chmod +x lib/vmm/binaries/cloud-hypervisor/v*/*/cloud-hypervisor
@echo "Binaries downloaded successfully"

Expand Down Expand Up @@ -177,7 +183,7 @@ ensure-ch-binaries:
echo "Unsupported architecture: $$ARCH"; exit 1; \
fi; \
NEEDS_DOWNLOAD=0; \
for CH_VERSION in v49.0 v51.1; do \
for CH_VERSION in v49.0 v51.1 v51.2; do \
CH_BIN=lib/vmm/binaries/cloud-hypervisor/$$CH_VERSION/$$CH_ARCH/cloud-hypervisor; \
if [ ! -f "$$CH_BIN" ]; then \
echo "Cloud Hypervisor binary not found: $$CH_BIN"; \
Expand Down
2 changes: 1 addition & 1 deletion lib/hypervisor/cloudhypervisor/cloudhypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func CapabilitiesForVersion(v vmm.CHVersion) hypervisor.Capabilities {
SupportsSnapshotBaseReuse: false,
}
switch v {
case vmm.V51_1:
case vmm.V51_1, vmm.V51_2:
caps.SupportsDiskResize = true
}
return caps
Expand Down
10 changes: 10 additions & 0 deletions lib/hypervisor/cloudhypervisor/register_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,13 @@ func TestCapabilitiesAdvertiseForkOnEveryVersion(t *testing.T) {
require.True(t, CapabilitiesForVersion(v).SupportsFork, "version %s", v)
}
}

// TestCapabilitiesAdvertiseDiskResizeOnV51 pins live disk resize for every
// v51 release, including the v51.2 default used for new instances.
func TestCapabilitiesAdvertiseDiskResizeOnV51(t *testing.T) {
t.Parallel()
require.Equal(t, vmm.V51_2, vmm.DefaultVersion)
for _, v := range []vmm.CHVersion{vmm.V51_1, vmm.V51_2} {
require.True(t, CapabilitiesForVersion(v).SupportsDiskResize, "version %s", v)
}
}
6 changes: 5 additions & 1 deletion lib/vmm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ lib/vmm/
│ ├── v49.0/
│ │ ├── x86_64/cloud-hypervisor
│ │ └── aarch64/cloud-hypervisor
│ └── v51.1/
│ ├── v51.1/
│ │ ├── x86_64/cloud-hypervisor
│ │ └── aarch64/cloud-hypervisor
│ └── v51.2/
│ ├── x86_64/cloud-hypervisor
│ └── aarch64/cloud-hypervisor
└── client_test.go # Tests with real Cloud Hypervisor
Expand All @@ -88,6 +91,7 @@ lib/vmm/

- Cloud Hypervisor v49.0 (API v0.3.0)
- Cloud Hypervisor v51.1 (API v0.3.0)
- Cloud Hypervisor v51.2 (API v0.3.0)

Cloud Hypervisor versions may update frequently while the API updates less frequently. All embedded versions currently share the same API spec.

Expand Down
3 changes: 2 additions & 1 deletion lib/vmm/binaries_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ type CHVersion string
const (
V49_0 CHVersion = "v49.0"
V51_1 CHVersion = "v51.1"
V51_2 CHVersion = "v51.2"
)

const DefaultVersion = V51_1
const DefaultVersion = V51_2

// SupportedVersions lists supported Cloud Hypervisor versions.
// On macOS, Cloud Hypervisor is not supported (use vz instead).
Expand Down
7 changes: 5 additions & 2 deletions lib/vmm/binaries_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ import (
//go:embed binaries/cloud-hypervisor/v49.0/aarch64/cloud-hypervisor
//go:embed binaries/cloud-hypervisor/v51.1/x86_64/cloud-hypervisor
//go:embed binaries/cloud-hypervisor/v51.1/aarch64/cloud-hypervisor
//go:embed binaries/cloud-hypervisor/v51.2/x86_64/cloud-hypervisor
//go:embed binaries/cloud-hypervisor/v51.2/aarch64/cloud-hypervisor
var binaryFS embed.FS

type CHVersion string

const (
V49_0 CHVersion = "v49.0"
V51_1 CHVersion = "v51.1"
V51_2 CHVersion = "v51.2"
)

const DefaultVersion = V51_1
const DefaultVersion = V51_2

var SupportedVersions = []CHVersion{V49_0, V51_1}
var SupportedVersions = []CHVersion{V49_0, V51_1, V51_2}

// ExtractBinary extracts the embedded Cloud Hypervisor binary to the data directory
func ExtractBinary(p *paths.Paths, version CHVersion) (string, error) {
Expand Down
2 changes: 2 additions & 0 deletions lib/vmm/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func TestExtractBinary(t *testing.T) {
func TestIsVersionSupported(t *testing.T) {
assert.True(t, IsVersionSupported(V49_0))
assert.True(t, IsVersionSupported(V51_1))
assert.True(t, IsVersionSupported(V51_2))
assert.False(t, IsVersionSupported("v1.0"))
}

Expand Down Expand Up @@ -120,6 +121,7 @@ func TestMultipleVersions(t *testing.T) {
}{
{"v49.0", V49_0},
{"v51.1", V51_1},
{"v51.2", V51_2},
}

for _, tt := range tests {
Expand Down