The object_compat decorator expects to get the Instance object with
'metadata' and 'system_metadata' attributes but if those aren't in the
db instance dict object, Instance._from_db_object will fail with a
KeyError.
In Kilo this happens per refresh_instance_security_rules because in the
compute API code, the instance passed to refresh_instance_security_rules
comes from the call to get the security group(s) which joins on the
instances column, but that doesn't join on the metadata/system_metadata
fields for the instances. So when the instances get to object_compat in
the compute manager and the db instance dict is converted to the
Instance object, it expects fields that aren't in the dict and we get
the KeyError.
The refresh_instance_security_rules case is fixed in Liberty per commit
12fbe6f082ef9b70b89302e15daa12e851e507a7 - in that case the compute API
passes Instance objects to the compute manager so object_compat doesn't
have anything to do, _load_instance just sees instance_or_dict isn't a
dict and ignores it.
We're making this change since (1) it's an obviously wrong assumption in
object_compat and should be fixed and (2) we need to backport this fix
to stable/kilo since it's an upgrade impact for users there.
Closes-Bug: #1484738
Change-Id: I36a954c095a9aa35879200784dc18e35edf689e6
This patch is making the Nova ironic driver to try to unprovision the node
even if it's in DEPLOYING state. Current Ironic will not accept aborting
the deployment when it's in DEPLOYING state but with the retry mechanism
it may work once the state is moved to ACTIVE or DEPLOYWAIT. Prior to
this patch the logic was to not even try to unprovision the node if it's
in DEPLOYING and just go ahead and clean the instance but that behavior
is dangerous and could leave orphan active instances in Ironic. With
this patch at least if the unprovision fails in Ironic we can make sure
that the instance won't be deleted from Nova.
The tests for the destroy() method were refactored to extend testing
destroy() being called with all provision state methods in Ironic
instead of picking certain ones; A helper function was created to avoid
code duplication on the tests.
Partial-Bug: #1477490
Change-Id: I227eac73a9043dc242b7a0908bc27b628b830c3c
To help with v2.1 compat mode, we need to allow users to pass in any
scheduler hints, to allow for out of tree extensions.
This includes ensuring the soft additional properties validator does not
strip out extra properties when they are allowed by the schema.
As this Mail:
http://lists.openstack.org/pipermail/openstack-dev/2015-June/067996.html
pointed out the limit the scheduler-hints in the API is problematic. This
patch relax the validation of scheduler hints for v2.1 also.
Co-Authored-By: Ed Leafe <ed@leafe.com>
Co-Authored-By: Alex Xu <hejie.xu@intel.com>
Change-Id: I4c066075165f69d355a74979808fa0ad8d6546ab
Since it's pretty confusing to understand why an instance AZ can be different
from the host AZ the instance belongs to, and since that field is never
updated even after an instance is scheduled to an host, we think it's good
to add a comment in the DB model to explain that.
Change-Id: Id0914530cbacf4cf5c3319f1401bf07b3112935d
This adds two comments to help remind us that Instance and InstanceList
v1 objects should not change anymore.
Related to blueprint liberty-bump-object-and-rpcapi-versions
Change-Id: Id05b35444a971d1531b43895533d6a6bf406c702
Nova uses overwrite in constructor of RequestContext to
update thread's local context or not, we don't need it
in method elevated, due to we never replace thread's local
context when get a copy with current context.
Change-Id: Ia85dfc4ddf4d4d31a7367c1ff90da118f503ba09
Policy check for delete related actions are supported,
but missing in the sample file, it would be nice to add these.
Change-Id: I8d58be7f3cb1bdefc3b783a256c21ed216cdbad7
Closes-bug: #1446032
Convert the ironic driver and related files to make use of
the nova.objects.ImageMeta object. Where an image_meta
dict is passed in via the virt API, it is converted to
object form before being used.
Change-Id: Icc1c6ab43fd6ac61a979c6c6676c1960c9cd0639
The config drive code checks for a property 'img_config_drive'
in the instance system metadata. Add this property to the
ImageMetaProps object and convert the config drive code to
use the ImageMeta object for accessing it.
Change-Id: Id96af7e6f8429c58a8224c3d32c982a3af7d9cd7
These two filters don't show up in the nova code anymore, probably
removed when baremetal was replaced with ironic.
Change-Id: Ia1e1bbe21bf9d8956775b7dff593dd9cbd046367
The server name is designed to be anything the user would like it to
be, so should be validated against name, not hostname. This is how
v2.0 worked, and v2.1 schema validation accidentally went over the top
here. v2.1 regressed at f40b6a1d5c91628f78fdbc0417a3a394a69ab716
Change-Id: Ia32a452ab3a5d7cd5a5289e8e8bf9f8e5e404780
Partial-Bug: #1491511
Fibre channel drivers are failing on calls from the
os-brick library to scsi_id.
This is a temporary fix until os-brick's rootwrap
filters can be pulled in. It is not intended or
desired that nova track all os-brick rootwrap filter
values. But until that mechanism is finalized, we
need necessary commands added here.
Change-Id: Ie5f1fbe0a2da171d80faefe3245df91aef8ce1ab
Partial-bug: #1479842
Now that the one and only call to create a compute node record in
resource tracker has been converted to objects[1], the old method
in conductor can be cleaned out.
[1] commit 2ef014eb313396cffb73fc52f5cea6b5a2151da7
Related to blueprint liberty-bump-object-and-rpcapi-versions
Change-Id: I6f8043efcc5928d7e42bc32b638bbd4e782a1e2a
A recent change replaced calls to conductor method vol_usage_update()
with objects calls. One mock was mistakenly left in place and must be
removed before the method itself can be dropped in an upcoming
conductor rpc major version bump.
Change-Id: I2881189c904110a9f8aa85af266916d243de7586