Commit Graph

87 Commits

Author SHA1 Message Date
Stephen Finucane 9b321e41f6 nova-net: Remove firewall support (pt. 3)
Firewall support is not needed with neutron, which supports both
security groups for per-port filtering and FWaaS for per-network
filtering. Remove both the generic firewalls and the hypervisor-specific
implementations.

This part focuses on removing the firewall drivers themselves, which are
now unused. It also updates the release note to note the two additional
config options that are removed here, '[DEFAULT] firewall_driver' and
'[DEFAULT] allow_same_net_traffic'.

Change-Id: I2dccf1610d6cbbb076fda393f1ef695d0be84b13
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-01-08 13:53:00 +00:00
Jenkins 45dfc7106e Merge "Remove translation of log messages" 2017-06-20 21:16:49 +00:00
Balazs Gibizer a4a9733f4a remove get_nw_info_for_instance from compute.utils
This patch removes get_nw_info_for_instance(instance) from nova.compute.utils
as it was just a proxy for instance.get_network_info() call.

Change-Id: Iddae8074554995df22b656bb2e9bddaec6d775cc
2017-06-13 13:30:06 +02:00
Ngo Quoc Cuong 6c3520ac5b Remove translation of log messages
The i18n team has decided not to translate the logs because it
seems like it not very useful; operators prefer to have them in
English so that they can search for those strings on the internet.

Partially fix on nova/virt other paths will be fixed on next commits

Change-Id: Ie7821aa4a5147cdb0616741bd1a1b1fc22080440
2017-06-13 11:20:28 +07:00
Martin Schuppert 2054082296 Fix spelling mistake
Change-Id: Idd1e75870348085d54dcb40a8d2c0bbdbcb05e0a
2016-06-28 08:41:09 +02:00
Pushkar Umaranikar d619ad6ba1 Config options: Centralize netconf options
The config options of the section
"nova/netconf" got moved to the
new central location
"nova/conf/netconf.py"

Change-Id: I8a17b6f00b15e03de55385fc0206bdc82441304a
Depends-On: I0da2ad7daa942b85c3395dc4861c6e18368ece88
Implements: blueprint centralize-config-options-newton
2016-04-24 18:15:05 +00:00
Takashi NATSUME 897cb7c2d3 Fix string interpolations at logging calls
Skip creating the formatted log message
if the message is not going to be emitted
because of the log level.

TrivialFix
Change-Id: Iba9f47163a0ac3aca612818272db6d536b238975
2016-03-07 12:05:58 +09:00
Stephen Finucane 6537213ddd config options: Centralise 'virt.firewall' options
Add options from 'virt.firewall'. These options are part of the
'DEFAULT' group but are included in the "nova.conf.virt" file in hope
that they can eventually be moved to their own group.

Change-Id: I54d7bbe416d908edf3447b36e054be189f9d5bf9
Implements: bp centralize-config-options
2016-02-22 09:36:44 +00:00
Hans Lindgren c5e2d4b6b4 Remove unused provider firewall rules functionality in nova
Provider firewall rules functionality is not in use and hasn't been
for a very long time. The api for this was removed in [1] and db api
methods for adding/removing rows in the associated db table have not
been used since.

Stop refreshing those rules as it is essentially a no-op and indeed a
costly one that includes a rpc round trip to the conductor to get
back an always empty db result. This should have a positive impact on
instance boot performance since the conductor call happens to live
inside an externally syncronized block of code.

Removes related compute rpcapi/manager code that were missed in a
recent cleanup[2]. Since this functionality hasn't been in use since
Havana timeframe(!), it should be fairly safe to remove without first
deprecating it.

Also removes the now unused virtapi method provider_fw_rule_get_all()
and the virtapi itself from virt firewall driver initialization.

[1] Commit: 62d5fae8d1
[2] Commit: e6f7d80417

Change-Id: Ifbb2514b9bc1445eaa07dcfe172c7405fd1a58f7
Partial-Bug: #1016633
2016-02-01 15:50:04 +01:00
Sudipta Biswas 58369a1f6d Cleanup NovaObjectDictCompat from security_group_rule
Cleanup subclassing on NovaObjectDictCompat and fix subsequent tests
and code associated with nova/objects/security_group_rule.py

Change-Id: Idffd15a6d4ce043d97f9e8ca4ac0f5abe51e5f2c
2016-01-05 16:21:08 +00:00
Hans Lindgren 82636d6788 Reduce the number of db/rpc calls to get instance rules
When getting instance rules in virt/firewall.py a for loop is used to
issue db queries for rules belonging to each individual security group
in a list of security groups that itself is fetched using a separate
query.

This can be made much more efficient by querying all rules in a single
db query joined by instance.

Change-Id: I325f9c71fecde8297842fd608ac3cfd51ea9db71
Closes-Bug: #1528041
2015-12-23 19:17:40 +01:00
Hans Lindgren 4ee60b92ed Remove unused refresh_security_group_members() call
This call was replaced with refresh_instance_security_groups() in
compute rpc version 1.41(!) Since we just reached version 4.0 it
should be fairly safe to just remove all traces of this without
backwards compatibility being an issue.

The original change that replaced and made this call no longer being
used was commit 2afbbab23a.

Change-Id: I60d314f68a984fa8e6d36f46b5ae595f0afabe73
2015-10-03 14:03:22 +02:00
Davanum Srinivas 54a19f9a51 Switch nova.virt.* to use the object dot notation
Fix virt/fake.py and virt/firewall.py to use instance objects
with the field access dot notation everywhere. Essentially we use
instance.key instead of instance['key']. Needed to rework some of
the test cases to get them working.

Change-Id: I6b8613edcfa0d735008b69824c996dc7e4fd25f7
2015-03-03 08:08:16 -05:00
Davanum Srinivas 97d63d8745 Use oslo.log
Convert the use of the incubated version of the log module
to the new oslo.log library.

Sync oslo-incubator modules to update their imports as well.

Co-Authored-By: Doug Hellmann <doug@doughellmann.com>
Change-Id: Ic4932e3f58191869c30bd07a010a6e9fdcb2a12c
2015-02-22 07:56:40 -05:00
Davanum Srinivas af2d6c9576 Switch to using oslo_* instead of oslo.*
The oslo team is recommending everyone to switch to the
non-namespaced versions of libraries. Updating the hacking
rule to include a check to prevent oslo.* import from
creeping back in.

This commit includes:
- using oslo_utils instead of oslo.utils
- using oslo_serialization instead of oslo.serialization
- using oslo_db instead of oslo.db
- using oslo_i18n instead of oslo.i18n
- using oslo_middleware instead of oslo.middleware
- using oslo_config instead of oslo.config
- using oslo_messaging instead of "from oslo import messaging"
- using oslo_vmware instead of oslo.vmware

Change-Id: I3e2eb147b321ce3e928817b62abcb7d023c5f13f
2015-02-06 06:03:10 -05:00
Mike Durnosvistov 8431670ef8 Replacement `_` on `_LI` in all LOG.info - part 1
oslo.i18n uses different marker functions to separate the
translatable messages into different catalogs, which the translation
teams can prioritize translating. For details, please refer to:
http://docs.openstack.org/developer/oslo.i18n/guidelines.html#guidelines-for-use-in-openstack

There were not marker fuctions some places in directory network.
This commit makes changes:
* Add missing marker functions
* Use ',' instead of '%' while adding variables to log messages

Added a hacking rule for the log info about checking
translation for it.

Change-Id: I96766d723b01082339876ed94bbaa77783322b8c
2014-11-20 10:19:17 +02:00
Davanum Srinivas 323fa6fef7 Use oslo.utils
oslo.utils library now provides the functionality previously in
oslo-incubator's excutils, importutils, network_utils, strutils
timeutils, units etc. Some modules already moved to oslo.utils
will still be around since other code in nova/openstack/common/
are using it and will be removed in a subsequent commit.

Change-Id: Idc716342535fdfa680963e0e073ddb46f5f1eb34
2014-10-06 21:41:17 -04:00
Joe Gordon 855fe98ef4 Fix and Gate on E265
pep8 E265 makes sure block comment start with '# '. Fix and gate on this
new rule as it helps improve comment readability.

In the few cases where the comment was just commented out code, remove
the comment.

Change-Id: Iea1c445df8ddc2b6c17a4ab697ad756eef2f91fa
2014-07-24 08:11:00 -04:00
Chris Behrens 3883697d31 Fix last of direct use of object modules
This replaces all uses of nova.objects.<module>.<object> with
nova.objects.<object> in the remaining places.

Implements-Blueprint: object-subclassing

Change-Id: Ic7632cca2455a38abcbdb94feb7e39cfb898bb27
2014-07-22 19:37:12 +10:00
Davanum Srinivas 826aed0ec7 Use oslo.i18n
oslo.i18n provides the i18n functions that were provided by
oslo-incubator's gettextutils module. Some tests that were
using internal details of the library were removed.

Change-Id: I44cfd5552e0dd86af21073419d31622f5fdb28e0
2014-07-18 14:28:09 -04:00
Jenkins e84b8ef982 Merge "change the firewall debugging for clarity" 2014-07-17 06:51:00 +00:00
Sean Dague d7ce7cccbc change the firewall debugging for clarity
When we are building rules ensure we log the instance['id'] so
we can actually correlate the iptables output to UUID for the
instance.

Also bundle up the security group to iptables translation to a
final view of the world instead of the piecemeal rule at a time
view.

Display what rules are being skipped in the add process, as the
skips seem to happen a lot. If this is completely normal we should
probably delete the bit entirely at some later point.

Related-Bug: #1298472

Change-Id: I0e90c3af9bf908b733ed895ad7c204b0a95ef786
2014-07-07 15:17:29 -04:00
Dan Smith 6aa368b992 Avoid re-adding iptables rules for instances that have disappeared
The remove_filters_for_instance() method fails silently if the
instance's chain is gone (i.e. it's been deleted). If this
happens while we're refreshing security group rules, we will
not notice this case and re-add stale rules for an old instance,
breaking our firewall for new instances.

This adds a quick check after we've captured the lock to see if
the associated chain exists, and bails if it doesn't.

Change-Id: Ic75988939f82de49735d85fe99a9eecd4baf45c9
Related-bug: #1182131
2014-07-03 12:46:53 -07:00
Dan Smith 72dd81343e Avoid referencing stale instance/network_info dicts in firewall
This makes the virt.firewall code cleaner in terms of referencing
the cached instance and network_info code it stores. Before this
patch, concurrent instance operations could modify these two dicts
so that while we're iterating instances, the network_info dict
is suddenly missing information we need.

The right fix for this is to use instance objects and their
associated info_cache objects, but that's a larger fix and one
not as well-suited to backporting to previous releases which
suffer from this as well.

The approach taken here is that we store the instance and
network_info cache together in the same dict that we can pop()
from atomically (this is not really necessary, but helps to
prevent introducing more of these cases). When we iterate over
the contents, we iterate over a copy of the keys, being careful
not to let a suddenly-missing key break us, and passing the
details all the way down the stack instead of having deeper calls
hit the cache dicts again.

Change-Id: I33366f50024a82451842d045b830ab19b59879c3
Closes-bug: #1182131
2014-07-02 12:44:48 -07:00
Chris Behrens 49170d772e Fix the rest of direct uses of instance module objects
This switches the remaining occurences of
nova.objects.instance.Instance* to nova.objects.Instance*.

Partial-Blueprint: object-subclassing

Change-Id: I3017c149cc9fbc6b1fbecb003dc55455b1dcd12c
2014-06-24 00:49:07 -07:00
Gary Kotton cfd0846498 Don't translate debug level logs in nova.virt
Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since nova doesn't support lazy translation yet).

Change-Id: I524b48f530d8afd59a067074332e3964426e4d70
2014-06-08 00:36:49 -07:00
liu-sheng 74f953a1d7 Remove vi modelines
We don't need to have the vi modelines in each source file,
it can be set in a user's vimrc if required.

Also a check is added to hacking to detect if they are re-added.

Change-Id: I347307a5145b2760c69085b6ca850d6a9137ffc6
Closes-Bug: #1229324
2014-02-03 14:19:44 +00:00
Dan Smith 3994512ac6 Refactor CIDR field to use netaddr.IPNetwork
This makes the CIDR field become the IPNetwork field (and associate
versioned fields). It also uses the netaddr.IPNetwork class, which
is what should have been done in the first place.

Wire format is unchanged, so we can make this without any version
bumps or upgrade impact.

Related to blueprint nova-network-objects

Change-Id: I1a3ab6a5f4c624f3da0ab1c78c75c6f1e474541f
2014-01-14 11:05:29 -08:00
Jay Lau 0526b098c9 Remove _security_group_chain_name from nova/virt/firewall.py
The function _security_group_chain_name in nova/virt/firewall.py is
useless for now, just remove it.

Change-Id: I1ad7050115ad56ce7b152efbcfcc42aff8e6c3ed
2013-11-29 07:31:29 +08:00
Dan Smith b1a27138f6 Make virt/firewall use objects for Security Groups and Rules
This makes the virt/firewall module use SecurityGroup and
SecurityGroupRule objects instead of relying on virtapi and
conductor for these operations.

Related to blueprint compute-manager-objects
Related to blueprint virt-objects

Change-Id: I39cb9422cb15e6222f5009f64706f1528035f42d
2013-10-30 07:34:58 -07:00
Vishvananda Ishaya 8679b2c8e7 Refresh network info cache for secgroups
Before updating security group rules, we need to make sure that
the info cache is up-to-date. Without this source groups are not
updated properly. This was a regression introduced in commit
85aac04704 which fixed a potential
DOS using source groups.

Fixes bug 1216720

Change-Id: I6b5115df53f2e159ea506ef966cd49cedd35f83d
2013-09-04 17:58:30 -07:00
Jenkins a5b1cb9300 Merge "Remove old legacy network info model in libvirt driver" 2013-08-15 21:37:45 +00:00
Yaguang Tang f070f08954 Remove old legacy network info model in libvirt driver
Update libvirt driver, virt firewall and hypervisor unit tests to
use nova.network.model instead of legacy "network,mapping" tuple.

Partly implement blueprint nova-network-legacy

Co-author: Amir Sadoughi<amir.sadoughi@gmail.com>
Change-Id: I4d38bb81a4f64efdb78f5da52fbbb382981e0b96
2013-08-09 11:51:37 +08:00
Pádraig Brady 9304aabeb8 maint: remove redundant default=None for config options
These 73 instances were inconsistent and redundant.

Change-Id: I298f2406535d0805caebdca4f2729d720dd5222f
2013-08-09 02:05:04 +01:00
Vishvananda Ishaya 85aac04704 Use cached nwinfo for secgroup rules
This stops a potential DOS with source security groups by using the
db cached version of the network info instead of calling out to
the network api multiple times.

Fixes bug 1184041

Change-Id: Id5f24ecf0e8cce60c27a9aecbc6e606c4c44d6b6
2013-07-31 16:31:15 -07:00
Alex Gaynor cd9d8e45c6 Remove the monkey patching of _ into the builtins
Previous _ was monkey patched into builtins whenever
certain modules were imported. This removes that and
simply imports it when it is needed.

Change-Id: I0af2c6d8a230e94440d655d13cab9107ac20d13c
2013-07-26 07:31:17 -07:00
Chris Behrens d8eeea1bae Convert network API to use InfoCache object
This converts the db.info_cache_update() call in network/api to use
objects.  The save() method has been extended to support what we need
for cells.

Converting to the object allows us to ditch the conductor_api kwarg on
some methods.

Related to blueprint unified-object-model

Change-Id: I1722c03d20511d67acc0a8947de1d4273dc78597
2013-07-22 07:15:10 -07:00
Dirk Mueller 1bf87dda57 Fix and enable H403 tests
Multi-line doc-strings should end on a new, separate line.

Change-Id: I4cf0cfe92b634ef77971863a4df41ef43531bc20
2013-06-12 22:07:23 +02:00
Zhongyue Luo 3c36cbdbc8 Hide lock_prefix argument using synchronized_with_prefix()
The lockfile module has a new convenience API which sets the lockfile prefix.
Using this API, the prefix is not required everytime synchronized is used.

Change-Id: Iac1cfcc83b59108164de924d20127c1cf4dd7dcd
2013-05-14 15:01:45 +08:00
Zhongyue Luo 67628c56ca Fixes passing arbitrary conductor_api argument
Fixes bug #1158679

Change-Id: Iabe1f58b6139f5619e328a986143e8591b3a02cc
2013-03-22 17:02:54 +08:00
Gary Kotton 83e907f588 Ensure that FORWARD rule also supports DHCP
The previous fix only addressed the INPUT rules and not the
FORWARD rule.

Adds FORWARD rule to ensure that DHCP traffic is forwarded correctly.

Fixes bug 1131223

Change-Id: Ie0d365ba1ba1014bdd2bfc944123c17c4e415d6e
2013-02-28 13:39:47 +00:00
Gary Kotton 81476d70c4 Enable VM DHCP request to reach DHCP agent
When using the firewall driver IptablesFirewallDriver and the
default INPUT and FORWARD rules are DISCARD then the DHCP
request from the VM is discarded prior to getting to the dnsmasq.

A new rule will be added that enables DHCP requests to pass.

This fixes bug 1131223

Change-Id: I50fad5b63c3c4b22a5d828e3e89353c1ed723332
2013-02-22 13:46:03 +00:00
Vishvananda Ishaya 1564bbce98 Fix handling of source_groups with no-db-compute.
The moving of data around in no-db-compute broke source groups. This
is a combination of a few errors. First, the instance_type data wasn't
being retrieved from system_metadata. Second, the instance_type data
was too deep in the heirarchy and being ignored. Finally, source
groups require a nw info call which causes a db access by
nova-compute.

Fixes bug 1122316

Change-Id: Iccb6e5d336c0b2c8ba41c41ab2e046fc9617835a
2013-02-20 08:12:57 -08:00
Mark McLoughlin 706a137005 Use oslo-config-2013.1b4
The cfg API is now available via the oslo-config library, so switch to
it and remove the copied-and-pasted version.

Add the 2013.1b4 tarball to tools/pip-requires - this will be changed
to 'oslo-config>=2013.1' when oslo-config is published to pypi. This
will happen in time for grizzly final.

Add dependency_links to setup.py so that oslo-config can be installed
from the tarball URL specified in pip-requires.

Remove the 'deps = pep8==1.3.3' from tox.ini as it means all the other
deps get installed with easy_install which can't install oslo-config
from the URL.

Make tools/hacking.py include oslo in IMPORT_EXCEPTIONS like it already
does for paste. It turns out imp.find_module() doesn't correct handle
namespace packages.

Retain dummy cfg.py file until keystoneclient middleware has been
updated (I18c450174277c8e2d15ed93879da6cd92074c27a).

Change-Id: I4815aeb8a9341a31a250e920157f15ee15cfc5bc
2013-02-19 21:16:32 -08:00
Pádraig Brady f379db545c fix misspellings in logs, comments and tests
Flagged with: https://github.com/lyda/misspell-check
Run with: git ls-files | misspellings -f -

Fixes bug: 1100083
Change-Id: Icf1f844fea8ad0a1101d1dc64b9a126608e9536e
2013-01-21 23:14:13 +00:00
Mark McLoughlin 7cb17d63f1 Move global service networking opts to new module
The my_ip, host and use_ipv6 options are used all over the codebase
and they're pretty well related to each other. Create a new netconf
module for them to live in.

There are now no options registered globally in nova.config!

blueprint: scope-config-opts
Change-Id: Ifde37839ae6f38e6bf99dff1e80b8e25fd68ed25
2013-01-09 22:09:17 +00:00
Sean Dague bf31e02d13 Fix N402 for nova/virt
Fix N402 errors (single line docstring should end in a period)
for nova/virt, part of a larger attempt to stop ignoring our own
hacking.py tests.

Change-Id: I523ce41bd2b38c73cf3fdb031101ccc0695f2488
2013-01-08 23:45:07 -05:00
Sean Dague 37bfdd3b38 fix N401 errors, stop ignoring all N4* errors
We had previously been ignoring all our custom N4xx hacking.py
errors. This fixes all the N401 errors "doc strings
should not start with a space" and reduces the ignore set down
to N402 only "single line docstrings should end with period".

It also fixes the N401 parser to catch only docstrings, and
not tripple quoted string blocks used later on in a function.

Clean up a few of the more crazy uses of """ in our code

Clean up additional funky comments to make indents a bit more
consistent, and pull in lines when possible.

Change-Id: I9040a1d2ca7efda83bd5e425b95d1408b5b63577
2013-01-07 21:39:58 -05:00
Joe Gordon 9402ca64a8 Fix spelling mistakes in nova.virt
Change-Id: Ic5ff80af956726b768610290e4fae7dd46549711
2013-01-02 14:22:10 -08:00
Dan Smith 20811e9298 Move security_group operations in VirtAPI to conductor
This patch adds the following methods to conductor's API and
redirects the use of them in nova-compute to conductor:

  security_group_get_by_instance()
  security_group_rule_get_by_security_group()

This involved changing the corresponding VirtAPI methods to
accept actual objects instead of IDs, to avoid introducing
additional DB messaging behavior.

Related to blueprint no-db-compute-manager

Change-Id: I14c2bcd181d0e0a1ec17130917c1a7eb0a091cf2
2012-12-15 08:07:51 -08:00