Commit Graph

31 Commits

Author SHA1 Message Date
zhurong 81acfe0f17 Add ip_version for NeutronNetwork subnet
Change-Id: I84791c93319dbd70fde436cc538b0e776e2a2a6d
2019-08-22 00:44:12 +00:00
Gyorgy Szombathelyi 78abdaa130 Use consistent session options
Various components defines different options for the client sessions.
Standardize them with the help of keystonauth1 lib.

Change-Id: I2f791caaf230a58b8426d1c1d6e1eb4316a85a28
2017-07-28 14:55:45 +02:00
shihanzhang 06746baa32 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: I24ca32d9e92cdd2b3a91916337839d116e335084
2017-04-03 12:11:20 +08:00
zhurong 2eb086769f Correct the wrong calling 'getExternalNetworkIdForRouter'
In 'io.murano.system.NetworkExplorer', there is a
'get_external_network_id_for_network' method calling
'getExternalNetworkIdForRouter' to get external network id for specific
router interface, which should be 'get_external_network_id_for_router'

Change-Id: Id2046106e274b8f6682703659ab8e27233d49209
Closes-Bug: #1638923
2017-01-06 10:35:47 +08:00
Boden R 6fd6c097ac Replace retrying with tenacity
We are replacing all usages of the 'retrying' package with
'tenacity' as the author of retrying is not actively maintaining
the project. Tenacity is a fork of retrying, but has improved the
interface and extensibility (see [1] for more details). Our end
goal here is removing the retrying package from our requirements.

Tenacity provides the same functionality as retrying, but has the
following major differences to account for:
- tenacity uses seconds rather than ms as retrying did.
- tenacity has different kwargs for the decorator and
Retrying class itself.
- tenacity has a different approach for retrying args by
using classes for its stop/wait/retry kwargs.
- By default tenacity raises a RetryError if a retried callable
times out; retrying raises the last exception from the callable.
Tenacity provides backwards compatibility here by offering
the 'reraise' kwarg.
- tenacity defines 'time.sleep' as a default value for a kwarg.
That said consumers who need to mock patch time.sleep
need to account for this via mocking of time.sleep before
tenacity is imported.

This patch updates all usages of retrying with tenacity.
Unit tests will be added where applicable.

Note: This change is not newton critical so projects are welcome
to hold off on committing until post-newton. Ideally this change
will merge by the first part of Ocata so dependant functionality
can land and have time to solidify for Ocata.

[1] https://github.com/jd/tenacity

Change-Id: I18a0075e9a7c376b6881555ce67267a8944caafa
2016-09-22 10:56:34 -06:00
Stan Lagun 3ab0be1f3e Break cyclic references in DSL
Because of several bugs/code design issues in the
DSL a cyclic references between objects were created.
Thus the object model objects were not automatically
deleted upon deployment finish even if there were no
cross-links between the objects in object model.

This commit both breaks the links and increases engine
performance due to
1) For LHS expressions there is no more need to parse
 yaql function definitions upon each variable modification
 because now the base LHS context is fixed and static
2) In most cases the objects now are reclaimed immediately
 after deployment finish thus python GC doesn't have to
 traverse large graphs

Targets-blueprint: dependency-driven-resource-deallocation

Change-Id: I4b1e0038bf7c08ced357fa20c4b1e3d612c93ae9
2016-09-14 03:42:59 +00:00
Stan Lagun acd269f9b2 Update clients with multi-region support
Clients for various OpenStack services
were updated so that it would be
possible to specify region name explicitly.

If it is not provided then for clients that are
used internally by the core library it is taken
from the current region. Otherwise the default
environment region is used.

Change-Id: I289c7f8dc93a30ba1d5aa06d9da29a6af1308b9a
2016-08-29 13:18:40 -07:00
Stan Lagun bb2d0e5a84 Support for multi-regional apps was added
Now all OpenStack resource classes inherit CloudResource
that provides getRegion method and regionName property.
This allows to assign resources to different regions.
getRegion() returns CloudRegion instance that resource or it
parent belong to. CloudRegion has the similar interface to
Environment class and is the correct way to get HeatStack
instance associated with the regoin, default network
configuration, security group manager and agent listener
instances. Environment acts as the default region so backward
compatibility is not broken. However new applications
should not use environment to set security group rules but
rather a region(s) of their instance(s) in order to work correctly
when their instances were configured to use region other then
the default.

Change-Id: I4dbf40c65042e9a354f3bfadfcd63a63e6e3e418
2016-08-12 07:09:58 -07:00
Alexander Tivelkov f25776a5c3 Fixed inability to deploy if security groups are disabled
Existing implementation of Neutron-based networking assumed that the
neutron's security groups are used to manage VM accessibility.
However there may exist environments with disabled security-group
extension in Neutron and thus relying on something else to restrict
the traffic. Murano could not operate in such environments since it
always was attempting to create resources of type
OS::Neutron::SecurityGroup and attach VMs' ports to this resource.

This is addressed by introducing a new subclass of
SecurityGroupManager - DummySecurityGroupManager, which actually does
nothing but silently ignores the calls to create security rules. This
new security manager is instantiated instead of
NeutronSecurityGroupManager for Neutron-based networks in cases if the
'security-group' extension is not present in Neutron's configuration.
If it is instantiated a warning message is reported to the end-user to
notify them that security requirements of the application were
ignored.

Change-Id: Ia3bc6c17f9ca0a4b8bf8c272481760a8c81b27b7
Closes-bug: #1593253
2016-06-20 09:30:37 +00:00
OpenStack Proposal Bot bc8943c8cc Modified docstrings to comply with pep8 H405 style check
Closes-Bug: #1563270

Change-Id: I987d846f1a86ecee1fcfb0f99877563a10481478
2016-05-10 20:18:23 +00:00
Kirill Zaitsev 3ae3ba5d34 Revert "Use unified retrying decorator"
This reverts commit 275ee8861d.

Change-Id: Id37de829d557d1378b451109e90c7376987b7534
2016-03-29 19:48:58 +00:00
Nikolay Starodubtsev 275ee8861d Use unified retrying decorator
Replace retry.retrying decorator with
oslo_services.loopingcall.RetryDecorator and remove obsolete retry
decorator from murano.common.utils

Change-Id: I622c9b0fdff4b3bd5836d80a4abab056799158ca
Closes-Bug: #1559890
2016-03-29 15:22:13 +03:00
Stan Lagun 322ba88742 Added property to associate environment with OS region
The Environment class got two additional properties:

region - name of the region where environment should be deployed. If
null then home region is used.

regionConfigs - config property (taken from class config) that specifies
region parameters. It is a dictionary of a form regionName -> regionSettings.
Currently the only setting available is a agentRabbitMq that is itself
a dictionary containing the same options as [rabbitmq] section of murano.conf

Thus the configuration file io.murano.Environment.yaml may look like:

 regionConfigs:
   RegionOne:
     agentRabbitMq:
       host: rabbitMqHostName
       port: 5672
       login: murano
       password: murano
       virtual_host: /
       ssl: false
       ca_certs: null

Implements Blueprint: assign-environment-to-region
Change-Id: I3c84c96f8eeae738f83ed7b3691be38100b30e1d
2016-03-03 18:25:47 +03:00
Stan Lagun 46ea32f4e8 Py3 compatibility fixes
With this commit most of the Python 3 compatibility
issues in murano-engine are resolved.

If run on yaql with https://review.openstack.org/#/c/286110/
fix all of the unit tests except for one success.
The only failing test is base64 encoding/decoding test
which require rethink of resource management to get away
from string types for binary content

Change-Id: Iee87d27fe4f04118202de07f376d41fbf2c90f54
2016-03-03 13:02:45 +00:00
Stan Lagun fc76b3b1b4 Major refactoring of how OS clients are created and managed
* Single universal ClientManager class was dropped in favor of
   of individual in-context methods to create OS clients without
   ClientManager restrictions.
* Environment class was renamed to ExecutionSession to avoid
   common confusion with io.murano.Environment
* execution_session_local module was introduced to simplify
   keep of per-execution session (per-deployment) data. This
   is similar to thread-locals with the difference that there can
   be many threads in single session.
* All OS-clients related code was migrated to keystone client
   sessions and API v3 (except for GLARE and Mistral that doesn't
   support sessions). This increases performance and solves
   authentication problems that could be caused by token expiration
   even with trusts enabled.
* [DEFAULT]/home_region setting was introduced instead of
   [murano]/region_for_services to configure what region
   should be used by the clients by default (where Murano API
   resides). All client factories respect this setting.

Change-Id: If02c7e5d7d39574d0621e0e8dc27d1f501a31984
2016-02-20 17:59:11 +03:00
Stan Lagun 04bccb55b9 Improve public network detection algorithm
It is possible that there are several public networks exist.
ExistingNeutronNetwork used to pick first one of them.
Now when internal network name or ID supplied it tries
to find such public network that the internal network has
a common router with.

Change-Id: I252bb5545891903355cf7f8480a2cd76febcfebe
Closes-Bug: #1524322
2015-12-09 16:04:59 +03:00
Nikolay Starodubtsev 097b7c3e24 Fix an error with wrong argument
Fix using of malformed argument in retry decorator. It should use
check which will return True\False instead of exception types.
Related-Bug: #1493883

Change-Id: I10bc8db1db1fd0791012de85def7ed92e9f05076
2015-09-17 18:26:47 +03:00
Nikolay Starodubtsev a8e91b16e7 Fix race condition with router creation
Previously when murano deployed a bunch of environments from scratch
it was possible to have an error during router creation. Router was
created by env_1 and before it was fully configure it was accessed by
env_2 and then the error occurred.

Change-Id: I6dcd281a24825bb9c2ae09f45009faa6eca5a451
Closes-Bug: #1493883
2015-09-14 14:24:18 +00:00
Nikolay Starodubtsev 975bcc4a98 Log refactoring close to new logging spec
* correct log levels
* correct log messages

partial-bug: 1419872
partial-implements-bp: unified-style-logging

Change-Id: I80c2b4c809dc52125f9f4a3beec0cd3b6c4c1213
2015-09-09 20:54:26 +03:00
Stan Lagun 425766a7f8 Migration to yaql 1.0
* Code migrated to yaql 1.0.0
* New MuranoPL object initialization
* Lots of refactoring

See referenced specs for more information

Implements: blueprint migrate-to-yaql-vnext
Implements: blueprint object-construction
Depends-on: I7f314634ab5f08a521e51082d5c84dffca4b0b5c
Closes-Bug: #1454264

Change-Id: I740a4f83c76d8b56a1da585a739d770ef823a524
2015-08-25 16:08:08 +03:00
Nikolay Starodubtsev de5ed2115a Switch to oslo_log
To follow latest community practices we need to use oslo_log in
murano instead of handcrafted libs.
Unsupported log level 'audit' was changed to 'info'.

Change-Id: I40c0f3790e34bf80d0b63554e86b3cbc019eefca
2015-07-15 11:20:45 +03:00
Sergey Vilgelm 44f4a63642 Declare the CONF variable
In the several places the CONF variable is used from the murano.config.
This patch declares the local CONF variable and uses the oslo_config library.

Change-Id: I1f9a42f7f2cf7fef2cf0d63b185428dfddd9e78e
2015-07-14 00:16:27 +03:00
Doug Hellmann 21a14acba4 Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: I975592f3694be42d52685ebf606f6d3012caf1a8
2015-04-28 20:21:22 +00:00
Stan Lagun e531698e0c Adds ability to join instances to existing Neutron networks
Also refactores networking code to move networking code from
Instance so that different types of network can be represented by
single simple interface

Implements: blueprint join-existing-neutron-networks
Change-Id: I90afcea6b1c12d7f6f564d8524f5c0d30e1b4686
2015-02-04 03:02:19 +03:00
Stan Lagun 1e78446c02 Fix usage of oslo.utils.uuidutils
This changeset also fixes issue with changed tempest API

Change-Id: I3252a0e309f23fd053571158f5104cc5ef1a6f64
Closes-Bug: #1409792
2015-01-12 20:18:59 +03:00
Ruslan Kamaldinov bf05953c28 Use oslo.utils
Files from oslo.utils will go away once Murano
migrates to oslo.serialization.

Change-Id: Ib3711164562bea4ac30a96384733d77753ffa69c
2014-12-11 01:49:37 +03:00
Stan Lagun f40169327b Use Keystone trusts to get fresh token
Instead of using user's auth token (which can expire) for interactions with
other services engine creates Keystone trust that impersonate user and
create new tokens on demand.

Heat stack is created on deployment start using token rather than trust so that
Heat could establish trust of its own (trusts cannot be chained).

New behavior is disabled by default and can be enabled using [engine]/use_trusts = True in murano.conf.
With trusts enabled engine will not work with Heat prior to Juno.
For Heat stacks with deferred actions or long deployment time to work it is also required to turn on trusts in Heat itself.
This can be done via [DEFAULT]/deferred_auth_method=trusts in heat.conf and ensuring that current user
has heat_stack_owner role (or any other that is in [DEFAULT]/trusts_delegated_roles=trusts in heat.conf)

Change-Id: Ic9f3f956ddb6ff2a300a08056ee841cf3c0db870
Implements: blueprint auth-for-long-running-requests
2014-11-14 13:58:17 +03:00
Ryan Peters 09fe0567a2 Creates a router if one doesn't exist
If it doesn't find a router by the name specified in router_name
in murano.conf, create a router with that name. Uses
external_network_id or external_network_name as the
external_gateway_info ID. Requires:
https://review.openstack.org/#/c/119800

Change-Id: If8b966a7d43eb2af485113de2a0708e554605725
2014-09-24 17:46:55 +00:00
Serg Melikyan f1905be336 Use only specific router for created networks
Murano should not use first available router it may create
different networking issues cause router may not have access to
external network.

Closes-bug: #1366124
Change-Id: I223a4862c3b20cfb20281be6bd9376be3644ad92
2014-09-24 16:55:49 +00:00
Ekaterina Fedorova d6a3a2b2e6 Enable H202, H402, H404 rules
* H202 assertRaises Exception too broad
* H402 one line docstring needs punctuation
* H404 multi line docstring should start without a leading new line

Change-Id: I2f662b8b97d14daa501620c8237bf93bd2251243
2014-09-01 09:10:51 +00:00
Ruslan Kamaldinov 86a4c4710d Rename muranoapi to murano
Partially-implements blueprint: rename-murano-api-to-murano

Change-Id: I2d7f52ef4073bce800cedc77f81f5d242c4d5d98
2014-05-27 15:14:44 +04:00