Commit Graph

46 Commits

Author SHA1 Message Date
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
Chris Behrens 0622868cc5 Refactor vm_vdi_cleaner.py connection use
cleanup_instance() would fail because of using old get_connection().
This refactors everything to use XenAPIDriver().

Fixes bug 1017282

Change-Id: I8822f322bb8f60e5992afbe1feb45c0f4fffc893
2012-06-24 23:08:19 +00:00
Zhongyue Luo 9ff3121bd9 Replaces functions in utils.py with openstack/common/timeutils.py
Fixes bug #1008628

1. Edit openstack-common.conf and import nova/openstack/common/timeutils.py
2. Move time related functions from utils.py to timeutils.py
3. Replace following functions in utils.py with timeutils.py
- isotime
- parse_isotime
- strtime
- parse_strtime
- normalize_time
- is_older_than
- utcnow_ts
- utcnow
- set_time_override
- advance_time_delta
- advance_time_seconds
- clear_time_override
4. Remove datetime related functions and datetime related unittests

Change-Id: I9a92be286fb071b6237dd39495d88dae106e2ce0
2012-06-16 07:17:01 +08:00
Mark McLoughlin 00786bc554 Use cfg's new global CONF object
Implements blueprint cfg-global-object

Replace nova.flags.FLAGS with openstack.common.cfg.CONF.

In future, we can do a s/FLAGS/CONF/ across the codebase.

Change-Id: Ib293873089a5399febd7a3b0410f66e9bef115f1
2012-05-30 21:24:53 +01:00
Brian Waldon 317378f742 Update pep8 dependency to v1.1
The latest release of pep8 adds stricter rules for extraneous
whitespace within lines. This patch also addresses these new
violations acoss the codebase.

Change-Id: Ib7e50281870473df1704ed50868c5c2e26bdb02e
2012-05-24 06:59:05 -07:00
Jenkins 5a9e678cc0 Merge "Modify vm_vdi_cleaner to handle -orig." 2012-05-17 20:36:37 +00:00
Chris Behrens ad5cf3e86b Modify vm_vdi_cleaner to handle -orig.
Also modifies the code to better handle various race conditions.

Fixes bug 1000359

Change-Id: I421b5827330da550810598cfbacc5bb679b477c7
2012-05-16 12:23:33 -05:00
Ghe Rivero 7e3e9b8e9c Remove old flagfile support.
Implements blueprint remove-old-flagfile

nova-manage can still be used to convert old flagfiles style files
to new .ini files:

$ ./bin/nova-manage  config  convert --help
Usage: nova-manage config convert <args> [options]

Options:
  -h, --help        show this help message and exit
  --infile=<path>   old-style flagfile to convert to config
  --outfile=<path>  path for output file. Writes configto stdout if not
                    specified.

Change-Id: Ib8fbbd858b1db7faef70d7d97955e5042bf378f2
Signed-off-by: Ghe Rivero <ghe@debian.org>
2012-05-10 19:17:34 +02:00
Johannes Erdfelt 97f0f80ada Trivial spelling fix
Change-Id: Ib5ba181886a073742ace4a8927061f5d4dcd0773
2012-04-30 15:38:59 +00:00
Johannes Erdfelt b05d1d8982 Use instance_get_by_uuid since we're looking up a UUID
Change-Id: I60869ace0890dcef887a7984e41abd9cf16ea9e3
2012-04-26 16:17:41 +00:00
Johannes Erdfelt 8a8f0712af Use nova_uuid attribute instead of trying to parse out name_label
The name_label parsing code is out-of-date since key support was
added to the format string, but it's not needed anymore since
the internal uuid was added to other-config for a while now.

Change-Id: I2902320ae7118e42cd3d18f2d6d0fab0fcbec687
2012-04-26 15:20:28 +00:00
Johannes Erdfelt 8f9c2bae1e nova.virt.xenapi_conn -> nova.virt.xenapi.connection
This fixes a couple of references that were missed in the recent move

Change-Id: I653b8b85294838a39f9d805bef094938f692e7be
2012-04-19 23:45:35 +00:00
Johannes Erdfelt 6d750971fd xenapi_conn -> xenapi.connection
This keeps all of the XenAPI related code together in one directory,
like libvirt.

Change-Id: I1de51eb8bcead0695e9f8ede466416e0257d0148
2012-04-12 14:41:53 +00:00
Rick Harris e6cf7fc7f4 Add VDI chain cleanup script.
References bug 949477

Change-Id: I819d4ed56675a4ef4e46adca2978b433386e128d
2012-03-09 23:27:48 +00:00
Rick Harris c40ee5cfe7 Add ability to see deleted and active records.
Fixes bug #900564

Changes `Context`.`read_deleted` from a bool to an enum string with values
"yes" (can read deleted records), "no" (cannot read deleted records), and
"only" (can only see deleted records, for backwards compatibility).

Change-Id: Ic81db3664c33f23f751b73973782efb06fce90d9
2011-12-07 16:06:31 -06:00
Josh Kearney cf5f055ebb Further changes to the cleaner.
Change-Id: Ib11fe18a46e57df3498596a2909879d67e84fdda
2011-10-10 15:19:25 -05:00
Josh Kearney 3a4eb1da2f Reference orphaned_instance instead of instance.
Change-Id: I3170f7b67466645d4c410b1d58b3e4e15b9e3265
2011-10-10 12:55:24 -05:00
Josh Kearney d5af7c6d8a Continue to the next iteration of the loop if an instance is not found.
Change-Id: I0342bfd9ec04c2bec25d03ce1200d38a57929bb9
2011-10-10 12:38:12 -05:00
Josh Kearney 04548b067c Adds a script that can automatically delete orphaned VDIs. Also had to move some flags around to avoid circular imports.
Fixes bug 809614.

Change-Id: I635f7eef9ede45bee1ee4a62a3882b55d4222ee3
2011-09-30 12:45:15 -05:00