]> git.ipfire.org Git - thirdparty/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)
committerJim Fehlig <jfehlig@suse.com>
Thu, 11 Jul 2013 16:36:17 +0000 (10:36 -0600)
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>
(cherry picked from commit f493d83fbd3257453e63f2f32ee90a216fd531c1)

src/qemu/qemu_driver.c

index c5d3a5b2dde83d58cfceedbbe8f5d50ba3cca877..87e82bbc81d7611d9899a3b1a1b221f4360577da 100644 (file)
@@ -7362,9 +7362,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,