From b73f6647d0670211fd5f6efb70509c437590425e Mon Sep 17 00:00:00 2001 From: "kernel-internal[bot]" <260533166+kernel-internal[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 04:59:22 +0000 Subject: [PATCH 1/2] Update hypeman-go SDK to 0872a65 and show vendor VFIO vGPUs in ps Bumps github.com/kernel/hypeman-go to v0.28.1-0.20260902045311-0872a65a3733, which integrates vendor VFIO vGPUs into the instance lifecycle. The SDK now documents InstanceGPU.MdevUuid as populated on mdev hosts only, and adds InstanceGPU.DevicePath for the sysfs path of an assigned vGPU device. `hypeman ps` gated its GPU column on MdevUuid alone, so an instance with a vendor VFIO vGPU and no profile name rendered as "-". formatGPU now also checks DevicePath. A full enumeration of api.md methods and CLI commands found no other coverage gaps: every SDK method has a CLI command and every param field has a corresponding flag. Co-authored-by: Cursor --- go.mod | 2 +- go.sum | 4 ++-- pkg/cmd/ps.go | 5 +++-- pkg/cmd/ps_test.go | 7 +++++++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 7a943f7..9da5b2f 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/google/go-containerregistry v0.20.7 github.com/gorilla/websocket v1.5.3 github.com/itchyny/json2yaml v0.1.4 - github.com/kernel/hypeman-go v0.28.0 + github.com/kernel/hypeman-go v0.28.1-0.20260902045311-0872a65a3733 github.com/knadh/koanf/parsers/yaml v1.1.0 github.com/knadh/koanf/providers/env v1.1.0 github.com/knadh/koanf/providers/file v1.2.1 diff --git a/go.sum b/go.sum index 23e0dcb..1cbc63c 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnV github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/itchyny/json2yaml v0.1.4 h1:/pErVOXGG5iTyXHi/QKR4y3uzhLjGTEmmJIy97YT+k8= github.com/itchyny/json2yaml v0.1.4/go.mod h1:6iudhBZdarpjLFRNj+clWLAkGft+9uCcjAZYXUH9eGI= -github.com/kernel/hypeman-go v0.28.0 h1:1flQG6NfifaqrZsoU5LHydnVEUzaVdWt64/9JvEaOk8= -github.com/kernel/hypeman-go v0.28.0/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48= +github.com/kernel/hypeman-go v0.28.1-0.20260902045311-0872a65a3733 h1:qJLI83DX+7jnEVUgBF8edK5OYwTOwI4OqER0R+bARgY= +github.com/kernel/hypeman-go v0.28.1-0.20260902045311-0872a65a3733/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48= github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co= github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0= github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo= diff --git a/pkg/cmd/ps.go b/pkg/cmd/ps.go index 558f02c..e8ef2df 100644 --- a/pkg/cmd/ps.go +++ b/pkg/cmd/ps.go @@ -121,8 +121,9 @@ func formatGPU(gpu hypeman.InstanceGPU) string { if gpu.Profile != "" { return gpu.Profile } - // Check if mdev UUID is set (indicates vGPU without profile name shown) - if gpu.MdevUuid != "" { + // A vGPU is attached without a profile name shown. mdev_uuid is only populated on + // mdev hosts; vendor VFIO hosts report device_path instead. + if gpu.MdevUuid != "" || gpu.DevicePath != "" { return "vgpu" } return "-" diff --git a/pkg/cmd/ps_test.go b/pkg/cmd/ps_test.go index ffa94d0..6ac67e3 100644 --- a/pkg/cmd/ps_test.go +++ b/pkg/cmd/ps_test.go @@ -34,6 +34,13 @@ func TestFormatGPU(t *testing.T) { }, expected: "vgpu", }, + { + name: "vGPU without profile but with device path", + gpu: hypeman.InstanceGPU{ + DevicePath: "/sys/bus/pci/devices/0000:41:00.4", + }, + expected: "vgpu", + }, } for _, tt := range tests { From 4ad8ab1c3f0e83989506f5c7189f876366af3994 Mon Sep 17 00:00:00 2001 From: "kernel-internal[bot]" <260533166+kernel-internal[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 14:38:30 +0000 Subject: [PATCH 2/2] Update hypeman-go SDK to e6c2b7b and add swtpm log source Bumps github.com/kernel/hypeman-go to v0.28.1-0.20260902143136-e6c2b7bc0171, which adds the "swtpm" value to InstanceLogsParamsSource as part of the Windows hypervisor primitives. Teaches `hypeman logs --source` about swtpm and validates the flag up front instead of forwarding an arbitrary string to the API, matching the parseInstanceWaitState / parseSnapshotTargetHypervisor pattern. Co-authored-by: Cursor --- go.mod | 2 +- go.sum | 4 ++-- pkg/cmd/coveragecmd_test.go | 13 +++++++++++++ pkg/cmd/logs.go | 24 ++++++++++++++++++++++-- 4 files changed, 38 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 9da5b2f..49efb56 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/google/go-containerregistry v0.20.7 github.com/gorilla/websocket v1.5.3 github.com/itchyny/json2yaml v0.1.4 - github.com/kernel/hypeman-go v0.28.1-0.20260902045311-0872a65a3733 + github.com/kernel/hypeman-go v0.28.1-0.20260902143136-e6c2b7bc0171 github.com/knadh/koanf/parsers/yaml v1.1.0 github.com/knadh/koanf/providers/env v1.1.0 github.com/knadh/koanf/providers/file v1.2.1 diff --git a/go.sum b/go.sum index 1cbc63c..08e9135 100644 --- a/go.sum +++ b/go.sum @@ -78,8 +78,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnV github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/itchyny/json2yaml v0.1.4 h1:/pErVOXGG5iTyXHi/QKR4y3uzhLjGTEmmJIy97YT+k8= github.com/itchyny/json2yaml v0.1.4/go.mod h1:6iudhBZdarpjLFRNj+clWLAkGft+9uCcjAZYXUH9eGI= -github.com/kernel/hypeman-go v0.28.1-0.20260902045311-0872a65a3733 h1:qJLI83DX+7jnEVUgBF8edK5OYwTOwI4OqER0R+bARgY= -github.com/kernel/hypeman-go v0.28.1-0.20260902045311-0872a65a3733/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48= +github.com/kernel/hypeman-go v0.28.1-0.20260902143136-e6c2b7bc0171 h1:psPDtnXBaPABqymQW5lu1o9YOF7gyyxJZeQOCqcuxyo= +github.com/kernel/hypeman-go v0.28.1-0.20260902143136-e6c2b7bc0171/go.mod h1:of8qI/nef2OPLzt0EMlIRbMdJHEvuc4yWG8g/ioNg48= github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co= github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0= github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo= diff --git a/pkg/cmd/coveragecmd_test.go b/pkg/cmd/coveragecmd_test.go index 49ef742..8a972e6 100644 --- a/pkg/cmd/coveragecmd_test.go +++ b/pkg/cmd/coveragecmd_test.go @@ -81,6 +81,19 @@ func TestParseInstanceWaitState(t *testing.T) { }) } +func TestParseInstanceLogsSource(t *testing.T) { + t.Run("accepts mixed-case source names", func(t *testing.T) { + source, err := parseInstanceLogsSource("SwTpM") + require.NoError(t, err) + assert.Equal(t, hypeman.InstanceLogsParamsSourceSwtpm, source) + }) + + t.Run("rejects unsupported source names", func(t *testing.T) { + _, err := parseInstanceLogsSource("kernel") + require.EqualError(t, err, "invalid source: kernel (must be app, vmm, hypeman, or swtpm)") + }) +} + func TestParseAutoStandbyPorts(t *testing.T) { t.Run("parses valid port values", func(t *testing.T) { ports, err := parseAutoStandbyPorts([]string{"80", " 443 "}, "ignore-destination-port") diff --git a/pkg/cmd/logs.go b/pkg/cmd/logs.go index d461aae..43a8e73 100644 --- a/pkg/cmd/logs.go +++ b/pkg/cmd/logs.go @@ -3,6 +3,7 @@ package cmd import ( "context" "fmt" + "strings" "github.com/kernel/hypeman-go" "github.com/kernel/hypeman-go/option" @@ -27,7 +28,7 @@ var logsCmd = cli.Command{ &cli.StringFlag{ Name: "source", Aliases: []string{"s"}, - Usage: "Log source: app (default), vmm (Cloud Hypervisor), or hypeman (operations log)", + Usage: "Log source: app (default), vmm (Cloud Hypervisor), hypeman (operations log), or swtpm (software TPM emulator)", }, }, Action: handleLogs, @@ -56,7 +57,11 @@ func handleLogs(ctx context.Context, cmd *cli.Command) error { params.Tail = hypeman.Opt(int64(cmd.Int("tail"))) } if cmd.IsSet("source") { - params.Source = hypeman.InstanceLogsParamsSource(cmd.String("source")) + source, err := parseInstanceLogsSource(cmd.String("source")) + if err != nil { + return err + } + params.Source = source } var opts []option.RequestOption @@ -78,3 +83,18 @@ func handleLogs(ctx context.Context, cmd *cli.Command) error { return stream.Err() } + +func parseInstanceLogsSource(raw string) (hypeman.InstanceLogsParamsSource, error) { + switch strings.ToLower(raw) { + case "app": + return hypeman.InstanceLogsParamsSourceApp, nil + case "vmm": + return hypeman.InstanceLogsParamsSourceVmm, nil + case "hypeman": + return hypeman.InstanceLogsParamsSourceHypeman, nil + case "swtpm": + return hypeman.InstanceLogsParamsSourceSwtpm, nil + default: + return "", fmt.Errorf("invalid source: %s (must be app, vmm, hypeman, or swtpm)", raw) + } +}