clh: opeanapi: update api for cloud hypervisor

[ Port from runtime commit 40f49312a4881c904a1cbdace04c4c697bd2d429 ]

Update api geneated by openapi.

Fixes: #461

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Jose Carlos Venegas Munoz 2020-08-10 22:07:47 +00:00 committed by Bo Chen
parent 89836cd31a
commit 3159438701
29 changed files with 713 additions and 134 deletions

View File

@ -85,9 +85,9 @@ 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) (*http.Response, error)
VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (chclient.PciDeviceInfo, *http.Response, error)
// Add a new disk device to the VM
VmAddDiskPut(ctx context.Context, diskConfig chclient.DiskConfig) (*http.Response, error)
VmAddDiskPut(ctx context.Context, diskConfig chclient.DiskConfig) (chclient.PciDeviceInfo, *http.Response, error)
}
type CloudHypervisorVersion struct {
@ -428,7 +428,7 @@ func (clh *cloudHypervisor) hotplugBlockDevice(drive *config.BlockDrive) error {
Readonly: drive.ReadOnly,
VhostUser: false,
}
_, err = cl.VmAddDiskPut(ctx, blkDevice)
_, _, err = cl.VmAddDiskPut(ctx, blkDevice)
}
if err != nil {
@ -447,7 +447,7 @@ func (clh *cloudHypervisor) hotPlugVFIODevice(device config.VFIODev) error {
return openAPIClientError(err)
}
_, err = cl.VmAddDevicePut(ctx, chclient.VmAddDevice{Path: device.SysfsDev})
_, _, err = cl.VmAddDevicePut(ctx, chclient.VmAddDevice{Path: device.SysfsDev})
if err != nil {
err = fmt.Errorf("Failed to hotplug device %+v %s", device, openAPIClientError(err))
}

View File

@ -95,13 +95,13 @@ func (c *clhClientMock) VmResizePut(ctx context.Context, vmResize chclient.VmRes
}
//nolint:golint
func (c *clhClientMock) VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (*http.Response, error) {
return nil, nil
func (c *clhClientMock) VmAddDevicePut(ctx context.Context, vmAddDevice chclient.VmAddDevice) (chclient.PciDeviceInfo, *http.Response, error) {
return chclient.PciDeviceInfo{}, nil, nil
}
//nolint:golint
func (c *clhClientMock) VmAddDiskPut(ctx context.Context, diskConfig chclient.DiskConfig) (*http.Response, error) {
return nil, nil
func (c *clhClientMock) VmAddDiskPut(ctx context.Context, diskConfig chclient.DiskConfig) (chclient.PciDeviceInfo, *http.Response, error) {
return chclient.PciDeviceInfo{}, nil, nil
}
func TestCloudHypervisorAddVSock(t *testing.T) {

View File

@ -0,0 +1,61 @@
.gitignore
.openapi-generator-ignore
.travis.yml
README.md
api/openapi.yaml
api_default.go
client.go
configuration.go
docs/CmdLineConfig.md
docs/ConsoleConfig.md
docs/CpuTopology.md
docs/CpusConfig.md
docs/DefaultApi.md
docs/DeviceConfig.md
docs/DiskConfig.md
docs/FsConfig.md
docs/InitramfsConfig.md
docs/KernelConfig.md
docs/MemoryConfig.md
docs/NetConfig.md
docs/PciDeviceInfo.md
docs/PmemConfig.md
docs/RestoreConfig.md
docs/RngConfig.md
docs/SgxEpcConfig.md
docs/VmAddDevice.md
docs/VmConfig.md
docs/VmInfo.md
docs/VmRemoveDevice.md
docs/VmResize.md
docs/VmSnapshotConfig.md
docs/VmmPingResponse.md
docs/VsockConfig.md
git_push.sh
go.mod
go.sum
model_cmd_line_config.go
model_console_config.go
model_cpu_topology.go
model_cpus_config.go
model_device_config.go
model_disk_config.go
model_fs_config.go
model_initramfs_config.go
model_kernel_config.go
model_memory_config.go
model_net_config.go
model_pci_device_info.go
model_pmem_config.go
model_restore_config.go
model_rng_config.go
model_sgx_epc_config.go
model_vm_add_device.go
model_vm_config.go
model_vm_info.go
model_vm_remove_device.go
model_vm_resize.go
model_vm_snapshot_config.go
model_vmm_ping_response.go
model_vsock_config.go
response.go

View File

@ -1 +1 @@
4.3.1-SNAPSHOT
5.0.0-SNAPSHOT

View File

@ -46,6 +46,7 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**VmAddNetPut**](docs/DefaultApi.md#vmaddnetput) | **Put** /vm.add-net | Add a new network device to the VM
*DefaultApi* | [**VmAddPmemPut**](docs/DefaultApi.md#vmaddpmemput) | **Put** /vm.add-pmem | Add a new pmem device to the VM
*DefaultApi* | [**VmAddVsockPut**](docs/DefaultApi.md#vmaddvsockput) | **Put** /vm.add-vsock | Add a new vsock device to the VM
*DefaultApi* | [**VmCountersGet**](docs/DefaultApi.md#vmcountersget) | **Get** /vm.counters | Get counters from the VM
*DefaultApi* | [**VmInfoGet**](docs/DefaultApi.md#vminfoget) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
*DefaultApi* | [**VmRemoveDevicePut**](docs/DefaultApi.md#vmremovedeviceput) | **Put** /vm.remove-device | Remove a device from the VM
*DefaultApi* | [**VmResizePut**](docs/DefaultApi.md#vmresizeput) | **Put** /vm.resize | Resize the VM
@ -58,6 +59,7 @@ Class | Method | HTTP request | Description
- [CmdLineConfig](docs/CmdLineConfig.md)
- [ConsoleConfig](docs/ConsoleConfig.md)
- [CpuTopology](docs/CpuTopology.md)
- [CpusConfig](docs/CpusConfig.md)
- [DeviceConfig](docs/DeviceConfig.md)
- [DiskConfig](docs/DiskConfig.md)
@ -66,9 +68,11 @@ Class | Method | HTTP request | Description
- [KernelConfig](docs/KernelConfig.md)
- [MemoryConfig](docs/MemoryConfig.md)
- [NetConfig](docs/NetConfig.md)
- [PciDeviceInfo](docs/PciDeviceInfo.md)
- [PmemConfig](docs/PmemConfig.md)
- [RestoreConfig](docs/RestoreConfig.md)
- [RngConfig](docs/RngConfig.md)
- [SgxEpcConfig](docs/SgxEpcConfig.md)
- [VmAddDevice](docs/VmAddDevice.md)
- [VmConfig](docs/VmConfig.md)
- [VmInfo](docs/VmInfo.md)

View File

@ -38,6 +38,16 @@ paths:
description: The VM information
summary: Returns general information about the cloud-hypervisor Virtual Machine
(VM) instance.
/vm.counters:
get:
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/VmCounters'
description: The VM counters
summary: Get counters from the VM
/vm.create:
put:
operationId: createVM
@ -138,7 +148,11 @@ paths:
description: The path of the new device
required: true
responses:
"204":
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
description: The new device was successfully added to the VM instance.
"404":
description: The new device could not be added to the VM instance.
@ -168,7 +182,11 @@ paths:
description: The details of the new disk
required: true
responses:
"204":
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
description: The new disk was successfully added to the VM instance.
"500":
description: The new disk could not be added to the VM instance.
@ -183,7 +201,11 @@ paths:
description: The details of the new virtio-fs
required: true
responses:
"204":
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
description: The new device was successfully added to the VM instance.
"500":
description: The new device could not be added to the VM instance.
@ -198,7 +220,11 @@ paths:
description: The details of the new pmem device
required: true
responses:
"204":
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
description: The new device was successfully added to the VM instance.
"500":
description: The new device could not be added to the VM instance.
@ -213,7 +239,11 @@ paths:
description: The details of the new network device
required: true
responses:
"204":
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
description: The new device was successfully added to the VM instance.
"500":
description: The new device could not be added to the VM instance.
@ -228,7 +258,11 @@ paths:
description: The details of the new vsock device
required: true
responses:
"204":
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
description: The new device was successfully added to the VM instance.
"500":
description: The new device could not be added to the VM instance.
@ -293,13 +327,14 @@ components:
hugepages: false
shared: false
mergeable: false
balloon: false
file: file
size: 1
hotplug_size: 5
size: 7
hotplug_size: 9
hotplug_method: acpi
disks:
- path: path
num_queues: 5
num_queues: 3
readonly: false
iommu: false
queue_size: 2
@ -309,7 +344,7 @@ components:
poll_queue: true
id: id
- path: path
num_queues: 5
num_queues: 3
readonly: false
iommu: false
queue_size: 2
@ -319,6 +354,11 @@ components:
poll_queue: true
id: id
cpus:
topology:
dies_per_package: 5
threads_per_core: 1
cores_per_die: 5
packages: 2
boot_vcpus: 1
max_vcpus: 1
devices:
@ -333,17 +373,22 @@ components:
rng:
iommu: false
src: /dev/urandom
sgx_epc:
- prefault: false
size: 1
- prefault: false
size: 1
fs:
- num_queues: 3
queue_size: 2
cache_size: 4
- num_queues: 1
queue_size: 1
cache_size: 1
dax: true
tag: tag
socket: socket
id: id
- num_queues: 3
queue_size: 2
cache_size: 4
- num_queues: 1
queue_size: 1
cache_size: 1
dax: true
tag: tag
socket: socket
@ -356,13 +401,13 @@ components:
pmem:
- mergeable: false
file: file
size: 7
size: 6
iommu: false
id: id
discard_writes: false
- mergeable: false
file: file
size: 7
size: 6
iommu: false
id: id
discard_writes: false
@ -377,9 +422,9 @@ components:
path: path
net:
- tap: tap
num_queues: 7
num_queues: 4
iommu: false
queue_size: 9
queue_size: 7
vhost_socket: vhost_socket
vhost_user: false
ip: 192.168.249.1
@ -387,9 +432,9 @@ components:
mac: mac
mask: 255.255.255.0
- tap: tap
num_queues: 7
num_queues: 4
iommu: false
queue_size: 9
queue_size: 7
vhost_socket: vhost_socket
vhost_user: false
ip: 192.168.249.1
@ -410,6 +455,27 @@ components:
- config
- state
type: object
VmCounters:
additionalProperties:
additionalProperties:
format: uint64
type: integer
type: object
type: object
PciDeviceInfo:
description: Information about a PCI device
example:
bdf: bdf
id: id
properties:
id:
type: string
bdf:
type: string
required:
- bdf
- id
type: object
VmConfig:
description: Virtual machine configuration
example:
@ -421,13 +487,14 @@ components:
hugepages: false
shared: false
mergeable: false
balloon: false
file: file
size: 1
hotplug_size: 5
size: 7
hotplug_size: 9
hotplug_method: acpi
disks:
- path: path
num_queues: 5
num_queues: 3
readonly: false
iommu: false
queue_size: 2
@ -437,7 +504,7 @@ components:
poll_queue: true
id: id
- path: path
num_queues: 5
num_queues: 3
readonly: false
iommu: false
queue_size: 2
@ -447,6 +514,11 @@ components:
poll_queue: true
id: id
cpus:
topology:
dies_per_package: 5
threads_per_core: 1
cores_per_die: 5
packages: 2
boot_vcpus: 1
max_vcpus: 1
devices:
@ -461,17 +533,22 @@ components:
rng:
iommu: false
src: /dev/urandom
sgx_epc:
- prefault: false
size: 1
- prefault: false
size: 1
fs:
- num_queues: 3
queue_size: 2
cache_size: 4
- num_queues: 1
queue_size: 1
cache_size: 1
dax: true
tag: tag
socket: socket
id: id
- num_queues: 3
queue_size: 2
cache_size: 4
- num_queues: 1
queue_size: 1
cache_size: 1
dax: true
tag: tag
socket: socket
@ -484,13 +561,13 @@ components:
pmem:
- mergeable: false
file: file
size: 7
size: 6
iommu: false
id: id
discard_writes: false
- mergeable: false
file: file
size: 7
size: 6
iommu: false
id: id
discard_writes: false
@ -505,9 +582,9 @@ components:
path: path
net:
- tap: tap
num_queues: 7
num_queues: 4
iommu: false
queue_size: 9
queue_size: 7
vhost_socket: vhost_socket
vhost_user: false
ip: 192.168.249.1
@ -515,9 +592,9 @@ components:
mac: mac
mask: 255.255.255.0
- tap: tap
num_queues: 7
num_queues: 4
iommu: false
queue_size: 9
queue_size: 7
vhost_socket: vhost_socket
vhost_user: false
ip: 192.168.249.1
@ -563,6 +640,10 @@ components:
type: array
vsock:
$ref: '#/components/schemas/VsockConfig'
sgx_epc:
items:
$ref: '#/components/schemas/SgxEpcConfig'
type: array
iommu:
default: false
type: boolean
@ -570,8 +651,29 @@ components:
- cmdline
- kernel
type: object
CpuTopology:
example:
dies_per_package: 5
threads_per_core: 1
cores_per_die: 5
packages: 2
properties:
threads_per_core:
type: integer
cores_per_die:
type: integer
dies_per_package:
type: integer
packages:
type: integer
type: object
CpusConfig:
example:
topology:
dies_per_package: 5
threads_per_core: 1
cores_per_die: 5
packages: 2
boot_vcpus: 1
max_vcpus: 1
properties:
@ -583,6 +685,8 @@ components:
default: 1
minimum: 1
type: integer
topology:
$ref: '#/components/schemas/CpuTopology'
required:
- boot_vcpus
- max_vcpus
@ -592,9 +696,10 @@ components:
hugepages: false
shared: false
mergeable: false
balloon: false
file: file
size: 1
hotplug_size: 5
size: 7
hotplug_size: 9
hotplug_method: acpi
properties:
size:
@ -617,6 +722,9 @@ components:
hugepages:
default: false
type: boolean
balloon:
default: false
type: boolean
required:
- size
type: object
@ -651,7 +759,7 @@ components:
DiskConfig:
example:
path: path
num_queues: 5
num_queues: 3
readonly: false
iommu: false
queue_size: 2
@ -694,9 +802,9 @@ components:
NetConfig:
example:
tap: tap
num_queues: 7
num_queues: 4
iommu: false
queue_size: 9
queue_size: 7
vhost_socket: vhost_socket
vhost_user: false
ip: 192.168.249.1
@ -748,9 +856,9 @@ components:
type: object
FsConfig:
example:
num_queues: 3
queue_size: 2
cache_size: 4
num_queues: 1
queue_size: 1
cache_size: 1
dax: true
tag: tag
socket: socket
@ -782,7 +890,7 @@ components:
example:
mergeable: false
file: file
size: 7
size: 6
iommu: false
id: id
discard_writes: false
@ -867,9 +975,24 @@ components:
- cid
- socket
type: object
SgxEpcConfig:
example:
prefault: false
size: 1
properties:
size:
format: uint64
type: integer
prefault:
default: false
type: boolean
required:
- size
type: object
VmResize:
example:
desired_vcpus: 1
desired_ram_w_balloon: 1
desired_ram: 6
properties:
desired_vcpus:
@ -879,6 +1002,10 @@ components:
description: desired memory ram in bytes
format: int64
type: integer
desired_ram_w_balloon:
description: desired ballon size in bytes
format: int64
type: integer
type: object
VmAddDevice:
example:

View File

@ -14,6 +14,7 @@ import (
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
_bytes "bytes"
)
// Linger please
@ -72,6 +73,7 @@ func (a *DefaultApiService) BootVM(ctx _context.Context) (*_nethttp.Response, er
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -138,6 +140,7 @@ func (a *DefaultApiService) CreateVM(ctx _context.Context, vmConfig VmConfig) (*
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -201,6 +204,7 @@ func (a *DefaultApiService) DeleteVM(ctx _context.Context) (*_nethttp.Response,
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -264,6 +268,7 @@ func (a *DefaultApiService) PauseVM(ctx _context.Context) (*_nethttp.Response, e
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -327,6 +332,7 @@ func (a *DefaultApiService) RebootVM(ctx _context.Context) (*_nethttp.Response,
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -390,6 +396,7 @@ func (a *DefaultApiService) ResumeVM(ctx _context.Context) (*_nethttp.Response,
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -453,6 +460,7 @@ func (a *DefaultApiService) ShutdownVM(ctx _context.Context) (*_nethttp.Response
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -516,6 +524,7 @@ func (a *DefaultApiService) ShutdownVMM(ctx _context.Context) (*_nethttp.Respons
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -535,14 +544,16 @@ func (a *DefaultApiService) ShutdownVMM(ctx _context.Context) (*_nethttp.Respons
VmAddDevicePut Add a new device to the VM
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param vmAddDevice The path of the new device
@return PciDeviceInfo
*/
func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context, vmAddDevice VmAddDevice) (*_nethttp.Response, error) {
func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context, vmAddDevice VmAddDevice) (PciDeviceInfo, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue PciDeviceInfo
)
// create path and map variables
@ -561,7 +572,7 @@ func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context, vmAddDevice VmA
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@ -572,18 +583,19 @@ func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context, vmAddDevice VmA
localVarPostBody = &vmAddDevice
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@ -591,24 +603,35 @@ func (a *DefaultApiService) VmAddDevicePut(ctx _context.Context, vmAddDevice VmA
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
VmAddDiskPut Add a new disk to the VM
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param diskConfig The details of the new disk
@return PciDeviceInfo
*/
func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context, diskConfig DiskConfig) (*_nethttp.Response, error) {
func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context, diskConfig DiskConfig) (PciDeviceInfo, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue PciDeviceInfo
)
// create path and map variables
@ -627,7 +650,7 @@ func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context, diskConfig DiskCo
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@ -638,18 +661,19 @@ func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context, diskConfig DiskCo
localVarPostBody = &diskConfig
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@ -657,24 +681,35 @@ func (a *DefaultApiService) VmAddDiskPut(ctx _context.Context, diskConfig DiskCo
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
VmAddFsPut Add a new virtio-fs device to the VM
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param fsConfig The details of the new virtio-fs
@return PciDeviceInfo
*/
func (a *DefaultApiService) VmAddFsPut(ctx _context.Context, fsConfig FsConfig) (*_nethttp.Response, error) {
func (a *DefaultApiService) VmAddFsPut(ctx _context.Context, fsConfig FsConfig) (PciDeviceInfo, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue PciDeviceInfo
)
// create path and map variables
@ -693,7 +728,7 @@ func (a *DefaultApiService) VmAddFsPut(ctx _context.Context, fsConfig FsConfig)
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@ -704,18 +739,19 @@ func (a *DefaultApiService) VmAddFsPut(ctx _context.Context, fsConfig FsConfig)
localVarPostBody = &fsConfig
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@ -723,24 +759,35 @@ func (a *DefaultApiService) VmAddFsPut(ctx _context.Context, fsConfig FsConfig)
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
VmAddNetPut Add a new network device to the VM
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param netConfig The details of the new network device
@return PciDeviceInfo
*/
func (a *DefaultApiService) VmAddNetPut(ctx _context.Context, netConfig NetConfig) (*_nethttp.Response, error) {
func (a *DefaultApiService) VmAddNetPut(ctx _context.Context, netConfig NetConfig) (PciDeviceInfo, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue PciDeviceInfo
)
// create path and map variables
@ -759,7 +806,7 @@ func (a *DefaultApiService) VmAddNetPut(ctx _context.Context, netConfig NetConfi
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@ -770,18 +817,19 @@ func (a *DefaultApiService) VmAddNetPut(ctx _context.Context, netConfig NetConfi
localVarPostBody = &netConfig
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@ -789,24 +837,35 @@ func (a *DefaultApiService) VmAddNetPut(ctx _context.Context, netConfig NetConfi
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
VmAddPmemPut Add a new pmem device to the VM
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param pmemConfig The details of the new pmem device
@return PciDeviceInfo
*/
func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context, pmemConfig PmemConfig) (*_nethttp.Response, error) {
func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context, pmemConfig PmemConfig) (PciDeviceInfo, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue PciDeviceInfo
)
// create path and map variables
@ -825,7 +884,7 @@ func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context, pmemConfig PmemCo
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@ -836,18 +895,19 @@ func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context, pmemConfig PmemCo
localVarPostBody = &pmemConfig
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@ -855,24 +915,35 @@ func (a *DefaultApiService) VmAddPmemPut(ctx _context.Context, pmemConfig PmemCo
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
VmAddVsockPut Add a new vsock device to the VM
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param vsockConfig The details of the new vsock device
@return PciDeviceInfo
*/
func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context, vsockConfig VsockConfig) (*_nethttp.Response, error) {
func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context, vsockConfig VsockConfig) (PciDeviceInfo, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPut
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue PciDeviceInfo
)
// create path and map variables
@ -891,7 +962,7 @@ func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context, vsockConfig Vsoc
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
@ -902,18 +973,19 @@ func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context, vsockConfig Vsoc
localVarPostBody = &vsockConfig
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
@ -921,10 +993,94 @@ func (a *DefaultApiService) VmAddVsockPut(ctx _context.Context, vsockConfig Vsoc
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
VmCountersGet Get counters from the VM
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return map[string]map[string]int32
*/
func (a *DefaultApiService) VmCountersGet(ctx _context.Context) (map[string]map[string]int32, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue map[string]map[string]int32
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/vm.counters"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(r)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
/*
@ -977,6 +1133,7 @@ func (a *DefaultApiService) VmInfoGet(ctx _context.Context) (VmInfo, *_nethttp.R
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
@ -1052,6 +1209,7 @@ func (a *DefaultApiService) VmRemoveDevicePut(ctx _context.Context, vmRemoveDevi
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -1118,6 +1276,7 @@ func (a *DefaultApiService) VmResizePut(ctx _context.Context, vmResize VmResize)
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -1184,6 +1343,7 @@ func (a *DefaultApiService) VmRestorePut(ctx _context.Context, restoreConfig Res
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -1250,6 +1410,7 @@ func (a *DefaultApiService) VmSnapshotPut(ctx _context.Context, vmSnapshotConfig
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
@ -1315,6 +1476,7 @@ func (a *DefaultApiService) VmmPingGet(ctx _context.Context) (VmmPingResponse, *
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

View File

@ -17,6 +17,7 @@ import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
"mime/multipart"
"net/http"
@ -35,7 +36,7 @@ import (
)
var (
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?(?:problem\+)?json)`)
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
)
@ -366,6 +367,15 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
*s = string(b)
return nil
}
if f, ok := v.(**os.File); ok {
*f, err = ioutil.TempFile("", "HttpClientFile")
if err != nil {
return
}
_, err = (*f).Write(b)
_, err = (*f).Seek(0, io.SeekStart)
return
}
if xmlCheck.MatchString(contentType) {
if err = xml.Unmarshal(b, v); err != nil {
return err

View File

@ -0,0 +1,14 @@
# CpuTopology
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**ThreadsPerCore** | **int32** | | [optional]
**CoresPerDie** | **int32** | | [optional]
**DiesPerPackage** | **int32** | | [optional]
**Packages** | **int32** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**BootVcpus** | **int32** | | [default to 1]
**MaxVcpus** | **int32** | | [default to 1]
**Topology** | [**CpuTopology**](CpuTopology.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -18,6 +18,7 @@ Method | HTTP request | Description
[**VmAddNetPut**](DefaultApi.md#VmAddNetPut) | **Put** /vm.add-net | Add a new network device to the VM
[**VmAddPmemPut**](DefaultApi.md#VmAddPmemPut) | **Put** /vm.add-pmem | Add a new pmem device to the VM
[**VmAddVsockPut**](DefaultApi.md#VmAddVsockPut) | **Put** /vm.add-vsock | Add a new vsock device to the VM
[**VmCountersGet**](DefaultApi.md#VmCountersGet) | **Get** /vm.counters | Get counters from the VM
[**VmInfoGet**](DefaultApi.md#VmInfoGet) | **Get** /vm.info | Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
[**VmRemoveDevicePut**](DefaultApi.md#VmRemoveDevicePut) | **Put** /vm.remove-device | Remove a device from the VM
[**VmResizePut**](DefaultApi.md#VmResizePut) | **Put** /vm.resize | Resize the VM
@ -257,7 +258,7 @@ No authorization required
## VmAddDevicePut
> VmAddDevicePut(ctx, vmAddDevice)
> PciDeviceInfo VmAddDevicePut(ctx, vmAddDevice)
Add a new device to the VM
@ -271,7 +272,7 @@ Name | Type | Description | Notes
### Return type
(empty response body)
[**PciDeviceInfo**](PciDeviceInfo.md)
### Authorization
@ -280,7 +281,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
@ -289,7 +290,7 @@ No authorization required
## VmAddDiskPut
> VmAddDiskPut(ctx, diskConfig)
> PciDeviceInfo VmAddDiskPut(ctx, diskConfig)
Add a new disk to the VM
@ -303,7 +304,7 @@ Name | Type | Description | Notes
### Return type
(empty response body)
[**PciDeviceInfo**](PciDeviceInfo.md)
### Authorization
@ -312,7 +313,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
@ -321,7 +322,7 @@ No authorization required
## VmAddFsPut
> VmAddFsPut(ctx, fsConfig)
> PciDeviceInfo VmAddFsPut(ctx, fsConfig)
Add a new virtio-fs device to the VM
@ -331,11 +332,11 @@ Add a new virtio-fs device to the VM
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**fsConfig** | [**FsConfig**](FsConfig.md)| The details of the new virtio-fs |
**fsConfig** | [**FsConfig**](FsConfig.md)| The details of the new virtio-fs |
### Return type
(empty response body)
[**PciDeviceInfo**](PciDeviceInfo.md)
### Authorization
@ -344,7 +345,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
@ -353,7 +354,7 @@ No authorization required
## VmAddNetPut
> VmAddNetPut(ctx, netConfig)
> PciDeviceInfo VmAddNetPut(ctx, netConfig)
Add a new network device to the VM
@ -367,7 +368,7 @@ Name | Type | Description | Notes
### Return type
(empty response body)
[**PciDeviceInfo**](PciDeviceInfo.md)
### Authorization
@ -376,7 +377,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
@ -385,7 +386,7 @@ No authorization required
## VmAddPmemPut
> VmAddPmemPut(ctx, pmemConfig)
> PciDeviceInfo VmAddPmemPut(ctx, pmemConfig)
Add a new pmem device to the VM
@ -399,7 +400,7 @@ Name | Type | Description | Notes
### Return type
(empty response body)
[**PciDeviceInfo**](PciDeviceInfo.md)
### Authorization
@ -408,7 +409,7 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
@ -417,7 +418,7 @@ No authorization required
## VmAddVsockPut
> VmAddVsockPut(ctx, vsockConfig)
> PciDeviceInfo VmAddVsockPut(ctx, vsockConfig)
Add a new vsock device to the VM
@ -427,11 +428,11 @@ Add a new vsock device to the VM
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**vsockConfig** | [**VsockConfig**](VsockConfig.md)| The details of the new vsock device |
**vsockConfig** | [**VsockConfig**](VsockConfig.md)| The details of the new vsock device |
### Return type
(empty response body)
[**PciDeviceInfo**](PciDeviceInfo.md)
### Authorization
@ -440,7 +441,35 @@ No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## VmCountersGet
> map[string]map[string]int32 VmCountersGet(ctx, )
Get counters from the VM
### Required Parameters
This endpoint does not need any parameter.
### Return type
[**map[string]map[string]int32**](map.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)

View File

@ -13,7 +13,7 @@ Name | Type | Description | Notes
**VhostUser** | **bool** | | [optional] [default to false]
**VhostSocket** | **string** | | [optional]
**PollQueue** | **bool** | | [optional] [default to true]
**Id** | **string** | | [optional]
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -5,12 +5,12 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Tag** | **string** | |
**Socket** | **string** | |
**Socket** | **string** | |
**NumQueues** | **int32** | | [optional] [default to 1]
**QueueSize** | **int32** | | [optional] [default to 1024]
**Dax** | **bool** | | [optional] [default to true]
**CacheSize** | **int64** | | [optional]
**Id** | **string** | | [optional]
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -11,6 +11,7 @@ Name | Type | Description | Notes
**HotplugMethod** | **string** | | [optional] [default to acpi]
**Shared** | **bool** | | [optional] [default to false]
**Hugepages** | **bool** | | [optional] [default to false]
**Balloon** | **bool** | | [optional] [default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -13,7 +13,7 @@ Name | Type | Description | Notes
**QueueSize** | **int32** | | [optional] [default to 256]
**VhostUser** | **bool** | | [optional] [default to false]
**VhostSocket** | **string** | | [optional]
**Id** | **string** | | [optional]
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# PciDeviceInfo
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **string** | |
**Bdf** | **string** | |
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -5,11 +5,11 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**File** | **string** | |
**Size** | **int64** | | [optional]
**Size** | **int64** | | [optional]
**Iommu** | **bool** | | [optional] [default to false]
**Mergeable** | **bool** | | [optional] [default to false]
**DiscardWrites** | **bool** | | [optional] [default to false]
**Id** | **string** | | [optional]
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,12 @@
# SgxEpcConfig
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Size** | **int32** | |
**Prefault** | **bool** | | [optional] [default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -17,7 +17,8 @@ Name | Type | Description | Notes
**Serial** | [**ConsoleConfig**](ConsoleConfig.md) | | [optional]
**Console** | [**ConsoleConfig**](ConsoleConfig.md) | | [optional]
**Devices** | [**[]DeviceConfig**](DeviceConfig.md) | | [optional]
**Vsock** | [**VsockConfig**](VsockConfig.md) | | [optional]
**Vsock** | [**VsockConfig**](VsockConfig.md) | | [optional]
**SgxEpc** | [**[]SgxEpcConfig**](SgxEpcConfig.md) | | [optional]
**Iommu** | **bool** | | [optional] [default to false]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -6,6 +6,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**DesiredVcpus** | **int32** | | [optional]
**DesiredRam** | **int64** | desired memory ram in bytes | [optional]
**DesiredRamWBalloon** | **int64** | desired ballon size in bytes | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -5,9 +5,9 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Cid** | **int64** | Guest Vsock CID |
**Socket** | **string** | Path to UNIX domain socket, used to proxy vsock connections. |
**Socket** | **string** | Path to UNIX domain socket, used to proxy vsock connections. |
**Iommu** | **bool** | | [optional] [default to false]
**Id** | **string** | | [optional]
**Id** | **string** | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -0,0 +1,17 @@
/*
* Cloud Hypervisor API
*
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
*
* API version: 0.3.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// CpuTopology struct for CpuTopology
type CpuTopology struct {
ThreadsPerCore int32 `json:"threads_per_core,omitempty"`
CoresPerDie int32 `json:"cores_per_die,omitempty"`
DiesPerPackage int32 `json:"dies_per_package,omitempty"`
Packages int32 `json:"packages,omitempty"`
}

View File

@ -12,4 +12,5 @@ package openapi
type CpusConfig struct {
BootVcpus int32 `json:"boot_vcpus"`
MaxVcpus int32 `json:"max_vcpus"`
Topology CpuTopology `json:"topology,omitempty"`
}

View File

@ -17,4 +17,5 @@ type MemoryConfig struct {
HotplugMethod string `json:"hotplug_method,omitempty"`
Shared bool `json:"shared,omitempty"`
Hugepages bool `json:"hugepages,omitempty"`
Balloon bool `json:"balloon,omitempty"`
}

View File

@ -0,0 +1,15 @@
/*
* Cloud Hypervisor API
*
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
*
* API version: 0.3.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// PciDeviceInfo Information about a PCI device
type PciDeviceInfo struct {
Id string `json:"id"`
Bdf string `json:"bdf"`
}

View File

@ -0,0 +1,15 @@
/*
* Cloud Hypervisor API
*
* Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
*
* API version: 0.3.0
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package openapi
// SgxEpcConfig struct for SgxEpcConfig
type SgxEpcConfig struct {
Size int32 `json:"size"`
Prefault bool `json:"prefault,omitempty"`
}

View File

@ -24,5 +24,6 @@ type VmConfig struct {
Console ConsoleConfig `json:"console,omitempty"`
Devices []DeviceConfig `json:"devices,omitempty"`
Vsock VsockConfig `json:"vsock,omitempty"`
SgxEpc []SgxEpcConfig `json:"sgx_epc,omitempty"`
Iommu bool `json:"iommu,omitempty"`
}

View File

@ -13,4 +13,6 @@ type VmResize struct {
DesiredVcpus int32 `json:"desired_vcpus,omitempty"`
// desired memory ram in bytes
DesiredRam int64 `json:"desired_ram,omitempty"`
// desired ballon size in bytes
DesiredRamWBalloon int64 `json:"desired_ram_w_balloon,omitempty"`
}

View File

@ -42,6 +42,17 @@ paths:
schema:
$ref: '#/components/schemas/VmInfo'
/vm.counters:
get:
summary: Get counters from the VM
responses:
200:
description: The VM counters
content:
application/json:
schema:
$ref: '#/components/schemas/VmCounters'
/vm.create:
put:
summary: Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.
@ -150,8 +161,12 @@ paths:
$ref: '#/components/schemas/VmAddDevice'
required: true
responses:
204:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
404:
description: The new device could not be added to the VM instance.
@ -182,8 +197,12 @@ paths:
$ref: '#/components/schemas/DiskConfig'
required: true
responses:
204:
200:
description: The new disk was successfully added to the VM instance.
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
500:
description: The new disk could not be added to the VM instance.
@ -198,8 +217,12 @@ paths:
$ref: '#/components/schemas/FsConfig'
required: true
responses:
204:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
500:
description: The new device could not be added to the VM instance.
@ -214,8 +237,12 @@ paths:
$ref: '#/components/schemas/PmemConfig'
required: true
responses:
204:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
500:
description: The new device could not be added to the VM instance.
@ -230,8 +257,12 @@ paths:
$ref: '#/components/schemas/NetConfig'
required: true
responses:
204:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
500:
description: The new device could not be added to the VM instance.
@ -246,8 +277,12 @@ paths:
$ref: '#/components/schemas/VsockConfig'
required: true
responses:
204:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: '#/components/schemas/PciDeviceInfo'
500:
description: The new device could not be added to the VM instance.
@ -311,6 +346,26 @@ components:
enum: [Created, Running, Shutdown, Paused]
description: Virtual Machine information
VmCounters:
type: object
additionalProperties:
type: object
additionalProperties:
type: integer
format: uint64
PciDeviceInfo:
required:
- id
- bdf
type: object
properties:
id:
type: string
bdf:
type: string
description: Information about a PCI device
VmConfig:
required:
- kernel
@ -355,11 +410,27 @@ components:
$ref: '#/components/schemas/DeviceConfig'
vsock:
$ref: '#/components/schemas/VsockConfig'
sgx_epc:
type: array
items:
$ref: '#/components/schemas/SgxEpcConfig'
iommu:
type: boolean
default: false
description: Virtual machine configuration
CpuTopology:
type: object
properties:
threads_per_core:
type: integer
cores_per_die:
type: integer
dies_per_package:
type: integer
packages:
type: integer
CpusConfig:
required:
- boot_vcpus
@ -374,6 +445,8 @@ components:
minimum: 1
default: 1
type: integer
topology:
$ref: '#/components/schemas/CpuTopology'
MemoryConfig:
required:
@ -401,6 +474,9 @@ components:
hugepages:
type: boolean
default: false
balloon:
type: boolean
default: false
KernelConfig:
required:
@ -598,6 +674,18 @@ components:
id:
type: string
SgxEpcConfig:
required:
- size
type: object
properties:
size:
type: integer
format: uint64
prefault:
type: boolean
default: false
VmResize:
type: object
properties:
@ -608,6 +696,10 @@ components:
description: desired memory ram in bytes
type: integer
format: int64
desired_ram_w_balloon:
description: desired ballon size in bytes
type: integer
format: int64
VmAddDevice:
type: object