Replace six.text_type with str.
A subsequent patch will replace other six.text_type.
Change-Id: I23bb9e539d08f5c6202909054c2dd49b6c7a7a0e
Implements: blueprint six-removal
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
When hosts apply config `CONF.force_config_drive=True`, the existing
VMs shouldn't be enforced to must have config drive device. For they
may have been cloud-inited via metadata service, and may not need and
have any config drive device ever. In contrast, the newly being-built
ones should. Instance attr `launched_at` serves as an apparent flag
to distinguish the two kinds of VMs.
When hard reboots happend, existing VMs skip config drive enforcement,
and therefore avoid hitting 'No such file or directory (config drive
device)' error.
Change-Id: I0558ece92f8657c2f6294e07965c619eb7c8dfcf
Closes-Bug: #1827492
As per the other conversions, simply move over to calling
processutils directly instead of via our wrapper.
Change-Id: I61a9b249aae54999f460038e79db0f1f36237b13
blueprint: execs-ive-had-a-few
Add a new filesytem mounting helper in privsep, and then start
moving things across to it. This currently implements mount and
unmount. We get to cleanup some rmdir calls while we're at it
which is nice as well.
I've added an upgrade note mentioning that we no longer ignore
the value of stderr from mount calls, as requesed in code review.
Change-Id: Ib5e585fa4bfb99617cd3ca983674114d323a3cce
blueprint: hurrah-for-privsep
Fixes unit tests related to incomparable types.
Fixes unit tests related to writing / reading bytes in / from files
or response bodies.
Fixes console websocketproxy unit tests.
Fixes consoleauth unit tests.
Fixes db unit tests.
Fixes image unit tests.
Fixes virt/block_devices unit tests.
Fixes virt/configdrive unit tests.
Fixes virt_drivers unit tests.
Fixes xenapi agent, vmops and volume_utils unit tests.
Fixes wsgi unit tests.
Enables some python3 unit tests.
Partially Implements: blueprint goal-python35
Change-Id: Ie98e968740d1015eae3278edeb93d4ba08155169
This change moves all of the configuration options previously defined in
nova/virt/configdrive.py to the new centralized nova/conf directory.
A subsequent patch will then improve the help texts.
Implements blueprint centralize-config-options-newton
Change-Id: Ic3a0f68cb1608ec9c379cf2b9419d5e681777d3f
It is no longer neccessary to directly call the from_instance
class method on ImageMeta. Instead the instance.image_meta
property provides (read-only) access to image properties.
Change-Id: I3af39057127f58ad33ee70dff9ef37b7bf0e30a0
In some modules the global LOG is not used any more. And the import
of logging is not used. This patch removes the unused logging import
and LOG vars.
Change-Id: I28572c325f8c31ff38161010047bba00c5d5b833
The 'force_config_drive' option provides a way to force injection of
configuration drives on instances. Previously, this option supported
three values: 'always', 'True' and 'False'. However, the 'always'
value was deprecated in Liberty and can now be removed.
Remove this value and replace the existing 'StrOpt' with a 'BoolOpt'.
This also requires changing some unit tests to reflect the new value
for this parameter.
UpgradeImpact: This change removes support for the 'always' option.
Configuration files providing this value will need to be updated
accordingly.
DocImpact: This option is now a BoolOpt and documentation will need to
be updated accordingly.
Change-Id: I0b4030ec1336fb1f2e721570c99a27a979e2847c
Reverting this patch due to issues with binary userdata.
This reverts commit 414243ace1.
Change-Id: Idf4048e064aa49423e45297f7a68168a2f5a7646
Closes-Bug: #1504235
ConfigDrive creation fails when writing metadata to file
due to a str to bytes conversion issue.
Change-Id: I4c086007543814a2f2ec3f7ccde9e8f9f2b5937f
Closes-Bug: #1502583
The config drive code checks for a property 'img_config_drive'
in the instance system metadata. Add this property to the
ImageMetaProps object and convert the config drive code to
use the ImageMeta object for accessing it.
Change-Id: Id96af7e6f8429c58a8224c3d32c982a3af7d9cd7
fileutils is graduated in the oslo.utils library.
Remove old implementation of the read_cached_file function
in the nova.utils and move from the fileutils the read_cached_file
and delete_cached_file functions to the nova.utils module and
the unit tests for these functions.
Implements: blueprint graduate-fileutils[1]
[1] https://blueprints.launchpad.net/oslo-incubator/+spec/graduate-fileutils
Depends-On: I51ba9076e1fbc16145ee2311f47b7768c16dcb20 (requirements)
Change-Id: I849f1c74ec811dbe82ba6270569a008a49eab465
This reverts commit def785a23d.
As discussed at the nova liberty mid-cycle, we still have concerns about
how this was implemented. We've also talked through an alternative
implementation (generate the config drive to a directory and then just map
that directory into the container).
I will work on the changes needed on the config drive site to implement
that now, and will help the PCS guys integrate that with their code.
Change-Id: I7106e9bf367e0d392566cf5271ae52fc1595284e
With this change, we're defining new setup methodology
for container based virt (parallels now, and in future LXC too).
In such environments the *host* container technology will be
responsible for mounting the config drive image inside the guest
filesystem. So when the guest image boots, it will see the config
drive data immediately at the location defined by cloud-init.
The only demand for existing images is having cloud-init turned on.
To support config drive in Virtuozzo (former PCS) containers,
we use ploop block device. Actions with ploop device are performed
via ploop CLI tool and newly created device is mounted into
/var/lib/cloud/seed/config_drive on container's filesystem.
This destination recognised by cloud-init as a source of data.
(Ploop device description: https://openvz.org/Ploop)
Co-Authored-By: Maxim Nestratov <mnestratov@parallels.com>
Change-Id: Ib21ab954a08027fb1f2aec13c2d95b5f080eccce
Implements: blueprint config-drive-support-for-virtuozzo
The oslo_config library supports the choices keyword argument. This commit
leverages the use of choices for StrOpts in Nova's configuration.
This change also adds 'ploop' as a valid value for the images_type option.
This was previously a valid value, but not documented.
Closes-Bug: #1423973
Change-Id: I4c0eb1366cc8a1b001fd403b67c3eec11f831541
In the case the config drive setting are overridden by either
image properties or the configuration setting then these are updated
on the instance to actually reflect the running VM configuration.
The patch creates a common method for updating instance details
after spawn.
Change-Id: Ia5e36989a7b7543fa77c7c196919f8566e02d28a
Closes-bug: #1403889
The supported values are 'always', 'True' and 'False'. Update the
help text to support this.
DocImpact
UpgradeImpact
NOTE: the 'always' option will be deprecated in Liberty.
Change-Id: Ib3de8402addb4657f4f6ede35792aab0b1498ff8
Partial-bug: #1403889
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
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
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
Change-Id: I913077d3b0fdee78e423c35b3a48137a17946a7b
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
Currently Nova decides the config_drive based on user input and compute
node configuration. We should also consider the image requirement for
config drive.
Implements: blueprint config-drive-image-property
DocImpact:
An new image metadata support added.
Change-Id: Ica32fb078d5440dbcf1251175585d34af9549815
Both H305 and H307 are part of the OpenStack style guide.
Ensure that there are 3 groups of imports, stdlib,
third-party and project specific. Within each category
ensure that imports are in alphabetical order.
Change-Id: Id4994551c135c3c1a4982153f0c6cacba6176b95
In looking to clean up excessive DEBUG logging, it became clear
that the logging in ConfigDriveBuilder was largely based on the
split logic that existed in doing fs opts in __init__ and then
also later in make_drive. This required a persistent tempdir, which
had to be manually cleaned up. It also meant a mandatory additional
config variable.
Refactor ConfigDriveBuilder to move all fs opts into make_drive,
deprecating the config variable in the process. In doing so, I don't
believe the previous debug logging is useful any more. However, in
case, add a __repr__ for ConfigDriveBuilder that will provide us with
a reasonable debug representation in case this becomes part of what
gets thrown.
Tests are now adjusted to not call private methods, but instead call
make_drive with config variable set.
Change-Id: I1aaf194fef00edd6eecf73b5bb9323e0e3a6f09f
The force_config_drive help clearly states that only possible option is
'always' but folks are setting it to 'True'/'False' etc and expecting
it to work. So let's enable that as well. In the worst case scenario
mentioned in the bug, it was set to 'False' and since the check for
force_config_drive took any string as true, we were enabling the flag
to true. With the change in this review, we force a conversion of the
string to true. Additional check for the flag to be set as 'always' is
treated as true as well. The test case checks for all the variations
Closes-Bug: #1319180
DocImpact
Change-Id: Ifa6348fa7dfd9de063eb13d30e3ddf94fa530b57
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
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
Module units landed in Nova first, then was accepted by oslo with
minor changes. This patch removes nova specific unit module and
test, replaces with module units in oslo.
commit in Oslo:'Add unit constants' f9308560c36918cc
Change-Id: I6054c18a56f59d33a69f4714be19d34fbe9de335
Co-Authored-By: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@cloudwatt.com>
Files must be written specifying "wb" instead of "w"
to support binary files on both Windows and Linux.
Change-Id: I069845136df4a11b54c931a71575ca3efb9bc6d0
Closes-Bug: #1261585
Replace numeric expressions with constants in nova/virt
to make code more readable.
Implements: blueprint byte-unit-clean
Change-Id: I71aba00ac3c33931082cf0402e4b68764caa0212
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
image_href support has not been working since at least shortly before
Folsom release. This is a good indication that this functionality is not
used. As far as I can tell, the docs also do not match what was
supported. An image ID was required, but docs show examples with full
hrefs.
DocImpact
http://docs.openstack.org/developer/nova/api_ext/ext_config_drive.html
References to supporting image_hrefs should be removed.
This patch also removes the hack that passed a config_drive_id via
the Instance dictionary when config_drive_id is not a valid Column for
Instance.
Fixes bug 1186401
Change-Id: Iced7bc8e278cb9f208183f1dbb7a293675a47eae
The following functions have moved to oslo.
remove_path_on_error
file_open
delete_if_exists
Replaced/removed overlapping functions with the ones in fileutils
Change-Id: I41a19d76a777b6f899843bb0cc0582630accbd5c
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
This is a little bit less awkward than the previous implementation,
and is based on a suggestion from Padraig Brady.
Change-Id: If8b09a41d21777a4bd56af16e1f7e02d61d1dd4e
This version implements a configdrive v2 for xenapi as discussed
in the xenapi IRC meetings.
- the config drive is now iso9660
- the admin password is injected (if we know it)
- vbd's are not reused
- review comments have been addressed
Progresses blueprint xenapi-config-drive. DocImpact.
(Dear documentation people, if using config drive with xenapi,
the user should consider disabling the agent as well with
xenapi_disable_agent. This mostly depends on if they want to
support post-boot password updates still.)
Change-Id: Ib23d117ad4cd5dc92298a0812eb468f7d557417c
Instead of hardcoding 'OpenStack nova' for the publisher
when building ISO images, use version.product_string().
Also append the package version suffix, if any.
Change-Id: If3dfbf895ef7037e15dd3ff8da8f47daecb4d24a
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
There's not a lot we can do here, the instance is invalid. However,
the better log message will hopefully make this easier for operators
to diagnose.
Partially addresses bug 872489.
Change-Id: Ib650cb114e57956bfe911370dd52aa4fdd4adc78
Modules import nova.config for two reasons right now - firstly, to
reference nova.config.CONF and, secondly, if they use one of the
options defined in nova.config.
Often modules import nova.openstack.common.cfg and nova.config
which is a bit pointless since they could just use cfg.CONF if
they just want to nova.config in order to reference CONF.
Let's just use cfg.CONF everywhere and we can explicitly state
where we actually require options defined in nova.config.
Change-Id: Ie4184a74e3e78c99658becb18dce1c2087e450bb
Now that options have all moved from nova.flags to nova.config, we can
safely remove the nova.flags imports and replace them with nova.config
imports.
Change-Id: Ic077a72dd6419bbf1e1babe71acfa43c4e8b55c8