before patch:
        #lscgroup
        cpu:/
        cpuset:/

        #cgsnapshot -s cpu

        mount {
            cpuset = /cgroup/cpuacct;
            cpu = /cgroup/cpu;
        }

We just wanted to save cpu controller, so cpuset was unexpected

after patch:
        #cgsnapshot -s cpu

        mount {
            cpu = /cgroup/cpu;
        }


Signed-off-by: Libo Chen <clbchenlibo.c...@huawei.com>
---
 src/tools/cgsnapshot.c |   33 +++++++++++++++++++++++----------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/src/tools/cgsnapshot.c b/src/tools/cgsnapshot.c
index 046c70a..4cd16e8 100644
--- a/src/tools/cgsnapshot.c
+++ b/src/tools/cgsnapshot.c
@@ -624,6 +624,27 @@ static int show_mountpoints(const char *controller)
        return 0;
 }

+static void parse_mountpoint(cont_name_t cont_names[CG_CONTROLLER_MAX],
+       struct controller_data *info)
+{
+       int i;
+
+       for (i=0; i<=CG_CONTROLLER_MAX-1; i++) {
+               if (!strncmp(cont_names[i], info->name, strlen(info->name)+1)) {
+                       if(show_mountpoints(info->name)){
+                               /* the controller is not mounted */
+                               if ((flags & FL_SILENT) == 0) {
+                                       fprintf(stderr, "ERROR: %s hierarchy "
+                                       "not mounted\n", info->name);
+
+                               }
+                               break;
+                       }
+               break;
+               }
+       }
+}
+
 /* print data about input mount points */
 /* TODO only wanted ones */
 static int parse_mountpoints(cont_name_t cont_names[CG_CONTROLLER_MAX],
@@ -642,16 +663,8 @@ static int parse_mountpoints(cont_name_t 
cont_names[CG_CONTROLLER_MAX],
        while (ret == 0) {

                /* the controller attached to some hierarchy */
-               if  (info.hierarchy != 0) {
-                       ret = show_mountpoints(info.name);
-                       if (ret != 0) {
-                               /* the controller is not mounted */
-                               if ((flags &  FL_SILENT) == 0) {
-                                       fprintf(stderr, "ERROR: %s hierarchy "\
-                                               "not mounted\n", info.name);
-                               }
-                       }
-               }
+               if  (info.hierarchy != 0)
+                   parse_mountpoint(cont_names, &info);

                /* next controller */
                ret = cgroup_get_all_controller_next(&handle, &info);
-- 


------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to