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

Tagging support #1146

Merged
merged 14 commits into from
Dec 7, 2021
Merged

Tagging support #1146

merged 14 commits into from
Dec 7, 2021

Conversation

bathina2
Copy link
Contributor

Change Overview

The following PR introduces the snapshot tagging for vsphere

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

  • #XXX

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

Comment on lines 115 to 117
Cns: cnsCli,
Gom: gom,
TagManager: tm,
Copy link
Contributor

Choose a reason for hiding this comment

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

Expose the tagging client and hide your interface.

Cns *cns.Client
Gom *vslm.GlobalObjectManager
Cns *cns.Client
TagManager tagManager
Copy link
Contributor

Choose a reason for hiding this comment

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

Expose the tagging service client too - the FcdProvider type is used in CBT which could need it over time.

Hide your internal interface variable - it is really tacky anyway to expose a variable to an internal interface.

// GetOrCreateCategory takes a category name and attempts to get or create the category
// it returns the category ID.
func (p *FcdProvider) GetOrCreateCategory(ctx context.Context, categoryName string) (string, error) {
cat, err := p.TagManager.GetCategory(ctx, categoryName)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use p.GetCategoryID here?

value string
}

func (t *snapshotTag) print() string {
Copy link
Contributor

Choose a reason for hiding this comment

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

This signature should be String() string.

}

// setTagsSnapshot sets tags for a snapshot
func (p *FcdProvider) setTagsSnapshot(ctx context.Context, snapshot *blockstorage.Snapshot, tags map[string]string) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

setSnapshotTags

return nil
}

func (p *FcdProvider) deleteTagsSnapshot(ctx context.Context, snapshot *blockstorage.Snapshot) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

deleteSnapshotTags

return fmt.Sprintf("%s:%s:%s:%s", volid, snapid, key, value)
}

func (p *FcdProvider) parseTag(tag string) (*snapshotTag, error) {
Copy link
Contributor

@carlbraganza carlbraganza Dec 6, 2021

Choose a reason for hiding this comment

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

This should be

func (t *snapshotTag) Parse(string) error

Copy link
Contributor

@carlbraganza carlbraganza left a comment

Choose a reason for hiding this comment

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

See comments.

@bathina2 bathina2 added the kueue label Dec 7, 2021
@mergify mergify bot merged commit 6cbf03e into master Dec 7, 2021
@mergify mergify bot deleted the vsphere_snapshot_tagging branch December 7, 2021 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants