[Libguestfs] [PATCH V4] NEW API:ext:mke2fs

Wanlong Gao gaowanlong at cn.fujitsu.com
Wed Sep 19 08:54:28 UTC 2012


On 09/18/2012 04:22 PM, Wanlong Gao wrote:
> New api mke2fs for full configuration of filesystem.
> 
> Signed-off-by: Wanlong Gao <gaowanlong at cn.fujitsu.com>
> ---
> 
> Hi Rich,
> 
> I made this new version by rebasing against the lastest tree,
> there is something wrong with the test of "mke2journal_U",
> please review and teach me, thank you.
> 
> Regards,
> Wanlong Gao
> 
> 
> 
>  daemon/ext2.c             | 369 +++++++++++++++++++++++++++++++++++++++++++++-
>  generator/actions.ml      | 139 +++++++++++++++++
>  gobject/Makefile.inc      |   6 +-
>  guestfs-release-notes.txt |   5 +
>  po/POTFILES               |   2 +
>  src/MAX_PROC_NR           |   2 +-
>  6 files changed, 519 insertions(+), 4 deletions(-)
> 
> diff --git a/daemon/ext2.c b/daemon/ext2.c
> index 40b36d2..7fc1172 100644
> --- a/daemon/ext2.c
> +++ b/daemon/ext2.c
> @@ -29,7 +29,7 @@
>  #include "c-ctype.h"
>  #include "actions.h"
>  
> -#define MAX_ARGS 64
> +#define MAX_ARGS 128
>  

[..]

>  
> +  { defaults with
> +    name = "mke2fs";
> +    style = RErr, [Device "device"], [OInt64 "blockscount"; OInt64 "blocksize"; OInt64 "fragsize"; OInt64 "blockspergroup"; OInt64 "numberofgroups"; OInt64 "bytesperinode"; OInt64 "inodesize"; OInt64 "journalsize"; OInt64 "numberofinodes"; OInt64 "stridesize"; OInt64 "stripewidth"; OInt64 "maxonlineresize"; OInt "reservedblockspercentage"; OInt "mmpupdateinterval"; OString "journaldevice"; OString "label"; OString "lastmounteddir"; OString "creatoros"; OString "fstype"; OString "usagetype"; OString "uuid"; OBool "forcecreate"; OBool "writesbandgrouponly"; OBool "lazyitableinit"; OBool "lazyjournalinit"; OBool "testfs"; OBool "discard"; OBool "quotatype";  OBool "extent"; OBool "filetype"; OBool "flexbg"; OBool "hasjournal"; OBool "journaldev"; OBool "largefile"; OBool "quota"; OBool "resizeinode"; OBool "sparsesuper"; OBool "uninitbg"];
> +    proc_nr = Some 368;
> +    tests = [
> +      InitEmpty, Always, TestOutput (
> +        [["part_init"; "/dev/sda"; "mbr"];
> +         ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> +         ["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
> +         ["mke2fs"; "/dev/sda1"; ""; "4096"; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; ""; ""; "NOARG";
> +            "NOARG"; "NOARG"; "NOARG"; "NOARG"; "NOARG";
> +            "NOARG"; "true"; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; "true"; ""; "";
> +            ""; ""; ""];
> +         ["mke2fs"; "/dev/sda2"; ""; "4096"; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; ""; ""; "/dev/sda1";
> +            "NOARG"; "NOARG"; "NOARG"; "ext2"; "NOARG";
> +            "NOARG"; "true"; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; ""];
> +         ["mount"; "/dev/sda2"; "/"];
> +         ["write"; "/new"; "new file contents"];
> +         ["cat"; "/new"]], "new file contents");
> +      InitEmpty, Always, TestOutput (
> +        [["part_init"; "/dev/sda"; "mbr"];
> +         ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> +         ["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
> +         ["mke2fs"; "/dev/sda1"; ""; "4096"; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; ""; ""; "/dev/sda1";
> +            "JOURNAL"; "NOARG"; "NOARG"; "ext2"; "NOARG";
> +            "NOARG"; "true"; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; "true"; ""; "";
> +            ""; ""; ""];
> +         ["mke2fs"; "/dev/sda2"; ""; "4096"; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; ""; ""; "LABEL=JOURNAL";
> +            "JOURNAL"; "NOARG"; "NOARG"; "ext2"; "NOARG";
> +            "NOARG"; "true"; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; ""; ""; "";
> +            ""; ""; ""];
> +         ["mount"; "/dev/sda2"; "/"];
> +         ["write"; "/new"; "new file contents"];
> +         ["cat"; "/new"]], "new file contents");
> +        InitEmpty, Always, TestOutput (
> +          [["part_init"; "/dev/sda"; "mbr"];
> +           ["part_add"; "/dev/sda"; "p"; "64"; "204799"];
> +           ["part_add"; "/dev/sda"; "p"; "204800"; "-64"];
> +           ["mke2fs"; "/dev/sda1"; ""; "4096"; ""; ""; "";
> +              ""; ""; ""; ""; "";
> +              ""; ""; ""; ""; "NOARG";
> +              "NOARG"; "NOARG"; "NOARG"; "NOARG"; "NOARG";
> +(* there is something wrong with uuid *)

Can you teach me how to test the "uuid" here?


Thanks,
Wanlong Gao




More information about the Libguestfs mailing list