Skip to content

Commit

Permalink
feat: LMGR-656: Creating lpar failed due to cryptoConfigration field …
Browse files Browse the repository at this point in the history
…in request body

Signed-off-by: zhangli <[email protected]>
  • Loading branch information
bjzhangl committed Nov 21, 2023
1 parent f89f6aa commit 5de1a95
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 26 deletions.
20 changes: 10 additions & 10 deletions pkg/zhmcclient/fakes/lpar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions pkg/zhmcclient/fakes/zhmc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/zhmcclient/lpar.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
type LparAPI interface {
CreateLPAR(cpcURI string, props *LparProperties) (string, int, *HmcError)
ListLPARs(cpcURI string, query map[string]string) ([]LPAR, int, *HmcError)
GetLparProperties(lparURI string) (*LparProperties, int, *HmcError)
GetLparProperties(lparURI string) (*LparObjectProperties, int, *HmcError)
UpdateLparProperties(lparURI string, props *LparProperties) (int, *HmcError)
StartLPAR(lparURI string) (string, int, *HmcError)
StopLPAR(lparURI string) (string, int, *HmcError)
Expand Down Expand Up @@ -119,10 +119,10 @@ func (m *LparManager) ListLPARs(cpcURI string, query map[string]string) ([]LPAR,
/**
* GET /api/partitions/{partition-id}
* @lparURI is the object-uri
* Return: 200 and LparProperties
* Return: 200 and LparObjectProperties
* or: 400, 404,
*/
func (m *LparManager) GetLparProperties(lparURI string) (*LparProperties, int, *HmcError) {
func (m *LparManager) GetLparProperties(lparURI string) (*LparObjectProperties, int, *HmcError) {
requestUrl := m.client.CloneEndpointURL()
requestUrl.Path = path.Join(requestUrl.Path, lparURI)

Expand All @@ -138,7 +138,7 @@ func (m *LparManager) GetLparProperties(lparURI string) (*LparProperties, int, *
}

if status == http.StatusOK {
lparProps := LparProperties{}
lparProps := LparObjectProperties{}
err := json.Unmarshal(responseBody, &lparProps)
if err != nil {
return nil, status, getHmcErrorFromErr(ERR_CODE_HMC_UNMARSHAL_FAIL, err)
Expand Down
87 changes: 86 additions & 1 deletion pkg/zhmcclient/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ type PartitionFeatureInfo struct {
State bool `json:"state,omitempty"`
}

type LparProperties struct {
type LparObjectProperties struct {
URI string `json:"object-uri,omitempty"`
CpcURI string `json:"parent,omitempty"`
Class string `json:"class,omitempty"`
Expand Down Expand Up @@ -826,6 +826,91 @@ type LparProperties struct {
Secureboot bool `json:"secure-boot,omitempty"`
}

type LparProperties struct {
URI string `json:"object-uri,omitempty"`
CpcURI string `json:"parent,omitempty"`
Class string `json:"class,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Status PartitionStatus `json:"status,omitempty"`
Type PartitionType `json:"type,omitempty"`
ShortName string `json:"short-name,omitempty"`
ID string `json:"partition-id,omitempty"`
AutoGenerateID bool `json:"autogenerate-partition-id,omitempty"`
OsName string `json:"os-name,omitempty"`
OsType string `json:"os-type,omitempty"`
OsVersion string `json:"os-version,omitempty"`
ReserveResources bool `json:"reserve-resources,omitempty"`
DegradedAdapters []string `json:"degraded-adapters,omitempty"`
ProcessorMode PartitionProcessorMode `json:"processor-mode,omitempty"`
CpProcessors int `json:"cp-processors,omitempty"`
IflProcessors int `json:"ifl-processors,omitempty"`
IflAbsoluteProcessorCapping bool `json:"ifl-absolute-processor-capping,omitempty"`
CpAbsoluteProcessorCapping bool `json:"cp-absolute-processor-capping,omitempty"`
IflAbsoluteProcessorCappingValue float64 `json:"ifl-absolute-processor-capping-value,omitempty"`
CpAbsoluteProcessorCappingValue float64 `json:"cp-absolute-processor-capping-value,omitempty"`
IflProcessingWeightCapped bool `json:"ifl-processing-weight-capped,omitempty"`
CpProcessingWeightCapped bool `json:"cp-processing-weight-capped,omitempty"`
MinimumIflProcessingWeight int `json:"minimum-ifl-processing-weight,omitempty"`
MinimumCpProcessingWeight int `json:"minimum-cp-processing-weight,omitempty"`
InitialIflProcessingWeight int `json:"initial-ifl-processing-weight,omitempty"`
InitialCpProcessingWeight int `json:"initial-cp-processing-weight,omitempty"`
CurrentIflProcessingWeight int `json:"current-ifl-processing-weight,omitempty"`
CurrentCpProcessingWeight int `json:"current-cp-processing-weight,omitempty"`
MaximumIflProcessingWeight int `json:"maximum-ifl-processing-weight,omitempty"`
MaximumCpProcessingWeight int `json:"maximum-cp-processing-weight,omitempty"`
ProcessorManagementEnabled bool `json:"processor-management-enabled,omitempty"`
InitialMemory int `json:"initial-memory,omitempty"`
ReservedMemory int `json:"reserved-memory,omitempty"`
MaximumMemory int `json:"maximum-memory,omitempty"`
AutoStart bool `json:"auto-start,omitempty"`
BootDevice PartitionBootDevice `json:"boot-device,omitempty"`
BootNetworkDevice string `json:"boot-network-device,omitempty"`
BootFtpHost string `json:"boot-ftp-host,omitempty"`
BootFtpUsername string `json:"boot-ftp-username,omitempty"`
BootFtpPassword string `json:"boot-ftp-password,omitempty"`
BootFtpInsfile string `json:"boot-ftp-insfile,omitempty"`
BootRemovableMedia string `json:"boot-removable-media,omitempty"`
BootRemovableMediaType PartionBootRemovableMediaType `json:"boot-removable-media-type,omitempty"`
BootTimeout int `json:"boot-timeout,omitempty"`
BootStorageDevice string `json:"boot-storage-device,omitempty"`
BootStorageVolume string `json:"boot-storage-volume,omitempty"`
BootLogicalUnitNumber string `json:"boot-logical-unit-number,omitempty"`
BootWorldWidePortName string `json:"boot-world-wide-port-name,omitempty"`
BootConfigurationSelector int `json:"boot-configuration-selector,omitempty"`
BootRecordLba string `json:"boot-record-lba,omitempty"`
BootLoadParameters string `json:"boot-load-parameters,omitempty"`
BootOsSpecificParameters string `json:"boot-os-specific-parameters,omitempty"`
BootIsoImageName string `json:"boot-iso-image-name,omitempty"`
BootIsoInsFile string `json:"boot-iso-ins-file,omitempty"`
AccessGlobalPerformanceData bool `json:"access-global-performance-data,omitempty"`
PermitCrossPartitionCommands bool `json:"permit-cross-partition-commands,omitempty"`
AccessBasicCounterSet bool `json:"access-basic-counter-set,omitempty"`
AccessProblemStateCounterSet bool `json:"access-problem-state-counter-set,omitempty"`
AccessCryptoActivityCounterSet bool `json:"access-crypto-activity-counter-set,omitempty"`
AccessExtendedCounterSet bool `json:"access-extended-counter-set,omitempty"`
AccessCoprocessorGroupSet bool `json:"access-coprocessor-group-set,omitempty"`
AccessBasicSampling bool `json:"access-basic-sampling,omitempty"`
AccessDiagnosticSampling bool `json:"access-diagnostic-sampling,omitempty"`
PermitDesKeyImportFunctions bool `json:"permit-des-key-import-functions,omitempty"`
PermitAesKeyImportFunctions bool `json:"permit-aes-key-import-functions,omitempty"`
ThreadsPerProcessor int `json:"threads-per-processor,omitempty"`
VirtualFunctionUris []string `json:"virtual-function-uris,omitempty"`
NicUris []string `json:"nic-uris,omitempty"`
HbaUris []string `json:"hba-uris,omitempty"`
StorageGroupURIs []string `json:"storage-group-uris,omitempty"`
CryptoConfiguration CryptoConfig `json:"-"`
SscHostName string `json:"ssc-host-name,omitempty"`
SscBootSelection SscBootSelection `json:"ssc-boot-selection,omitempty"`
SscIpv4Gateway string `json:"ssc-ipv4-gateway,omitempty"`
SscIpv6Gateway string `json:"ssc-ipv6-gateway,omitempty"`
SscDnsServers []string `json:"ssc-dns-servers,omitempty"`
SscMasterUserid string `json:"ssc-master-userid,omitempty"`
SscMasterPw string `json:"ssc-master-pw,omitempty"`
AvailableFeaturesList []PartitionFeatureInfo `json:"available-features-list,omitempty"`
Secureboot bool `json:"secure-boot,omitempty"`
}

type StartStopLparResponse struct {
URI string `json:"job-uri"`
Message string `json:"message"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/zhmcclient/zhmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (m *ZhmcManager) GetCPCProperties(cpcURI string) (*CPCProperties, int, *Hmc
func (m *ZhmcManager) ListLPARs(cpcURI string, query map[string]string) ([]LPAR, int, *HmcError) {
return m.lparManager.ListLPARs(cpcURI, query)
}
func (m *ZhmcManager) GetLparProperties(lparURI string) (*LparProperties, int, *HmcError) {
func (m *ZhmcManager) GetLparProperties(lparURI string) (*LparObjectProperties, int, *HmcError) {
return m.lparManager.GetLparProperties(lparURI)
}
func (m *ZhmcManager) UpdateLparProperties(lparURI string, props *LparProperties) (int, *HmcError) {
Expand Down

0 comments on commit 5de1a95

Please sign in to comment.