SHA256
1
0
forked from pool/libvirt
libvirt/83edaf44-libxl-dont-hardcode-sched-weight.patch
James Fehlig 1ea77165a0 Accepting request 589839 from home:jfehlig:branches:Virtualization
- libxl: don't hardcode scheduler weight
  83edaf44-libxl-dont-hardcode-sched-weight.patch
  bsc#1086377

- libxl: fixes and improvements in migration APIs
  64370c4b-libxl-MigrateBegin.patch,
  99486799-libxl-MigrateConfirm.patch,
  f5eacf2a-libxl-MigratePerform.patch,
  4e6fcdb6-libxl-libxlDomObjFromDomain-cleanup.patch,
  fe51dbda-libxl-use-FindByRef.patch,
  60b3fcd9-libxl-MigratePrepare.patch,
  3c89868c-libxl-lock-after-ListRemove.patch,
  13e81fc6-libxl-EndJob-on-error.patch,
  594b8b99-libxl-DefineXMLFlags-API-pattern.patch,
  c66e344e-libxl-dont-deref-NULL.patch
  bsc#1080957

OBS-URL: https://build.opensuse.org/request/show/589839
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=681
2018-03-22 00:33:49 +00:00

266 lines
8.2 KiB
Diff

commit 83edaf4435f9c2d1fa5afd1dfbb1643b4f564fd1
Author: Jim Fehlig <jfehlig@suse.com>
Date: Thu Feb 22 11:52:56 2018 -0700
libxl: don't hardcode scheduler weight
Long ago in commit dfa1e1dd53 the scheduler weight was accidentally
hardcoded to 1000. Weight is a setting with no unit since it is
relative to the weight of other domains. If no weight is specified,
libxl defaults to 256.
Instead of hardcoding the weight to 1000, honor any <shares> specified
in <cputune>. libvirt's notion of shares is synonomous to libxl's
scheduler weight setting. If shares is unspecified, defer default
weight setting to libxl.
Removing the hardcoded weight required some test fixup. While at it,
add an explicit test for <shares> conversion to scheduler weight.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
Index: libvirt-4.1.0/src/libxl/libxl_conf.c
===================================================================
--- libvirt-4.1.0.orig/src/libxl/libxl_conf.c
+++ libvirt-4.1.0/src/libxl/libxl_conf.c
@@ -366,7 +366,9 @@ libxlMakeDomBuildInfo(virDomainDefPtr de
}
}
- b_info->sched_params.weight = 1000;
+ if (def->cputune.sharesSpecified)
+ b_info->sched_params.weight = def->cputune.shares;
+
/* Xen requires the memory sizes to be rounded to 1MiB increments */
virDomainDefSetMemoryTotal(def,
VIR_ROUND_UP(virDomainDefGetMemoryInitial(def), 1024));
Index: libvirt-4.1.0/tests/libxlxml2domconfigdata/basic-hvm.json
===================================================================
--- libvirt-4.1.0.orig/tests/libxlxml2domconfigdata/basic-hvm.json
+++ libvirt-4.1.0/tests/libxlxml2domconfigdata/basic-hvm.json
@@ -19,7 +19,7 @@
"device_model_version": "qemu_xen",
"device_model": "/bin/true",
"sched_params": {
- "weight": 1000
+
},
"type.hvm": {
"pae": "True",
Index: libvirt-4.1.0/tests/libxlxml2domconfigdata/basic-pv.json
===================================================================
--- libvirt-4.1.0.orig/tests/libxlxml2domconfigdata/basic-pv.json
+++ libvirt-4.1.0/tests/libxlxml2domconfigdata/basic-pv.json
@@ -15,7 +15,7 @@
"max_memkb": 524288,
"target_memkb": 524288,
"sched_params": {
- "weight": 1000
+
},
"type.pv": {
"bootloader": "pygrub"
Index: libvirt-4.1.0/tests/libxlxml2domconfigdata/cpu-shares-hvm.json
===================================================================
--- /dev/null
+++ libvirt-4.1.0/tests/libxlxml2domconfigdata/cpu-shares-hvm.json
@@ -0,0 +1,89 @@
+{
+ "c_info": {
+ "type": "hvm",
+ "name": "test-hvm",
+ "uuid": "2147d599-9cc6-c0dc-92ab-4064b5446e9b"
+ },
+ "b_info": {
+ "max_vcpus": 4,
+ "avail_vcpus": [
+ 0,
+ 1,
+ 2,
+ 3
+ ],
+ "max_memkb": 1048576,
+ "target_memkb": 1048576,
+ "video_memkb": 8192,
+ "shadow_memkb": 12288,
+ "device_model_version": "qemu_xen",
+ "device_model": "/bin/true",
+ "sched_params": {
+ "weight": 1500
+ },
+ "type.hvm": {
+ "pae": "True",
+ "apic": "True",
+ "acpi": "True",
+ "vga": {
+ "kind": "cirrus"
+ },
+ "vnc": {
+ "enable": "True",
+ "listen": "0.0.0.0",
+ "findunused": "False"
+ },
+ "sdl": {
+ "enable": "False"
+ },
+ "spice": {
+
+ },
+ "boot": "c",
+ "rdm": {
+
+ }
+ },
+ "arch_arm": {
+
+ }
+ },
+ "disks": [
+ {
+ "pdev_path": "/var/lib/xen/images/test-hvm.img",
+ "vdev": "hda",
+ "backend": "qdisk",
+ "format": "raw",
+ "removable": 1,
+ "readwrite": 1
+ }
+ ],
+ "nics": [
+ {
+ "devid": 0,
+ "mac": "00:16:3e:66:12:b4",
+ "bridge": "br0",
+ "script": "/etc/xen/scripts/vif-bridge",
+ "nictype": "vif_ioemu"
+ }
+ ],
+ "vfbs": [
+ {
+ "devid": -1,
+ "vnc": {
+ "enable": "True",
+ "listen": "0.0.0.0",
+ "findunused": "False"
+ },
+ "sdl": {
+ "enable": "False"
+ }
+ }
+ ],
+ "vkbs": [
+ {
+ "devid": -1
+ }
+ ],
+ "on_reboot": "restart"
+}
Index: libvirt-4.1.0/tests/libxlxml2domconfigdata/cpu-shares-hvm.xml
===================================================================
--- /dev/null
+++ libvirt-4.1.0/tests/libxlxml2domconfigdata/cpu-shares-hvm.xml
@@ -0,0 +1,39 @@
+<domain type='xen'>
+ <name>test-hvm</name>
+ <description>None</description>
+ <uuid>2147d599-9cc6-c0dc-92ab-4064b5446e9b</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>4</vcpu>
+ <cputune>
+ <shares>1500</shares>
+ </cputune>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <clock offset='utc'/>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <apic/>
+ <acpi/>
+ <pae/>
+ </features>
+ <devices>
+ <emulator>/bin/true</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu'/>
+ <source file='/var/lib/xen/images/test-hvm.img'/>
+ <target dev='hda'/>
+ </disk>
+ <interface type='bridge'>
+ <source bridge='br0'/>
+ <mac address='00:16:3e:66:12:b4'/>
+ <script path='/etc/xen/scripts/vif-bridge'/>
+ </interface>
+ <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/>
+ </devices>
+</domain>
Index: libvirt-4.1.0/tests/libxlxml2domconfigdata/moredevs-hvm.json
===================================================================
--- libvirt-4.1.0.orig/tests/libxlxml2domconfigdata/moredevs-hvm.json
+++ libvirt-4.1.0/tests/libxlxml2domconfigdata/moredevs-hvm.json
@@ -21,7 +21,7 @@
"device_model_version": "qemu_xen",
"device_model": "/bin/true",
"sched_params": {
- "weight": 1000
+
},
"type.hvm": {
"pae": "True",
Index: libvirt-4.1.0/tests/libxlxml2domconfigdata/multiple-ip.json
===================================================================
--- libvirt-4.1.0.orig/tests/libxlxml2domconfigdata/multiple-ip.json
+++ libvirt-4.1.0/tests/libxlxml2domconfigdata/multiple-ip.json
@@ -15,7 +15,7 @@
"max_memkb": 524288,
"target_memkb": 524288,
"sched_params": {
- "weight": 1000
+
},
"type.pv": {
"bootloader": "pygrub"
Index: libvirt-4.1.0/tests/libxlxml2domconfigdata/variable-clock-hvm.json
===================================================================
--- libvirt-4.1.0.orig/tests/libxlxml2domconfigdata/variable-clock-hvm.json
+++ libvirt-4.1.0/tests/libxlxml2domconfigdata/variable-clock-hvm.json
@@ -21,7 +21,7 @@
"device_model_version": "qemu_xen",
"device_model": "/bin/true",
"sched_params": {
- "weight": 1000
+
},
"type.hvm": {
"pae": "True",
Index: libvirt-4.1.0/tests/libxlxml2domconfigdata/vnuma-hvm.json
===================================================================
--- libvirt-4.1.0.orig/tests/libxlxml2domconfigdata/vnuma-hvm.json
+++ libvirt-4.1.0/tests/libxlxml2domconfigdata/vnuma-hvm.json
@@ -107,7 +107,7 @@
"device_model_version": "qemu_xen",
"device_model": "/bin/true",
"sched_params": {
- "weight": 1000
+
},
"type.hvm": {
"pae": "True",
Index: libvirt-4.1.0/tests/libxlxml2domconfigtest.c
===================================================================
--- libvirt-4.1.0.orig/tests/libxlxml2domconfigtest.c
+++ libvirt-4.1.0/tests/libxlxml2domconfigtest.c
@@ -192,6 +192,7 @@ mymain(void)
DO_TEST("basic-pv");
DO_TEST("basic-hvm");
+ DO_TEST("cpu-shares-hvm");
DO_TEST("variable-clock-hvm");
DO_TEST("moredevs-hvm");
DO_TEST("vnuma-hvm");