summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/virt/libvirt/designer.py11
-rwxr-xr-xnova/virt/libvirt/driver.py6
-rwxr-xr-xnova/virt/libvirt/imagebackend.py6
3 files changed, 16 insertions, 7 deletions
diff --git a/nova/virt/libvirt/designer.py b/nova/virt/libvirt/designer.py
index 0625d407b..8dc579300 100644
--- a/nova/virt/libvirt/designer.py
+++ b/nova/virt/libvirt/designer.py
@@ -101,11 +101,16 @@ def set_vif_host_backend_802qbh_config(conf, devname, profileid,
def set_vif_bandwidth_config(conf, extra_specs):
- """Config vif inbound/outbound bandwidth limit."""
+ """Config vif inbound/outbound bandwidth limit. parameters are
+ set in instance_type_extra_specs table, key is in the format
+ quota:vif_inbound_average.
+ """
bandwidth_items = ['vif_inbound_average', 'vif_inbound_peak',
'vif_inbound_burst', 'vif_outbound_average', 'vif_outbound_peak',
'vif_outbound_burst']
for key, value in extra_specs.iteritems():
- if key in bandwidth_items:
- setattr(conf, key, value)
+ scope = key.split(':')
+ if len(scope) > 1 and scope[0] == 'quota':
+ if scope[1] in bandwidth_items:
+ setattr(conf, scope[1], value)
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 2a25b800e..eabe75c73 100755
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -2137,8 +2137,10 @@ class LibvirtDriver(driver.ComputeDriver):
quota_items = ['cpu_shares', 'cpu_period', 'cpu_quota']
for key, value in inst_type['extra_specs'].iteritems():
- if key in quota_items:
- setattr(guest, key, value)
+ scope = key.split(':')
+ if len(scope) > 1 and scope[0] == 'quota':
+ if scope[1] in quota_items:
+ setattr(guest, scope[1], value)
guest.cpu = self.get_guest_cpu_config()
diff --git a/nova/virt/libvirt/imagebackend.py b/nova/virt/libvirt/imagebackend.py
index 25c6be1f3..c15896986 100755
--- a/nova/virt/libvirt/imagebackend.py
+++ b/nova/virt/libvirt/imagebackend.py
@@ -120,8 +120,10 @@ class Image(object):
# 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)
+ scope = key.split(':')
+ if len(scope) > 1 and scope[0] == 'quota':
+ if scope[1] in tune_items:
+ setattr(info, scope[1], value)
return info
def cache(self, fetch_func, filename, size=None, *args, **kwargs):