Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make PublishVolume compatible with Hosts and Host Groups #58

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ validate:
generate:
@echo "Generating $(OPENAPI_YAML) using openapi-generator-cli"
rm -rf pkg/client
docker run $(GENERATE_USER_ARGS) --rm -v ${PWD}:/local openapitools/openapi-generator-cli:$(GENERATOR_VERSION) generate -i $(OPENAPI_YAML) -g go -t /local/templates/go -o /local/pkg/client --package-name client --ignore-file-override=/local/.openapi-generator-ignore
docker run $(GENERATE_USER_ARGS) --rm -v ${PWD}:/local openapitools/openapi-generator-cli:$(GENERATOR_VERSION) generate -i $(OPENAPI_YAML) -g go -t /local/templates/go -o /local/pkg/client --package-name client --ignore-file-override=/local/.openapi-generator-ignore --additional-properties=useOneOfDiscriminatorLookup=true
@echo "Format files after generation to conform to project standard"
$(GOFMT_OPTS)

Expand Down
165 changes: 164 additions & 1 deletion api/mc-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,46 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/statusObject'
# /show/host-groups
/show/host-groups/hosts/{hostsOption}:
get:
description: Execute /show/host-groups command
operationId: ShowHost-GroupsHostsGet
parameters:
- $ref: '#/components/parameters/hostsOption'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/host-groupObject'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/statusObject'
# /show/host-groups
/show/host-groups/groups/{groupsOption}:
get:
description: Execute /show/host-groups command
operationId: ShowHost-GroupsGroupsGet
parameters:
- $ref: '#/components/parameters/groupsOption'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/host-groupObject'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/statusObject'
# /show/disk-groups
/show/disk-groups:
get:
Expand Down Expand Up @@ -397,7 +437,47 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/initiator-viewObject'
discriminator:
propertyName: object-name
mapping:
hosts-view: '#/components/schemas/hosts-viewObject'
initiator-view: '#/components/schemas/initiator-viewObject'
host-group-view: '#/components/schemas/host-group-viewObject'
status: '#/components/schemas/statusObject'
oneOf:
- $ref: '#/components/schemas/hosts-viewObject'
- $ref: '#/components/schemas/initiator-viewObject'
- $ref: '#/components/schemas/host-group-viewObject'
- $ref: '#/components/schemas/statusObject'
'401':
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/statusObject'
# /show/maps/initiator
/show/maps/initiator:
get:
description: Execute /show/maps/initiator command
operationId: ShowMapsInitiatorGet
responses:
'200':
description: OK
content:
application/json:
schema:
discriminator:
propertyName: object-name
mapping:
hosts-view: '#/components/schemas/hosts-viewObject'
initiator-view: '#/components/schemas/initiator-viewObject'
host-group-view: '#/components/schemas/host-group-viewObject'
status: '#/components/schemas/statusObject'
oneOf:
- $ref: '#/components/schemas/hosts-viewObject'
- $ref: '#/components/schemas/initiator-viewObject'
- $ref: '#/components/schemas/host-group-viewObject'
- $ref: '#/components/schemas/statusObject'
'401':
description: Unauthorized
content:
Expand Down Expand Up @@ -817,6 +897,18 @@ components:
required: true
schema:
type: string
hostsOption:
name: hostsOption
in: path
required: true
schema:
type: string
groupsOption:
name: groupsOption
in: path
required: true
schema:
type: string
volumeOption:
name: volumeOption
in: path
Expand Down Expand Up @@ -1257,6 +1349,13 @@ components:
cs-secondary-numeric:
type: integer
format: int64
current-job:
type: string
current-job-completion:
type: string
current-job-numeric:
type: integer
format: int64
durable-id:
type: string
group-key:
Expand Down Expand Up @@ -3771,6 +3870,8 @@ components:
ec-fw:
type: string
description: The Expander Controller firmware version
ese-version:
type: string
fw-default-platform-brand:
type: string
description: Default hardware platform brand of the firmware
Expand Down Expand Up @@ -3956,12 +4057,36 @@ components:
description: Logical Unit Number
ports:
type: string
volume:
type: string
description: User-defined name for the volume
volume-name:
type: string
description: User-defined name for the volume
volume-serial:
type: string
description: Unique serial number for the volume
volume-view:
$ref: '#/components/schemas/volume-viewResource'
hosts-viewResource:
type: array
minItems: 1
maxItems: 1024
items:
type: object
properties:
object-name:
type: string
meta:
type: string
durable-id:
type: string
host-name:
type: string
serial-number:
type: string
host-view-mappings:
$ref: '#/components/schemas/host-view-mappingsResource'
initiator-viewResource:
type: array
minItems: 1
Expand All @@ -3982,6 +4107,30 @@ components:
format: int64
id:
type: string
status:
$ref: '#/components/schemas/statusResource'
host-view-mappings:
$ref: '#/components/schemas/host-view-mappingsResource'
host-group-viewResource:
type: array
minItems: 1
maxItems: 1024
items:
type: object
properties:
object-name:
type: string
meta:
type: string
durable-id:
type: string
group-name:
type: string
description: Name of a Management Group
serial-number:
type: string
status:
$ref: '#/components/schemas/statusResource'
host-view-mappings:
$ref: '#/components/schemas/host-view-mappingsResource'
snapshotsResource:
Expand Down Expand Up @@ -4221,13 +4370,27 @@ components:
$ref: '#/components/schemas/volume-group-viewResource'
volume-view:
$ref: '#/components/schemas/volume-viewResource'
hosts-viewObject:
type: object
properties:
status:
$ref: '#/components/schemas/statusResource'
hosts-view:
$ref: '#/components/schemas/hosts-viewResource'
initiator-viewObject:
type: object
properties:
status:
$ref: '#/components/schemas/statusResource'
initiator-view:
$ref: '#/components/schemas/initiator-viewResource'
host-group-viewObject:
type: object
properties:
status:
$ref: '#/components/schemas/statusResource'
host-group-view:
$ref: '#/components/schemas/host-group-viewResource'
initiatorObject:
type: object
properties:
Expand Down
9 changes: 2 additions & 7 deletions cmd/api-regression/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/Seagate/seagate-exos-x-api-go/v2/pkg/regression"

"github.com/onsi/ginkgo/v2"
"k8s.io/klog/v2"
)

Expand Down Expand Up @@ -39,6 +38,7 @@ func main() {
config := flag.String("config", "", "set the configuration file")

// Parse flags
//klog.InitFlags(nil)
flag.Parse()

if *version {
Expand Down Expand Up @@ -66,16 +66,11 @@ func main() {
os.Exit(1)
}

// Logging
klog.EnableContextualLogging(true)
klog.SetOutput(ginkgo.GinkgoWriter)
logger := klog.FromContext(apiConfig.Ctx)

// Create testing object
t := testing{}

// Run regression tests
regression.Test(&t, apiConfig, logger)
regression.Test(&t, apiConfig, klog.FromContext(apiConfig.Ctx))

os.Exit(t.result)
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Seagate/seagate-exos-x-api-go/v2

go 1.20
go 1.22

require (
github.com/go-logr/logr v1.2.4
Expand Down
75 changes: 74 additions & 1 deletion internal/generator/mc-commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,34 @@ commands:
nested:
- name: initiator

- command: /show/host-groups
meta: host-group
include:
- status
options:
- flag: hosts
type: string
required: false
keyword-required: true
nested:
- name: host
nested:
- name: initiator

- command: /show/host-groups
meta: host-group
include:
- status
options:
- flag: groups
type: string
required: false
keyword-required: true
nested:
- name: host
nested:
- name: initiator

- command: /show/disk-groups
meta: disk-groups
include:
Expand Down Expand Up @@ -162,7 +190,27 @@ commands:
description: A comma-separated list of the names or serial numbers of the volumes. A name that includes a space must be enclosed in double quotes.

- command: /show/maps/initiator
meta: initiator-view
meta-set:
metas:
- name: hosts-view
nested:
- name: host-view-mappings
nested:
- name: volume-view
- name: initiator-view
nested:
- name: status
- name: host-view-mappings
nested:
- name: volume-view
- name: host-group-view
nested:
- name: status
- name: host-view-mappings
nested:
- name: volume-view
- name: status
set-option: oneOf
include:
- status
nested:
Expand All @@ -174,6 +222,31 @@ commands:
keyword-required: false
description: Optional. A comma-separated list of the names or serial numbers of host-type items (initiators, hosts, and host groups) or volume-type items (volumes and volume groups) for which to show mappings.

- command: /show/maps/initiator
meta-set:
metas:
- name: hosts-view
nested:
- name: host-view-mappings
nested:
- name: volume-view
- name: initiator-view
nested:
- name: status
- name: host-view-mappings
nested:
- name: volume-view
- name: host-group-view
nested:
- name: status
- name: host-view-mappings
nested:
- name: volume-view
- name: status
set-option: oneOf
include:
- status

- command: /show/maps/all
meta: volume-view
include:
Expand Down
Loading