]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
cgroup: Fix start VMs coincidently failed
authorWang Yufei <james.wangyufei@huawei.com>
Thu, 20 Mar 2014 07:14:01 +0000 (07:14 +0000)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 21 Mar 2014 12:27:28 +0000 (13:27 +0100)
When I start multi VMs coincidently and any of the cgroup directories
named machine doesn't exist. There's a chance that VM start failed because
of creating directory failed:
Unable to initialize /machine cgroup: File exists
When the errno returned by mkdir in virCgroupMakeGroup is EEXIST,
we should pass it through and continue to start the VM.
Signed-off-by: Wang Yufei <james.wangyufei@huawei.com>
src/util/vircgroup.c

index c5925b1df730c52dffc3e67e3802a4c4fad32663..a10d6f6f8aa6b3c4277077f27c94a3c1f268709f 100644 (file)
@@ -924,6 +924,10 @@ virCgroupMakeGroup(virCgroupPtr parent,
         if (!virFileExists(path)) {
             if (!create ||
                 mkdir(path, 0755) < 0) {
+                if (errno == EEXIST) {
+                    VIR_FREE(path);
+                    continue;
+                }
                 /* With a kernel that doesn't support multi-level directory
                  * for blkio controller, libvirt will fail and disable all
                  * other controllers even though they are available. So