Skip to content

[manila]: implement share transfer API#2648

Merged
mandre merged 2 commits intogophercloud:masterfrom
kayrus:share-transfer
Jun 21, 2023
Merged

[manila]: implement share transfer API#2648
mandre merged 2 commits intogophercloud:masterfrom
kayrus:share-transfer

Conversation

@kayrus
Copy link
Copy Markdown
Contributor

@kayrus kayrus commented Jun 14, 2023

Fixes #2647

@coveralls
Copy link
Copy Markdown

coveralls commented Jun 14, 2023

Coverage Status

coverage: 79.05% (-0.01%) from 79.063% when pulling c779dc2 on kayrus:share-transfer into 44d55f0 on gophercloud:master.

@kayrus kayrus force-pushed the share-transfer branch 10 times, most recently from 7f75ba3 to 02c6154 Compare June 15, 2023 13:10
@kayrus kayrus changed the title [WIP] [manila]: implement share transfer API [manila]: implement share transfer API Jun 15, 2023
current_branch := getReleaseFromEnv(t)

if current_branch != "master" && current_branch < release {
if current_branch != "master" || current_branch < release {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix allows to run tests on master branch only while using clients.SkipReleasesBelow(t, "master")

@kayrus
Copy link
Copy Markdown
Contributor Author

kayrus commented Jun 15, 2023

@mandre @pierreprinetti ready for review

// The key to sort a list of transfers. A valid value is id, name,
// resource_type, resource_id, source_project_id, destination_project_id,
// created_at, expires_at.
SortKey string `q:"sort"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be sort_key according to the doc:

Suggested change
SortKey string `q:"sort"`
SortKey string `q:"sort_key"`


// The direction to sort a list of resources. A valid value is asc, or
// desc.
SortDir string `q:"sort"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
SortDir string `q:"sort"`
SortDir string `q:"sort_dir"`

DestinationProjectID string `json:"destination_project_id"`
ResourceID string `json:"resource_id"`
ResourceType string `json:"resource_type"`
CreatedAt time.Time `json:"-"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could also add expires_at, WDYT?

type tmp Transfer
var s struct {
tmp
CreatedAt gophercloud.JSONRFC3339MilliNoZ `json:"created_at"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which makes me think, we still have #2507 😅

@kayrus
Copy link
Copy Markdown
Contributor Author

kayrus commented Jun 21, 2023

You're right in all comments :) Thanks. As for the UTC offset, for some reason I cannot access debug logs for intermediate push :\ I don't have this API locally, therefore I rely on API reference and CI tests :)

@kayrus
Copy link
Copy Markdown
Contributor Author

kayrus commented Jun 21, 2023

According to debug logs the time format is fine:

2023/06/21 07:48:00 [DEBUG] OpenStack Response Body: {
  "transfer": {
    "accepted": false,
    "auth_key": "4fbbb3ba15e6549e",
    "created_at": "2023-06-21T07:48:00.589548",
    "destination_project_id": null,
    "expires_at": "2023-06-21T07:53:00.587670",
    "id": "787da824-1b89-46f5-9ec7-e0b5afa2f28c",
    "links": [
      {
        "href": "http://10.1.120.0/share/v2/share-transfer/787da824-1b89-46f5-9ec7-e0b5afa2f28c",
        "rel": "self"
      },
      {
        "href": "http://10.1.120.0/share/share-transfer/787da824-1b89-46f5-9ec7-e0b5afa2f28c",
        "rel": "bookmark"
      }
    ],
    "name": "123",
    "resource_id": "dbae4463-25f3-42c3-9b18-46bc29ff733d",
    "resource_type": "share",    
    "source_project_id": "98df2063d7a8467eadc137dd4c5f4ca7"
  }
}

@mandre
Copy link
Copy Markdown
Contributor

mandre commented Jun 21, 2023

Yep, because our devstack returns the date without the UTC offset, which is why we're able to parse it. The ±hh:mm part is optional in the ISO 8601 format. It would break if manila included it in it's responses.
It's not a big deal, as far as I know nobody reported issues, so that's probably not common at all in the wild, or perhaps just a documentation problem.

@mandre mandre added this to the v1.5.0 milestone Jun 21, 2023
@mandre mandre merged commit 1f574bb into gophercloud:master Jun 21, 2023
@kayrus kayrus deleted the share-transfer branch June 21, 2023 08:33
@kayrus
Copy link
Copy Markdown
Contributor Author

kayrus commented Jun 21, 2023

@mandre BTW, does it make sense to turn on the OS_DEBUG=true for all tests?

@mandre
Copy link
Copy Markdown
Contributor

mandre commented Jun 21, 2023

@mandre BTW, does it make sense to turn on the OS_DEBUG=true for all tests?

I'm afraid this is going to generate too much logs. The errors are generally obvious when we debug a CI job. We can always manually add it when needed, like you did.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[manila]: implement share transfer API

3 participants