@@ -510,10 +510,142 @@ For example:
510510 should be addressed over time.
511511
512512
513+ API versioning
514+ ==============
515+
516+ OpenStackClient will strive to behave sensibly for services that version their
517+ API. The API versioning schemes in use vary between services and have evolved
518+ since the early days of OpenStack. There are two types of API versioning to
519+ consider: the major version and the minor version. Today, most OpenStack
520+ services have settled on a single major API version and have chosen to evolve
521+ the API without bumping the major API version any further. There are three API
522+ "minor" versioning schemes in common use.
523+
524+ .. rubric :: Per-release versions
525+
526+ This is used by the Image service (glance). All changes to the API during a
527+ given release cycle are gathered into a single new API version. As such, the
528+ API version will increase at most once per release. You can continue to request
529+ older versions.
530+
531+ Example:
532+
533+ .. list-table :: Image (glance) API versions per release
534+
535+ * - Release
536+ - Supported 2.x API versions
537+
538+ * - Grizzly
539+ - 2.0 - 2.1
540+
541+ * - Havana
542+ - 2.0 - 2.2
543+
544+ * - Kilo
545+ - 2.0 - 2.3
546+
547+ * - ...
548+ - ...
549+
550+ .. rubric :: Microversions
551+
552+ This is used by multiple services including the Compute service (nova), Block
553+ Storage service (cinder), and Shared Filesystem service (manila). Each change
554+ to the API will result in a new API version. As such, the API version can
555+ increase multiple times per release. You can continue to request older
556+ versions.
557+
558+ Example:
559+
560+ .. list-table :: Compute (nova) API versions per release
561+
562+ * - Release
563+ - Supported 2.x API versions
564+
565+ * - Kilo
566+ - 2.1 - 2.3
567+
568+ * - Liberty
569+ - 2.1 - 2.12
570+
571+ * - Mitaka
572+ - 2.1 - 2.25
573+
574+ * - ...
575+ - ...
576+
577+ .. rubric :: Extensions
578+
579+ This is used by the Networking service (neutron). It's a versioning scheme that
580+ doesn't use API versions. Instead, it exposes a list of available extensions.
581+ An extension can add, remove or modify features and vendor-specific
582+ functionality to the API. This can include API resources/routes as well as new
583+ fields in API requests and responses. If you want to depend on a feature added
584+ by an extension, you should check if the extension is present.
585+
586+ Major API version support
587+ -------------------------
588+
589+ Major API version support has become less important over time as the various
590+ OpenStack services have chosen to focus on the "minor" versioning mechanisms
591+ described above. However, OpenStackClient aims to support **all ** OpenStack
592+ clouds, not just those running the most recent OpenStack release. This means it
593+ must aim to support older major API versions that have since been removed from
594+ the services in question. For example, the Volume service's (cinder) v2 API was
595+ deprecated in cinder 11.0.0 (Pike) and was removed in cinder 19.0.0 (Xena),
596+ however, OpenStackClient continues to support this API since not all OpenStack
597+ deployments have updated or will update to Xena or later. This should remain
598+ the case for as long as this support is technically feasible.
599+
600+ .. note ::
601+
602+ While OpenStackClient will continue to support existing command
603+ implementations for older APIs, there is no requirement to add **new **
604+ commands that implement support for deprecated or removed APIs.
605+
606+ OpenStackClient provides different command implementations depending on the API
607+ version used. On startup, OpenStackClient will attempt to identify the API
608+ version using the service catalog. Where a service provides multiple API major
609+ versions, OpenStackClient defaults to the latest one. This can be configured by
610+ the user using options (``--os-{service}-api-version ``), environment variables
611+ (``OS_{service}_API_VERSION ``) or configuration in the ``clouds.yaml `` file.
612+
613+ Minor API version and extension support
614+ ---------------------------------------
615+
616+ As most services implement some form of versioning and use this to both add new
617+ functionality and to modify or remove existing functionality, it is imperative
618+ that OpenStackClient provides a mechanism to configure the API version used.
619+ Unlike major API versions, support for API microversions or API extensions is
620+ implemented via logic in the command itself. OpenStackClient commands should
621+ indicate the minimum or maximum API microversion or the API extension required
622+ for given actions and options in the help string for same. Where a user
623+ attempts to use a feature that requires a particular microversion or extension
624+ that the service does not support, OpenStackClient should fail with an error
625+ message describing these requirements. Like API versions, the requested can be
626+ configured by the user using options (``--os-{service}-api-version ``),
627+ environment variables (``OS_{service}_API_VERSION ``) or configuration in
628+ ``clouds.yaml `` file.
629+
630+ .. important ::
631+
632+ Historically, OpenStackClient has defaulted to the lowest supported
633+ microversion for each service. This was not by design but rather a side
634+ effect of relying on legacy clients who implement this behavior.
635+ openstacksdk does not implement this behavior and instead auto-negotiates a
636+ version based on the versions that SDK knows about. For now, this means we
637+ have some commands that require explicit microversion configuration to get
638+ the latest and greatest behavior, while others will handle this
639+ transparently. For humans, this should not matter. For scripts, which are
640+ more fragile, it is recommended that an explicit microversion is always
641+ requested.
642+
643+
513644Examples
514645========
515646
516- The following examples depict common command and output formats expected to be produces by the OpenStack client.
647+ The following examples depict common command and output formats expected to be
648+ produces by the OpenStackClient.
517649
518650Authentication
519651--------------
0 commit comments