diff --git a/src/runtime/virtcontainers/clh.go b/src/runtime/virtcontainers/clh.go index d690ed350..69cfe7917 100644 --- a/src/runtime/virtcontainers/clh.go +++ b/src/runtime/virtcontainers/clh.go @@ -21,8 +21,11 @@ import ( "os" "os/exec" "path/filepath" + "regexp" "strconv" "strings" + "sync" + "sync/atomic" "syscall" "time" @@ -100,7 +103,7 @@ type clhClient interface { // Add/remove CPUs to/from the VM VmResizePut(ctx context.Context, vmResize chclient.VmResize) (*http.Response, error) // Add VFIO PCI device to the VM - VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (chclient.PciDeviceInfo, *http.Response, error) + VmAddDevicePut(ctx context.Context, deviceConfig chclient.DeviceConfig) (chclient.PciDeviceInfo, *http.Response, error) // Add a new disk device to the VM VmAddDiskPut(ctx context.Context, diskConfig chclient.DiskConfig) (chclient.PciDeviceInfo, *http.Response, error) // Remove a device from the VM @@ -136,8 +139,8 @@ func (c *clhClientApi) VmResizePut(ctx context.Context, vmResize chclient.VmResi return c.ApiInternal.VmResizePut(ctx).VmResize(vmResize).Execute() } -func (c *clhClientApi) VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (chclient.PciDeviceInfo, *http.Response, error) { - return c.ApiInternal.VmAddDevicePut(ctx).VmAddDevice(vmAddDevice).Execute() +func (c *clhClientApi) VmAddDevicePut(ctx context.Context, deviceConfig chclient.DeviceConfig) (chclient.PciDeviceInfo, *http.Response, error) { + return c.ApiInternal.VmAddDevicePut(ctx).DeviceConfig(deviceConfig).Execute() } func (c *clhClientApi) VmAddDiskPut(ctx context.Context, diskConfig chclient.DiskConfig) (chclient.PciDeviceInfo, *http.Response, error) { @@ -253,6 +256,8 @@ type cloudHypervisor struct { vmconfig chclient.VmConfig state CloudHypervisorState config HypervisorConfig + stopped int32 + mu sync.Mutex } var clhKernelParams = []Param{ @@ -415,7 +420,13 @@ func (clh *cloudHypervisor) enableProtection() error { return errors.New("Firmware path is not specified") } - clh.vmconfig.Tdx = chclient.NewTdxConfig(firmwarePath) + clh.vmconfig.Payload.SetFirmware(firmwarePath) + + if clh.vmconfig.Platform == nil { + clh.vmconfig.Platform = chclient.NewPlatformConfig() + } + clh.vmconfig.Platform.SetTdx(true) + return nil case sevProtection: @@ -715,6 +726,55 @@ func (clh *cloudHypervisor) GetThreadIDs(ctx context.Context) (VcpuThreadIDs, er vcpuInfo.vcpus = make(map[int]int) + getVcpus := func(pid int) (map[int]int, error) { + vcpus := make(map[int]int) + + dir := fmt.Sprintf("/proc/%d/task", pid) + files, err := os.ReadDir(dir) + if err != nil { + return vcpus, err + } + + pattern, err := regexp.Compile(`^vcpu\d+$`) + if err != nil { + return vcpus, err + } + for _, file := range files { + comm, err := os.ReadFile(fmt.Sprintf("%s/%s/comm", dir, file.Name())) + if err != nil { + return vcpus, err + } + pName := strings.TrimSpace(string(comm)) + if !pattern.MatchString(pName) { + continue + } + + cpuID := strings.TrimPrefix(pName, "vcpu") + threadID := file.Name() + + k, err := strconv.Atoi(cpuID) + if err != nil { + return vcpus, err + } + v, err := strconv.Atoi(threadID) + if err != nil { + return vcpus, err + } + vcpus[k] = v + } + return vcpus, nil + } + + if clh.state.PID == 0 { + return vcpuInfo, nil + } + + vcpus, err := getVcpus(clh.state.PID) + if err != nil { + return vcpuInfo, err + } + vcpuInfo.vcpus = vcpus + return vcpuInfo, nil } @@ -798,8 +858,7 @@ func (clh *cloudHypervisor) hotPlugVFIODevice(device *config.VFIODev) error { defer cancel() // Create the clh device config via the constructor to ensure default values are properly assigned - clhDevice := *chclient.NewVmAddDevice() - clhDevice.Path = &device.SysfsDev + clhDevice := *chclient.NewDeviceConfig(device.SysfsDev) pciInfo, _, err := cl.VmAddDevicePut(ctx, clhDevice) if err != nil { return fmt.Errorf("Failed to hotplug device %+v %s", device, openAPIClientError(err)) @@ -1022,9 +1081,21 @@ func (clh *cloudHypervisor) ResumeVM(ctx context.Context) error { // StopVM will stop the Sandbox's VM. func (clh *cloudHypervisor) StopVM(ctx context.Context, waitOnly bool) (err error) { + clh.mu.Lock() + defer func() { + if err == nil { + atomic.StoreInt32(&clh.stopped, 1) + } + clh.mu.Unlock() + }() span, _ := katatrace.Trace(ctx, clh.Logger(), "StopVM", clhTracingTags, map[string]string{"sandbox_id": clh.id}) defer span.End() clh.Logger().WithField("function", "StopVM").Info("Stop Sandbox") + if atomic.LoadInt32(&clh.stopped) != 0 { + clh.Logger().Info("Already stopped") + return nil + } + return clh.terminate(ctx, waitOnly) } @@ -1326,16 +1397,20 @@ func (clh *cloudHypervisor) isClhRunning(timeout uint) (bool, error) { pid := clh.state.PID - if err := syscall.Kill(pid, syscall.Signal(0)); err != nil { + if atomic.LoadInt32(&clh.stopped) != 0 { return false, nil } timeStart := time.Now() cl := clh.client() for { + err := syscall.Kill(pid, syscall.Signal(0)) + if err != nil { + return false, nil + } ctx, cancel := context.WithTimeout(context.Background(), clh.getClhAPITimeout()*time.Second) - defer cancel() - _, _, err := cl.VmmPingGet(ctx) + _, _, err = cl.VmmPingGet(ctx) + cancel() if err == nil { return true, nil } else { diff --git a/src/runtime/virtcontainers/clh_test.go b/src/runtime/virtcontainers/clh_test.go index 1a30d515e..e8f02101e 100644 --- a/src/runtime/virtcontainers/clh_test.go +++ b/src/runtime/virtcontainers/clh_test.go @@ -103,7 +103,7 @@ func (c *clhClientMock) VmResizePut(ctx context.Context, vmResize chclient.VmRes } //nolint:golint -func (c *clhClientMock) VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (chclient.PciDeviceInfo, *http.Response, error) { +func (c *clhClientMock) VmAddDevicePut(ctx context.Context, deviceConfig chclient.DeviceConfig) (chclient.PciDeviceInfo, *http.Response, error) { return chclient.PciDeviceInfo{}, nil, nil } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES index 7618fe3ab..3cd6cf37e 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/.openapi-generator/FILES @@ -32,10 +32,9 @@ docs/RestoreConfig.md docs/RngConfig.md docs/SendMigrationData.md docs/SgxEpcConfig.md -docs/TdxConfig.md docs/TokenBucket.md +docs/TpmConfig.md docs/VdpaConfig.md -docs/VmAddDevice.md docs/VmConfig.md docs/VmCoredumpData.md docs/VmInfo.md @@ -73,10 +72,9 @@ model_restore_config.go model_rng_config.go model_send_migration_data.go model_sgx_epc_config.go -model_tdx_config.go model_token_bucket.go +model_tpm_config.go model_vdpa_config.go -model_vm_add_device.go model_vm_config.go model_vm_coredump_data.go model_vm_info.go diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md index 5839299b6..cb42aa49b 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/README.md @@ -134,10 +134,9 @@ Class | Method | HTTP request | Description - [RngConfig](docs/RngConfig.md) - [SendMigrationData](docs/SendMigrationData.md) - [SgxEpcConfig](docs/SgxEpcConfig.md) - - [TdxConfig](docs/TdxConfig.md) - [TokenBucket](docs/TokenBucket.md) + - [TpmConfig](docs/TpmConfig.md) - [VdpaConfig](docs/VdpaConfig.md) - - [VmAddDevice](docs/VmAddDevice.md) - [VmConfig](docs/VmConfig.md) - [VmCoredumpData](docs/VmCoredumpData.md) - [VmInfo](docs/VmInfo.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml index 96a0498a4..750c1e725 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -171,7 +171,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/VmAddDevice' + $ref: '#/components/schemas/DeviceConfig' description: The path of the new device required: true responses: @@ -425,7 +425,7 @@ components: VmInfo: description: Virtual Machine information example: - memory_actual_size: 3 + memory_actual_size: 7 state: Created config: console: @@ -433,7 +433,7 @@ components: file: file iommu: false balloon: - size: 6 + size: 1 deflate_on_oom: false free_page_reporting: false memory: @@ -469,6 +469,7 @@ components: hotplug_size: 7 hotplug_size: 4 hotplug_method: Acpi + thp: true disks: - pci_segment: 8 path: path @@ -530,83 +531,81 @@ components: - 3 - 3 devices: - - pci_segment: 6 + - pci_segment: 3 path: path iommu: false id: id - - pci_segment: 6 + - pci_segment: 3 path: path iommu: false id: id vdpa: - - pci_segment: 3 + - pci_segment: 7 path: path num_queues: 3 iommu: false id: id - - pci_segment: 3 + - pci_segment: 7 path: path num_queues: 3 iommu: false id: id numa: - distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 + guest_numa_id: 0 - distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 - tdx: - firmware: firmware + guest_numa_id: 0 rng: iommu: false src: /dev/urandom sgx_epc: - prefault: false - size: 7 + size: 6 id: id - prefault: false - size: 7 + size: 6 id: id fs: - pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id - pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id vsock: - pci_segment: 0 + pci_segment: 7 iommu: false socket: socket id: id @@ -615,22 +614,25 @@ components: iommu_segments: - 3 - 3 - num_pci_segments: 7 + num_pci_segments: 3 oem_strings: - oem_strings - oem_strings + tdx: false serial_number: serial_number uuid: uuid + tpm: + socket: socket pmem: - - pci_segment: 5 + - pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false - - pci_segment: 5 + - pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false @@ -640,14 +642,16 @@ components: cmdline: cmdline kernel: kernel initramfs: initramfs + firmware: firmware serial: mode: "false" file: file iommu: false net: - tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -659,7 +663,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -667,8 +672,9 @@ components: id: id mask: 255.255.255.0 - tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -680,7 +686,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -769,7 +776,10 @@ components: cmdline: cmdline kernel: kernel initramfs: initramfs + firmware: firmware properties: + firmware: + type: string kernel: type: string cmdline: @@ -785,7 +795,7 @@ components: file: file iommu: false balloon: - size: 6 + size: 1 deflate_on_oom: false free_page_reporting: false memory: @@ -821,6 +831,7 @@ components: hotplug_size: 7 hotplug_size: 4 hotplug_method: Acpi + thp: true disks: - pci_segment: 8 path: path @@ -882,83 +893,81 @@ components: - 3 - 3 devices: - - pci_segment: 6 + - pci_segment: 3 path: path iommu: false id: id - - pci_segment: 6 + - pci_segment: 3 path: path iommu: false id: id vdpa: - - pci_segment: 3 + - pci_segment: 7 path: path num_queues: 3 iommu: false id: id - - pci_segment: 3 + - pci_segment: 7 path: path num_queues: 3 iommu: false id: id numa: - distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 + guest_numa_id: 0 - distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 - tdx: - firmware: firmware + guest_numa_id: 0 rng: iommu: false src: /dev/urandom sgx_epc: - prefault: false - size: 7 + size: 6 id: id - prefault: false - size: 7 + size: 6 id: id fs: - pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id - pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id vsock: - pci_segment: 0 + pci_segment: 7 iommu: false socket: socket id: id @@ -967,22 +976,25 @@ components: iommu_segments: - 3 - 3 - num_pci_segments: 7 + num_pci_segments: 3 oem_strings: - oem_strings - oem_strings + tdx: false serial_number: serial_number uuid: uuid + tpm: + socket: socket pmem: - - pci_segment: 5 + - pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false - - pci_segment: 5 + - pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false @@ -992,14 +1004,16 @@ components: cmdline: cmdline kernel: kernel initramfs: initramfs + firmware: firmware serial: mode: "false" file: file iommu: false net: - tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -1011,7 +1025,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -1019,8 +1034,9 @@ components: id: id mask: 255.255.255.0 - tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -1032,7 +1048,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -1084,8 +1101,6 @@ components: items: $ref: '#/components/schemas/SgxEpcConfig' type: array - tdx: - $ref: '#/components/schemas/TdxConfig' numa: items: $ref: '#/components/schemas/NumaConfig' @@ -1098,6 +1113,8 @@ components: type: boolean platform: $ref: '#/components/schemas/PlatformConfig' + tpm: + $ref: '#/components/schemas/TpmConfig' required: - payload type: object @@ -1191,10 +1208,11 @@ components: iommu_segments: - 3 - 3 - num_pci_segments: 7 + num_pci_segments: 3 oem_strings: - oem_strings - oem_strings + tdx: false serial_number: serial_number uuid: uuid properties: @@ -1214,6 +1232,9 @@ components: items: type: string type: array + tdx: + default: false + type: boolean type: object MemoryZoneConfig: example: @@ -1298,6 +1319,7 @@ components: hotplug_size: 7 hotplug_size: 4 hotplug_method: Acpi + thp: true properties: size: format: int64 @@ -1326,6 +1348,9 @@ components: prefault: default: false type: boolean + thp: + default: true + type: boolean zones: items: $ref: '#/components/schemas/MemoryZoneConfig' @@ -1442,8 +1467,9 @@ components: NetConfig: example: tap: tap - num_queues: 9 - queue_size: 6 + host_mac: host_mac + num_queues: 6 + queue_size: 3 ip: 192.168.249.1 rate_limiter_config: ops: @@ -1455,7 +1481,8 @@ components: one_time_burst: 0 refill_time: 0 mac: mac - pci_segment: 3 + mtu: 9 + pci_segment: 6 vhost_mode: Client iommu: false vhost_socket: vhost_socket @@ -1473,6 +1500,10 @@ components: type: string mac: type: string + host_mac: + type: string + mtu: + type: integer iommu: default: false type: boolean @@ -1514,7 +1545,7 @@ components: type: object BalloonConfig: example: - size: 6 + size: 1 deflate_on_oom: false free_page_reporting: false properties: @@ -1535,8 +1566,8 @@ components: FsConfig: example: pci_segment: 6 - num_queues: 1 - queue_size: 2 + num_queues: 2 + queue_size: 6 tag: tag socket: socket id: id @@ -1564,9 +1595,9 @@ components: type: object PmemConfig: example: - pci_segment: 5 + pci_segment: 6 file: file - size: 6 + size: 5 iommu: false id: id discard_writes: false @@ -1614,7 +1645,7 @@ components: type: object DeviceConfig: example: - pci_segment: 6 + pci_segment: 3 path: path iommu: false id: id @@ -1632,9 +1663,18 @@ components: required: - path type: object + TpmConfig: + example: + socket: socket + properties: + socket: + type: string + required: + - socket + type: object VdpaConfig: example: - pci_segment: 3 + pci_segment: 7 path: path num_queues: 3 iommu: false @@ -1659,7 +1699,7 @@ components: type: object VsockConfig: example: - pci_segment: 0 + pci_segment: 7 iommu: false socket: socket id: id @@ -1688,7 +1728,7 @@ components: SgxEpcConfig: example: prefault: false - size: 7 + size: 6 id: id properties: id: @@ -1703,21 +1743,10 @@ components: - id - size type: object - TdxConfig: - example: - firmware: firmware - properties: - firmware: - description: Path to the firmware that will be used to boot the TDx guest - up. - type: string - required: - - firmware - type: object NumaDistance: example: - distance: 8 - destination: 4 + distance: 7 + destination: 8 properties: destination: format: int32 @@ -1732,20 +1761,20 @@ components: NumaConfig: example: distances: - - distance: 8 - destination: 4 - - distance: 8 - destination: 4 + - distance: 7 + destination: 8 + - distance: 7 + destination: 8 cpus: - - 0 - - 0 + - 4 + - 4 sgx_epc_sections: - sgx_epc_sections - sgx_epc_sections memory_zones: - memory_zones - memory_zones - guest_numa_id: 6 + guest_numa_id: 0 properties: guest_numa_id: format: int32 @@ -1800,20 +1829,6 @@ components: format: int64 type: integer type: object - VmAddDevice: - example: - path: path - iommu: false - id: id - properties: - path: - type: string - iommu: - default: false - type: boolean - id: - type: string - type: object VmRemoveDevice: example: id: id diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go index cf97c19dd..5c59d43d4 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api_default.go @@ -831,14 +831,14 @@ func (a *DefaultApiService) ShutdownVMMExecute(r ApiShutdownVMMRequest) (*_netht } type ApiVmAddDevicePutRequest struct { - ctx _context.Context - ApiService *DefaultApiService - vmAddDevice *VmAddDevice + ctx _context.Context + ApiService *DefaultApiService + deviceConfig *DeviceConfig } // The path of the new device -func (r ApiVmAddDevicePutRequest) VmAddDevice(vmAddDevice VmAddDevice) ApiVmAddDevicePutRequest { - r.vmAddDevice = &vmAddDevice +func (r ApiVmAddDevicePutRequest) DeviceConfig(deviceConfig DeviceConfig) ApiVmAddDevicePutRequest { + r.deviceConfig = &deviceConfig return r } @@ -882,8 +882,8 @@ func (a *DefaultApiService) VmAddDevicePutExecute(r ApiVmAddDevicePutRequest) (P localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if r.vmAddDevice == nil { - return localVarReturnValue, nil, reportError("vmAddDevice is required and must be specified") + if r.deviceConfig == nil { + return localVarReturnValue, nil, reportError("deviceConfig is required and must be specified") } // to determine the Content-Type header @@ -904,7 +904,7 @@ func (a *DefaultApiService) VmAddDevicePutExecute(r ApiVmAddDevicePutRequest) (P localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.vmAddDevice + localVarPostBody = r.deviceConfig req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md index 1391a0b27..d61097719 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/DefaultApi.md @@ -554,7 +554,7 @@ No authorization required ## VmAddDevicePut -> PciDeviceInfo VmAddDevicePut(ctx).VmAddDevice(vmAddDevice).Execute() +> PciDeviceInfo VmAddDevicePut(ctx).DeviceConfig(deviceConfig).Execute() Add a new device to the VM @@ -571,11 +571,11 @@ import ( ) func main() { - vmAddDevice := *openapiclient.NewVmAddDevice() // VmAddDevice | The path of the new device + deviceConfig := *openapiclient.NewDeviceConfig("Path_example") // DeviceConfig | The path of the new device configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) - resp, r, err := api_client.DefaultApi.VmAddDevicePut(context.Background()).VmAddDevice(vmAddDevice).Execute() + resp, r, err := api_client.DefaultApi.VmAddDevicePut(context.Background()).DeviceConfig(deviceConfig).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.VmAddDevicePut``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -596,7 +596,7 @@ Other parameters are passed through a pointer to a apiVmAddDevicePutRequest stru Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **vmAddDevice** | [**VmAddDevice**](VmAddDevice.md) | The path of the new device | + **deviceConfig** | [**DeviceConfig**](DeviceConfig.md) | The path of the new device | ### Return type diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md index 669bcc518..e6127fc17 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/MemoryConfig.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **Hugepages** | Pointer to **bool** | | [optional] [default to false] **HugepageSize** | Pointer to **int64** | | [optional] **Prefault** | Pointer to **bool** | | [optional] [default to false] +**Thp** | Pointer to **bool** | | [optional] [default to true] **Zones** | Pointer to [**[]MemoryZoneConfig**](MemoryZoneConfig.md) | | [optional] ## Methods @@ -254,6 +255,31 @@ SetPrefault sets Prefault field to given value. HasPrefault returns a boolean if a field has been set. +### GetThp + +`func (o *MemoryConfig) GetThp() bool` + +GetThp returns the Thp field if non-nil, zero value otherwise. + +### GetThpOk + +`func (o *MemoryConfig) GetThpOk() (*bool, bool)` + +GetThpOk returns a tuple with the Thp field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetThp + +`func (o *MemoryConfig) SetThp(v bool)` + +SetThp sets Thp field to given value. + +### HasThp + +`func (o *MemoryConfig) HasThp() bool` + +HasThp returns a boolean if a field has been set. + ### GetZones `func (o *MemoryConfig) GetZones() []MemoryZoneConfig` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md index 073401d19..f3af12647 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/NetConfig.md @@ -8,6 +8,8 @@ Name | Type | Description | Notes **Ip** | Pointer to **string** | | [optional] [default to "192.168.249.1"] **Mask** | Pointer to **string** | | [optional] [default to "255.255.255.0"] **Mac** | Pointer to **string** | | [optional] +**HostMac** | Pointer to **string** | | [optional] +**Mtu** | Pointer to **int32** | | [optional] **Iommu** | Pointer to **bool** | | [optional] [default to false] **NumQueues** | Pointer to **int32** | | [optional] [default to 2] **QueueSize** | Pointer to **int32** | | [optional] [default to 256] @@ -137,6 +139,56 @@ SetMac sets Mac field to given value. HasMac returns a boolean if a field has been set. +### GetHostMac + +`func (o *NetConfig) GetHostMac() string` + +GetHostMac returns the HostMac field if non-nil, zero value otherwise. + +### GetHostMacOk + +`func (o *NetConfig) GetHostMacOk() (*string, bool)` + +GetHostMacOk returns a tuple with the HostMac field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetHostMac + +`func (o *NetConfig) SetHostMac(v string)` + +SetHostMac sets HostMac field to given value. + +### HasHostMac + +`func (o *NetConfig) HasHostMac() bool` + +HasHostMac returns a boolean if a field has been set. + +### GetMtu + +`func (o *NetConfig) GetMtu() int32` + +GetMtu returns the Mtu field if non-nil, zero value otherwise. + +### GetMtuOk + +`func (o *NetConfig) GetMtuOk() (*int32, bool)` + +GetMtuOk returns a tuple with the Mtu field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetMtu + +`func (o *NetConfig) SetMtu(v int32)` + +SetMtu sets Mtu field to given value. + +### HasMtu + +`func (o *NetConfig) HasMtu() bool` + +HasMtu returns a boolean if a field has been set. + ### GetIommu `func (o *NetConfig) GetIommu() bool` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PayloadConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PayloadConfig.md index 8985796ea..096584a8f 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PayloadConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PayloadConfig.md @@ -4,6 +4,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**Firmware** | Pointer to **string** | | [optional] **Kernel** | Pointer to **string** | | [optional] **Cmdline** | Pointer to **string** | | [optional] **Initramfs** | Pointer to **string** | | [optional] @@ -27,6 +28,31 @@ NewPayloadConfigWithDefaults instantiates a new PayloadConfig object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set +### GetFirmware + +`func (o *PayloadConfig) GetFirmware() string` + +GetFirmware returns the Firmware field if non-nil, zero value otherwise. + +### GetFirmwareOk + +`func (o *PayloadConfig) GetFirmwareOk() (*string, bool)` + +GetFirmwareOk returns a tuple with the Firmware field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetFirmware + +`func (o *PayloadConfig) SetFirmware(v string)` + +SetFirmware sets Firmware field to given value. + +### HasFirmware + +`func (o *PayloadConfig) HasFirmware() bool` + +HasFirmware returns a boolean if a field has been set. + ### GetKernel `func (o *PayloadConfig) GetKernel() string` diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PlatformConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PlatformConfig.md index eacec0d02..d8772c5e0 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PlatformConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/PlatformConfig.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **SerialNumber** | Pointer to **string** | | [optional] **Uuid** | Pointer to **string** | | [optional] **OemStrings** | Pointer to **[]string** | | [optional] +**Tdx** | Pointer to **bool** | | [optional] [default to false] ## Methods @@ -154,6 +155,31 @@ SetOemStrings sets OemStrings field to given value. HasOemStrings returns a boolean if a field has been set. +### GetTdx + +`func (o *PlatformConfig) GetTdx() bool` + +GetTdx returns the Tdx field if non-nil, zero value otherwise. + +### GetTdxOk + +`func (o *PlatformConfig) GetTdxOk() (*bool, bool)` + +GetTdxOk returns a tuple with the Tdx field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTdx + +`func (o *PlatformConfig) SetTdx(v bool)` + +SetTdx sets Tdx field to given value. + +### HasTdx + +`func (o *PlatformConfig) HasTdx() bool` + +HasTdx returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TdxConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TdxConfig.md deleted file mode 100644 index 8577bcf5b..000000000 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TdxConfig.md +++ /dev/null @@ -1,51 +0,0 @@ -# TdxConfig - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Firmware** | **string** | Path to the firmware that will be used to boot the TDx guest up. | - -## Methods - -### NewTdxConfig - -`func NewTdxConfig(firmware string, ) *TdxConfig` - -NewTdxConfig instantiates a new TdxConfig object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewTdxConfigWithDefaults - -`func NewTdxConfigWithDefaults() *TdxConfig` - -NewTdxConfigWithDefaults instantiates a new TdxConfig object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetFirmware - -`func (o *TdxConfig) GetFirmware() string` - -GetFirmware returns the Firmware field if non-nil, zero value otherwise. - -### GetFirmwareOk - -`func (o *TdxConfig) GetFirmwareOk() (*string, bool)` - -GetFirmwareOk returns a tuple with the Firmware field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetFirmware - -`func (o *TdxConfig) SetFirmware(v string)` - -SetFirmware sets Firmware field to given value. - - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TpmConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TpmConfig.md new file mode 100644 index 000000000..f659490e3 --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/TpmConfig.md @@ -0,0 +1,51 @@ +# TpmConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Socket** | **string** | | + +## Methods + +### NewTpmConfig + +`func NewTpmConfig(socket string, ) *TpmConfig` + +NewTpmConfig instantiates a new TpmConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewTpmConfigWithDefaults + +`func NewTpmConfigWithDefaults() *TpmConfig` + +NewTpmConfigWithDefaults instantiates a new TpmConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetSocket + +`func (o *TpmConfig) GetSocket() string` + +GetSocket returns the Socket field if non-nil, zero value otherwise. + +### GetSocketOk + +`func (o *TpmConfig) GetSocketOk() (*string, bool)` + +GetSocketOk returns a tuple with the Socket field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetSocket + +`func (o *TpmConfig) SetSocket(v string)` + +SetSocket sets Socket field to given value. + + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md deleted file mode 100644 index aaef7b32c..000000000 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmAddDevice.md +++ /dev/null @@ -1,108 +0,0 @@ -# VmAddDevice - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Path** | Pointer to **string** | | [optional] -**Iommu** | Pointer to **bool** | | [optional] [default to false] -**Id** | Pointer to **string** | | [optional] - -## Methods - -### NewVmAddDevice - -`func NewVmAddDevice() *VmAddDevice` - -NewVmAddDevice instantiates a new VmAddDevice object -This constructor will assign default values to properties that have it defined, -and makes sure properties required by API are set, but the set of arguments -will change when the set of required properties is changed - -### NewVmAddDeviceWithDefaults - -`func NewVmAddDeviceWithDefaults() *VmAddDevice` - -NewVmAddDeviceWithDefaults instantiates a new VmAddDevice object -This constructor will only assign default values to properties that have it defined, -but it doesn't guarantee that properties required by API are set - -### GetPath - -`func (o *VmAddDevice) GetPath() string` - -GetPath returns the Path field if non-nil, zero value otherwise. - -### GetPathOk - -`func (o *VmAddDevice) GetPathOk() (*string, bool)` - -GetPathOk returns a tuple with the Path field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetPath - -`func (o *VmAddDevice) SetPath(v string)` - -SetPath sets Path field to given value. - -### HasPath - -`func (o *VmAddDevice) HasPath() bool` - -HasPath returns a boolean if a field has been set. - -### GetIommu - -`func (o *VmAddDevice) GetIommu() bool` - -GetIommu returns the Iommu field if non-nil, zero value otherwise. - -### GetIommuOk - -`func (o *VmAddDevice) GetIommuOk() (*bool, bool)` - -GetIommuOk returns a tuple with the Iommu field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetIommu - -`func (o *VmAddDevice) SetIommu(v bool)` - -SetIommu sets Iommu field to given value. - -### HasIommu - -`func (o *VmAddDevice) HasIommu() bool` - -HasIommu returns a boolean if a field has been set. - -### GetId - -`func (o *VmAddDevice) GetId() string` - -GetId returns the Id field if non-nil, zero value otherwise. - -### GetIdOk - -`func (o *VmAddDevice) GetIdOk() (*string, bool)` - -GetIdOk returns a tuple with the Id field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetId - -`func (o *VmAddDevice) SetId(v string)` - -SetId sets Id field to given value. - -### HasId - -`func (o *VmAddDevice) HasId() bool` - -HasId returns a boolean if a field has been set. - - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md index 717749be6..175df7ff3 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/VmConfig.md @@ -19,11 +19,11 @@ Name | Type | Description | Notes **Vdpa** | Pointer to [**[]VdpaConfig**](VdpaConfig.md) | | [optional] **Vsock** | Pointer to [**VsockConfig**](VsockConfig.md) | | [optional] **SgxEpc** | Pointer to [**[]SgxEpcConfig**](SgxEpcConfig.md) | | [optional] -**Tdx** | Pointer to [**TdxConfig**](TdxConfig.md) | | [optional] **Numa** | Pointer to [**[]NumaConfig**](NumaConfig.md) | | [optional] **Iommu** | Pointer to **bool** | | [optional] [default to false] **Watchdog** | Pointer to **bool** | | [optional] [default to false] **Platform** | Pointer to [**PlatformConfig**](PlatformConfig.md) | | [optional] +**Tpm** | Pointer to [**TpmConfig**](TpmConfig.md) | | [optional] ## Methods @@ -414,31 +414,6 @@ SetSgxEpc sets SgxEpc field to given value. HasSgxEpc returns a boolean if a field has been set. -### GetTdx - -`func (o *VmConfig) GetTdx() TdxConfig` - -GetTdx returns the Tdx field if non-nil, zero value otherwise. - -### GetTdxOk - -`func (o *VmConfig) GetTdxOk() (*TdxConfig, bool)` - -GetTdxOk returns a tuple with the Tdx field if it's non-nil, zero value otherwise -and a boolean to check if the value has been set. - -### SetTdx - -`func (o *VmConfig) SetTdx(v TdxConfig)` - -SetTdx sets Tdx field to given value. - -### HasTdx - -`func (o *VmConfig) HasTdx() bool` - -HasTdx returns a boolean if a field has been set. - ### GetNuma `func (o *VmConfig) GetNuma() []NumaConfig` @@ -539,6 +514,31 @@ SetPlatform sets Platform field to given value. HasPlatform returns a boolean if a field has been set. +### GetTpm + +`func (o *VmConfig) GetTpm() TpmConfig` + +GetTpm returns the Tpm field if non-nil, zero value otherwise. + +### GetTpmOk + +`func (o *VmConfig) GetTpmOk() (*TpmConfig, bool)` + +GetTpmOk returns a tuple with the Tpm field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetTpm + +`func (o *VmConfig) SetTpm(v TpmConfig)` + +SetTpm sets Tpm field to given value. + +### HasTpm + +`func (o *VmConfig) HasTpm() bool` + +HasTpm returns a boolean if a field has been set. + [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go index f7b4bb09a..bc80adaba 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_memory_config.go @@ -25,6 +25,7 @@ type MemoryConfig struct { Hugepages *bool `json:"hugepages,omitempty"` HugepageSize *int64 `json:"hugepage_size,omitempty"` Prefault *bool `json:"prefault,omitempty"` + Thp *bool `json:"thp,omitempty"` Zones *[]MemoryZoneConfig `json:"zones,omitempty"` } @@ -45,6 +46,8 @@ func NewMemoryConfig(size int64) *MemoryConfig { this.Hugepages = &hugepages var prefault bool = false this.Prefault = &prefault + var thp bool = true + this.Thp = &thp return &this } @@ -63,6 +66,8 @@ func NewMemoryConfigWithDefaults() *MemoryConfig { this.Hugepages = &hugepages var prefault bool = false this.Prefault = &prefault + var thp bool = true + this.Thp = &thp return &this } @@ -346,6 +351,38 @@ func (o *MemoryConfig) SetPrefault(v bool) { o.Prefault = &v } +// GetThp returns the Thp field value if set, zero value otherwise. +func (o *MemoryConfig) GetThp() bool { + if o == nil || o.Thp == nil { + var ret bool + return ret + } + return *o.Thp +} + +// GetThpOk returns a tuple with the Thp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MemoryConfig) GetThpOk() (*bool, bool) { + if o == nil || o.Thp == nil { + return nil, false + } + return o.Thp, true +} + +// HasThp returns a boolean if a field has been set. +func (o *MemoryConfig) HasThp() bool { + if o != nil && o.Thp != nil { + return true + } + + return false +} + +// SetThp gets a reference to the given bool and assigns it to the Thp field. +func (o *MemoryConfig) SetThp(v bool) { + o.Thp = &v +} + // GetZones returns the Zones field value if set, zero value otherwise. func (o *MemoryConfig) GetZones() []MemoryZoneConfig { if o == nil || o.Zones == nil { @@ -407,6 +444,9 @@ func (o MemoryConfig) MarshalJSON() ([]byte, error) { if o.Prefault != nil { toSerialize["prefault"] = o.Prefault } + if o.Thp != nil { + toSerialize["thp"] = o.Thp + } if o.Zones != nil { toSerialize["zones"] = o.Zones } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go index 976d8cd33..8f6d30ff3 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_net_config.go @@ -20,6 +20,8 @@ type NetConfig struct { Ip *string `json:"ip,omitempty"` Mask *string `json:"mask,omitempty"` Mac *string `json:"mac,omitempty"` + HostMac *string `json:"host_mac,omitempty"` + Mtu *int32 `json:"mtu,omitempty"` Iommu *bool `json:"iommu,omitempty"` NumQueues *int32 `json:"num_queues,omitempty"` QueueSize *int32 `json:"queue_size,omitempty"` @@ -204,6 +206,70 @@ func (o *NetConfig) SetMac(v string) { o.Mac = &v } +// GetHostMac returns the HostMac field value if set, zero value otherwise. +func (o *NetConfig) GetHostMac() string { + if o == nil || o.HostMac == nil { + var ret string + return ret + } + return *o.HostMac +} + +// GetHostMacOk returns a tuple with the HostMac field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetConfig) GetHostMacOk() (*string, bool) { + if o == nil || o.HostMac == nil { + return nil, false + } + return o.HostMac, true +} + +// HasHostMac returns a boolean if a field has been set. +func (o *NetConfig) HasHostMac() bool { + if o != nil && o.HostMac != nil { + return true + } + + return false +} + +// SetHostMac gets a reference to the given string and assigns it to the HostMac field. +func (o *NetConfig) SetHostMac(v string) { + o.HostMac = &v +} + +// GetMtu returns the Mtu field value if set, zero value otherwise. +func (o *NetConfig) GetMtu() int32 { + if o == nil || o.Mtu == nil { + var ret int32 + return ret + } + return *o.Mtu +} + +// GetMtuOk returns a tuple with the Mtu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *NetConfig) GetMtuOk() (*int32, bool) { + if o == nil || o.Mtu == nil { + return nil, false + } + return o.Mtu, true +} + +// HasMtu returns a boolean if a field has been set. +func (o *NetConfig) HasMtu() bool { + if o != nil && o.Mtu != nil { + return true + } + + return false +} + +// SetMtu gets a reference to the given int32 and assigns it to the Mtu field. +func (o *NetConfig) SetMtu(v int32) { + o.Mtu = &v +} + // GetIommu returns the Iommu field value if set, zero value otherwise. func (o *NetConfig) GetIommu() bool { if o == nil || o.Iommu == nil { @@ -506,6 +572,12 @@ func (o NetConfig) MarshalJSON() ([]byte, error) { if o.Mac != nil { toSerialize["mac"] = o.Mac } + if o.HostMac != nil { + toSerialize["host_mac"] = o.HostMac + } + if o.Mtu != nil { + toSerialize["mtu"] = o.Mtu + } if o.Iommu != nil { toSerialize["iommu"] = o.Iommu } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_payload_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_payload_config.go index 04abb6a3e..5029c92d9 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_payload_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_payload_config.go @@ -16,6 +16,7 @@ import ( // PayloadConfig Payloads to boot in guest type PayloadConfig struct { + Firmware *string `json:"firmware,omitempty"` Kernel *string `json:"kernel,omitempty"` Cmdline *string `json:"cmdline,omitempty"` Initramfs *string `json:"initramfs,omitempty"` @@ -38,6 +39,38 @@ func NewPayloadConfigWithDefaults() *PayloadConfig { return &this } +// GetFirmware returns the Firmware field value if set, zero value otherwise. +func (o *PayloadConfig) GetFirmware() string { + if o == nil || o.Firmware == nil { + var ret string + return ret + } + return *o.Firmware +} + +// GetFirmwareOk returns a tuple with the Firmware field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PayloadConfig) GetFirmwareOk() (*string, bool) { + if o == nil || o.Firmware == nil { + return nil, false + } + return o.Firmware, true +} + +// HasFirmware returns a boolean if a field has been set. +func (o *PayloadConfig) HasFirmware() bool { + if o != nil && o.Firmware != nil { + return true + } + + return false +} + +// SetFirmware gets a reference to the given string and assigns it to the Firmware field. +func (o *PayloadConfig) SetFirmware(v string) { + o.Firmware = &v +} + // GetKernel returns the Kernel field value if set, zero value otherwise. func (o *PayloadConfig) GetKernel() string { if o == nil || o.Kernel == nil { @@ -136,6 +169,9 @@ func (o *PayloadConfig) SetInitramfs(v string) { func (o PayloadConfig) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} + if o.Firmware != nil { + toSerialize["firmware"] = o.Firmware + } if o.Kernel != nil { toSerialize["kernel"] = o.Kernel } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_platform_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_platform_config.go index 250493a6b..3072f0bd3 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_platform_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_platform_config.go @@ -21,6 +21,7 @@ type PlatformConfig struct { SerialNumber *string `json:"serial_number,omitempty"` Uuid *string `json:"uuid,omitempty"` OemStrings *[]string `json:"oem_strings,omitempty"` + Tdx *bool `json:"tdx,omitempty"` } // NewPlatformConfig instantiates a new PlatformConfig object @@ -29,6 +30,8 @@ type PlatformConfig struct { // will change when the set of required properties is changed func NewPlatformConfig() *PlatformConfig { this := PlatformConfig{} + var tdx bool = false + this.Tdx = &tdx return &this } @@ -37,6 +40,8 @@ func NewPlatformConfig() *PlatformConfig { // but it doesn't guarantee that properties required by API are set func NewPlatformConfigWithDefaults() *PlatformConfig { this := PlatformConfig{} + var tdx bool = false + this.Tdx = &tdx return &this } @@ -200,6 +205,38 @@ func (o *PlatformConfig) SetOemStrings(v []string) { o.OemStrings = &v } +// GetTdx returns the Tdx field value if set, zero value otherwise. +func (o *PlatformConfig) GetTdx() bool { + if o == nil || o.Tdx == nil { + var ret bool + return ret + } + return *o.Tdx +} + +// GetTdxOk returns a tuple with the Tdx field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PlatformConfig) GetTdxOk() (*bool, bool) { + if o == nil || o.Tdx == nil { + return nil, false + } + return o.Tdx, true +} + +// HasTdx returns a boolean if a field has been set. +func (o *PlatformConfig) HasTdx() bool { + if o != nil && o.Tdx != nil { + return true + } + + return false +} + +// SetTdx gets a reference to the given bool and assigns it to the Tdx field. +func (o *PlatformConfig) SetTdx(v bool) { + o.Tdx = &v +} + func (o PlatformConfig) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.NumPciSegments != nil { @@ -217,6 +254,9 @@ func (o PlatformConfig) MarshalJSON() ([]byte, error) { if o.OemStrings != nil { toSerialize["oem_strings"] = o.OemStrings } + if o.Tdx != nil { + toSerialize["tdx"] = o.Tdx + } return json.Marshal(toSerialize) } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tdx_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tdx_config.go deleted file mode 100644 index 3fe9057da..000000000 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tdx_config.go +++ /dev/null @@ -1,107 +0,0 @@ -/* -Cloud Hypervisor API - -Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. - -API version: 0.3.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "encoding/json" -) - -// TdxConfig struct for TdxConfig -type TdxConfig struct { - // Path to the firmware that will be used to boot the TDx guest up. - Firmware string `json:"firmware"` -} - -// NewTdxConfig instantiates a new TdxConfig object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewTdxConfig(firmware string) *TdxConfig { - this := TdxConfig{} - this.Firmware = firmware - return &this -} - -// NewTdxConfigWithDefaults instantiates a new TdxConfig object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewTdxConfigWithDefaults() *TdxConfig { - this := TdxConfig{} - return &this -} - -// GetFirmware returns the Firmware field value -func (o *TdxConfig) GetFirmware() string { - if o == nil { - var ret string - return ret - } - - return o.Firmware -} - -// GetFirmwareOk returns a tuple with the Firmware field value -// and a boolean to check if the value has been set. -func (o *TdxConfig) GetFirmwareOk() (*string, bool) { - if o == nil { - return nil, false - } - return &o.Firmware, true -} - -// SetFirmware sets field value -func (o *TdxConfig) SetFirmware(v string) { - o.Firmware = v -} - -func (o TdxConfig) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["firmware"] = o.Firmware - } - return json.Marshal(toSerialize) -} - -type NullableTdxConfig struct { - value *TdxConfig - isSet bool -} - -func (v NullableTdxConfig) Get() *TdxConfig { - return v.value -} - -func (v *NullableTdxConfig) Set(val *TdxConfig) { - v.value = val - v.isSet = true -} - -func (v NullableTdxConfig) IsSet() bool { - return v.isSet -} - -func (v *NullableTdxConfig) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableTdxConfig(val *TdxConfig) *NullableTdxConfig { - return &NullableTdxConfig{value: val, isSet: true} -} - -func (v NullableTdxConfig) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableTdxConfig) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tpm_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tpm_config.go new file mode 100644 index 000000000..7dc4ad4be --- /dev/null +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_tpm_config.go @@ -0,0 +1,106 @@ +/* +Cloud Hypervisor API + +Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. + +API version: 0.3.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package openapi + +import ( + "encoding/json" +) + +// TpmConfig struct for TpmConfig +type TpmConfig struct { + Socket string `json:"socket"` +} + +// NewTpmConfig instantiates a new TpmConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewTpmConfig(socket string) *TpmConfig { + this := TpmConfig{} + this.Socket = socket + return &this +} + +// NewTpmConfigWithDefaults instantiates a new TpmConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewTpmConfigWithDefaults() *TpmConfig { + this := TpmConfig{} + return &this +} + +// GetSocket returns the Socket field value +func (o *TpmConfig) GetSocket() string { + if o == nil { + var ret string + return ret + } + + return o.Socket +} + +// GetSocketOk returns a tuple with the Socket field value +// and a boolean to check if the value has been set. +func (o *TpmConfig) GetSocketOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Socket, true +} + +// SetSocket sets field value +func (o *TpmConfig) SetSocket(v string) { + o.Socket = v +} + +func (o TpmConfig) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if true { + toSerialize["socket"] = o.Socket + } + return json.Marshal(toSerialize) +} + +type NullableTpmConfig struct { + value *TpmConfig + isSet bool +} + +func (v NullableTpmConfig) Get() *TpmConfig { + return v.value +} + +func (v *NullableTpmConfig) Set(val *TpmConfig) { + v.value = val + v.isSet = true +} + +func (v NullableTpmConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableTpmConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTpmConfig(val *TpmConfig) *NullableTpmConfig { + return &NullableTpmConfig{value: val, isSet: true} +} + +func (v NullableTpmConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTpmConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go deleted file mode 100644 index acc3c177d..000000000 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_add_device.go +++ /dev/null @@ -1,189 +0,0 @@ -/* -Cloud Hypervisor API - -Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine. - -API version: 0.3.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package openapi - -import ( - "encoding/json" -) - -// VmAddDevice struct for VmAddDevice -type VmAddDevice struct { - Path *string `json:"path,omitempty"` - Iommu *bool `json:"iommu,omitempty"` - Id *string `json:"id,omitempty"` -} - -// NewVmAddDevice instantiates a new VmAddDevice object -// This constructor will assign default values to properties that have it defined, -// and makes sure properties required by API are set, but the set of arguments -// will change when the set of required properties is changed -func NewVmAddDevice() *VmAddDevice { - this := VmAddDevice{} - var iommu bool = false - this.Iommu = &iommu - return &this -} - -// NewVmAddDeviceWithDefaults instantiates a new VmAddDevice object -// This constructor will only assign default values to properties that have it defined, -// but it doesn't guarantee that properties required by API are set -func NewVmAddDeviceWithDefaults() *VmAddDevice { - this := VmAddDevice{} - var iommu bool = false - this.Iommu = &iommu - return &this -} - -// GetPath returns the Path field value if set, zero value otherwise. -func (o *VmAddDevice) GetPath() string { - if o == nil || o.Path == nil { - var ret string - return ret - } - return *o.Path -} - -// GetPathOk returns a tuple with the Path field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *VmAddDevice) GetPathOk() (*string, bool) { - if o == nil || o.Path == nil { - return nil, false - } - return o.Path, true -} - -// HasPath returns a boolean if a field has been set. -func (o *VmAddDevice) HasPath() bool { - if o != nil && o.Path != nil { - return true - } - - return false -} - -// SetPath gets a reference to the given string and assigns it to the Path field. -func (o *VmAddDevice) SetPath(v string) { - o.Path = &v -} - -// GetIommu returns the Iommu field value if set, zero value otherwise. -func (o *VmAddDevice) GetIommu() bool { - if o == nil || o.Iommu == nil { - var ret bool - return ret - } - return *o.Iommu -} - -// GetIommuOk returns a tuple with the Iommu field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *VmAddDevice) GetIommuOk() (*bool, bool) { - if o == nil || o.Iommu == nil { - return nil, false - } - return o.Iommu, true -} - -// HasIommu returns a boolean if a field has been set. -func (o *VmAddDevice) HasIommu() bool { - if o != nil && o.Iommu != nil { - return true - } - - return false -} - -// SetIommu gets a reference to the given bool and assigns it to the Iommu field. -func (o *VmAddDevice) SetIommu(v bool) { - o.Iommu = &v -} - -// GetId returns the Id field value if set, zero value otherwise. -func (o *VmAddDevice) GetId() string { - if o == nil || o.Id == nil { - var ret string - return ret - } - return *o.Id -} - -// GetIdOk returns a tuple with the Id field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *VmAddDevice) GetIdOk() (*string, bool) { - if o == nil || o.Id == nil { - return nil, false - } - return o.Id, true -} - -// HasId returns a boolean if a field has been set. -func (o *VmAddDevice) HasId() bool { - if o != nil && o.Id != nil { - return true - } - - return false -} - -// SetId gets a reference to the given string and assigns it to the Id field. -func (o *VmAddDevice) SetId(v string) { - o.Id = &v -} - -func (o VmAddDevice) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if o.Path != nil { - toSerialize["path"] = o.Path - } - if o.Iommu != nil { - toSerialize["iommu"] = o.Iommu - } - if o.Id != nil { - toSerialize["id"] = o.Id - } - return json.Marshal(toSerialize) -} - -type NullableVmAddDevice struct { - value *VmAddDevice - isSet bool -} - -func (v NullableVmAddDevice) Get() *VmAddDevice { - return v.value -} - -func (v *NullableVmAddDevice) Set(val *VmAddDevice) { - v.value = val - v.isSet = true -} - -func (v NullableVmAddDevice) IsSet() bool { - return v.isSet -} - -func (v *NullableVmAddDevice) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableVmAddDevice(val *VmAddDevice) *NullableVmAddDevice { - return &NullableVmAddDevice{value: val, isSet: true} -} - -func (v NullableVmAddDevice) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableVmAddDevice) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go index f48f92b3c..cd243bce9 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_vm_config.go @@ -31,11 +31,11 @@ type VmConfig struct { Vdpa *[]VdpaConfig `json:"vdpa,omitempty"` Vsock *VsockConfig `json:"vsock,omitempty"` SgxEpc *[]SgxEpcConfig `json:"sgx_epc,omitempty"` - Tdx *TdxConfig `json:"tdx,omitempty"` Numa *[]NumaConfig `json:"numa,omitempty"` Iommu *bool `json:"iommu,omitempty"` Watchdog *bool `json:"watchdog,omitempty"` Platform *PlatformConfig `json:"platform,omitempty"` + Tpm *TpmConfig `json:"tpm,omitempty"` } // NewVmConfig instantiates a new VmConfig object @@ -536,38 +536,6 @@ func (o *VmConfig) SetSgxEpc(v []SgxEpcConfig) { o.SgxEpc = &v } -// GetTdx returns the Tdx field value if set, zero value otherwise. -func (o *VmConfig) GetTdx() TdxConfig { - if o == nil || o.Tdx == nil { - var ret TdxConfig - return ret - } - return *o.Tdx -} - -// GetTdxOk returns a tuple with the Tdx field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *VmConfig) GetTdxOk() (*TdxConfig, bool) { - if o == nil || o.Tdx == nil { - return nil, false - } - return o.Tdx, true -} - -// HasTdx returns a boolean if a field has been set. -func (o *VmConfig) HasTdx() bool { - if o != nil && o.Tdx != nil { - return true - } - - return false -} - -// SetTdx gets a reference to the given TdxConfig and assigns it to the Tdx field. -func (o *VmConfig) SetTdx(v TdxConfig) { - o.Tdx = &v -} - // GetNuma returns the Numa field value if set, zero value otherwise. func (o *VmConfig) GetNuma() []NumaConfig { if o == nil || o.Numa == nil { @@ -696,6 +664,38 @@ func (o *VmConfig) SetPlatform(v PlatformConfig) { o.Platform = &v } +// GetTpm returns the Tpm field value if set, zero value otherwise. +func (o *VmConfig) GetTpm() TpmConfig { + if o == nil || o.Tpm == nil { + var ret TpmConfig + return ret + } + return *o.Tpm +} + +// GetTpmOk returns a tuple with the Tpm field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *VmConfig) GetTpmOk() (*TpmConfig, bool) { + if o == nil || o.Tpm == nil { + return nil, false + } + return o.Tpm, true +} + +// HasTpm returns a boolean if a field has been set. +func (o *VmConfig) HasTpm() bool { + if o != nil && o.Tpm != nil { + return true + } + + return false +} + +// SetTpm gets a reference to the given TpmConfig and assigns it to the Tpm field. +func (o *VmConfig) SetTpm(v TpmConfig) { + o.Tpm = &v +} + func (o VmConfig) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} if o.Cpus != nil { @@ -743,9 +743,6 @@ func (o VmConfig) MarshalJSON() ([]byte, error) { if o.SgxEpc != nil { toSerialize["sgx_epc"] = o.SgxEpc } - if o.Tdx != nil { - toSerialize["tdx"] = o.Tdx - } if o.Numa != nil { toSerialize["numa"] = o.Numa } @@ -758,6 +755,9 @@ func (o VmConfig) MarshalJSON() ([]byte, error) { if o.Platform != nil { toSerialize["platform"] = o.Platform } + if o.Tpm != nil { + toSerialize["tpm"] = o.Tpm + } return json.Marshal(toSerialize) } diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml index 029b4cf08..dee8bdbf0 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -185,7 +185,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/VmAddDevice" + $ref: "#/components/schemas/DeviceConfig" required: true responses: 200: @@ -502,6 +502,8 @@ components: PayloadConfig: type: object properties: + firmware: + type: string kernel: type: string cmdline: @@ -559,8 +561,6 @@ components: type: array items: $ref: "#/components/schemas/SgxEpcConfig" - tdx: - $ref: "#/components/schemas/TdxConfig" numa: type: array items: @@ -573,6 +573,8 @@ components: default: false platform: $ref: "#/components/schemas/PlatformConfig" + tpm: + $ref: "#/components/schemas/TpmConfig" description: Virtual machine configuration CpuAffinity: @@ -650,6 +652,9 @@ components: type: array items: type: string + tdx: + type: boolean + default: false MemoryZoneConfig: required: @@ -723,6 +728,9 @@ components: prefault: type: boolean default: false + thp: + type: boolean + default: true zones: type: array items: @@ -818,6 +826,10 @@ components: default: "255.255.255.0" mac: type: string + host_mac: + type: string + mtu: + type: integer iommu: type: boolean default: false @@ -948,6 +960,14 @@ components: id: type: string + TpmConfig: + required: + - socket + type: object + properties: + socket: + type: string + VdpaConfig: required: - path @@ -1006,15 +1026,6 @@ components: type: boolean default: false - TdxConfig: - required: - - firmware - type: object - properties: - firmware: - type: string - description: Path to the firmware that will be used to boot the TDx guest up. - NumaDistance: required: - destination @@ -1079,17 +1090,6 @@ components: type: integer format: int64 - VmAddDevice: - type: object - properties: - path: - type: string - iommu: - type: boolean - default: false - id: - type: string - VmRemoveDevice: type: object properties: diff --git a/versions.yaml b/versions.yaml index 370f54561..c0be81c37 100644 --- a/versions.yaml +++ b/versions.yaml @@ -75,7 +75,7 @@ assets: url: "https://github.com/cloud-hypervisor/cloud-hypervisor" uscan-url: >- https://github.com/cloud-hypervisor/cloud-hypervisor/tags.*/v?(\d\S+)\.tar\.gz - version: "v26.0" + version: "v28.0" firecracker: description: "Firecracker micro-VMM"