65 Commits

Author SHA1 Message Date
Sean Mooney
f3d48000b1 Add autopep8 to tox and pre-commit
autopep8 is a code formating tool that makes python code pep8
compliant without changing everything. Unlike black it will
not radically change all code and the primary change to the
existing codebase is adding a new line after class level doc strings.

This change adds a new tox autopep8 env to manually run it on your
code before you submit a patch, it also adds autopep8 to pre-commit
so if you use pre-commit it will do it for you automatically.

This change runs autopep8 in diff mode with --exit-code in the pep8
tox env so it will fail if autopep8 would modify your code if run
in in-place mode. This allows use to gate on autopep8 not modifying
patches that are submited. This will ensure authorship of patches is
maintianed.

The intent of this change is to save the large amount of time we spend
on ensuring style guidlines are followed automatically to make it
simpler for both new and old contibutors to work on nova and save
time and effort for all involved.

Change-Id: Idd618d634cc70ae8d58fab32f322e75bfabefb9d
2021-11-08 12:37:27 +00:00
Stephen Finucane
bab3c8f3cb Remove references to 'sys.version_info'
We support Python 3.6 as a minimum now, making these checks no-ops.

Change-Id: I5ca2439c948687022f8d88df978bc7ee77199fcc
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-04-21 12:02:27 +01:00
Stephen Finucane
4f1b879a68 docs: Change 'add_stylesheet' to 'add_css_file'
We're seeing a warning in our docs build:

  nova/doc/ext/feature_matrix.py:578: RemovedInSphinx40Warning: The
  app.add_stylesheet() is deprecated. Please use app.add_css_file()
  instead.

Do as it says. This deprecation happened in Sphinx v1.8.0 [1] so there's
no need to bump our minimum version.

[1] https://github.com/sphinx-doc/sphinx/commit/3afc72fba4

Change-Id: I75d7b2e1a6771ebdb05972e29033505391587512
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-03-18 17:31:35 +00:00
Stephen Finucane
f4c249c692 docs: Document UEFI secure boot feature
Introduce two new guides on UEFI and Secure Boot. In addition, update
the flavors guide to document the secure boot feature (though this doc
should really be removed in near term in favour of the auto-generated
docs, as noted inline).

Note that this change includes our first use of the ':nova:extra-spec:'
cross-reference role and highlights a small bug in that implementation.
This is resolved.

Blueprint: allow-secure-boot-for-qemu-kvm-guests
Change-Id: I4eb370b87ba8d0403c8c0ef038a909313a48d1d6
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-03-12 17:42:02 +00:00
Stephen Finucane
7062e1db8b tox: Enable parallel docs build
This significantly speeds up our doc build process. This requires a
newer version of 'sphinx-feature-classification' and some tweaks to our
own in-tree extensions. While we're here, we drop the '-d DOCTREE_DIR'
parameter since it's of no use when we blast away our previously built
docs each time we build.

Change-Id: I679da65d44c40880f720df8a2f06286a19eb8d22
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-01-27 16:46:21 +00:00
Takashi Natsume
1d0a0e8c20 Remove six.moves
Replace the following items with Python 3 style code.

- six.moves.configparser
- six.moves.StringIO
- six.moves.cStringIO
- six.moves.urllib
- six.moves.builtins
- six.moves.range
- six.moves.xmlrpc_client
- six.moves.http_client
- six.moves.http_cookies
- six.moves.queue
- six.moves.zip
- six.moves.reload_module
- six.StringIO
- six.BytesIO

Subsequent patches will replace other six usages.

Change-Id: Ib2c406327fef2fb4868d8050fc476a7d17706e23
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
2020-11-07 03:25:02 +00:00
Stephen Finucane
8a2ed8a78e docs: Resolve issue with deprecated extra specs
The warning directive should look like so:

  .. warning::

      Some text here.

However, we weren't indenting the body correctly, meaning the directive
appeared to have no content. Resolve this.

Change-Id: Ib93cbd7c5ba64e678393554ba77f568efdb2608a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-05-08 10:15:26 +01:00
Stephen Finucane
63e30e022d docs: Add documentation for flavor extra specs
Now that we have a registry of all extra specs known by stock nova, we
can start documenting these. We choose the configuration guide to do
this since configuration of flavor extra specs is traditionally an
admin-only operation.

Part of blueprint flavor-extra-spec-validators

Change-Id: I5ad6576e0d31a29822d1c7b47751ea81828630cf
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-04-08 13:20:15 +00:00
Matt Riedemann
d50efc337c Add notification sample test for aggregate.cache_images.start|end
This adds the functional notification sample test for the
aggregate.cache_images.start and aggregate.cache_images.end
versioned notifications.

I also added a comment to the docs builder code since it took
me a bit to figure out how to get the notification sample
linked into the docs, and for whatever reason figured that out
by looking through code rather than our nicely detailed docs
that already explain it.

Part of blueprint image-precache-support

Change-Id: I0869979a1b8a0966f0e7b49e5a5984f76d7d67cd
2019-10-25 10:38:19 -07:00
Mike Perez
c09fe87feb Replace support matrix ext with common library
The code to generate a support matrix has been pulled into a common
library. Using this instead of duplicating code in various projects that
need it.

Change-Id: If5c0bf2b0dcd7dbb7d316139ecb62a936fd15439
Co-Authored-By: Stephen Finucane <stephenfin@redhat.com>
2018-07-16 15:04:00 +01:00
Takashi NATSUME
54d3e7096c Fix missing versioned notification examples
Python 3 is used in executing 'tox -e docs' by default currently.
When Python 3 is used, there are some missing notification examples.

In python 3, map function returns an iterator instead of a list,
and importlib.import_module is not executed in the document generation.
So it causes missing versioned notification examples in the nova docs.

This patch fixes it.

Change-Id: Ie4f3f9be0ca7f94ce00a14f3d825a067a807eb12
Closes-Bug: #1779606
2018-07-02 14:43:49 +09:00
Thomas Goirand
8ca01a3abb Python 3 fix for sphinx doc
In Python 3, dict methods dict.keys() return “views” instead of lists.
Therefore, the code:

    impls = sorted(matrix.targets.keys())
    impls.sort()

should be replaced by:

    impls = sorted(matrix.targets.keys())

to be Python 3 compatible.

Change-Id: I50477b0ac43adff9e9b0220bd7c48d6ebb6471b3
2018-02-15 14:26:45 +01:00
Balazs Gibizer
ff4f58fcd2 Fix the usage of instance.snapshot notification sample
The instance.snapshot.start and .end notification sample file was
attached to two different Notification ovo by mistake. This caused that
the samples are appeared in the notification dev-ref twice.

This patch removes the duplication and adds a simple check to the doc
generation code to detech such problems in the future.

Change-Id: I8478c134f9cdb08c02a44e1838dbacede5523914
Closes-Bug: #1732685
2017-11-21 11:03:52 +00:00
Balazs Gibizer
5a5155ea4e Factor out duplicated notification sample data
Versioned notifications are functionally tested against stored sample
data. Also most of the instance notitication shares payload structure.
Today we store a separate sample for every instance notification.
These samples store similar, mostly redundant data. When a new field
is added to the InstancePayload then every instance notification
related sample file needs to be modified. This leads to big and
redundant changes like I18af99479562e2fe5e74e6e1252b804b074fee58.

To remove the redundancy this patch proposes to use json references
in the sample files instead of copy pasting the same notification
sample fragment to every sample.

As a first step this patch introduces a small json ref resolver.
Then subsequent patches will replace the duplicated sample data
with references to common sample fragments.

This proposed resolver supports resolving the refs recursively so
a referenced json fragment can reference further fragments. However
the current implementation does not handle reference loops.
The resolver also supports overriding parts of the referenced
json fragment to support content customization needed in the next
patch.

Change-Id: Ic3ab7d60e4ac12b767fe70bef97b327545a86e74
2017-11-03 11:36:57 +01:00
Jenkins
c57bfdfed1 Merge "doc: Remove deprecated call to sphinx.util.compat" 2017-09-06 18:14:40 +00:00
Balazs Gibizer
0499b28051 doc: fix show-hide sample in notification devref
The new doc template includes jquery too late and therefore showing
and hindig notification samples and auto hiding them by default doesn't
work.

This patch loads the jquery lib earlier for the notification devref.

Closes-Bug: #1713974
Closes-Bug: #1714363
Change-Id: I07db4755c69d493e591761578d1077bb44acda41
2017-09-01 12:39:01 +02:00
Stephen Finucane
46a5569fb1 doc: Remove deprecated call to sphinx.util.compat
This call generates the following deprecation warning:

  RemovedInSphinx17Warning: sphinx.util.compat.Directive is deprecated
  and will be removed in Sphinx 1.7, please use docutils' instead.

Resolve this.

Change-Id: I73a182248a64d1e931a1bcb3989aa96f0aec71ed
2017-08-29 15:12:10 +01:00
Stephen Finucane
62ccbe1c3f doc: Enable pep8 on doc generation code
As pep8 does not run on doc generation python code so we have some
style violations there. As it not too hard to fix the problems and
therefore enable pep8 on these files this patch proposes such a
change.

Change-Id: I26104ea66fc4f3e67f8227025f43202e483beb25
2017-07-12 14:20:25 +01:00
Stephen Finucane
6671ddc832 doc: Remove dead plugin
Whatever extra functionality the 'nova.ext.nova_todo' plugin provided
over the stock 'sphinx.ext.todo' extension, we're no longer using it and
it prevents us from using the stock one. Remove it and enable the stock
one instead.

Change-Id: I57fde86bf77dad87bb4d41ef8ad19f933f5c1260
2017-07-12 14:05:14 +01:00
Matt Riedemann
9269d35ea8 Fix error message when support matrix entry is missing a driver
This was noticed in change If10cffd0dc4c9879f6754ce39bee5fae1d04f474
which was missing the powervm driver target for the extend-volume entry.

Before this change, the error message was:

  'libvirt-vz-ct' missing in '[operation.extend-volume]' section

This was really confusing because that driver is in the change. What
was missing was powervm, but because the error message is using the
wrong key that was not showing up.

Change-Id: I2e7ea49d5ba42cc633796222af47c1d4cd59f96b
Closes-Bug: #1702542
2017-07-05 15:15:50 -04:00
Balazs Gibizer
5a35a2b99e add missing notification samples to dev ref
The already transformed aggregate notifications were missing from the
notification dev-ref due to a missing import in the doc generation code.

This patch improves the doc generation to automatically pick up new modules
added under nova.notitications.objects.

Change-Id: I688bc59f19814956d73e04b4970add21ce64ba90
Closes-Bug: #1698779
2017-06-19 13:46:47 +02:00
Béla Vancsics
ad56be6d22 Transform keypair.create notification
The keypair.create.start and keypair.create.end notifications
has been transformed to the versioned notification framework.

Change-Id: I71e9d8dae55653ad3ee70f708a6d92c98ed20c1c
Implements: bp versioned-notification-transformation-pike
2017-06-14 07:28:47 +02:00
Jenkins
6f3338612d Merge "Removes unnecessary utf-8 encoding" 2017-02-03 06:00:47 +00:00
liyingjun
8d9b3d6b9d Notifications for flavor operations
This patch implements the versioned notifications for flavor
create and destroy.

Implement blueprint: flavor-notifications

Change-Id: Icc2169b87ffba4e7e2079076a82029156c584c6a
2017-01-09 20:39:58 +08:00
Cao Xuan Hoang
d99fd590b0 Removes unnecessary utf-8 encoding
trivialfix

Change-Id: I1294ecb5e85c9bf70a23992e92eeccfd35362551
2016-12-20 10:27:01 +07:00
Balazs Gibizer
b8897aba72 Fix notification doc generator
The doc generator only picked up the event types related to instance
actions because the doc generator looked up the registered notification
classes only. Until now, only the instance related notifications were
imported in the doc generation environment so the other notification
classes were not registered.

This commit explicitly imports the modules that defines the notification
classes to make the doc complete.

Change-Id: I269e05ddb62ec6c6cc7f7922c1344186ccf850d1
Closes-bug: #1640818
2016-11-24 13:25:54 +00:00
Jenkins
6961ac9972 Merge "Fix invalid import order and remove import *" 2016-10-11 14:50:50 +00:00
ChangBo Guo(gcb)
f8c1ee3950 Fix SafeConfigParser DeprecationWarning in Python 3.2
SafeConfigParser is deprecated in Python 3.2 and log warning
like " DeprecationWarning: The SafeConfigParser class has
been renamed to ConfigParser in Python 3.2. This alias will be
removed in future versions. Use ConfigParser directly instead."
So use ConfigParser in Python 3.2+.

Closes-Bug: #1618666
Change-Id: I225bde35b18bd410f3fe9d415759d1def0a91aca
2016-09-12 13:04:38 +08:00
TuanLAF
dce1f7160c Fix invalid import order and remove import *
- Remove import * follow [H303] do not use wildcard * import [1]
- Made corrections in import order as per OpenStack import order template [1]
	{{stdlib imports in human alphabetical order}}
	\n
	{{third-party lib imports in human alphabetical order}}
	\n
	{{project imports in human alphabetical order}}
	\n
	\n
	{{begin your code}}

[1] http://docs.openstack.org/developer/hacking/#import-order-template

Change-Id: I3eded1b4bdc10d2a2bb36d41a1f9b5fd8ab2893a
2016-07-20 10:12:01 +07:00
Balazs Gibizer
8279b1ea2e Handle multiple samples per versioned notification
The notification_sample decorator is changed to handle
attaching multiple sample files to a notification object.

Change-Id: I4c3df17d93282f6946221da65d26d0ca3194d3df
2016-06-21 09:39:54 +02:00
Balazs Gibizer
520ee65a55 Do not register notification objects
Only registering the notification objects during unit test.
Notification objects are never used in the Nova RPC interface
and shall not be mixed with such objects.

Change-Id: Iba9079bb204e6ef1302529ac159199ab9fa6272b
2016-06-08 11:32:53 +02:00
Balazs Gibizer
5e074a59d2 Move notification related code to separate package
To be able to separate the versioned notification related
object model from the nova internal object model a new
nova.notification.object package is introduced.

As nova had nova/notifications.py already in the tree
the code from that file is moved into the new nova.notification
package as a first step.

Implements: bp versioned-notification-transformation-newton
Change-Id: I315f548180c260c22a2ebcf7b7cb56d284b6e580
2016-06-08 11:32:53 +02:00
Andrey Volkov
9053a4685b Make available to build docs with python3
On Ubuntu 16.04 a tox package is for python3 by default
and this causes errors in building docs in tox enviroment.

In these changes iterators are replaced with lists where it's needed.
Also external command calls result are decoded from bytes to unicode.

Change-Id: I88ef54405b4bc13c269bdda55ae8289676311ee1
2016-05-23 15:30:20 +03:00
Jenkins
3c40b0a9fb Merge "Add prototype feature classification matrix" 2016-08-18 13:22:34 +00:00
Balazs Gibizer
e5798f9f9d Enhance notification doc generation with samples
Until now the notification devref only contained a link to the sample file
and that link did only exist after the sample file was merged.
This is suboptimal as the locally generated doc might be incomplete.

This patch changes the doc to contain the content of the sample file.

Change-Id: I4343a2feb13de8b614e8d42d5f1db14102ab492e
2016-07-20 17:33:32 +00:00
John Garbutt
027b92dc4e Add prototype feature classification matrix
Add in feature_classification.ini that makes use of new sphinx
extension feature_matrix. While it is loosely based on the
support_matrix extension, longer term this extension will live
outside the Nova tree. As such, this has been created as a new
separate sphinx plugin.

The matrix has links to wiki page for the CI in the header of the
summary matrix. This is called a target.

Also, there are links to admin docs, API docs, and tempest test uuids
added into the feature details. An option is added to ensure these are
always present in the prototype matrix.

A maturity status is added to be clear about the level of maturity
of each feature. When in maturity mode, this is added into the summary
table in place of the status. There is also some formating for the
different maturity levels.

blueprint feature-classification

Change-Id: Ib5895e8de901f1a282d0f5c0ecb811ff8b451497
2016-07-18 18:31:03 +00:00
Jenkins
ab4a5f8a55 Merge "Refactor _load_support_matrix" 2016-02-02 15:05:49 +00:00
Jenkins
e5256c32a7 Merge "Add argument to support-matrix sphinx extension" 2016-02-01 14:36:10 +00:00
Balazs Gibizer
05adc8d006 Generate doc for versioned notifications
This commit adds a new sphinx extension that inspects the nova code
and adds information about the existing versioned notifications to
the nofitications devref. This way the devref is automatically kept
up to date with relevant information.

Partially-Implements: bp versioned-notification-api
Change-Id: If65d5d81e26cb2b4a9f57a8c7d37d3de310ebe00
2016-01-28 15:33:06 +01:00
John Garbutt
fbbe1cf316 Refactor _load_support_matrix
In the Sphinx extension, split up the _load_support_matrix method, so
its easier to understand the additions for the feature_classification
table.

Change-Id: Ic3654017f63dda2c2505057b0063acbc6d5f83c2
2016-01-07 11:18:51 +00:00
John Garbutt
b583604f05 Add argument to support-matrix sphinx extension
Make it easier to add additional support-matrix entries by making the
filename of the ini file a required argument of the directive.

As a side effect, its clearer in the rst file where the data is stored.

Change-Id: I05bd30b64152368b53c030a32754d0ed4a35bf88
2016-01-06 11:32:30 +00:00
En
313f60778f formely is not correct
message:
I change "formely" to "formerly".

Change-Id: I77366aa1d84c31e5ffdfaa0a5fd5c99a77e3a19c
Closes-Bug: #1481271
2015-08-04 17:58:16 +08:00
Maxim Nestratov
bc3b6cca47 libvirt: rename parallels driver to virtuozzo
As Parallels Cloud Server product was renamed within Parallels company rebranding
we need to change its reference in feature support matrix and documents accordingly.
A parameter 'virt_type' in libvirt section of nova.conf will remain 'parallels'.

Since libvirt version that supports 'vz' starts to report it as a hypervisor type,
we add a new hv_type 'vz' in the list of known hypervisors.

DocImpact.

Change-Id: I536e4284927508a813edd05f185f7ba0ed76d38c
implements: blueprint rename-pcs-to-virtuozzo
2015-07-29 18:40:12 +03:00
Markus Zoeller
6a6059a9a6 hypervisor support matrix: add CLI commands to features
Some features could be made clearer if the CLI commands which are
related to that feature are listed. This patch set allows to set
CLI commands per feature.
This is an interim solution until the new feature classification
system is established.

Change-Id: If599627187080a8349811f50f6561e9efbc35138
2015-06-26 08:11:18 +00:00
Markus Zoeller
36f7451c33 hypervisor support matrix: add status "unknown"
When a new feature gets added to the hypervisor support matrix it
was not possible to state that the hypervisor did not make a support
statement yet. You had to choose between "complete", "partial" and
"missing" wich could be missleading.
This change set adds the status "unknown" which could make the
statements more precise.

Change-Id: If94fc772796742de88af5893839945834b9d3eb6
2015-06-15 10:18:37 +02:00
Jenkins
2108a66572 Merge "Use six.moves.range for Python 3" 2015-05-22 18:04:43 +00:00
Jenkins
98f7e8dae3 Merge "Replace unicode with six.text_type" 2015-05-21 00:47:36 +00:00
Victor Stinner
b259659a22 Use six.moves.range for Python 3
The function xrange() was renamed to range() in Python 3.

Use "from six.moves import range" to get xrange() on Python 2 and range() on
Python 3 as the name "range", and replace "xrange()" with "range()".

The import is omitted for small ranges (1024 items or less).

This patch was generated by the following tool (revision 0c1d096b3903)
with the "xrange" operation:
https://bitbucket.org/haypo/misc/src/tip/python/sixer.py

Manual change:

* Replace range(n) with list(range(n)) in a loop of
  nova/virt/libvirt/driver.py which uses list.pop()

Blueprint nova-python3
Change-Id: Iceda35cace04cc8ddc6adbd59df4613b22b39793
2015-05-20 15:19:51 -07:00
Victor Stinner
67eedf4fa0 Replace unicode with six.text_type
The Unicode type is 'unicode' in Python 2 and 'str' on Python 3: replace
unicode with six.text_type to make Nova compatible with Python 2 and
Python 3.

This patch was generated by the following tool (revision e760664379c3) with the
operation "unicode":
https://bitbucket.org/haypo/misc/src/tip/python/sixer.py

Manual change:

* Replace "isinstance(value, str) or isinstance(value, unicode)"
  with "isinstance(value, six.string_types)" in nova/api/ec2/ec2utils.py

* Revert changes in strings in:

  - nova/compute/api.py
  - nova/hacking/checks.py
  - nova/tests/unit/api/openstack/test_wsgi.py
  - nova/utils.py

* Revert changes in nova/tests/unit/test_hacking.py: tests must use
  "unicode()". The nova.hacking module will probably need other changes
  to support Python 3.

* Reformat nova/tests/unit/objects/test_instance_action.py and
  nova/tests/unit/virt/hyperv/test_hypervapi.py to 80 columns

Blueprint nova-python3
Change-Id: I7ced236b6f8f8b6a5d2e7fee3c4f0ba4d72c21fb
2015-05-12 12:31:20 +02:00
Markus Zoeller
dcc2cc40a6 Hypervisor Support Matrix renders links in notes
The sphinx-extension which renders the support_matrix.ini file into
HTML did not recognize URLs in the notes which have to be written as
an HTML anchor element. This commit changes that. The links are
clickable now.

Closes-Bug: 1451468

Change-Id: Ia05610afb32c7a86536b7f462d3cfc44f9a2ca7d
2015-05-12 11:02:20 +02:00