Allow including @ and . (dot) characters in keypair name

https://blueprints.launchpad.net/nova/+spec/allow-special-characters-in-keypair-name

Problem description

Keypair names currently allow only digits, ascii letters, dashs, underscores and spaces.

When user tries to insert any other character, he gets the error: “Keypair name contains unsafe characters”.

Allowing the @ (at) and . (dot) characters in keypair names make it possible to use the format user.name@host.name.

More context:

Check is done by https://opendev.org/openstack/nova/src/commit/5ea4f712c583c87a24eb6aafb6d3835d534a171c/nova/compute/api.py#L6422

It was introduced by https://opendev.org/openstack/nova/commit/c8b0a9a3be7ca276d91d470a629fdd0209812993, to resolve https://bugs.launchpad.net/nova/+bug/937408

Only modified once since to include space in https://opendev.org/openstack/nova/commit/ec0a65d81fd11d26be77b45827a4dd7c77711675

Use Cases

Some end users have the habit of using the format user.name@host.name in their keypair name, probably because it is the default comment generated by ssh-keygen.

Proposed change

Modify the list of safe characters to add the @ (at) and . (dot).

Alternatives

None

Data model impact

None

REST API impact

Existing microversion should keep these characters forbidden. A new microversion will allow these characters.

Security impact

None

Notifications impact

None

Other end user impact

None

Performance Impact

None

Other deployer impact

None

Developer impact

None

Upgrade impact

None

Implementation

Assignee(s)

Primary assignee:

nautik

Other contributors:

None

Feature Liaison

Liaison Needed

Work Items

None

Dependencies

None

Testing

Adding unit tests should be enough to test these special characters.

Documentation Impact

API reference documentation should explain what characters are allowed for keypair names. See https://docs.openstack.org/api-ref/compute/?expanded=create-or-import-keypair-detail#create-or-import-keypair

References

Discussion on IRC about the need for a new API microversion: http://eavesdrop.openstack.org/irclogs/%23openstack-nova/%23openstack-nova.2021-03-19.log.html#t2021-03-19T10:02:01

History

Revisions

Release Name

Description

Xena

Introduced