My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 8: Parsing XML document.
1 person starred this issue and may be notified of changes. Back to list
 
Project Member Reported by sneha.hendre@gmail.com, Dec 19, 2008
I have attached the XML file and the C file for parsing the file.
I am successful in getting the children nodes....
You can view the output on command line....

Compilation of file:

 gcc Child_parsing.c `xml2-config --cflags --libs`

Running The file:

 ./a.out OHSM_Create_XML.xml

The XML file is as specified by RKS...


Child_parsing.c
3.6 KB   View   Download
OHSM_Create_XML.xml
658 bytes   View   Download
outputFile
472 bytes   View   Download
Dec 19, 2008
Project Member #1 sandeepksinha
Can somebody take a quick look at it ?
Dec 19, 2008
Project Member #2 sandeepksinha
(No comment was entered for this change.)
Status: Need-Review
Dec 19, 2008
Project Member #3 imreckless@gmail.com
I have verified it , this works fine.

Dec 19, 2008
Project Member #4 sandeepksinha
Do recommend if you feel it requires any changes. We need to make the XML part
concrete. If I can recall, Rishi has documented once regarding the XML parsing and
the structure that will be passed from user to the kernel space.

Rishi, can you re-check on that and provide Sneha with any kind of feedback that she
needs.
Dec 19, 2008
Project Member #5 imreckless@gmail.com
XML file is fine. SH just see if you can validate this using DTD,

This is what u had suggested earlier, we will parse the XML file
to create a structure and give it to OHSM modules, we will use a char device for this.

This char device must be structured properly because this char device
will be used for all the interactions between user and kernel space.

I think SH can create a structure like

struct ohsm_info_user {
     unsigned int uid;
     unsigned int tier;
}

struct ohsm_info_group {
     unsigned int uid;
     unsigned int tier;
}

struct ohsm_allocation_info_ {
     struct ohsm_info_user user[10];
     struct ohsm_info_user group[10];
     ...
     ...
}

may be somthing of this sort, Rishi what say ??
Dec 19, 2008
Project Member #8 sneha.hendre@gmail.com
Yes I am going to validate it with DTD as it is essential...
I have also tried the structure as said by RKS but I was unsuccessful I tried
structure of kind...

struct name_tier{
    char name[10];
    char tier[10];
};
typedef struct OHSM_struct {
    struct name_tier *user[5];
    struct name_tier *group[5];
    struct name_tier *directory[5];
  
} OHSM_struct;

But its not working properly...it is giving a segmentation fault...It was checked by
VA also...I will try the way RKS said it may work hopefully.......


Also Rishi please send me the document that was told by SKS which contain the format
of structure....I need it urgently....If I will the format my 50% job will be
done......So do it asap....


Dec 19, 2008
Project Member #9 sandeepksinha
Rishi can you immediately follow up on this.
If you are not able to find the doc, I think you will probably get it at
fscops@gmail.com for sure, as we have a copy of all the mails there.


Dec 19, 2008
Project Member #10 sandeepksinha
https://code.google.com/p/fscops/downloads/list

Sneha, I repeat the document is present here. I told you yesterday as well.You can
immediately start your work. Also, rishi will help you with any clarifications, if
required. 

I want a working model by monday evening with all the data structures and as per our
initial design. You should be able to close this issue by monday evening and rishi
should agree on that.

I want just the basic/initial/primitive implementation.

Dec 19, 2008
Project Member #11 sneha.hendre@gmail.com
Yes sir,
I have gone through the documents but that is not what I want..I already have those
documents and the sample working code is ready till making the document....also
parsing of the document is also done...I have posted the working model for
that.....its just the part of making few minor changes...

What I want is format of the structure that we are going to pass through ioctl as you
said before....I am stuck over there....no document is mentioning about the format of
that structure.....

Once the sample structure is built I will start coding for all policies...Allocation
as well as relocation as per design in those documents it will hardly take some time
as the same code is to be implemented for all. Just I have to do is copy paste and
add the widget(text box,spinbutton etc.) names and few changes....

And also can make the XML file structure as you want any time....

RKS and VA have seen the output by running the code...of parsing as well as the
document which is built through GUI....I dont know about RA as he has not replied yet...
Dec 20, 2008
Project Member #12 sneha.hendre@gmail.com
I am successful in adding the parsed value to the structure....which can be passed...
I m attaching the code file, please do run and see the output


Sample XML file:


<?xml version = '1.0'?>
<create>
  <User>
    <user>Rohit</user>   <tier>Tier1</tier>
    <user>Rishi</user>   <tier>Tier3</tier>
    <user>Sneha</user>   <tier>Tier1</tier>
    <user>Sandeep</user> <tier>Tier2</tier>
  </User>
	
	<group>
	    <Group>Gid 1</Group>   <tier>Tier2</tier>
	    <Group>Gid 2</Group>   <tier>Tier3</tier>
	    <Group>Gid 3</Group>   <tier>Tier1</tier>
	    <Group>Gid 4</Group>   <tier>Tier1</tier>
	</group>

	<directory>
    	    <Directory>/usr/pool</Directory>   <tier>Tier2</tier>
	    <Directory>/src</Directory>   	   <tier>Tier1</tier>
	    <Directory>/abc/pqr</Directory>   	   <tier>tier2</tier>
	</directory>
</create>



output on terminal structure printed:


[root@localhost libxml]# gcc OHSM_struct.c `xml2-config --cflags --libs`
[root@localhost libxml]# ./a.out OHSM_Create_XML.xml
User 

USER = Rohit	Tier = Tier1
USER = Rishi	Tier = Tier3
USER = Sneha	Tier = Tier1
USER = Sandeep	Tier = Tier2
group 

Group = Gid 1	Tier = Tier2
Group = Gid 2	Tier = Tier3
Group = Gid 3	Tier = Tier1
Group = Gid 4	Tier = Tier1
directory 

DIRECTORY = /usr/pool	Tier = Tier2
DIRECTORY = /src	Tier = Tier1
DIRECTORY = /abc/pqr	Tier = tier2
[root@localhost libxml]# 
[root@localhost libxml]# 


I have attached the xml file before and the C file is attached......


OHSM_struct.c
4.1 KB   View   Download
Dec 21, 2008
Project Member #13 sneha.hendre@gmail.com
Latest code.....

The file is compiled by...

gcc OHSM_struct.c `xml2-config --cflags --libs`

And Run it as

./a.out OHSM_Create_XML.xml

OHSM_Create_XML.xml
658 bytes   View   Download
OHSM_struct.c
4.1 KB   View   Download
Dec 21, 2008
Project Member #14 sneha.hendre@gmail.com

I have made the XML parsing file it parses for the user, group and directory of
allocation policy....

The value of user group and directory and there corresponding tier is stored in
structure....

Further format of structure for all fields like for the total relocation and
allocation policy is to be decided....
Dec 21, 2008
Project Member #15 sandeepksinha
Hi Sneha,
I had a look, its just a very primitive implementation.
So, you have two classes to handle,

1. ALLOCATION POLICY.

This will create everything on tier 1.
This basically means that my first preference of choice for storage is TIER 1.
If that full, then take default.
<CREATE> 
 <ON> 
  <DESTINATION> 
       <CLASS> TIER1 </CLASS>
  </DESTINATION>
 </ON>
</CREATE>
 

This will create on TIER 1 when size is equal to 1 MB

This is one rule.
<CREATE> 
 <ON> 
  <DESTINATION> 
       <CLASS> TIER1 </CLASS>
         <SIZE units="MB" Cond="=" >1</SIZE> <- We can specify all our conditions here
  </DESTINATION>
 </ON>
</CREATE>
You can have multiple allocation rules in one file.


FOR RELOCATION:

[1] <RELOCATE>
[2]  <FROM>
[3]    <SOURCE><CLASS>...placement_class_name...</CLASS></SOURCE>
[4]    <SOURCE>...additional placement class specifications...</SOURCE>
[5]  </FROM>
[6]  <TO>
[7]    <DESTINATION>
[8]     <CLASS>...placement_class_name...</CLASS>
[9]      <BALANCE_SIZE Units="units_specifier">...chunk_size...</BALANCE_SIZE>
[10]   </DESTINATION>
[11]   <DESTINATION>...additional placement class specifications...</DESTINATION>
[12] </TO>
[13] <WHEN>...relocation conditions...</WHEN>
[14]</RELOCATE>
[15]
[16]

Similarly for relocation.

This is your next milestone. 
You can make changes to the keywords here. Or may be you have decide the easiest
way.We dont want a complex solution. Provide us a simple design.
You have to take a decision as you being the owner of this module.

Also, refer the doc, Using Dynamic Storage Tiering, it will be helpful.
Tell me how much time would you require for this.
Dec 21, 2008
Project Member #16 sneha.hendre@gmail.com
>>1. ALLOCATION POLICY.

>><CREATE> 
>> <ON> 
>>  <DESTINATION> 
>>       <CLASS> TIER1 </CLASS>
>>  </DESTINATION>
>> </ON>
>></CREATE>
 

Sir,this design is already done only the default tier is to be added....

U can see the above file in comment#12 it represents the same design but in much
simpler way....
I have also made the structure for the same..

Are we supposed to add multiple allocation rule for a single file??????

I will provide with the relocation design by Tuesday....as I am going out of station
tomorrow with family....

I have done all my work till the day....
Dec 21, 2008
Project Member #17 sandeepksinha
Tuesday is done !!!
do_commit(tuesday);
Dec 21, 2008
Project Member #18 sandeepksinha
This will create on TIER 1 when size is equal to 1 MB

This is one rule.
<CREATE> 
 <ON> 
  <DESTINATION> 
       <CLASS> TIER1 </CLASS>
         <SIZE units="MB" Cond="=" >1</SIZE> <- We can specify all our conditions here
  </DESTINATION>
 </ON>
</CREATE>


What baout this one ???

Status: In-progress
Labels: -Type-Defect Type-Enhancement
Dec 21, 2008
Project Member #19 sneha.hendre@gmail.com
I asked the same thing that ...
for a particular file are we going to have two or more policies

like for abc.c with userid Rishi and filesize > 12MB

or we have to set priorities 

we will first see for
1.User
then 
2.Group
then
3.Directory etc.
Dec 21, 2008
Project Member #20 sandeepksinha
Good question infact.
Firstly yes, we surely can have more than one policy for a particular class of data.
And we also will have priorities too, but now in user space but in the file system
driver.
We will have some heuristics to decide the priority inside the file system driver.
So, you just focus on parsing and converting the policy file into a structure.

Dec 21, 2008
Project Member #21 imreckless@gmail.com
Here we need to consider conflicts that arise.
For eg. 
Consider policy of file size and user id.
Take abc.txt if file size > 12 Mb then tier 1
and user id SH then tier 2. So file abc.txt is
qualified for both the tiers, so we raise a policy conflict.
In this case we cant enforce both the policy.
So according to me, we should restrict it to any one policy
preferably user.
Dec 29, 2008
Project Member #22 imreckless@gmail.com
The final structure of XML needs to be confirmed.
Jan 13, 2009
Project Member #23 sneha.hendre@gmail.com
Issues regarding parsing of XML file is resolved .... 
Any XML file can now be parsed successfully 
And for deciding final data structure another issue has been already opened so can I
close this issue ???? 
Jan 13, 2009
Project Member #24 sandeepksinha
Hi Sneha, The other issue will be dealing with the data structures in which you will
move the information after parsing.
This issue should be used to provide the sample policy file and the method/algorithm
that you would use to parse the XML file.

You can also provide your GUI to XML file creation here.
 
Jan 14, 2009
Project Member #25 sandeepksinha
(No comment was entered for this change.)
Cc: -fscops -sandeepksinha -imreckless -postrishi -bharati.alatgi -checkout.vineet -sneha.hendre
Jan 14, 2009
Project Member #26 sandeepksinha
I think Rishi has done enough on this.
Moving the ownership to rishi.
Will decide later if it needs to be re-owned by sneha or not.
Jan 14, 2009
Project Member #27 sandeepksinha
(No comment was entered for this change.)
Owner: postrishi
Jan 14, 2009
#28 postri...@gmail.com
sneha,

can you just see how DTD's or any other feature of XML can check the correctness of
any xml file

for eg:

in CLI mode the user may enter an incorrect file.

The error may be of type: he may have made a spelling mistake in the tags <device>
written as <evice>


second:

he may have assigned same device to two different tiers


try to find out any in built tool , or any feature already present

if nothing is present then write algo for doing the same
Owner: sneha.hendre
Cc: fscops sandeepksinha postrishi imreckless rohitvashist2kk3 checkout.vineet bharati.alatgi sneha.hendre
Labels: -Type-Enhancement -Priority-Low Type-Defect Priority-Critical
Jan 15, 2009
Project Member #29 sneha.hendre@gmail.com
I have written the modification in the code I have attached a file
see the commented part in function parseinfo and parseuser

if you want more detailed code for parseuser then will give it by evening
and this code will appear in group directory types etc. etc.


ohsm_xml_policy_functions.c
7.6 KB   View   Download
Jan 29, 2009
Project Member #30 sneha.hendre@gmail.com
Parsing of XML file is done.

Just validation is remaining.

Its is parsing the documents(XML files)

As XML files created by GUI will not have to be validated.
just checking of mount point will be there.

If you say then I will start parser. 
If correct files are passed to the parser then it working perfectly fine.

And the files generated by GUI are perfectly fine.

Jan 29, 2009
Project Member #31 sandeepksinha
Remember that you parser will be invoked from the CLI as well. and there you will
surely require a validation mechanism.


Jan 29, 2009
#32 postri...@gmail.com
as of now the parser will accept only completely correct file.

Even small mistakes results in a crash
Jan 29, 2009
Project Member #33 sandeepksinha
Thats not acceptable to me.
Sneha, why is such a restriction ???

You said the parser is complete...
I want the parser to be complete...
Its not acceptable to me that the parser is still not functional.

Leave the GUI as of now...
I want the parser first.
I have mentioned this to Sneha earlier as well.
Jan 29, 2009
#34 postri...@gmail.com
The program is not resulting in crash. 
I was wrong to report that

The libxml is giving the errors when it gets error in tags

We plan to move that errors to a temporary file and tell the user that

OHSM could not start : parsing of "xyz.file" resulted in error. The error file is
created /a/b/c/erro1.ohsm


Jan 30, 2009
#35 postri...@gmail.com
The validation part is currently been looked upon by rishi and sneha.

Sneha's GUI work is on hold for now
Jan 30, 2009
#36 postri...@gmail.com
The parsing of xml file is done.

This issue is closed.

Opening new issue for validation
Status: Fixed

Powered by Google Project Hosting