Repository navigation
Conversation
Cleaning up a shared OpenStack project means working out who created each server and from which cookbook or repo, so the right person can run kitchen destroy. The default name was <suite-platform>-<user>-<host>-<random>, which names the person but not the project, and a suite like "default" exists in almost every cookbook. Servers now carry metadata saying where they came from, and the generated name starts with the project. Instances created by earlier releases are unaffected: once a server exists, every action finds it through state[:server_id], never by name. - Add default_metadata (on by default) to set kitchen_instance, kitchen_suite, kitchen_platform, kitchen_project, kitchen_user and kitchen_host - Merge the user's metadata over those defaults with stringified keys, since Kitchen symbolizes config keys and both spellings would otherwise be sent - Send user metadata values as strings, the only type Nova accepts, and reject a metadata setting that is not a hash with ActionFailed - Truncate default values to Nova's 255-byte limit without splitting a multibyte character - Generate <project>-<suite-platform>-<user>-<random>, where the project is the basename of kitchen_root; the hostname moves to kitchen_host - Leave out name components that strip to nothing instead of leaving a stray separator - Rename NAME_HOSTNAME_LENGTH to NAME_PROJECT_LENGTH, keeping its 23 characters - Log the server id when create finds an existing server, instead of a newly generated name that server never had - Document both in the README - Cover the metadata rules in server_helper_spec, the name layout in config_spec and the create message in openstack_spec BREAKING CHANGE: generated server names, and the guest hostnames Nova derives from them, now start with the project instead of ending with the workstation hostname. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Lance Albertson <lance@osuosl.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Tag every server kitchen-openstack creates with where it came from, and start generated server names with the project. This lets whoever cleans up a shared OpenStack project tell who created a server and from which cookbook, so the right person can run
kitchen destroy.The default name was
<suite-platform>-<user>-<host>-<random>. That names the person but not the project, and a suite likedefaultexists in almost every cookbook. We hit this at the OSU Open Source Lab while cleaning up a shared test project near its RAM quota, where most servers could only be traced to a person, not to the cookbook that created them.Servers now carry six
kitchen_*metadata keys, and the generated name is<project>-<suite-platform>-<user>-<random>. The project is the basename of the Kitchen root, usually the cookbook directory. Instances created by earlier releases are unaffected, because once a server exists every action finds it throughstate[:server_id], never by name. The server name and metadata logic are inconfig.rbandserver_helper.rb, and both are worth reading first.default_metadata, on by default, which setskitchen_instance,kitchen_suite,kitchen_platform,kitchen_project,kitchen_userandkitchen_hostmetadataover those defaults so user keys win, with keys stringified because Kitchen symbolizes config keys and both spellings would otherwise be sentkeep: trueinkitchen.ymlno longer fails at create timeActionFailedwhenmetadatais not a hash instead of crashing withNoMethodError<project>-<suite-platform>-<user>-<random>and move the workstation hostname tokitchen_hostNAME_HOSTNAME_LENGTHtoNAME_PROJECT_LENGTHcreatefinds an existing server, instead of a newly generated name that server never hadserver_helper_spec, the name layout inconfig_specand thecreatemessage inopenstack_specIssues Resolved
None filed.
Type of Change
feat!:because generated server names, and the guest hostnames Nova derives from them, now start with the project instead of ending with the workstation hostname. Anyone matching on the old name format will notice, so this should release as a major version. Setserver_nameorserver_name_prefixto keep a fixed name, ordefault_metadata: falseto skip the metadata.Check List
References: