]> xenbits.xensource.com Git - libvirt.git/commitdiff
Cope with missing swap cgroup controls
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 9 May 2013 12:53:39 +0000 (13:53 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 10 May 2013 18:57:18 +0000 (19:57 +0100)
It is possible to build a kernel without swap cgroup controls
present. This causes a fatal error when querying memory
parameters. Treat missing swap controls as meaning "unlimited".
The fatal error remains if the user tries to actually change
the limit.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_driver.c

index 3eb4915f83066a2b214a2c96f6021c3979c4da20..ab52693ee4da9f761d9c0b52191c71092f9d1422 100644 (file)
@@ -7613,9 +7613,12 @@ qemuDomainGetMemoryParameters(virDomainPtr dom,
         case 2: /* fill swap hard limit here */
             rc = virCgroupGetMemSwapHardLimit(priv->cgroup, &val);
             if (rc != 0) {
-                virReportSystemError(-rc, "%s",
-                                     _("unable to get swap hard limit"));
-                goto cleanup;
+                if (rc != -ENOENT) {
+                    virReportSystemError(-rc, "%s",
+                                         _("unable to get swap hard limit"));
+                    goto cleanup;
+                }
+                val = VIR_DOMAIN_MEMORY_PARAM_UNLIMITED;
             }
             if (virTypedParameterAssign(param,
                                         VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT,