Commit Graph

211 Commits

Author SHA1 Message Date
Pavlo Shchelokovskyy c6094856a3 Fix parsing of live data from OS::Nova::Server
depending on compute API version, flavor in the instance representation
may not have "id" field, but "original_name" instead.

Story: 2009753
Task: 44211
Change-Id: Ieeae2f36f5e59e01f57a2f8e66a983ec3d99ec63
2023-03-06 04:44:52 +00:00
apetrich 06071f5e9b Add REBUILD option to user_data_update_policy
OS::Nova::Server supports it so here we add the heat support for it.

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1802602

Change-Id: Ieb05ba6d6b670aff31f9f8c8debb86a6dd3b0245
2021-12-07 04:06:07 +00:00
Harald Jensås 45750c603a Use neutron client for server.addresses
The server.addresses (/servers/{server_id}/ips)
endpoint can contain stale data causing attribute
lookups to fail.

This change replaces the use of server.addresses
and instead uses the neutron client to list ports
with 'device_id' matching the server id.

Story: 2008632
Task: 41843
Related: RHBZ#1902230
Change-Id: I1b9293041f2ad92eac0e9bc9646e7b2d7c6f7fd0
2021-02-18 12:20:39 +00:00
David Hill b068f45add As of nova microversion 2.57, personality is deprecated
This patch returns a stack validation error if the nova microversion
is 2.57 or greater and the personality parameter is also specified
in the templates.

Change-Id: I0919150baa36112ccbd8bfd7ccebc7aab5735cf3
Task: 41229
2020-11-09 07:38:33 -05:00
Zuul 3e2209aeb8 Merge "Use set instead of list of server_deferred_statuses" 2020-11-03 00:10:50 +00:00
Hervé Beraud e8c52040da Remove six and python 2.7 full support
Six is in use to help us to keep support for python 2.7.
Since the ussuri cycle we decide to remove the python 2.7
support so we can go ahead and also remove six usage from
the python code.

Review process and help
-----------------------
Removing six introduce a lot of changes and an huge amount of modified files
To simplify reviews we decided to split changes into several patches to avoid
painful reviews and avoid mistakes.

To review this patch you can use the six documentation [1] to obtain help and
understand choices.

Additional informations
-----------------------
Changes related to 'six.b(data)' [2]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

six.b [2] encode the given datas in latin-1 in python3 so I did the same
things in this patch.

Latin-1 is equal to iso-8859-1 [3].

This encoding is the default encoding [4] of certain descriptive HTTP
headers.

I suggest to keep latin-1 for the moment and to move to another encoding
in a follow-up patch if needed to move to most powerful encoding (utf8).

HTML4 support utf8 charset and utf8 is the default charset for HTML5 [5].

Note that this commit message is autogenerated and not necesserly contains
changes related to 'six.b'

[1] https://six.readthedocs.io/
[2] https://six.readthedocs.io/#six.b
[3] https://docs.python.org/3/library/codecs.html#standard-encodings
[4] https://www.w3schools.com/charsets/ref_html_8859.asp
[5] https://www.w3schools.com/html/html_charset.asp

Patch 11 of a serie of 28 patches

Change-Id: I1d796ac4dbe29217ed87015cde21597dbcd4cf9b
2020-04-23 14:49:12 +02:00
huangtianhua fc57076d3c Deprecate 'accessIPv4'/'accessIPv6' attributes
Nova now return these two attributes with empty value,
deprecated them.

Change-Id: Id176d8cbc332cb02ff4f1523993ee5b232e0aa15
2020-02-19 19:42:45 +00:00
Zane Bitter 9a4012ba9d Use set instead of list of server_deferred_statuses
We only use this list to test for membership, so it's more efficient to
use a set.

Change-Id: I520fd87a18f37da3ae2e61c56fe00063348540b4
2020-02-18 09:20:41 -05:00
Zane Bitter 9dd523c311 Don't mark snapshot complete while task in progress
Failures in the gate suggest that it is now somehow possible for the
Glance image created by a snapshot to appear to have been created even
while the Nova server remains in a state like 'image_uploading'. Servers
in this state cannot be rebuilt (to restore a snapshot). To ensure that
the snapshot has actually completed before the resource is marked
SNAPSHOT_COMPLETE, check the task state of the server as well as the
state of the snapshot image in Glance.

Change-Id: I2b5cddcbeab849054d84501dfcec48442f3666d3
Co-Authored-By: Rico Lin <rico.lin.guanyu@gmail.com>
Task: 36964
2019-10-09 11:19:35 +08:00
Feilong Wang f6249c0110 Support Ignition for userdata
Fedora CoreOS will replace Fedora Atomic being the next generation
container OS. So it would be nice to support Fedora CoreOS in Heat.
In Fedora CoreOS, the cloud-init will be replaced with Ignition[1],
so the changes proposed in this patch are mainly focusing on how to
support Ignition when using Heat SOFTWARE_CONFIG with Ignition.

Task: 36671
Story: 2006566

Change-Id: I11df2431634de7d8b584b1a2ac733d43959e34fc
2019-10-01 07:08:05 +13:00
Andreas Florath bb44f779fb Document block_device_mapping_v2 delete_on_termination defaults
The default values for the 'delete_on_termination' flag for
the 'block_device_mapping_v2' depends on other parameters
of the mapping and it is not obvious for a user which default
is used in which case.
This patch documents the defaults for the different cases.

Change-Id: I44e3646e55c067aea95044f5da7c5536387d6f23
Signed-off-by: Andreas Florath <Andreas.Florath@telekom.de>
2019-09-09 09:04:22 +00:00
zhurong 7485c240db Fix coverity check FORWARD_NULL error
Change-Id: I1e115003748b8c73144984c7132845a083b5d2a2
2019-08-06 08:53:42 +08:00
ricolin 680d7a0ecf Deprecate `personality` for `OS::Nova::Server`
This patch deprecate personality property for `OS::Nova::Server`.
Since that property is deprecated by nova since version 2.57,
we should plan to Hidden that property soon.
please use ``user_data`` or ``metadata`` instead. If that
property really required, use config ``max_nova_api_microversion``
to set the maximum nova API microversion <2.57 for nova client
plugin to support personality property.

Add config option ``max_nova_api_microversion`` to set the maximum
nova API microversion for nova client plugin.

Story: #2004188
Task: #29979

Change-Id: I1852739e818ec67ac5a821e436e243eaa72f0938
2019-03-13 06:52:02 +00:00
Zuul 315a0de97c Merge "OS::Nova::Server: Extend addresses attr to include network" 2018-07-25 18:13:54 +00:00
Zuul 8cfff53e26 Merge "Define constants for Neutron client resource types" 2018-07-24 19:40:14 +00:00
Harald Jensås 30d63c5b63 OS::Nova::Server: Extend addresses attr to include network
This change adds 'network' to the addresses attribute of the
OS::Nova::Server resource. This enables resolving the
properties of the neutron network for the server resource.

Story: 1766946
Task: 19690
Change-Id: I5bef751982919103ecbefeee64bf0f2cbede0cd0
2018-07-20 10:50:54 +02:00
rabi 3c06347a93 Refactor resource plugins for microversion usage
This changes the way nova client plugin is used in some nova
resource plugins.

Change-Id: Ibc41e0387a3056b3fde7b7690bf924e7493a7a7e
2018-06-29 09:37:44 +05:30
Harald Jensås 46ac3932f9 OS::Nova::Server: Extend addresses attr to include subnets
This change adds 'subnets' to the addresses attribute of the
OS::Nova::Server resource. This enables resolving the subnet
properties for the server resource which brings parity with
OS::Neutron::Port's 'subnets' attribute.

Story: 1766946
Task: 19689
Change-Id: I6927f1e142e83df7258e259bffc86819e4cbe881
2018-06-12 15:35:10 +00:00
Zuul e880be32b3 Merge "Ignore property errors in implicit dependencies" 2018-04-28 10:27:31 +00:00
Harald Jensas f4a9e9c1b0 Exclude updated networks - match actual interface state
Use update_networks_matching_iface_port() to populate old_nets
with implicit values from interfaces before matching new_nets
properties. The network is not updated if added properties match
what is currently on the interface.

Without this chanage a stack created with...

    networks:
      - network: net0

... then updated with...

    networks:
      - network: net0
        subnet: subnet0

... would result in a port replace, which is not necessary if the
implicit subnet used when the stack was initially created was also
'subnet0'. The port being replaced will result in neutron re-running
ipam and the ip_address associated would change.

Closes-Bug: #1696483
Closes-Bug: #1702279
Depends-On: Ic4bbbcc3cee329a4de8f0eac710128175c4fc397
Change-Id: Iab75ec49b962617943017dcaf1b04b89f91a982e
Implements: blueprint tripleo-routed-networks-deployment
2018-01-20 19:53:54 +01:00
Zane Bitter 2bc7ca6d66 Define constants for Neutron client resource types
Use named constants to pass as the 'resource' parameter to the
find_resourceid_by_name_or_id() method of the Neutron client plugin.

Apart from making everything more explicit and less error-prone, this also
provides clarity on the meaning of obtuse names like 'policy' (QoS, not
any other kind of policy) or 'pool' (load balancer, not subnet).

Change-Id: If9b5528835775d303db477fafabf3ed6bd224bd0
2017-11-06 15:09:52 -05:00
Zane Bitter b50df6b1fc Ignore property errors in implicit dependencies
Implicit dependencies are calculated before resources are validated.
Therefore, any error getting a property that occurs during processing on
implicit dependencies will be raised without any of the context of which
resource is in error. By ignoring such property errors in implicit
dependency calculations, we can defer the error handling until the
actual resource validation and thus give the user an error message they
can actually use.

Change-Id: If7e0e8fd46b1b06a29cdd89743635ed32a9392e7
Closes-Bug: #1708209
2017-09-19 11:29:53 -04:00
huangtianhua d9bd5f5290 Fix client plugin name when calling ignore_not_found
When deleting the snapshot image for server resource,
we didn't use the correct client plugin, to use
'glance' instead of 'nova'.

Change-Id: I2c0e72cd6819ba2b1e27308a32b59f020804fcfd
2017-09-14 16:35:33 +08:00
Jenkins 817d8d84c3 Merge "Do not disassociate floating ip again" 2017-08-03 18:44:25 +00:00
huangtianhua fecd7a11a8 Do not disassociate floating ip again
The floating ips will be detached from server when delete
the server. So we don't have to detach those floating ips
explicitly before calling server delete.

Change-Id: I7f85d7f12c58872d790ebfe565931985099ec846
Partial-Bug: #1700830
2017-08-01 14:48:48 +00:00
Jenkins d85361bd9f Merge "Add validation of block_device_mapping_v2" 2017-07-21 05:32:29 +00:00
Kanagaraj Manickam 1269de4b4a Add tag for server nic
It adds the support for tagging the server
nic.

Change-Id: I32d0c9634987106c2e9d7dd8587be03dcb9e64a1
Closes-bug: #1657669
2017-07-17 01:30:35 +00:00
Jenkins da685482bd Merge "Reorder the update task for nova server resource" 2017-07-05 10:10:27 +00:00
Zane Bitter 176c3f7d14 Mark Server os_collect_config attribute as CACHE_NONE
When the os_collect_config attribute was added to OS::Nova::Server (in
64ddd07160), it was implemented both in
_resolve_attribute() and in get_attribute(), with the latter overriding the
former so it is never called (for this attribute) and so that the value is
never cached. To be sure, to be sure, the attribute caches - which cannot
contain the value of this attribute - were cleared whenever the deployment
data is updated.

It's much easier to just mark the attribute as CACHE_NONE. This also makes
the status of this attribute visible to other parts of the code.

Change-Id: Icaecf70529f19fb32b34de9cedb82e5006282002
Partial-Bug: #1660831
Partially-Implements: blueprint split-stack-default
2017-06-21 20:18:46 -04:00
Zane Bitter 3ffe67eaf4 Document user_data replace-on-update policy
Since d4188127a1 the documentation for the
user_data property of OS::Nova::Server has been dangerously misleading,
stating that updates to the property don't cause replacement of the
resource, which is not true by default. This adds documentation that
explains exactly what is going on.

Change-Id: I2d95205fbcbd0bfafa6690a6efec1a56441ce22d
2017-06-15 12:18:54 -04:00
huangtianhua 71b1c09afc Reorder the update task for nova server resource
Closes-Bug: #1689689
Change-Id: Ie3cba305bc6d16af21370d60025c5f3788b9b224
2017-06-13 11:06:24 +00:00
Jenkins d44111294f Merge "deployment_swift_data property for server resources" 2017-06-12 17:19:12 +00:00
Jenkins 34a4c03265 Merge "Deprecate property 'metadata' of OS::Heat::DeployedServer" 2017-06-08 12:02:12 +00:00
James Slagle c78ded7c5f deployment_swift_data property for server resources
Adds a new property, deployment_swift_data for server resources. The
property is a map containing the swift container and object name to use
for storing the deployment data and generating temp url's for the
resource.

Making this a property allows it to be created externally from Heat with
known values prior to stack creation. This allows the configuration of
the os-collect-config agent on deployed servers prior to starting the
Heat stack creation.

implements blueprint split-stack-default

Change-Id: Ia07e9374a4b95bd0e74fc47fb9df4bf6ad096715
2017-06-07 09:33:13 +00:00
huangtianhua 08e8e790bd Deprecate property 'metadata' of OS::Heat::DeployedServer
The property 'metadata' doesn't make sense for resource
OS::Heat::DeployedServer, because the deployed server can
be provisioned out of nova. The deployment metadata
we can set by resource.metadata, so deprecate the
property 'metadata' and ignore it.

Change-Id: Id218d699a0d49f127243ec537f719dd247197279
Closes-Bug: #1693661
2017-06-06 06:37:36 +00:00
huangtianhua 8fb7c3b9e4 Add validation of block_device_mapping_v2
Heat assumes image/volume/snapshot in bdm_v2
as bootable sources, if user does not specify
the 'boot_index' for them, heat will give the
value '0' for all of them, but nova does not
allow this.
This patch adds validation to avoid the error.

Closes-Bug: #1658007
Change-Id: I6809c8cb839eba20ffe12f783854fbaa7b9267d6
2017-06-06 10:06:11 +08:00
rabi 1bb701217a Check for correct Neutron exceptions harder
The change to stop using the Nova passthrough API for networking in
e8e0a2483a changed the type of exceptions
expected in a couple of places, without changing the exception handling
code accordingly.

7b17c8b4ee changed the exception handling
in one case, but continued to raise the exception instead of suppressing
it.

This patch suppresses the exception, and makes the same change to
another case of the problem.

Use a different network name for test_create_server_with_port instead of
'my_net' which is also used by one of the other tests in the same file,
to avoid the conflict at its source.

Change-Id: I2f1210e546a5ad7eef3ffd6537335049120b2d2c
Co-Authored-By: Zane Bitter <zbitter@redhat.com>
Closes-Bug: #1694412
2017-06-01 19:00:46 -04:00
rabi 7b17c8b4ee Check for correct neutron exceptions
Check for the correct exceptions from neutronclient
when replacing network id with network name in
'networks' attribute of server.

This also changes one of the tests to use a different
network name.

Change-Id: I9457ed93857805ee30e550f23b1da3d262dd83fd
Closes-Bug: #1694412
2017-05-30 17:03:46 +05:30
Jenkins 1efd0b404d Merge "Fix handle_restore for server and volume resources" 2017-05-25 07:43:08 +00:00
Jenkins 68d88b41ea Merge "Fix check_snapshot_complete for nova server" 2017-05-25 07:36:45 +00:00
Jenkins 46e42c5184 Merge "Add os_collect_config attribute to server resources" 2017-05-22 11:16:42 +00:00
rabi a8129573d2 Fix handle_restore for server and volume resources
When resource references are used for properties restore
does not work for nova server and volume resources.

This patch fixes it and adds a functional test for it.

Change-Id: I34efb3f4e0d3578d95134793f5c5d413667790e0
Closes-Bug: #1687009
2017-05-19 11:56:27 +05:30
rabi 660d8d517d Fix check_snapshot_complete for nova server
Now that we're making glance client api calls to get the image
after the snapshot is created, the image status is returned
in lower case.

This also fixes handle_delete_snapshot to make the correct
client api call.

Change-Id: I60c84d4bc3ba75604b0c5bd6c4819cd0504f1cc8
Closes-Bug: #1691939
2017-05-19 11:53:06 +05:30
rabi e8e0a2483a Fix python-novaclient 8.0.0 related issues
New python-novaclient release has removed support for
network/image/floating_ip apis. This also means
nova-network support would also cease to exist after
this change.

Change-Id: Icbcf279c10720f99a0aed1a3aaaf3945c5442a8a
Closes-Bug: #1690936
2017-05-16 16:12:04 +02:00
huangtianhua d5f2944f4c Supports string values 'none' and 'auto' for networks
Supports to specify string values 'none' and 'auto' for
networks while creating nova server. auto: automatically
allocate network resources if none are available;
none: do not attach a NIC at all. Nova supports these
string values since api version '2.37'.

Change-Id: If65f193dfdaedec3e549a8bd7b39e5f1c02be658
Blueprint: support-auto-none-special-network
Closes-Bug: #1646360
2017-05-10 09:47:39 +08:00
James Slagle 64ddd07160 Add os_collect_config attribute to server resources
Add a new attribute, os_collect_config to the server resources. The
attribute's value is a map representing the configuration for the
os-collect-config agent on the actual servers.

Adding this data as an attribute will allow it to be represented in a
stack output and also queried directly in the templates.

implements blueprint split-stack-default
Change-Id: I8acfd67cd8138d587cc362184c84a08134bf3157
2017-05-01 17:08:03 -04:00
Peter Razumovsky b386d97825 Get rid of undesirable properties.data usage
Remove all undesirable properties.data usages in resource
plugins. This usages can be harmless replaced with self.properties.

Change-Id: Ic8f619adc09fc5a2bd8e5cdb02d058199318b6c9
2017-04-04 14:29:29 +00:00
huangtianhua 7f4a64e0aa Support to get webmks console url for server
Support 'webmks' console type when get console url
for server.
Change-Id: I1e46a42ad65bba703015ef7c57aefdc67606e87c
Closes-Bug: #1646678
2017-03-31 02:48:17 +00:00
Zane Bitter e2b614c529 Use exception_filter in RPC client
This provides both better stack traces for exceptions that are not ignored,
and nicer syntax.

Change-Id: I3467c17272e4a6f81ae8293f723f95dfad3180ab
2017-03-27 14:38:53 -04:00
liyi 8f10215ffd Remove log translations
Log messages are no longer being translated. This removes all use of
the _LE, _LI, and _LW translation markers to simplify logging and to
avoid confusion with new contributions.

See:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

Change-Id: Ieec8028305099422e1b0f8fc84bc90c9ca6c694f
2017-03-25 17:11:50 +08:00