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

Add content library VmConfigSpec support #2844

Merged
merged 3 commits into from May 16, 2022
Merged

Conversation

dougm
Copy link
Member

@dougm dougm commented May 13, 2022

Description

  • govc: add library.deploy '-config' flag

  • vcsim: add content library VmConfigSpec support

  • api: add VmConfigSpec field to content library DeploymentSpec

Closes: #2843

Type of change

Please mark options that are relevant:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to
    not work as expected)
  • This change requires a documentation update
  • Build related change

Checklist:

  • My code follows the CONTRIBUTION guidelines of
    this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged

@@ -1898,6 +1938,17 @@ func (s *handler) deleteVM(ref *types.ManagedObjectReference) {
})
}

func (s *handler) reconfigVM(ref types.ManagedObjectReference, config types.VirtualMachineConfigSpec) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: reconfigureVM better?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's ok - unexported and the API method is actually called ReconfigVM_Task.. not sure why chose to spell it out in the wrapper method 🤷

@@ -61,6 +63,10 @@ func (cmd *deploy) Register(ctx context.Context, f *flag.FlagSet) {
cmd.OptionsFlag.Register(ctx, f)

f.StringVar(&cmd.profile, "profile", "", "Storage profile")

if os.Getenv("VM_CLASS_AS_CONFIG") == "true" { // FSS
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: why do we conditionally enable (define) this flag based on this env var? Is this a pattern we already do? Would it harm to always define it, since it's "" by default?

Also: what does the comment // FFS stand for?

Copy link
Member Author

Choose a reason for hiding this comment

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

Feature State Switch. We use this pattern in vCenter/WCP/VM Service/Guest Cluster Service, but this is the first time in govc it'd be used for a specific flag/field. govc does have a way to disable unreleased commands by default (see below). We'd used that for library.{checkin,checkout} for example. This feature will be released with 8.0, but is still subject to change and could still be disabled by default? Just wanted to add the flag for testing within govmomi itself and folks working on the feature.

// hideUnreleased allows commands to be compiled into the govc binary without being registered by default.
// Unreleased commands are omitted from 'govc -h' help text and the generated govc/USAGE.md
// Setting the env var GOVC_SHOW_UNRELEASED=true enables any commands registered as unreleased.

Copy link
Member Author

Choose a reason for hiding this comment

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

On second thought, I suppose we could just use the same GOVC_SHOW_UNRELEASED env var here instead adding a feature specific env var.

Copy link
Member Author

Choose a reason for hiding this comment

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

Pushed a change that does the above, can you review again @sreyasn @embano1 ?

sreyasn
sreyasn previously approved these changes May 16, 2022
Copy link

@sreyasn sreyasn left a comment

Choose a reason for hiding this comment

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

Change LGTM, Doug. Thanks again!.

As this feature is unreleased, the VM_CLASS_AS_CONFIG env var must be set to enable.
@dougm dougm merged commit ecf7a0b into vmware:master May 16, 2022
@dougm dougm deleted the issue-2843 branch May 16, 2022 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce VmConfigSpec field to the DeployLibraryItem() DeploymentSpec
4 participants