Since a guest-assisted disk snapshot is performed on the compute
that the instance is running on, there are only certain states
that the instance can be in to perform this operation. For example,
if the instance is shelved_offloaded then the instance does not
have a host and we can't cast to a compute to perform the snapshot.
Given how unrestrictive this API was before, the only restriction
we place on the state is that the instance does not have a task_state
set. We allow any vm_state for performing the operation as long as
there is a host and no task_state.
As noted in the code, we'd normally return a 409 in this case but
according to our microversion docs [1] that would be a new error
code and require a version bump, so this change just uses 400 and
leaves a TODO to make this 409 in a later mass return code update
microversion.
[1] https://docs.openstack.org/developer/nova/api_microversion_dev.html#f1
Change-Id: I1dc54a38f02bb48921bcbc4c2fdcc2c946e783c1
Closes-Bug: #1657585
Before b9587587c2 we were doing
an explicit check on the response status codes, but after
that change, we just rely on the bool override in requests.Reponse
which is True for any repsonse code less than 400. In the 204 case
we won't have response text, so we should handle that before trying
to load the json repsonse text. Because TypeError and ValueError are
handled it would just result in a warning if you got a 204, unless
CONF.api.vendordata_dynamic_failure_fatal was True in which case
it's a failure (as shown in the unit test update here).
Change-Id: Iba95fd0112ae4510ef21fdb44fcb281b14567c07
Closes-Bug: #1669084
Instances aren't getting SSH keys in some circumstances.
This adds a few debug statements to see if the Nova metadata
service thinks an instance has keys.
Related-Bug: #1668958
Change-Id: I3095d3024b62d5ebb4ea9e388a40ed94ef8f832b
This patch adds DB table `traits` and `resource_provider_traits` into
the api database.
The traits table is used to represent the trait. The resource_provider_traits
table is used to represent the relationship between trait and resource provider.
Part of implementation blueprint shared-resources-pike
Change-Id: I5c34bdd1423beab53cc4af45e016d9a9bba5ffda
Stop using mox in test_shelve.py in below test cases:
- test_unshelve
- test_unshelve_volume_backed
Change-Id: I2394b0588bc7210efd16456af2fc12dc7071681c
Partially-Implements: blueprint remove-mox-pike
Currently, when nova is creating ports, we don't update the device_id
until we bind the port much later in the process. It's better to set the
device_id when we create the port for a variety of reasons, such as it
stops other instances trying to use the port we just created.
The real reason it is changed here is because in a few edge cases Nova
still fails to correctly clean up ports we created. By adding the
device_id we should be able to more easily track down the cause of the
leaking ports, and it may help fix the issue too.
Change-Id: Ie697ad6520622d6f01f06b19b143d5f8ac21e053
Related-Bug: 1603909
Some of the apis use common.get_instance() which calls compute/api
get(). This makes that also set_target_cell() on the context like
the internal-to-servers utility method before. Now things like
server delete will work with cells.
Change-Id: I72e33b00577f53039a2d3caa4f9e716898b7f713
Remove mox from GetConsoleOutputTestCase in
nova/tests/unit/virt/xenapi/test_vmops.py
Part of blueprint remove-mox-pike
Change-Id: I3bc75d00d368a9c229d312ed6525fa8ddd5d4844
Existance of this file causes py3* tests to fail if
run after py27. This patch adds cleaning up of this
file before running py3* tests.
Change-Id: I64ef1eac7f05f217674c73ddd2cc3af773dd75ce
Closes-Bug: #1229445
The tests for XenAPI plugins were introduced with change [1].
This change also appended them to the python3 test whitelist,
as the functionality could only be executed on python2.4 environment.
The aforementioned changes were removed with change [2], but
the whitelist item was left behind. This change removes the obsolete
line.
[1] 2aa81e9ef6
[2] 21149582ff
Change-Id: Ibc15e9a06adf34512eda904d0bb3eba1eed04784
When we go to detect the minimum version for a given service, we
should ignore any deleted services. Without this, we will return
the minimum version of all records, including those that have been
deleted with "nova service-delete". This patch filters deleted
services from the query.
Closes-Bug: #1668310
Change-Id: Ic96a5eb3728f97a3c35d2c5121e6fdcd4fd1c70b
This patch finishes to remove the 'check_attach' call from Nova
completely. As Cinder already performs the required checks as part
of the 'reserve_volume' (os-reserve) call it is unnecessary to check the
statemachine in Nova also and it can lead to race conditions.
The missing 'reserve_volume' call is added to the BFV flow. In case of
build failure the volume will be locked in 'attaching' state until the
instance in ERROR state is cleaned up.
We also check AZ for each volume attach operation which we haven't
done for unshelve. A release note is added to enable 'cross_az_attach'
in case the user does not care about AZ.
The compute service version had to be bumped as the old computes still
perform 'check_attach', which will fail when the API reserves the
volume and the volume state moves to 'attaching'. If the computes
are not new enough the old check will be called as opposed to
'reserve_volume'.
Closes-Bug: #1581230
Change-Id: I3a3caa4c566ecc132aa2699f8c7e5987bbcc863a
Change c1a61fcc37 made
BlockDeviceMapping.get_by_volume raise VolumeBDMIsMultiAttach
but we weren't handling it in the create method of the
os-assisted-volume-snapshots API. This adds the handling of
the exception so it will result in a 400 instead of a 500
error if we hit it.
Change-Id: Ie544d10ada5ee1812ec5f201b02f7ba0af449bd7
Related-Bug: #1533834
Python-requests isn't really needed, don't import it to prevent
copy/paste of the anti pattern of accessing it's codes directly.
Fix one unit test that was returning a 204 but actually including data
in it, but expecting that data to not be used.
Change-Id: I9f6eda0c3e6f7d390abca5e9e4ebe059788ee11f