Commit Graph

68 Commits

Author SHA1 Message Date
Matt Riedemann 9f48aee9b0 Remove deprecated monkey_patch config options
These were deprecated in Queens:

  Id793ac2c5cdc5dc473f95eac53b77617a1e389da

And can now be removed.

Change-Id: I27518d1154ec09c57700905bc58ae6a3ce1d8049
2018-05-16 11:40:41 -04:00
naichuans 693ace79fb xenapi: cached images should be cleaned up by time
For xenapi driver, there needs to be some way to delete cached
images based on when they were created. add an optional arg to
control delete operation.

Change-Id: I24fc45e989aa951aab55a261fce77f7e3667d988
Closes-bug: 1481689
2017-10-23 16:29:16 +00:00
Stephen Finucane 21d5dfacb4 tools/xenserver: Remove 'cleanup_sm_locks'
XenServer 6.0 has long since been replaced and the bug was fixed in 6.1
[1]. No need to keep this legacy script around.

[1] https://bugs.launchpad.net/nova/+bug/1103158/comments/1

Change-Id: I8c41e88281aaf4250859622142a2f03f4452e1be
2017-08-07 12:26:53 +00:00
ChangBo Guo(gcb) 6b73c281bc Remove usage of config option verbose
oslo.log deprecate config option verbose since aug 1, 2015 in review:
in https://review.openstack.org/#/c/206437/

That was a long time ago so it should be possible to remove it now. This
was already merged once but had to be reverted because some projects
were still relying on it. Oslo team plan to remove it, so we need clean
up its usage before removing it.

Closes-Bug: #1663570

Change-Id: I072e1078486f50cebea92695ff46c1af879eb23d
2017-02-27 10:02:45 +08:00
Huan Xie 062065ca9e XenAPI Use os-xenapi lib for nova
XenServer has released os-xenapi lib on pypi, this patch is to
use os-xenapi in nova project. In this patch, we only change
the usage of XenAPI to os-xenapi and fix unit tests. In the next
patch, we will delete those unused files.

Partially-Implements: blueprint add-os-xenapi-library

Depends-On: Ic327135b893a77672fd42af919f47f181e932773

Change-Id: I424dfcd507c4b7fbeea5245cc1c234dec01d5781
2017-01-10 17:26:23 -08:00
Cao Xuan Hoang 9a5748de21 Add Apache 2.0 license to source file
As per OpenStack licensing guide lines [1]:
[H102 H103] Newly contributed Source Code should be licensed under
the Apache 2.0 license.
[H104] Files with no code shouldn't contain any license header nor
comments, and must be left completely empty.

[1] http://docs.openstack.org/developer/hacking/#openstack-licensing

Change-Id: I74d25d88ac285c456cbb8874deb000ed782c2192
2016-09-29 11:15:32 +07:00
Luong Anh Tuan b9610fb0a3 Remove locals() for formatting strings.
Following OpenStack Style Guidelines:
http://docs.openstack.org/developer/hacking/#dictionaries-lists

Using locals() for formmatting strings is not clear as using explicit dictionaries
and can hire errors during refactoring.

Change-Id: If3930d62fea166760161eaa3bdf85efca95be121
2016-08-22 17:32:38 +07:00
Chen Fan 17ed8bf929 xenserver: fix an output format error in cleanup_smp_locks
Change-Id: I9b58a1a1128921dd4de07a65b5615d1a0fe3fea9
2016-08-01 10:51:57 +08:00
bhagyashris 046f34290d Fix invalid import order
Made corrections in import order as per OpenStack import standards [1].

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

TrivialFix

Change-Id: Ieb63c7fc5becc68db8d68b3e6847321e77ceeed3
2016-07-04 16:24:10 +05:30
liangjingtao a0f5a56a15 Make print py3 compatible
In PY3,remove the print "", join the print () function to achieve
the same function,this patch is to fix it.

Change-Id: Ie860e912b0c7101fd9d1d5c8373db8688f99122c
Closes-Bug: #1595773
2016-06-25 08:19:27 +00:00
Sujitha 8fc7d30600 Config options: Centralize compute options
This change moves the config options in nova/compute/
manager.py to a central location "nova/conf/compute.py".

Change-Id: Iac75f966571d1224fcd9487b110cb5a4eaa29219
Implements: blueprint centralize-config-options-newton
2016-04-20 19:00:25 +00:00
Anusha Unnam 424ab495e7 Config options: Centralize xenapi driver options
The config options of
"nova/virt/xenapi/driver.py" got moved
to the new central location
"nova/conf/xenserver.py”

Change-Id: I87f6163c7a3b69ef8ede947132b771f32742781e
Implements: blueprint centralize-config-options-newton
2016-04-05 16:34:02 +00:00
Bob Ball a40ee2ce1b XenAPI: Fix race on rotate_xen_guest_logs
There is a race between where Xen creates the domain and starts logging
and when XAPI returns to say that the domain has started.

If the cronjob to rotate the guest logs runs in this period, it can
delete the console logs before we set the last_dom_id which is used to
preserve logs.

This change adds a fixed delay before deleting any log files, allowing
the VM start operation to return after the domain has been successfully
created.

Change-Id: I82ae3e008974f33b60256366f171abf1f0369e60
Closes-Bug: 1535616
2016-01-19 10:15:08 +00:00
Bob Ball 61813e69f7 XenAPI: Fix race in rotate_xen_guest_logs
It's possible that a log file is created while this script is
running, and if being created after we get the valid last_dom_ids
then the log file may be deleted incorrectly.

Also add some logging which can be used to trace any future race
conditions

Change-Id: I1df1a0775a7dae41105d6c41b046c86002eb5eec
Closes-Bug: 1516721
2015-12-17 13:15:16 +00:00
Sulochan Acharya d731a04b60 xapi-tools: fixes cache cleaner script
Fixes cache cleaner script by removing import of
driver and using session directly to call vm_utils.

There is no test included for this. Since this is out of nova
tree, adding tests is tracked in 1481705

Closes-Bug: #1481693

Change-Id: I25ee22777baecaf64de63a39d19e8f8f514f70b3
2015-10-02 10:20:51 +00:00
Bob Ball f985a11bc6 XenAPI: Refactor rotate_xen_guest_logs to avoid races
Moving console logs to a temporary file is a clear race when Nova tries to
access a file it might not be there.

We need to keep the readable file in place at all times.  Atomic operations
like mv are fine as if the file was opened before the mv operation Linux
will keep the contents available until the file is closed by Nova's plugin.

Futher, we need to be able to report the console logs from domains that have
been shutdown but still exist on the host.  Ensure we keep track of the domain
that we last booted with

Change-Id: Icfff9886d79f788be871bf28c8b729a57dcd94d2
Fixes-bug: 1466914
2015-06-26 12:17:38 +01:00
Davanum Srinivas a412e038dd Switch to uuidutils from oslo_utils library
Get rid of our copy of uuidutils.py from oslo-incubator

Change-Id: Idca3581475bcd4a04ce8d3420a1b7763db15b390
2015-02-25 20:05:49 -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
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
Mark McLoughlin 0861fc2d22 Re-work how debugger CLI opts are registered
CLI options must be registered before the command line is parsed or a
cfg.ArgsAlreadyParsedError is raised.

Since commit 2cbea24 we are registering two 'remote_debug' arguments
in nova.service. In commit b506529, we see a hack being added to
ensure that nova.service is imported and the CLI opts registered
before config.parse_args() is called.

To clean this up somewhat, refactor all the elements of this remote
debugger support into nova.debugger. Avoid importing modules at
module import time since we need to import this before monkey
patching. Add a function for registering the CLI options just before
config.parse_args() is called. And fail gracefully if the CLI options
aren't registered when we called debugger.init().

Note that because the options aren't registered at module import time
any more, the config generator doesn't pick them up. However, that's
actually a good thing since this support doesn't work if you enable it
via config files since debugger.enabled() only looks at the command
line.

DocImpact: remote_debug options are not available via the config file,
only via the command line.

Change-Id: I97f747a2fb9222137203657df1d86ba89f3219e2
2014-03-25 06:44:50 -04:00
Philip Schwartz b506529ca2 Fix break in vm_vdi_cleaner after oslo changes.
Added missing imports along with adding a call to config.parser_args as needed
to allow vm_vdi_cleaner to work against current master.

Corrected spelling error in comment.

Change-Id: I4d30d0f7f9718cb29fb8c4c18e9e6fa23f3496ef
Closes-Bug: #1279942
2014-02-14 16:43:50 -05:00
Wu Wenxiang 608a710db5 Remove unused import
Remove unused import in tools/xenserver/destroy_cached_images.py

Change-Id: I5907c99ff702ebe0fc52e9e95c1b0443e20c5c6f
Closes-Bug: #1265264
2014-01-01 11:04:18 +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
Jenkins 7f45bacc53 Merge "xenapi: Fix console rotate script" 2013-07-27 14:57:33 +00: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
Mate Lakat f3af80fea6 xenapi: Fix console rotate script
First time run of the console rotate script failed, due to the fact that
the logs did not exist at that time.

Fixes bug 1204440

Change-Id: I49b5569c1ba3349d911caace42685fa0f19a1f66
2013-07-24 10:43:35 +01:00
Joe Gordon cf34ee9431 Standardize use of nova.db
We already mostly use:
from nova import db
instead of:
import nova.db.api

So change remaining few cases to use nova.db instead of nova.db.api.
Help make code more uniform and easy to work with.

Change-Id: I6183352c4bbe77b88a5b277788f588b0b48c6476
2013-07-01 16:17:20 +02:00
John Garbutt 0af9b83a6b xenapi: script to rotate the guest logs
Xen will produce the guest logs in a specified directory.

This scripts configures the above logging as expected
by the xapi plugin nova uses to read the logs.
In addition it ensures that any log that grows bigger
than 1MB will be truncated down to 5KB.

Ensuring the log directory is inside a loop back device
of a restricted size, and running this script every
minute using cron, will stop guests from using up
too much Dom0 disk space, and taking out the hypervisor

Part of blueprint xenapi-server-log
Change-Id: I4caa82f4d0620d924e37e3b605cf62b4d5b73570
2013-06-19 14:41:43 +00:00
Rick Harris f3843dec21 xenapi: Always set other_config for VDIs
The existing code only set `other_config` on a VDI when it was created using
`create_vdi`. This patch updates the code so that `other_config` is also set
when a VDI is created from a dom0 plugin or during a migration.

Also included is a one-time script to set the other_config for existing
VDIs that were affected by this bug.

Fixes bug 1162029

Change-Id: I4fa856754487f77ce9c8e39d45eee7ea5187123e
2013-05-02 15:38:44 +00:00
Andrew Laski 205bda2cb5 import and install gettext in vm_vdi_cleaner.py
importing some nova modules expects _() to be defined, so lets define it
before we start importing them.

Change-Id: I7f951a24c19a53434c090cd2c01eded77c703943
2013-04-30 18:42:03 -04:00
Kurt Taylor d17f9ab13d Update OpenStack LLC to Foundation
Update all references of "LLC" to "Foundation".

Change-Id: I009e86784ef4dcf38882d64b0eff484576e04efe
2013-02-26 19:15:29 -05: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
Brian Elliott cf51411531 Fix script argument parsing.
The vm_vdi_cleaner.py script's argument parsing was broken and unloved.

Change-Id: I1662534d65fd0e8472e092ed9f10d6cc059f1cab
2013-02-14 19:09:33 +00:00
Jenkins b1a2b077f1 Merge "xenapi: Add cleanup_sm_locks script" 2013-01-23 17:30:55 +00:00
Rick Harris c8f0720511 xenapi: Add cleanup_sm_locks script
XenServer 5.6 and 6.0 don't appear to be cleaning up sm locks when using
a FileSR. When enough locks accumulate, this causes image related
operations to fail.

This cleanup script is a stop-gap solution that can be run against all
of the dom0's in the cluster to prevent too many locks from
accumulating.

We can remove this script when the root-cause is fixed upstream.

References 1103158

Change-Id: I798bcfeb727a59003910b82d331fdbe031c4a2b4
2013-01-22 23:15:54 +00:00
Mark McLoughlin 8d5891e5bc Sync latest cfg from oslo-incubator
The main change is:

  c5984ba Move logging config options into the log module

Re-generate nova.conf.sample to reflect the options move.

Change-Id: I3913ea54465658d93dc56e014dfe5d911b0541d6
2013-01-21 16:57:32 +00:00
Sean Dague 1d350ba537 fix N402 on tools/
fix N402 (single line docstrings should end in a period)

Change-Id: I2086dfb33a6efeb6ef6edc6a326182b6deda2527
2013-01-09 15:47:22 -05:00
Mark McLoughlin 79ac64dd32 Move zombie_instance_updated_at_window option
The zombie_instance_updated_at_window option is only used in
vm_vdi_cleaner so declare it there.

blueprint: scope-config-opts
Change-Id: I8d95fbd858f8afe855c2b559dea6995497d8f682
2012-12-11 08:06:53 +00:00
Brian Lamar ee1b598ef1 Correctly init XenAPIDriver in vm_vdi_cleaner.py
Fixes bug 1088615

Change-Id: Iaf0569fd45ed180d141dc0367c547f014b7502e1
2012-12-10 17:24:47 -05:00
Mark McLoughlin e237c86446 Use CONF.import_opt() for nova.config opts
The only reason for importing nova.config now is where one of the
options defined in that file is needed. Rather than importing
nova.config using an import statement, use CONF.import_opt() so
that it is clear which option we actually require.

In future, we will move many options out of nova.config so many
of these import_opt() calls will either go away or cause a module
other than nova.config to be imported.

Change-Id: I0646efddecdf2530903afd50c1f4364cb1d5dce1
2012-11-20 00:04:49 +00:00
Mark McLoughlin 94d87bce21 Remove nova.config.CONF
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
2012-11-20 00:00:21 +00:00
Mark McLoughlin 6e92a67fc3 Remove nova.flags
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
2012-11-17 16:30:03 +00:00
Mark McLoughlin 637e805634 Switch from FLAGS to CONF in misc modules
Use the global CONF variable instead of FLAGS. This is purely a cleanup
since FLAGS is already just another reference to CONF.

We leave the nova.flags imports until a later cleanup commit since
removing them may cause unpredictable problems due to config options not
being registered.

Change-Id: Ib110ba8d1837780e90b0d3fe13f8e6b68ed15f65
2012-11-04 21:46:35 +00:00
Mark McLoughlin 8ce58defbe Remove flags.DECLARE
The cfg.ConfigOpts class has an equivalent method, so lets use that.

Change-Id: I5860230336d00d7531a0ffd255c766ff77661625
2012-11-04 21:38:38 +00:00
Mark McLoughlin efede80046 Move parse_args to nova.config
The flags module will eventually be removed and this is a first step
towards that.

Change-Id: I729b08900e53e2ae6db10633dcff3be59720fa6f
2012-11-04 21:37:39 +00:00
Rick Harris 4afaf1792d XenAPI: Add script to destroy cached images.
Operations will want the ability to clear out cached images when
disk-space becomes an issue.

This script allows ops to clear out all cached images or just cached
images that aren't in current use.

Change-Id: If87bd10ef3f893c416d2f0615358ba65aef17a2d
2012-08-01 20:49:47 +00:00
Rick Harris 196a4892fc Xen: Add race-condition troubleshooting script.
This stress-test runs builds and migrations concurrently making it
easier to uncovers certain types of race-conditions in the virt-layer
code.

Change-Id: I89c382b85aa6d0eb3dc957803f3ea34e3a36e9d4
2012-07-25 00:32:24 +00:00
Chris Behrens 216467b345 Fixes XenAPI driver import in vm_vdi_cleaner
xenapi/connection.py was renamed xenapi/driver.py, it appears, but
vm_vdi_cleaner was not updated.

Also removed unused optparse import.

Fixes bug 1025912

Change-Id: Ia1a93400dc24455fe91fdf4283eb32bcca4037cf
2012-07-17 21:58:00 +00:00
Johannes Erdfelt 26eb1122a5 Switch to using new config parsing for vm_vdi_cleaner.py
Fixes bug 1018166

Also uses CONF.verbose instead of passing verbose flag everywhere

Change-Id: Ifee832dd087cae8c36b7b7a4f08b2e22ef7f06a3
2012-06-27 15:09:58 +00:00
Johannes Erdfelt 75546dade8 Remove unknown shutdown kwarg in call to vmops._destroy
Fixes bug 1017562

Also, _destroy will now intelligently shutdown the VM first, so need
to do that in vm_vdi_cleaner.py anymore

Change-Id: I8c1e3aa8ecb98ed3c19ab4b8fa072b7fa8e5618f
2012-06-25 15:37:50 +00:00