diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-20 07:02:42 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-20 07:02:42 +0000 |
| commit | 7a4f3c19fd1c80da2fc341303f94a1adcb8143dc (patch) | |
| tree | 86ea122ed3c3bb8dcdc9b501ecd0715b52e873e8 /nova | |
| parent | 6d0ed8f86fbaa7c52e66a1d335dcf063232de8dd (diff) | |
| parent | 86e6f34eca14b8271a974f06bff7be179449c90b (diff) | |
| download | nova-7a4f3c19fd1c80da2fc341303f94a1adcb8143dc.tar.gz nova-7a4f3c19fd1c80da2fc341303f94a1adcb8143dc.tar.xz nova-7a4f3c19fd1c80da2fc341303f94a1adcb8143dc.zip | |
Merge "Add support for instance disk IO control."
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/tests/fake_imagebackend.py | 2 | ||||
| -rwxr-xr-x | nova/virt/libvirt/driver.py | 3 | ||||
| -rwxr-xr-x | nova/virt/libvirt/imagebackend.py | 14 |
3 files changed, 16 insertions, 3 deletions
diff --git a/nova/tests/fake_imagebackend.py b/nova/tests/fake_imagebackend.py index c284a5042..48426505e 100644 --- a/nova/tests/fake_imagebackend.py +++ b/nova/tests/fake_imagebackend.py @@ -41,7 +41,7 @@ class Backend(object): pass def libvirt_info(self, disk_bus, disk_dev, device_type, - cache_mode): + cache_mode, extra_specs): info = config.LibvirtConfigGuestDisk() info.source_type = 'file' info.source_device = device_type diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 02ca98a3f..bc7f803e9 100755 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -1753,7 +1753,8 @@ class LibvirtDriver(driver.ComputeDriver): return image.libvirt_info(disk_info['bus'], disk_info['dev'], disk_info['type'], - self.disk_cachemode) + self.disk_cachemode, + instance['extra_specs']) def get_guest_storage_config(self, instance, image_meta, disk_info, diff --git a/nova/virt/libvirt/imagebackend.py b/nova/virt/libvirt/imagebackend.py index ba75ccf8b..1a4d7f603 100755 --- a/nova/virt/libvirt/imagebackend.py +++ b/nova/virt/libvirt/imagebackend.py @@ -86,13 +86,15 @@ class Image(object): """ pass - def libvirt_info(self, disk_bus, disk_dev, device_type, cache_mode): + def libvirt_info(self, disk_bus, disk_dev, device_type, cache_mode, + extra_specs): """Get `LibvirtConfigGuestDisk` filled for this image. :disk_dev: Disk bus device name :disk_bus: Disk bus type :device_type: Device type for this image. :cache_mode: Caching mode for this image + :extra_specs: Instance type extra specs dict. """ info = vconfig.LibvirtConfigGuestDisk() info.source_type = self.source_type @@ -104,6 +106,16 @@ class Image(object): driver_name = libvirt_utils.pick_disk_driver_name(self.is_block_dev) info.driver_name = driver_name info.source_path = self.path + + tune_items = ['disk_read_bytes_sec', 'disk_read_iops_sec', + 'disk_write_bytes_sec', 'disk_write_iops_sec', + 'disk_total_bytes_sec', 'disk_total_iops_sec'] + # Note(yaguang): Currently, the only tuning available is Block I/O + # throttling for qemu. + if self.source_type in ['file', 'block']: + for key, value in extra_specs.iteritems(): + if key in tune_items: + setattr(info, key, value) return info def cache(self, fetch_func, filename, size=None, *args, **kwargs): |
