Changeset 560

Show
Ignore:
Timestamp:
02/21/07 14:14:18 (2 years ago)
Author:
hollow
Message:

split vg list handling

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/vcc/vce/cmd.c

    r559 r560  
    6868                        "   list                [<username>]\n" 
    6969                        "\n" 
    70                 "   dep.add             <name> <depname>\n" 
    71                 "   dep.remove          <name> <depname>\n" 
    72                 "\n" 
     70                       "   dep.add             <name> <depname>\n" 
     71                       "   dep.remove          <name> <depname>\n" 
     72                       "\n" 
    7373                        "   dx.limit.get        <name>\n" 
    7474                        "   dx.limit.remove     <name>\n" 
  • trunk/src/vcd/methods/Makefile.am

    r559 r560  
    3333 
    3434M_VG = vg/vg_add.c \ 
     35       vg/vg_internal.c \ 
     36       vg/vg_internal.h \ 
    3537       vg/vg_list.c \ 
    3638       vg/vg_remove.c \ 
  • trunk/src/vcd/methods/vg/vg_add.c

    r551 r560  
    11// Copyright 2007 Luca Longinotti <chtekk@gentoo.org> 
     2//           2007 Benedikt Böhm <hollow@gentoo.org> 
    23// 
    34// This program is free software; you can redistribute it and/or modify 
  • trunk/src/vcd/methods/vg/vg_list.c

    r558 r560  
    11// Copyright 2007 Luca Longinotti <chtekk@gentoo.org> 
     2//           2007 Benedikt Böhm <hollow@gentoo.org> 
    23// 
    34// This program is free software; you can redistribute it and/or modify 
  • trunk/src/vcd/methods/vg/vg_remove.c

    r558 r560  
    11// Copyright 2007 Luca Longinotti <chtekk@gentoo.org> 
     2//           2007 Benedikt Böhm <hollow@gentoo.org> 
    23// 
    34// This program is free software; you can redistribute it and/or modify 
  • trunk/src/vcd/methods/vg/vg_vx_start.c

    r558 r560  
    11// Copyright 2007 Luca Longinotti <chtekk@gentoo.org> 
     2//           2007 Benedikt Böhm <hollow@gentoo.org> 
    23// 
    34// This program is free software; you can redistribute it and/or modify 
     
    2526#include <lucid/str.h> 
    2627 
     28#include "vg_internal.h" 
     29 
    2730/* vg.vx.start(string groupname) */ 
    2831xmlrpc_value *m_vg_vx_start(xmlrpc_env *env, xmlrpc_value *p, void *c) 
     
    3033        LOG_TRACEME 
    3134 
    32         typedef struct { 
    33                 list_t list; 
    34                 xid_t  xid; 
    35                 const char *name; 
    36         } xn_list_t; 
    37  
    3835        xmlrpc_value *params; 
    3936        char *group; 
    4037        int rc, gid; 
    41         xn_list_t _xns, *xns = &_xns, *pos; 
     38        vg_list_t _vxs, *vxs = &_vxs, *pos; 
    4239 
    4340        params = method_init(env, p, c, VCD_CAP_INIT, 0); 
     
    6966        } 
    7067 
    71         if (rc != VXDB_OK) 
    72                 method_return_vxdb_fault(env); 
    73  
    74         INIT_LIST_HEAD(&(xns->list)); 
    75  
    76         vxdb_foreach_step(rc, dbr) { 
    77                 LIST_NODE_ALLOC(xn_list_t, new); 
    78  
    79                 new->xid  = vxdb_column_int(dbr, 0); 
    80                 new->name = str_dup(vxdb_column_text(dbr, 1)); 
    81  
    82                 list_add(&(new->list), &(xns->list)); 
    83         } 
    84  
    85         if (rc != VXDB_DONE) 
     68        if (rc != VXDB_OK || vg_list_from_vxdb(dbr, vxs) != VXDB_DONE) 
    8669                method_return_vxdb_fault(env); 
    8770 
    8871        vxdb_finalize(dbr); 
    8972 
    90         list_for_each_entry(pos, &(xns->list), list) { 
     73        list_for_each_entry(pos, &(vxs->list), list) { 
    9174                /* vserver is stopped, let's start it */ 
    9275                if (vx_info(pos->xid, NULL) == -1) { 
     
    10184        } 
    10285 
     86        vg_list_free(vxs); 
     87 
    10388        return xmlrpc_nil_new(env); 
    10489} 
  • trunk/src/vcd/methods/vg/vg_vx_stop.c

    r558 r560  
    11// Copyright 2007 Luca Longinotti <chtekk@gentoo.org> 
     2//           2007 Benedikt Böhm <hollow@gentoo.org> 
    23// 
    34// This program is free software; you can redistribute it and/or modify 
     
    2526#include <lucid/str.h> 
    2627 
     28#include "vg_internal.h" 
     29 
    2730/* vg.vx.stop(string groupname) */ 
    2831xmlrpc_value *m_vg_vx_stop(xmlrpc_env *env, xmlrpc_value *p, void *c) 
     
    3033        LOG_TRACEME 
    3134 
    32         typedef struct { 
    33                 list_t list; 
    34                 xid_t  xid; 
    35                 const char *name; 
    36         } xn_list_t; 
    37  
    3835        xmlrpc_value *params; 
    3936        char *group; 
    4037        int rc, gid; 
    41         xn_list_t _xns, *xns = &_xns, *pos; 
     38        vg_list_t _vxs, *vxs = &_vxs, *pos; 
    4239 
    4340        params = method_init(env, p, c, VCD_CAP_INIT, 0); 
     
    6966        } 
    7067 
    71         if (rc != VXDB_OK) 
    72                 method_return_vxdb_fault(env); 
    73  
    74         INIT_LIST_HEAD(&(xns->list)); 
    75  
    76         vxdb_foreach_step(rc, dbr) { 
    77                 LIST_NODE_ALLOC(xn_list_t, new); 
    78  
    79                 new->xid  = vxdb_column_int(dbr, 0); 
    80                 new->name = str_dup(vxdb_column_text(dbr, 1)); 
    81  
    82                 list_add(&(new->list), &(xns->list)); 
    83         } 
    84  
    85         if (rc != VXDB_DONE) 
     68        if (rc != VXDB_OK || vg_list_from_vxdb(dbr, vxs) != VXDB_OK) 
    8669                method_return_vxdb_fault(env); 
    8770 
    8871        vxdb_finalize(dbr); 
    8972 
    90         list_for_each_entry(pos, &(xns->list), list) { 
     73        list_for_each_entry(pos, &(vxs->list), list) { 
    9174                /* vserver is running, let's stop it */ 
    9275                if (vx_info(pos->xid, NULL) == 0) { 
     
    9679        } 
    9780 
     81        vg_list_free(vxs); 
     82 
    9883        return xmlrpc_nil_new(env); 
    9984}