diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-10-24 21:51:10 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-10-24 21:51:10 +0000 |
| commit | 69e1015b6ea2e66ae45dfed4c90103939b73dfa5 (patch) | |
| tree | 2154027948321d5c959029ce25cd9ed9bb3bab2f /nova/virt | |
| parent | 1123c87e58bf0b128230a02ebe29f1f6d6b632c8 (diff) | |
| parent | cc4d766a0476211288d5b67f3647a721159185d3 (diff) | |
Merge "Remove database usage from libvirt imagecache module"
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/driver.py | 2 | ||||
| -rw-r--r-- | nova/virt/fake.py | 4 | ||||
| -rw-r--r-- | nova/virt/libvirt/driver.py | 4 | ||||
| -rw-r--r-- | nova/virt/libvirt/imagecache.py | 10 | ||||
| -rw-r--r-- | nova/virt/powervm/driver.py | 2 |
5 files changed, 12 insertions, 10 deletions
diff --git a/nova/virt/driver.py b/nova/virt/driver.py index 8a7c39fa8..941d46e5e 100644 --- a/nova/virt/driver.py +++ b/nova/virt/driver.py @@ -641,7 +641,7 @@ class ComputeDriver(object): # TODO(tr3buchet): update all subclasses and remove this return True - def manage_image_cache(self, context): + def manage_image_cache(self, context, all_instances): """ Manage the driver's local image cache. diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 0996988cd..3527ac19b 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -46,6 +46,10 @@ class FakeInstance(object): class FakeDriver(driver.ComputeDriver): + capabilities = { + "has_imagecache": True, + } + """Fake hypervisor driver""" def __init__(self, read_only=False): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index fd241c38d..34d667c16 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2753,9 +2753,9 @@ class LibvirtDriver(driver.ComputeDriver): out, err = utils.execute('env', 'LANG=C', 'uptime') return out - def manage_image_cache(self, context): + def manage_image_cache(self, context, all_instances): """Manage the local cache of images.""" - self.image_cache_manager.verify_base_images(context) + self.image_cache_manager.verify_base_images(context, all_instances) def _cleanup_remote_migration(self, dest, inst_base, inst_base_resize): """Used only for cleanup in case migrate_disk_and_power_off fails""" diff --git a/nova/virt/libvirt/imagecache.py b/nova/virt/libvirt/imagecache.py index ba350749a..dd4635123 100644 --- a/nova/virt/libvirt/imagecache.py +++ b/nova/virt/libvirt/imagecache.py @@ -29,7 +29,6 @@ import time from nova.compute import task_states from nova.compute import vm_states -from nova import db from nova import flags from nova.openstack.common import cfg from nova.openstack.common import log as logging @@ -127,14 +126,13 @@ class ImageCacheManager(object): ent))): self._store_image(base_dir, ent, original=False) - def _list_running_instances(self, context): + def _list_running_instances(self, context, all_instances): """List running instances (on all compute nodes).""" self.used_images = {} self.image_popularity = {} self.instance_names = set() - instances = db.instance_get_all(context) - for instance in instances: + for instance in all_instances: self.instance_names.add(instance['name']) resize_states = [task_states.RESIZE_PREP, @@ -357,7 +355,7 @@ class ImageCacheManager(object): virtutils.chown(base_file, os.getuid()) os.utime(base_file, None) - def verify_base_images(self, context): + def verify_base_images(self, context, all_instances): """Verify that base images are in a reasonable state.""" # NOTE(mikal): The new scheme for base images is as follows -- an @@ -379,7 +377,7 @@ class ImageCacheManager(object): LOG.debug(_('Verify base images')) self._list_base_images(base_dir) - self._list_running_instances(context) + self._list_running_instances(context, all_instances) # Determine what images are on disk because they're in use for img in self.used_images: diff --git a/nova/virt/powervm/driver.py b/nova/virt/powervm/driver.py index 3b65b5c45..5fc73b4a9 100644 --- a/nova/virt/powervm/driver.py +++ b/nova/virt/powervm/driver.py @@ -169,7 +169,7 @@ class PowerVMDriver(driver.ComputeDriver): """ return False - def manage_image_cache(self, context): + def manage_image_cache(self, context, all_instances): """ Manage the driver's local image cache. |
