From f5d0acfa6799380bf6eebd7911ac569c50ac6cbe Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Wed, 15 Mar 2017 17:00:46 -0400 Subject: [PATCH] Add a note about force_hosts only ever having a single value The fact force_hosts and force_nodes are lists in the scheduler filter properties and RequestSpec object is really confusing when you actually look at what populates those lists, which is a single value from the API when specifying an availability zone during server create: nova boot .. --availability-zone ZONE:HOST:NODE You can only have at most one host or node to force the server build. It appears the confusion was originally introduced way back in Essex with this change: 16ea348a1623f055809d0d9b7fe9f046515b5dd1 Maybe that was for future proofing, or maybe it was somehow related to pre-Essex features, or simply a typo, we don't really know. But what's clear is you can't provide a list of hosts to force the server build onto via the compute REST API, at least not with vanilla unmodified Nova. This change just adds some comments to the RequestSpec object so that future generations trying to sort this out don't have to stumble along as much as I did. Change-Id: I5d17fb04de22f680fe9a6cbc1e06e946abfc5aff --- nova/objects/request_spec.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nova/objects/request_spec.py b/nova/objects/request_spec.py index e8d45bf67322..c58c0aa0d70b 100644 --- a/nova/objects/request_spec.py +++ b/nova/objects/request_spec.py @@ -55,7 +55,13 @@ class RequestSpec(base.NovaObject): 'flavor': fields.ObjectField('Flavor', nullable=False), 'num_instances': fields.IntegerField(default=1), 'ignore_hosts': fields.ListOfStringsField(nullable=True), + # NOTE(mriedem): In reality, you can only ever have one + # host in the force_hosts list. The fact this is a list + # is a mistake perpetuated over time. 'force_hosts': fields.ListOfStringsField(nullable=True), + # NOTE(mriedem): In reality, you can only ever have one + # node in the force_nodes list. The fact this is a list + # is a mistake perpetuated over time. 'force_nodes': fields.ListOfStringsField(nullable=True), 'requested_destination': fields.ObjectField('Destination', nullable=True,