Changeset 714

Show
Ignore:
Timestamp:
03/08/10 19:49:12 (2 years ago)
Author:
cryptronic
Message:

Make the cgroup stuff more configurable.

Location:
trunk/daemon
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/daemon/openvcpd.conf

    r654 r714  
    2828AdminEmail=openvcp@lists.openvcp.org 
    2929 
     30# options for cgroup handling 
     31CGroupMountPoint=/dev/cgroup 
     32CGroupMountOptions=cpu,cpuset,memory,cpuacct,devices,freezer,net_cls 
     33 
  • trunk/daemon/src/get.c

    r708 r714  
    465465        response = ovcp_response_new(); 
    466466 
    467         ovcp_response_struct_new(response); 
    468  
    469467        while(cgroup_params[i] != NULL) 
    470468        { 
     
    473471                if(file_exist(path)) 
    474472                { 
    475                         value = file_read(path); 
    476  
     473                        ovcp_response_struct_new(response); 
     474 
     475                        ovcp_response_struct_add_string(response, "name", cgroup_params[i]); 
     476 
     477                        value = file_read(path); 
    477478                        if(value != NULL) 
    478479                        { 
    479480                                trim_string(value); 
    480                                 ovcp_response_struct_add_string(response, cgroup_params[i], value); 
     481                                ovcp_response_struct_add_string(response, "value", value); 
    481482                                free(value); 
    482483                        } 
     484                        else 
     485                        { 
     486                            ovcp_response_struct_add_string(response, "value", ""); 
     487                        } 
     488 
     489                        ovcp_response_struct_end(response); 
    483490                } 
    484491 
    485492                i++; 
    486493        } 
    487  
    488         ovcp_response_struct_end(response); 
    489494 
    490495        return response; 
  • trunk/daemon/src/main.c

    r711 r714  
    120120        if(!fs_cgroup_support()) 
    121121        { 
    122             if(!dir_exist("/dev/cgroup")) 
    123                 mkdir("/dev/cgroup", 0755); 
    124             execb_cmd("mount", "mount", "-ocpu,cpuset", "-t", "cgroup", "none", "/dev/cgroup", NULL); 
     122            if(!dir_exist(config_st.cgroupdir)) 
     123                mkdir(config_st.cgroupdir, 0755); 
     124            execb_cmd("mount", "mount", config_st.cgroupmountoptions, "-t", "cgroup", "none", config_st.cgroupdir NULL); 
    125125        } 
    126126 
  • trunk/daemon/src/parseconfig.c

    r671 r714  
    157157                                        config->adminemail = (char *) malloc(strlen(directives[1])+1); 
    158158                                        strcpy(config->adminemail, directives[1]); 
     159                                } 
     160                                else 
     161                                if(strcasecmp(directives[0], "CGroupMountPoint") == 0) 
     162                                { 
     163                                        config->cgroupdir = (char *) malloc(strlen(directives[1])+1); 
     164                                        strcpy(config->cgroupdir, directives[1]); 
     165                                } 
     166                                else 
     167                                if(strcasecmp(directives[0], "CGroupMountOptions") == 0) 
     168                                { 
     169                                        config->cgroupmountoptions = (char *) malloc(strlen(directives[1])+1); 
     170                                        strcpy(config->cgroupmountoptions, directives[1]); 
    159171                                } 
    160172 
     
    203215        if(config->userbackup_dir == NULL) 
    204216                die("ERROR: UserBackupDir Directive not Found\n"); 
     217        if(config->cgroupdir == NULL) 
     218                die("ERROR: CGroupMountPoint Directive not Found\n"); 
     219        if(config->cgroupmountoptions == NULL) 
     220                die("ERROR: CGroupMountOptions Directive not Found\n"); 
    205221 
    206222        if(!dir_exist(config->root_dir)) 
  • trunk/daemon/src/parseconfig.h

    r654 r714  
    4545 
    4646                char *adminemail; 
     47                char *cgroupdir; 
     48                char *cgroupmountoptions; 
    4749        }; 
    4850 
  • trunk/daemon/src/set.c

    r712 r714  
    727727 
    728728                                        //try to apply the new limits directly 
    729                                         sconcat(filepath, BUF_SIZE, "/dev/cgroup/", name, cgroup_params[i], NULL); 
     729                                        sconcat(filepath, BUF_SIZE, global_settings.cgroupdir, name, cgroup_params[i], NULL); 
    730730                                        if(file_exist(filepath)) 
    731731                                        {