Commit Graph

20 Commits

Author SHA1 Message Date
Surya Seetharaman f44700935f Include removal of ephemeral backing files in the image cache manager
If CONF.image_cache.remove_unused_base_images is True, the base and
swap files are removed during the image cache manager's periodic
task while the ephemeral backing files are never deleted. This is a
long standing bug and this patch proposes to remove the ephemeral
backing files in the same way as for the swap files.

Change-Id: Ibf722265a4450fb81d40dee635667e39bc5b3edc
Closes-bug: #1602193
2020-10-09 12:24:06 +01:00
Balazs Gibizer 89fe504abf Reserve DISK_GB resource for the image cache
If the nova compute image cache is on the same disk as the instance
directory then the images in the cache will consume the same disk
resource as the nova instances which can lead to disk overallocation.

This patch adds a new config option
[workarounds]/reserve_disk_resource_for_image_cache . If it is set the
libvirt driver will reserve DISK_GB resources in placement for the
actual size of the image cache.

This is a low complexity solution with known limitations:
* Reservation is updated long after the image is downloaded
* This code allows the reservation to push the provider into negative
available resource if the reservation + allocations exceed the total
inventory.

Change-Id: If874f018ea996587e178219569c2903c2ee923cf
Closes-Bug: #1878024
2020-05-19 17:47:50 +02:00
Eric Fried 828e8047e5 Consolidate [image_cache] conf options
Blueprint image-precache-support added a conf section called
[image_cache], so it makes sense to move all the existing image
cache-related conf options into it.

Old:
[DEFAULT]image_cache_manager_interval
[DEFAULT]image_cache_subdirectory_name
[DEFAULT]remove_unused_base_images
[DEFAULT]remove_unused_original_minimum_age_seconds
[libvirt]remove_unused_resized_minimum_age_seconds

New:
[image_cache]manager_interval
[image_cache]subdirectory_name
[image_cache]remove_unused_base_images
[image_cache]remove_unused_original_minimum_age_seconds
[image_cache]remove_unused_resized_minimum_age_seconds

Change-Id: I3c49825ac0d70152b6c8ee4c8ca01546265f4b80
Partial-Bug: #1847302
2019-11-13 11:09:03 -06:00
Matthew Booth cb15d34cc1 Rename ImageCacheManager._list_base_images to _scan_base_images
The method's return value is never used, only its side-effects are
used. We rename it to reflect its actual usage, and remove the unused
return value to avoid confusion.

NOTE(mdbooth): The use of global state is a large part of what makes
ImageCacheManager hard to read. I don't mean to imply with this change
that's what should be done here, only to make it clearer to the reader
that it is what's being done currently.

Change-Id: Ic82f6d4f00fd1226673750538019339937a623bc
2016-05-26 14:45:42 +01:00
Matthew Booth d661db6a99 Remove all references to image_popularity from image cache
Nothing ever reads it.

Change-Id: Ieeb068b992263cf0208c2d8dc3a8d6f0683bf18c
2016-05-26 14:44:51 +01: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
Stephen Finucane 1154923f8e config options: Centralise 'virt.imagecache' options
Add options from 'virt.imagecache'. 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: I0e683c08b0479e41487c6b05de7d588f5d88ad0e
Implements: bp centralize-config-options-newton
2016-03-30 12:47:53 +01:00
Hans Lindgren 990eafe4c4 Reduce number of db calls during image cache manager periodic task
Make a single db call to get bdms for all instances instead of one
call per instance.

Change-Id: I74864b398f2d17a24b9ed676945183401e9872a0
Closes-Bug: #1484847
2016-03-28 10:57:56 +02: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
jichenjc 7252839c9e image cache clean-up to clean swap disk
Currently swap backing files are never removed from the system.
The image clean-up code should recognise at least obsolete unused files
need to be removed.

Change-Id: I09519a73c7233f2dc6f46f6cd094a3e1cc3dc395
Partial-Bug: 1253991a
2014-11-11 15:27:40 +08:00
Matthew Gilliard 324d951667 Remove warning & change @periodic_task behaviour
During development of Juno, Ia227f4c4e69ecf361ab02d1d17a3010303650104
added a warning that the behaviour of periodic_tasks with an interval of
0 would change.  This patch changes the behaviour and removes the
warning.

Oslo (which provides the @periodic_task decorator) uses spacing=0 to
mean "run at the default interval of 60s", but several nova methods used
spacing=0 to mean "don't run".  These methods now behave consistently
with the Oslo code.

Due to an error in the original patch, some of the warnings refer to the
intended behaviour change as being in "the K release", and some to "Juno".
The warning about changing behaviour is first present in Juno, so this
patch should be merged in Kilo.

Change-Id: Ie5f2092a3b84e3674fe6a68ce511d2dc218bb625
Closes-bug: 1276203
2014-10-29 10:01:55 +00:00
Gary Kotton 23340b49b1 Image caching: update image caching to use objects
Commit 1023e703bd added support
for objects. This patch ensures that the parsing of the instances
is correct.

The patch does the following:
1. In the method _list_running_instances it treats all instances
   as an object
2. Fixes the bug mentioned below. The code was making a string from
   None. This would lead to invalid image details.
3. Ensures that the unit tests actually pass instance objects instead
   of an instance dict
4. In relevant tests updates assertEquals to have the expected parameter
   first

Closes-bug: #1354664

Change-Id: Ib028baab4d4c823f22c371a83f7a813c24d77570
2014-08-15 08:03:10 -07:00
Jenkins 77bad25209 Merge "Remove deprecated config option names: Juno Edition" 2014-06-15 01:56:54 +00:00
Jenkins 2590c5b985 Merge "Add warning to periodic_task with interval 0" 2014-05-01 22:19:56 +00:00
Alex Gaynor b055e16846 Fixed many typos.
These were found using: https://github.com/intgr/topy

Change-Id: Ia4e14508c285d95ab4eaeabbde032ecc5e7c9e4b
2014-04-25 21:47:41 -07:00
Matthew Gilliard 2bfc7171c2 Add warning to periodic_task with interval 0
The behaviour of Oslo's @periodic_task decorator is that
a repeat interval of 0 means that the method will be
called regularly.  Several Nova methods which use that
decorator also have code for returning early (ie no-op)
if the interval is 0.  This is inconsistent for users, and
means there is timing-related code where it doesn't belong.

This patch adds a warning when a user takes a value of 0
from config and uses it as an interval in a @periodic_task.

Ideally all code will use Oslo's convention that 0 means
run at the default rate and a negative interval will mean
"don't run".  After this warning has been in place for a full
release cycle that can be the case.

Change-Id: Ia227f4c4e69ecf361ab02d1d17a3010303650104
DocImpact: Warns of upcoming change to behaviour when
           *_interval is set to 0
Closes-Bug: #1272830
Partial-Bug: #1276203
2014-04-25 17:28:51 +01:00
Joe Gordon d0a02fa390 Remove deprecated config option names: Juno Edition
Just like the beginning of every other release, remove the deprecated
config option aliases that were marked as deprecated in Icehouse.

Equivalent Icehouse patch: I64548e40f6cea42275a6f0f3ebdc0c4cd9324804

DocImpact: Configurations that were deprecated in the Icehouse release are not
recognized in Juno.

Change-Id: I346ee0248c03e60716bd7dc4a5ee4493610867cb
2014-04-17 15:35:59 -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
Gary Kotton 312a0a6fd2 Imagecache: fix docstring
Original docstring had incorrect information. That is,
the method did not return None.

Change-Id: I7519259b99e21e24723c566e8e7d04e32e0d2c07
2013-12-24 01:27:46 -08:00
Gary Kotton 6e6b4ad411 Image cache: move all of the variables to a common place
In addition to this it creates a base ImageCacheManager class.

This moves common image cache config from the libvirt driver into
a place that can be shared between drivers, nova.virt.imagecache
The libvirt specific image caching variables are untouched.

The other image cache fields that were in the nova.compute.manager
have also been moved to the common place.

These common configuration can be used by the
blueprint multiple-image-cache-handlers and the
blueprint vmware-image-cache-management.

DocImpact
    The following configuration variables are now in the DEFAULT
    section:
        image_cache_manager_interval
        image_cache_subdirectory_name
        remove_unused_base_images
        remove_unused_original_minimum_age_seconds

Change-Id: I92080f20c3d21ec348aff7d0a9795e773bcc2649
2013-12-17 02:33:45 -08:00