From eba66de646acf2cea59986ea2cfda79673f1fafa Mon Sep 17 00:00:00 2001 From: Georgina Kinge Date: Fri, 10 Mar 2023 11:28:04 +0000 Subject: [PATCH] Revert "runtime: clh: Re-generate the client code" Reverting as cloud-hypervisor shouldn't be upgraded in CC. Signed-off-by: Georgina Kinge --- .../cloud-hypervisor/client/api/openapi.yaml | 3 - .../client/docs/CpuAffinity.md | 16 ++++- .../client/model_cpu_affinity.go | 64 +++++++++++-------- .../cloud-hypervisor/cloud-hypervisor.yaml | 3 - 4 files changed, 52 insertions(+), 34 deletions(-) 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 d514ae7b81..750c1e7251 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/api/openapi.yaml @@ -1131,9 +1131,6 @@ components: items: type: integer type: array - required: - - host_cpus - - vcpu type: object CpuFeatures: example: diff --git a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpuAffinity.md b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpuAffinity.md index 52eb24a184..300c7af1da 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpuAffinity.md +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/docs/CpuAffinity.md @@ -4,14 +4,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**Vcpu** | **int32** | | -**HostCpus** | **[]int32** | | +**Vcpu** | Pointer to **int32** | | [optional] +**HostCpus** | Pointer to **[]int32** | | [optional] ## Methods ### NewCpuAffinity -`func NewCpuAffinity(vcpu int32, hostCpus []int32, ) *CpuAffinity` +`func NewCpuAffinity() *CpuAffinity` NewCpuAffinity instantiates a new CpuAffinity object This constructor will assign default values to properties that have it defined, @@ -45,6 +45,11 @@ and a boolean to check if the value has been set. SetVcpu sets Vcpu field to given value. +### HasVcpu + +`func (o *CpuAffinity) HasVcpu() bool` + +HasVcpu returns a boolean if a field has been set. ### GetHostCpus @@ -65,6 +70,11 @@ and a boolean to check if the value has been set. SetHostCpus sets HostCpus field to given value. +### HasHostCpus + +`func (o *CpuAffinity) HasHostCpus() bool` + +HasHostCpus 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_cpu_affinity.go b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpu_affinity.go index 889c8364f0..f0009699f2 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpu_affinity.go +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/client/model_cpu_affinity.go @@ -16,18 +16,16 @@ import ( // CpuAffinity struct for CpuAffinity type CpuAffinity struct { - Vcpu int32 `json:"vcpu"` - HostCpus []int32 `json:"host_cpus"` + Vcpu *int32 `json:"vcpu,omitempty"` + HostCpus *[]int32 `json:"host_cpus,omitempty"` } // NewCpuAffinity instantiates a new CpuAffinity 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 NewCpuAffinity(vcpu int32, hostCpus []int32) *CpuAffinity { +func NewCpuAffinity() *CpuAffinity { this := CpuAffinity{} - this.Vcpu = vcpu - this.HostCpus = hostCpus return &this } @@ -39,60 +37,76 @@ func NewCpuAffinityWithDefaults() *CpuAffinity { return &this } -// GetVcpu returns the Vcpu field value +// GetVcpu returns the Vcpu field value if set, zero value otherwise. func (o *CpuAffinity) GetVcpu() int32 { - if o == nil { + if o == nil || o.Vcpu == nil { var ret int32 return ret } - - return o.Vcpu + return *o.Vcpu } -// GetVcpuOk returns a tuple with the Vcpu field value +// GetVcpuOk returns a tuple with the Vcpu field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CpuAffinity) GetVcpuOk() (*int32, bool) { - if o == nil { + if o == nil || o.Vcpu == nil { return nil, false } - return &o.Vcpu, true + return o.Vcpu, true } -// SetVcpu sets field value +// HasVcpu returns a boolean if a field has been set. +func (o *CpuAffinity) HasVcpu() bool { + if o != nil && o.Vcpu != nil { + return true + } + + return false +} + +// SetVcpu gets a reference to the given int32 and assigns it to the Vcpu field. func (o *CpuAffinity) SetVcpu(v int32) { - o.Vcpu = v + o.Vcpu = &v } -// GetHostCpus returns the HostCpus field value +// GetHostCpus returns the HostCpus field value if set, zero value otherwise. func (o *CpuAffinity) GetHostCpus() []int32 { - if o == nil { + if o == nil || o.HostCpus == nil { var ret []int32 return ret } - - return o.HostCpus + return *o.HostCpus } -// GetHostCpusOk returns a tuple with the HostCpus field value +// GetHostCpusOk returns a tuple with the HostCpus field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *CpuAffinity) GetHostCpusOk() (*[]int32, bool) { - if o == nil { + if o == nil || o.HostCpus == nil { return nil, false } - return &o.HostCpus, true + return o.HostCpus, true } -// SetHostCpus sets field value +// HasHostCpus returns a boolean if a field has been set. +func (o *CpuAffinity) HasHostCpus() bool { + if o != nil && o.HostCpus != nil { + return true + } + + return false +} + +// SetHostCpus gets a reference to the given []int32 and assigns it to the HostCpus field. func (o *CpuAffinity) SetHostCpus(v []int32) { - o.HostCpus = v + o.HostCpus = &v } func (o CpuAffinity) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { + if o.Vcpu != nil { toSerialize["vcpu"] = o.Vcpu } - if true { + if o.HostCpus != nil { toSerialize["host_cpus"] = o.HostCpus } 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 a2392f9884..dee8bdbf0c 100644 --- a/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml +++ b/src/runtime/virtcontainers/pkg/cloud-hypervisor/cloud-hypervisor.yaml @@ -578,9 +578,6 @@ components: description: Virtual machine configuration CpuAffinity: - required: - - vcpu - - host_cpus type: object properties: vcpu: