dpm2_python man page

dpm2_python(3)                 Python Reference                 dpm2_python(3)

[1mNAME[0m
      dpm - Python interface to the DPM

[1mSYNOPSIS[0m
      [1mimport dpm2 as dpm[0m

[1mDESCRIPTION[0m
      The  dpm  module  permits  you  to access the DPM client interface from
      python programs. The dpm module is a swig wrapping of  the  standard  C
      interface.  For detailed descriptions of each function see the individ-
      ual man page of each function.

[1mFUNCTIONS[0m
      [1mdpns_aborttrans ( )[0m

      [1mdpns_access ( string [4m[22mpath[24m[1m, int [4m[22mamode[24m [1m) -> bool [4m[22maccess[0m

      [1mdpns_accessr ( string [4m[22msfn[24m[1m, int [4m[22mamode[24m [1m) -> bool [4m[22maccess[0m

      [1mdpns_addreplica  (  string  [4m[22mguid[24m[1m,  struct  dpns_fileid  *[4m[22mfile_uniqueid[24m[1m,[0m
      [1mstring  [4m[22mserver[24m[1m,  string [4m[22msfn[24m[1m, char [4m[22mstatus[24m[1m, char [4m[22mf_type[24m[1m, string [4m[22mpoolname[24m[1m,[0m
      [1mstring [4m[22mfs[24m [1m)[0m

      [1mdpns_addreplicax (  string  [4m[22mguid[24m[1m,  struct  dpns_fileid  *[4m[22mfile_uniqueid[24m[1m,[0m
      [1mstring  [4m[22mserver[24m[1m,  string [4m[22msfn[24m[1m, char [4m[22mstatus[24m[1m, char [4m[22mf_type[24m[1m, string [4m[22mpoolname[24m[1m,[0m
      [1mstring [4m[22mfs[24m[1m, char [4m[22mr_type[24m[1m, string [4m[22msetname[24m [1m)[0m

      [1mdpns_chdir ( string [4m[22mpath[24m [1m)[0m

      [1mdpns_chmod ( string [4m[22mpath[24m[1m, mode_t [4m[22mmode[24m [1m)[0m

      [1mdpns_chown ( string [4m[22mpath[24m[1m, uid_t [4m[22mnew_uid[24m[1m, gid_t [4m[22mnew_gid[24m [1m)[0m

      [1mdpns_client_setAuthorizationId ( uid_t [4m[22muid[24m[1m,  gid_t  [4m[22mgid[24m[1m,  string  [4m[22mmech[24m[1m,[0m
      [1mstring [4m[22mid[24m [1m)[0m

      [1mdpns_client_setVOMS_data ( string [4m[22mvoname[24m[1m, stringlist [4m[22mvomsdata[24m [1m)[0m

      [1mdpns_closedir ( dpns_DIR [4m[22mdirp[24m [1m)[0m

      [1mdpns_creat ( string [4m[22mpath[24m[1m, mode_t [4m[22mmode[24m [1m)[0m

      [1mdpns_delcomment ( string [4m[22mpath[24m [1m)[0m

      [1mdpns_delete ( string [4m[22mpath[24m [1m)[0m

      [1mdpns_delreplica  (  string  [4m[22mguid[24m[1m,  struct  dpns_fileid  *[4m[22mfile_uniqueid[24m[1m,[0m
      [1mstring [4m[22msfn[24m [1m)[0m

      [1mdpns_delreplicasbysfn ( ListOfString  [4m[22msfns[24m[1m,  ListOfString  [4m[22mguids[24m  [1m)  ->[0m
      [1mListOfInt [4m[22mresults[0m

      [1mdpns_endsess ( )[0m

      [1mdpns_endtrans ( )[0m

      [1mdpns_getacl ( string [4m[22mpath[24m[1m, ) -> ListOf struct dpns_acl [4m[22macls[0m

      [1mdpns_getcomment ( string [4m[22mpath[24m [1m) -> string [4m[22mcomment[0m

      [1mdpns_getcwd ( ) -> string [4m[22mdir[0m

      [1mdpns_getifcevers ( ) -> string [4m[22mversion[0m

      [1mdpns_getlinks  ( string [4m[22mpath[24m[1m, string [4m[22mguid[24m [1m) -> ListOf struct dpns_link-[0m
      [1minfo [4m[22mlinks[0m

      [1mdpns_getreplica ( string [4m[22mpath[24m[1m, string  [4m[22mguid[24m[1m,  string  [4m[22mse[24m  [1m)  ->  ListOf[0m
      [1mstruct dpns_filereplica [4m[22mreplicas[0m

      [1mdpns_getreplicax  (  string  [4m[22mpath[24m[1m,  string  [4m[22mguid[24m[1m, string [4m[22mse[24m [1m) -> ListOf[0m
      [1mstruct dpns_filereplicax [4m[22mreplicas[0m

      [1mdpns_lchown ( string [4m[22mpath[24m[1m, uid_t [4m[22mnew_uid[24m[1m, gid_t [4m[22mnew_gid[24m [1m)[0m

      [1mdpns_listreplicax ( string [4m[22mpoolname[24m[1m,  string  [4m[22mserver[24m[1m,  string  [4m[22mfs[24m[1m,  int[0m
      [4mflags[24m[1m, dpns_list * listp ) -> struct dpns_filereplica [4m[22mreplica[0m

      [1mdpns_listrepset  (  string  [4m[22msetname[24m[1m,  int  [4m[22mflags[24m[1m, dpns_list *[4m[22mlistp[24m [1m) ->[0m
      [1mstruct dpns_filereplicax [4m[22mreplica[0m

      [1mdpns_lstat ( string [4m[22mpath[24m [1m) -> struct dpns_filestat [4m[22mstatbuf[0m

      [1mdpns_mkdir ( string [4m[22mpath[24m[1m, mode_t [4m[22mmode[24m [1m)[0m

      [1mdpns_modreplica ( string [4m[22msfn[24m[1m, string [4m[22msetname[24m[1m, string  [4m[22mpoolname[24m[1m,  string[0m
      [4mserver[24m [1m)[0m

      [1mdpns_modreplicax  ( string [4m[22msfn[24m[1m, string [4m[22msetname[24m[1m, string [4m[22mpoolname[24m[1m, string[0m
      [4mserver[24m[1m, string [4m[22mfs[24m[1m, char [4m[22mr_type[24m [1m)[0m

      [1mdpns_opendir ( string [4m[22mpath[24m [1m) -> dpns_DIR [4m[22mdir[0m

      [1mdpns_opendirxg ( string [4m[22mserver[24m[1m, string [4m[22mpath[24m[1m, string [4m[22mguid[24m [1m) ->  dpns_DIR[0m
      [4mdir[0m

      [1mdpns_ping ( string [4m[22mserver[24m [1m) -> string [4m[22minfo[0m

      [1mdpns_readdir ( dpns_DIR [4m[22mdirp[24m [1m) -> struct dirent [4m[22mdirent[0m

      [1mdpns_readdirc ( dpns_DIR [4m[22mdirp[24m [1m) -> struct dpns_direncomm [4m[22mdirent[0m

      [1mdpns_readdirg ( dpns_DIR [4m[22mdirp[24m [1m) -> struct dpns_direnstatg [4m[22mdirent[0m

      [1mdpns_readdirx ( dpns_DIR [4m[22mdirp[24m [1m) -> struct dpns_direnstat [4m[22mdirent[0m

      [1mdpns_readdirxc ( dpns_DIR [4m[22mdirp[24m [1m) -> struct dpns_direnstatc [4m[22mdirent[0m

      [1mdpns_readdirxp  (  dpns_DIR [4m[22mdirp[24m[1m, string [4m[22mpattern[24m[1m, string [4m[22mse[24m [1m= None ) ->[0m
      [1mstruct dpns_direnrep [4m[22mdirent[0m

      [1mdpns_readdirxr  (  dpns_DIR  [4m[22mdirp[24m[1m,  string  [4m[22mse[24m  [1m=  None  )  ->   struct[0m
      [1mdpns_direnrep [4m[22mdirent[0m

      [1mdpns_readlink ( string [4m[22mpath[24m [1m) -> string [4m[22mlink[0m

      [1mdpns_rename ( string [4m[22moldpath[24m[1m, string [4m[22mnewpath[24m [1m)[0m

      [1mdpns_rewinddir ( dpns_DIR [4m[22mdirp[24m [1m)[0m

      [1mdpns_rmdir ( string [4m[22mpath[24m [1m)[0m

      [1mdpns_setacl ( string [4m[22mpath[24m[1m, ListOf struct dpns_acl [4m[22macls[24m [1m)[0m

      [1mdpns_setatime ( string [4m[22mpath[24m[1m, struct dpns_fileid [4m[22mfile_uniqueid[24m [1m)[0m

      [1mdpns_setcomment ( string [4m[22mpath[24m[1m, string [4m[22mcomment[24m [1m)[0m

      [1mdpns_setfsize  (  string  [4m[22mpath[24m[1m,  struct dpns_fileid [4m[22mfile_uniqueid[24m[1m, long[0m
      [4mfilesize[24m [1m)[0m

      [1mdpns_setfsizec ( string [4m[22mpath[24m[1m, struct  dpns_fileid  [4m[22mfile_uniqueid[24m[1m,  long[0m
      [4mfilesize[24m[1m, string [4m[22mcsumtype[24m[1m, string [4m[22mcsumvalue[24m [1m)[0m

      [1mdpns_setptime ( string [4m[22msfn[24m[1m, long [4m[22mptime[24m [1m)[0m

      [1mdpns_setratime ( string [4m[22msfn[24m [1m)[0m

      [1mdpns_setrltime ( string [4m[22msfn[24m[1m, long [4m[22mltime[24m [1m)[0m

      [1mdpns_setrstatus ( string [4m[22msfn[24m[1m, char [4m[22mstatus[24m [1m)[0m

      [1mdpns_setrtype ( string [4m[22msfn[24m[1m, char [4m[22mtype[24m [1m)[0m

      [1mdpns_startsess ( string [4m[22mserver[24m[1m, string [4m[22mcomment[24m [1m)[0m

      [1mdpns_starttrans ( string [4m[22mserver[24m[1m, string [4m[22mcomment[24m [1m)[0m

      [1mdpns_stat ( string [4m[22mpath[24m [1m) -> struct dpns_filestat [4m[22mstatbuf[0m

      [1mdpns_statg  ( string [4m[22mpath[24m[1m, string [4m[22mguid[24m [1m) -> struct dpns_filestatg [4m[22mstat-[0m
      [4mbuf[0m

      [1mdpns_statr ( string [4m[22msfn)[24m [1m) -> struct dpns_filestatg [4m[22mstatbuf[0m

      [1mdpns_symlink ( string [4m[22mtarget[24m[1m, string [4m[22mlinkname[24m [1m)[0m

      [1mdpns_umask ( mode_t [4m[22mcmask[24m [1m) -> mode_t [4m[22moldmask[0m

      [1mdpns_undelete ( string [4m[22mpath[24m [1m)[0m

      [1mdpns_unlink ( string [4m[22mpath[24m [1m)[0m

      [1mdpns_utime ( string [4m[22mpath[24m[1m, struct utimbuf [4m[22mtimes[24m [1m)[0m

      [1mdpns_entergrpmap ( gid_t [4m[22mgid[24m[1m, string [4m[22mgroupname[24m [1m)[0m

      [1mdpns_enterusrmap ( uid_t [4m[22muid[24m[1m, string [4m[22musername[24m [1m)[0m

      [1mdpns_getgrpbygid ( gid_t [4m[22mgid[24m [1m) -> string [4m[22mgroup[0m

      [1mdpns_getgrpbygids ( ListOfgid_t [4m[22mgids[24m [1m) -> ListOfString [4m[22mgroups[0m

      [1mdpns_getgrpbynam ( string [4m[22mgroupname[24m [1m) -> gid_t [4m[22mgid[0m

      [1mdpns_getgrpmap ( ) -> ListOf struct dpns_groupinfo [4m[22minfos[0m

      [1mdpns_getusrbynam ( string [4m[22musername[24m [1m) -> uid_t [4m[22muid[0m

      [1mdpns_getusrbyuid ( uid_t [4m[22muid[24m [1m) -> string [4m[22muser[0m

      [1mdpns_getusrmap ( ) -> ListOf struct dpns_userinfo [4m[22muserinfo[0m

      [1mdpns_modifygrpmap ( gid_t [4m[22mgid[24m[1m, string [4m[22mnewname[24m [1m)[0m

      [1mdpns_modifyusrmap ( uid_t [4m[22muid[24m[1m, string [4m[22mnewname[24m [1m)[0m

      [1mdpns_rmgrpmap ( gid_t [4m[22mgid[24m[1m, string [4m[22mgroupname[24m [1m)[0m

      [1mdpns_rmusrmap ( uid_t [4m[22muid[24m[1m, string [4m[22musername[24m [1m)[0m

      [1mdpm_getpoolfs ( string [4m[22mpoolname[24m [1m) -> ListOf struct dpm_fs [4m[22mdpm_fs[0m

      [1mdpm_getpools ( ) -> ListOf struct dpm_pool [4m[22mdpm_pools[0m

      [1mdpm_getprotocols ( ) -> ListOfString [4m[22mprotocols[0m

      [1mdpm_getspacemd   (   ListOfString   [4m[22ms_tokens[24m   [1m)   ->   ListOf   struct[0m
      [1mdpm_space_metadata [4m[22mspacemd[0m

      [1mdpm_getspacetoken ( string [4m[22mu_token[24m [1m) -> ListOfString [4m[22ms_tokens[0m

      [1mdpm_addfs ( string [4m[22mpoolname[24m[1m, string [4m[22mserver[24m[1m, string [4m[22mfs[24m[1m, int [4m[22mstatus[24m [1m)[0m

      [1mdpm_addpool ( struct dpm_pool [4m[22mdpm_pool[24m [1m)[0m

      [1mdpm_delreplica ( string [4m[22mpfn[24m [1m)[0m

      [1mdpm_modifyfs ( string [4m[22mserver[24m[1m, string [4m[22mfs[24m[1m, int [4m[22mstatus[24m [1m)[0m

      [1mdpm_modifypool ( struct dpm_pool [4m[22mdpm_pool[24m [1m)[0m

      [1mdpm_ping ( string [4m[22mhost[24m [1m) -> string [4m[22minfo[0m

      [1mdpm_releasespace ( string [4m[22ms_token[24m[1m, int [4m[22mforce[24m [1m)[0m

      [1mdpm_reservespace  (  char [4m[22ms_type[24m[1m, string [4m[22mu_token[24m[1m, char [4m[22mret_policy[24m[1m, char[0m
      [4mac_latency[24m[1m, long  [4m[22mreq_t_space[24m[1m,  long  [4m[22mreq_g_space[24m[1m,  long  [4m[22mreq_lifetime[24m[1m,[0m
      [1mListOfInt   [4m[22mgids[24m[1m,   string  [4m[22mpoolname[24m  [1m)  ->  char  [4m[22mactual_s_type[24m[1m,  long[0m
      [4mactual_t_space[24m[1m,  long  [4m[22mactual_g_space[24m[1m,  long  [4m[22mactual_lifetime[24m[1m,   string[0m
      [4ms_token[0m

      [1mdpm_rmfs ( string [4m[22mserver[24m[1m, string [4m[22mfs[24m [1m)[0m

      [1mdpm_rmpool ( string [4m[22mpoolname[24m [1m)[0m

      [1mdpm_updatespace  (  string [4m[22ms_token[24m[1m, long [4m[22mreq_t_space[24m[1m, long [4m[22mreq_g_space[24m[1m,[0m
      [1mlong [4m[22mreq_lifetime[24m[1m,  ListOfInt  [4m[22mgids[24m  [1m)  ->  long  [4m[22mactual_t_space[24m[1m,  long[0m
      [4mactual_g_space[24m[1m, long [4m[22mactual_lifetime[0m

[1mSTRUCTURES[0m
      Sometimes  you  need  to  specify a structure as an input argument (eg.
      [4mstruct[24m [4mdpns_acl[24m, [4mstruct[24m [4mdpns_list[24m, [4mstruct[24m [4mdpm_pool[24m,  etc.).   For  that
      purpose,  the  module includes structure constructors, named exactly as
      the structure.

      Thus, to create [4mstruct[24m [4mdpns_acl[24m, [4mstruct[24m [4mdpns_list[24m or [4mstruct[24m  [4mdpmm_pool[24m,
      you have to do the following:

          dpnsacl = dpm.dpns_acl()
          dpnslist = dpm.dpns_list()
          dpmpool = dpm.dpm_pool()

      If  you want to see how to use it in a real case, please have a look at
      examples.

[1mERRORS[0m
      As you can see, no error code is returned. When  an  error  occurs,  an
      exception is raised with a description of the error.

[1mEXAMPLE[0m
      #!/usr/bin/python

      """
      # Using the dpns_readdirxr method
      """

      import sys
      import traceback
      import dpm2 as dpm

      name = "/dpm/cern.ch/home/dteam/";

      try:
         dir = dpm.dpns_opendir(name)

         while 1:
            entry = dpm.dpns_readdirxr(dir)
            if entry == None:
               break
            print entry.d_name
            for i in range(entry.nbreplicas):
               print " ==> %s" % entry.rep[i].sfn

         dpm.dpns_closedir(dir)
      except TypeError, x:
         print " ==> None"
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpns_getreplica method
      """

      file = "/dpm/cern.ch/home/dteam/file.test"

      try:
         list = dpm.dpns_getreplica(file, "", "")
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      for i in list:
         print i.host
         print i.sfn

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpns_getacl and dpns_setacl methods to add a user ACL
      """

      file = "/dpm/cern.ch/home/dteam/file.test"

      try:
         acls_list = dpm.dpns_getacl(file)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      for i in acls_list:
              print i.a_type
              print i.a_id
              print i.a_perm

      # When adding a first ACL for a given user, you also need to add the mask
      # When adding the second user ACL, it is not necessary anymore

      acl_user = dpm.dpns_acl()
      acl_mask = dpm.dpns_acl()

      acl_user.a_type = lfc.CNS_ACL_USER
      acl_user.a_id = 18701         # user id
      acl_user.a_perm = 5

      acl_mask.a_type = lfc.CNS_ACL_MASK
      acl_mask.a_id = 0             # no user id specified
      acl_mask.a_perm = 5

      acls_list.append(acl_user)
      acls_list.append(acl_mask)

      try:
         dpm.dpns_setacl(file, acls_list)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpns_getacl and dpns_setacl methods to remove a user ACL
      """

      file = "/dpm/cern.ch/home/dteam/file.test"

      try:
         acls_list = dpm.dpns_getacl(file)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      for i in acls_list:
              print i.a_type
              print i.a_id
              print i.a_perm

      del acls_list[1]    # delete a given user ACL from the list of ACLs

      try:
         dpm.dpns_setacl(file, acls_list)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpns_getusrmap method
      """

      try:
         list = dpm.dpns_getusrmap()
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      for i in list:
         print i.userid + " " + i.username

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpns_getgrpmap method
      """

      try:
         list = dpm.dpns_getgrpmap()
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      for i in list:
         print i.gid + " " + i.groupname

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_addfs method
      """

      try:
         dpm.dpm_addfs("mypool", "mydiskserver.domain.com", "/mountpoint",                       dpm.FS_READONLY)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_modifyfs method
      """

      try:
         dpm.dpm_modifyfs("mydiskserver.domain.com", "/mountpoint",                       dpm.FS_READONLY)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_rmfs method
      """

      try:
         dpm.dpm_rmfs("mypool", "mydiskserver.domain.com", "/mountpoint")
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_addpool method
      """

      dpmpool = dpm.dpm_pool()
      dpmpool.poolname = "mypool"
      dpmpool.defsize = 209715200
      dpmpool.def_lifetime = 604800
      dpmpool.defpintime = 604800
      dpmpool.max_lifetime = 604800
      dpmpool.max_pintime = 604800
      dpmpool.nbgids = 1
      dpmpool.gids = [0]
      dpmpool.ret_policy = 'R'
      dpmpool.s_type = 'D'

      try:
         dpm.dpm_addpool(dpmpool)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_modifypool method
      """

      dpmpool = dpm.dpm_pool()
      dpmpool.poolname = "mypool"
      dpmpool.defsize = 209715200
      dpmpool.def_lifetime = 604800
      dpmpool.defpintime = 604800
      dpmpool.max_lifetime = 604800
      dpmpool.max_pintime = 604800
      dpmpool.nbgids = 1
      dpmpool.gids = [0]
      dpmpool.ret_policy = 'R'
      dpmpool.s_type = 'D'

      try:
         dpm.dpm_modifypool(dpmpool)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_rmpool method
      """

      try:
         dpm.dpm_rmpool("mypool")
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_getpoolfs method
      """

      try:
         list = dpm.dpm_getpoolfs("mypool")
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      print len(list)
      for i in list:
         print "POOL " + i.poolname + " SERVER " + i.server + " FS " + i.fs              + " CAPACITY " + i.capacity + " FREE " + i.free

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_getpools method
      """

      try:
         list = dpm.dpm_getpools()
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      print len(list)
      for i in list:
         print "POOL " + i.poolname + " CAPACITY " + i.capacity + " FREE " + i.free

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_getprotocols method
      """

      try:
         list = dpm.dpm_getprotocols()
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      print len(list)
      for i in list:
         print i

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_getspacemd method
      """

      try:
         list = dpm.dpm_getspacemd(["myspacetoken"])
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      print len(list)
      for i in list:
         print "TYPE " + i.s_type + " SPACETOKEN " i.s_token + " USERTOKEN "              + i.u_token + " TOTAL " + i.t_space + " GUARANTUEED " + i.g_space              + " UNUSED " + i.u_space + " POOL " + i.poolname

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_getspacetoken method
      """

      try:
         list = dpm.dpm_getspacetoken("myspacetokendesc")
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      print len(list)
      for i in list:
         print i

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_reservespace method
      """

      try:
         actual_s_type,actual_t_space,actual_g_space,actual_lifetime,s_token =                  dpm.dpm_reservespace('D', "myspacetokendesc", 'R', 'O', 209715200,                  209715200, 2592000, 0, "mypoolname")
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      print "TYPE " + actual_s_type + " TOTAL " + actual_t_space + " GUARANTEED "           + actual_g_space + " LIFETIME " + actual_lifetime + " TOKEN " + s_token

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_updatespace method
      """

      try:
         actual_t_space,actual_g_space,actual_lifetime =                  dpm.dpm_updatespace("myspacetoken", 209715200, 209715200, 2592000)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      print " TOTAL " + actual_t_space + " GUARANTEED " + actual_g_space           + " LIFETIME " + actual_lifetime

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_releasespace method
      """

      try:
         dpm.dpm_releasespace("myspacetoken", 0)
      except Exception:
         traceback.print_exc()
         sys.exit(1)

[1mEXAMPLE[0m
      #!/usr/bin/python

      import sys
      import traceback
      import dpm2 as dpm

      """
      # Using the dpm_ping method
      """

      try:
         info = dpm.dpm_ping("mydpmserver.domain.com")
      except Exception:
         traceback.print_exc()
         sys.exit(1)

      print info

[1mSEE ALSO[0m
      [1mDPM C interface man pages[0m

DPM          $Date: 2010-12-14 08:31:05 +0100 (Tue, 14 Dec 2010)d$pm2_python(3)