Topic
  • 14 replies
  • Latest Post - ‏2013-09-06T15:51:44Z by dwg
HajoEhlers
HajoEhlers
253 Posts

Pinned topic manpage for mmsetquota missing !?

‏2012-03-21T11:09:08Z |
Hi

Given: GPFS v3.4 PTF 11

Task: Deploy GPFS quotas automaticly via mmsetquota .

Problem:
Its looks like that the command mmsetquota can be used to deploy quota setting in a none interactive mode but i could not find a man page for this command.

cheers
Hajo
Updated on 2012-03-23T10:53:36Z at 2012-03-23T10:53:36Z by cap_
  • truongv
    truongv
    95 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T15:02:25Z  
    This command is not officially supported. Thus, you will not find a man page for it.
  • ralfu
    ralfu
    2 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T15:18:56Z  
    some hints in this thread: Setting quota on the command prompt
  • HajoEhlers
    HajoEhlers
    253 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T15:46:30Z  
    • ralfu
    • ‏2012-03-21T15:18:56Z
    some hints in this thread: Setting quota on the command prompt
    I have read the thread and that the reason for this question. On AIX i am used NOT to edit files but use commands to manipulate them.

    The only offical way seems to be to use these interactive mmedquota command. Thats a nogo.

    In any way i will use mmsetquota :-)

    cheers
    Hajo

    BTW: SONAS does have a setquota command.
  • SystemAdmin
    SystemAdmin
    2092 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T20:07:52Z  
    I have read the thread and that the reason for this question. On AIX i am used NOT to edit files but use commands to manipulate them.

    The only offical way seems to be to use these interactive mmedquota command. Thats a nogo.

    In any way i will use mmsetquota :-)

    cheers
    Hajo

    BTW: SONAS does have a setquota command.
    I wrote this in another thread on this board last October, 2011:

    I would agree this use of EDITOR is funky and there ought to be a supported, documented, "real" command line style command.... BUT ---

    you can export EDITOR=/your-own-funky-script

    Then your own funky script can write a GPFS quota settings file to its argument and there you go.

    Haven't tried this but your-own-funky-script could be this simple:

    cat /path-to/my-quota-settings >$1
    If you needed to regularize this, you could build a cover script that did something like

    1. Construct your quota settings and copy to a temp file: temp1

    2. Write your funky script to another temp file: temp2

    3. invoke: `EDITOR=temp2 mmedquota -whatever flags ...`

    4. clean up.
  • HajoEhlers
    HajoEhlers
    253 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T20:21:05Z  
    I wrote this in another thread on this board last October, 2011:

    I would agree this use of EDITOR is funky and there ought to be a supported, documented, "real" command line style command.... BUT ---

    you can export EDITOR=/your-own-funky-script

    Then your own funky script can write a GPFS quota settings file to its argument and there you go.

    Haven't tried this but your-own-funky-script could be this simple:

    cat /path-to/my-quota-settings >$1
    If you needed to regularize this, you could build a cover script that did something like

    1. Construct your quota settings and copy to a temp file: temp1

    2. Write your funky script to another temp file: temp2

    3. invoke: `EDITOR=temp2 mmedquota -whatever flags ...`

    4. clean up.
    Hi Marc,
    i know your solution but never understood ... ;-(

    Like i said , the mmsetquota is fine but it should be officially supported. It make no sense that everyone is imho inventing its own version.

    BTW:
    I used the cat ( EDITOR=/usr/bin/cat ; mmedquota ) command to get the output to stdout. This way i would be able to parse and change the output but i do not know of an easy way to send the result back to the 'final' quota file.

    So in the logic of the future script ' setquota'

    EDITOR=/usr/bin/cat ; mmedquota | MyChanges | ( EDITOR=??? ; mmedquota )

    the ??? is open. Hm - i could use ed . Any other idea ?
    Hajo
  • SystemAdmin
    SystemAdmin
    2092 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T21:05:31Z  
    Hi Marc,
    i know your solution but never understood ... ;-(

    Like i said , the mmsetquota is fine but it should be officially supported. It make no sense that everyone is imho inventing its own version.

    BTW:
    I used the cat ( EDITOR=/usr/bin/cat ; mmedquota ) command to get the output to stdout. This way i would be able to parse and change the output but i do not know of an easy way to send the result back to the 'final' quota file.

    So in the logic of the future script ' setquota'

    EDITOR=/usr/bin/cat ; mmedquota | MyChanges | ( EDITOR=??? ; mmedquota )

    the ??? is open. Hm - i could use ed . Any other idea ?
    Hajo
    Let me try again...

    Assuming you've figured out the funky syntax that mmedquota uses to set quotas...

    Your script does A-F)

    A) Writes a valid GPFS quota specification to file temp1.

    B) Writes a file into temp2 that is a script that looks like this:

    #!/bin/bash
    cat temp1 >$1 # write policy into $1 which is the path where mmedquota wants it. This overwrites the prototype that was written into $1 by mmedquota

    C) chmod a+x temp2 # make temp2 is executable

    D) EDITOR=temp2 mmedquota mmedquota options # mmedquota will "call back" the script temp2

    E) # Check the $?, assuming mmedquota is able to parse temp1, the new quotas should be set.

    F) rm temp1 temp2 # erase the temp files
  • SystemAdmin
    SystemAdmin
    2092 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T21:18:11Z  
    Let me try again...

    Assuming you've figured out the funky syntax that mmedquota uses to set quotas...

    Your script does A-F)

    A) Writes a valid GPFS quota specification to file temp1.

    B) Writes a file into temp2 that is a script that looks like this:

    #!/bin/bash
    cat temp1 >$1 # write policy into $1 which is the path where mmedquota wants it. This overwrites the prototype that was written into $1 by mmedquota

    C) chmod a+x temp2 # make temp2 is executable

    D) EDITOR=temp2 mmedquota mmedquota options # mmedquota will "call back" the script temp2

    E) # Check the $?, assuming mmedquota is able to parse temp1, the new quotas should be set.

    F) rm temp1 temp2 # erase the temp files
    And yet again, this time with your ed idea, but lets use sed which is designed for this purpose
    Assuming you've figured out a set of sed commands to change the quotas.

    Your script does A-F)

    A) Put your sed script into temp1. temp1 will contain the sed commands to modify the mmedquota style quota specifications

    B) Write a file into temp2 that is a script that looks like this:

    #!/bin/bash
    sed -f temp1 --in-place $1 # edit in place the mmedquota spec file

    C) chmod a+x temp2 # make temp2 executable

    D) EDITOR=temp2 mmedquota [mmedquota options] # mmedquota will "call back" the script temp2

    E) # Check the $?, assuming mmedquota is able to parse temp1, the new quotas should be set.

    F) rm temp1 temp2 # erase the temp files
  • dlmcnabb
    dlmcnabb
    1012 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T21:24:31Z  
    Hi Marc,
    i know your solution but never understood ... ;-(

    Like i said , the mmsetquota is fine but it should be officially supported. It make no sense that everyone is imho inventing its own version.

    BTW:
    I used the cat ( EDITOR=/usr/bin/cat ; mmedquota ) command to get the output to stdout. This way i would be able to parse and change the output but i do not know of an easy way to send the result back to the 'final' quota file.

    So in the logic of the future script ' setquota'

    EDITOR=/usr/bin/cat ; mmedquota | MyChanges | ( EDITOR=??? ; mmedquota )

    the ??? is open. Hm - i could use ed . Any other idea ?
    Hajo
    To set the quota back, the script that mmedquota calls must overwrite the file that was passed in. Internally, it just opens the temporaty file to write it then seeks back to offset 0 to read the results back. So you cannot write the results to a different file (even with the same name).

    This "same file" semantics is sometimes broken if vi is used as the editor since it sometimes (some operating systems) puts the saved data into a new file with the old name.
  • truongv
    truongv
    95 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-21T21:27:11Z  
    Hi Marc,
    i know your solution but never understood ... ;-(

    Like i said , the mmsetquota is fine but it should be officially supported. It make no sense that everyone is imho inventing its own version.

    BTW:
    I used the cat ( EDITOR=/usr/bin/cat ; mmedquota ) command to get the output to stdout. This way i would be able to parse and change the output but i do not know of an easy way to send the result back to the 'final' quota file.

    So in the logic of the future script ' setquota'

    EDITOR=/usr/bin/cat ; mmedquota | MyChanges | ( EDITOR=??? ; mmedquota )

    the ??? is open. Hm - i could use ed . Any other idea ?
    Hajo
    I think you can do something like this.

    Create file MyChanges2 and make it executable
    
    #!/bin/ksh   set -e   /bin/cat $1 | MyChanges > /tmp/mmedquota.input.$$ /bin/cp /tmp/mmedquota.input.$$ $1 /bin/rm -f /tmp/mmedquota.input.$$ exit 0
    


    Then change the EDITOR before calling mmedquota
    
    EDITOR=MyChanges2 mmedquota 
    {option
    }
    


    MyChanges2 should be a full path name of the script.
  • SystemAdmin
    SystemAdmin
    2092 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-22T12:19:19Z  
    • truongv
    • ‏2012-03-21T21:27:11Z
    I think you can do something like this.

    Create file MyChanges2 and make it executable
    <pre class="jive-pre"> #!/bin/ksh set -e /bin/cat $1 | MyChanges > /tmp/mmedquota.input.$$ /bin/cp /tmp/mmedquota.input.$$ $1 /bin/rm -f /tmp/mmedquota.input.$$ exit 0 </pre>

    Then change the EDITOR before calling mmedquota
    <pre class="jive-pre"> EDITOR=MyChanges2 mmedquota {option } </pre>

    MyChanges2 should be a full path name of the script.
    All of those suggestions are totally disgusting to put it mildly.

    That lack of supported command line setting of quota's is a failing, just like the lack of command line ACL setting options.

    That said loads of the mm commands don't have manual pages, so I have been happily using mmsetquota for ages assuming that lack of man page was just par for the course.
  • SystemAdmin
    SystemAdmin
    2092 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-22T14:53:47Z  
    All of those suggestions are totally disgusting to put it mildly.

    That lack of supported command line setting of quota's is a failing, just like the lack of command line ACL setting options.

    That said loads of the mm commands don't have manual pages, so I have been happily using mmsetquota for ages assuming that lack of man page was just par for the course.
    I won't argue that at all ;-) Just pointing out that there are ways to build a CLI on top of a EDITOR style UI.

    Here's a hint I didn't tell you and that IBM reserves the right to change in any PTF or release:

    `tssetquota` will issue a usage message that looks pretty easy to follow. And there's no harm in defined a test group, fileset, or userid to
    "play around with".

    Use
    `mmlsquota ...` to confirm any changes you might make with any of the XXsetquota or XXedquota commands.
  • cap_
    cap_
    17 Posts

    Re: manpage for mmsetquota missing !?

    ‏2012-03-23T10:53:36Z  
    All of those suggestions are totally disgusting to put it mildly.

    That lack of supported command line setting of quota's is a failing, just like the lack of command line ACL setting options.

    That said loads of the mm commands don't have manual pages, so I have been happily using mmsetquota for ages assuming that lack of man page was just par for the course.
    I completely agree with Jonathan (mmedquota is horrible, we use mmsetquota)
  • dwg
    dwg
    2 Posts

    Re: manpage for mmsetquota missing !?

    ‏2013-08-29T23:58:49Z  
    • cap_
    • ‏2012-03-23T10:53:36Z
    I completely agree with Jonathan (mmedquota is horrible, we use mmsetquota)

    I realize this post is a bit stale but I was wondering if anyone knew the inputFile format for mmsetquota -f.  According to the command usage:

     

    # mmsetquota -h

     [[ snip ]]

     mmsetquota -f  inputFile                  // input file in -Y format

     

    Any ideas what "-Y format" means?  A quick peruse through the tssetquota source file would easily identify but, alas, I do not have access to this.  Any information appreciated!

  • dwg
    dwg
    2 Posts

    Re: manpage for mmsetquota missing !?

    ‏2013-09-06T15:51:44Z  
    • dwg
    • ‏2013-08-29T23:58:49Z

    I realize this post is a bit stale but I was wondering if anyone knew the inputFile format for mmsetquota -f.  According to the command usage:

     

    # mmsetquota -h

     [[ snip ]]

     mmsetquota -f  inputFile                  // input file in -Y format

     

    Any ideas what "-Y format" means?  A quick peruse through the tssetquota source file would easily identify but, alas, I do not have access to this.  Any information appreciated!

    Thanks to the GPFS Team for this reply!

    1. "mmsetquota -f ". Its goal is for restoring quota configure. "mmrepquota -Y" backups quota configure to a file and "mmsetquota -f " restores it. The format is like:

    [root@gpfsbc01b09 ~]# mmrepquota -Y gpfs mmrepquota::HEADER:version:reserved:reserved:filesystemName:quotaType:id:name:blockUsage:blockQuota:blockLimit:blockInDoubt:blockGrace:filesUsage:filesQuota:filesLimit:filesInDoubt:filesGrace:remarks:quota:defQuota:fid:filesetname: mmrepquota::0:1:::gpfs:USR:0:root:2410760:0:0:38057728:none:2:0:0:399:none:i:on:off::: mmrepquota::0:1:::gpfs:USR:99:nobody:0:0:1048576000:0:none:99:0:0:0:none:e:on:off::: mmrepquota::0:1:::gpfs:GRP:0:root:2410760:0:0:38057728:none:2:0:0:399:none:i:on:off::: mmrepquota::0:1:::gpfs:GRP:99:nobody:0:0:0:0:none:99:0:0:0:none:i:on:off:::99:none:i:on:off::: mmrepquota::0:1:::gpfs:FILESET:0:root:2410752:0:0:38057728:none:1:0:0:3 mmrepquota::0:1:::gpfs:FILESET:1:ss1:8:0:0:0:none:100:0:100:0:none:e:on:off:::

    2. mmsetquota is the right way to set quota without interactive input. Until now, it isn't an official gpfs command and isn't recorded in gpfs manual. In the coming gpfs 4.1, it will become an official gpfs command.

    Best Regards,

    Landen ( Tian Zhi Yong )

    GPFS Development, CSTL Tel:(8610)82451743 Mobile: 13121720799 EMail: tianzy@cn.ibm.com 28,ZhongGuanCun Software Park,No.8 Dong Bei Wang West Road Haidian District Beijing P.R.China 100193