diff --git a/include/Group.h b/include/Group.h
index 51086f12c6..0fdd367efa 100644
--- a/include/Group.h
+++ b/include/Group.h
@@ -97,9 +97,10 @@ private:
      *  Execute an INSERT or REPLACE Sql query.
      *    @param db The SQL DB
      *    @param replace Execute an INSERT or a REPLACE
+     *    @param error_str Returns the error reason, if any
      *    @return 0 one success
-    */
-    int insert_replace(SqlDB *db, bool replace);
+     */
+    int insert_replace(SqlDB *db, bool replace, string& error_str);
 
     /**
      *  Bootstraps the database table(s) associated to the Group
@@ -119,16 +120,7 @@ private:
      */
     int insert(SqlDB *db, string& error_str)
     {
-        int rc;
-
-        rc = insert_replace(db, false);
-
-        if ( rc != 0 )
-        {
-            error_str = "Error inserting Group in DB.";
-        }
-
-        return rc;
+        return insert_replace(db, false, error_str);
     }
 
     /**
@@ -138,7 +130,8 @@ private:
      */
     int update(SqlDB *db)
     {
-        return insert_replace(db, true);
+        string error_str;
+        return insert_replace(db, true, error_str);
     }
 };
 
diff --git a/include/Host.h b/include/Host.h
index cb9403cdf4..9ef83f0149 100644
--- a/include/Host.h
+++ b/include/Host.h
@@ -371,9 +371,10 @@ private:
      *  Execute an INSERT or REPLACE Sql query.
      *    @param db The SQL DB
      *    @param replace Execute an INSERT or a REPLACE
+     *    @param error_str Returns the error reason, if any
      *    @return 0 one success
-    */
-    int insert_replace(SqlDB *db, bool replace);
+     */
+    int insert_replace(SqlDB *db, bool replace, string& error_str);
 
     /**
      *  Bootstraps the database table(s) associated to the Host
@@ -391,14 +392,21 @@ private:
      *    @param db pointer to the db
      *    @return 0 on success
      */
-    int insert(SqlDB *db, string& error_str);
+    int insert(SqlDB *db, string& error_str)
+    {
+        return insert_replace(db, false, error_str);
+    };
 
     /**
      *  Writes/updates the Hosts data fields in the database.
      *    @param db pointer to the db
      *    @return 0 on success
      */
-    int update(SqlDB *db);
+    int update(SqlDB *db)
+    {
+        string error_str;
+        return insert_replace(db, true, error_str);
+    };
 };
 
 #endif /*HOST_H_*/
diff --git a/include/Image.h b/include/Image.h
index 46575ad428..563ecca9db 100644
--- a/include/Image.h
+++ b/include/Image.h
@@ -349,9 +349,10 @@ private:
      *  Execute an INSERT or REPLACE Sql query.
      *    @param db The SQL DB
      *    @param replace Execute an INSERT or a REPLACE
+     *    @param error_str Returns the error reason, if any
      *    @return 0 on success
-    */
-    int insert_replace(SqlDB *db, bool replace);
+     */
+    int insert_replace(SqlDB *db, bool replace, string& error_str);
 
     /**
      *  Bootstraps the database table(s) associated to the Image
diff --git a/include/ObjectXML.h b/include/ObjectXML.h
index 9be989618b..188beb8b09 100644
--- a/include/ObjectXML.h
+++ b/include/ObjectXML.h
@@ -152,6 +152,14 @@ public:
      */
     int update_from_node(const xmlNodePtr node);
 
+    /**
+     *  Validates the xml string
+     *
+     *  @param xml_doc string to parse
+     *  @return 0 if the xml validates
+     */
+    static int validate_xml(const string &xml_doc);
+
     // ---------------------------------------------------------
     //  Lex & bison parser for requirements and rank expressions
     // ---------------------------------------------------------
diff --git a/include/RequestManagerAllocate.h b/include/RequestManagerAllocate.h
index e2561eb4d9..c9921b39d0 100644
--- a/include/RequestManagerAllocate.h
+++ b/include/RequestManagerAllocate.h
@@ -210,7 +210,7 @@ public:
     HostAllocate():
         RequestManagerAllocate("HostAllocate",
                                "Allocates a new host",
-                               "A:sssss",
+                               "A:ssssss",
                                false)
     {    
         Nebula& nd  = Nebula::instance();
diff --git a/include/User.h b/include/User.h
index 39a28c1c76..c0cd2c0e14 100644
--- a/include/User.h
+++ b/include/User.h
@@ -250,9 +250,10 @@ private:
      *  Execute an INSERT or REPLACE Sql query.
      *    @param db The SQL DB
      *    @param replace Execute an INSERT or a REPLACE
+     *    @param error_str Returns the error reason, if any
      *    @return 0 one success
      */
-    int insert_replace(SqlDB *db, bool replace);
+    int insert_replace(SqlDB *db, bool replace, string& error_str);
 
     /**
      *  Bootstraps the database table(s) associated to the User
@@ -320,7 +321,10 @@ protected:
      *    @param db pointer to the db
      *    @return 0 on success
      */
-    int insert(SqlDB *db, string& error_str);
+    int insert(SqlDB *db, string& error_str)
+    {
+        return insert_replace(db, false, error_str);
+    };
 
     /**
      *  Writes/updates the User data fields in the database.
@@ -329,7 +333,8 @@ protected:
      */
     int update(SqlDB *db)
     {
-        return insert_replace(db, true);
+        string error_str;
+        return insert_replace(db, true, error_str);
     }
 };
 
diff --git a/include/VMTemplate.h b/include/VMTemplate.h
index 130cbcc851..5409a06768 100644
--- a/include/VMTemplate.h
+++ b/include/VMTemplate.h
@@ -102,9 +102,10 @@ private:
      *  Execute an INSERT or REPLACE Sql query.
      *    @param db The SQL DB
      *    @param replace Execute an INSERT or a REPLACE
+     *    @param error_str Returns the error reason, if any
      *    @return 0 one success
      */
-    int insert_replace(SqlDB *db, bool replace);
+    int insert_replace(SqlDB *db, bool replace, string& error_str);
 
     /**
      *  Bootstraps the database table(s) associated to the VMTemplate
@@ -152,6 +153,7 @@ protected:
     /**
      *  Writes the VMTemplate in the database.
      *    @param db pointer to the db
+     *    @param error_str Returns the error reason, if any
      *    @return 0 on success
      */
     int insert(SqlDB *db, string& error_str);
@@ -163,7 +165,8 @@ protected:
      */
     int update(SqlDB *db)
     {
-        return insert_replace(db, true);
+        string err;
+        return insert_replace(db, true, err);
     };
 };
 
diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h
index a375b97242..5ea07918bc 100644
--- a/include/VirtualMachine.h
+++ b/include/VirtualMachine.h
@@ -834,9 +834,10 @@ private:
      *  Execute an INSERT or REPLACE Sql query.
      *    @param db The SQL DB
      *    @param replace Execute an INSERT or a REPLACE
+     *    @param error_str Returns the error reason, if any
      *    @return 0 one success
-    */
-    int insert_replace(SqlDB *db, bool replace);
+     */
+    int insert_replace(SqlDB *db, bool replace, string& error_str);
 
     /**
      *  Updates the VM history record
@@ -954,7 +955,8 @@ protected:
      */
     int update(SqlDB * db)
     {
-        return insert_replace(db, true);
+        string error_str;
+        return insert_replace(db, true, error_str);
     }
 
     /**
diff --git a/include/VirtualNetwork.h b/include/VirtualNetwork.h
index cca301be12..44ec7b604b 100644
--- a/include/VirtualNetwork.h
+++ b/include/VirtualNetwork.h
@@ -257,9 +257,10 @@ private:
      *  Execute an INSERT or REPLACE Sql query.
      *    @param db The SQL DB
      *    @param replace Execute an INSERT or a REPLACE
+     *    @param error_str Returns the error reason, if any
      *    @return 0 on success
      */
-    int insert_replace(SqlDB *db, bool replace);
+    int insert_replace(SqlDB *db, bool replace, string& error_str);
 
     /**
      *  Bootstraps the database table(s) associated to the Virtual Network
@@ -355,7 +356,8 @@ private:
      */
     int update(SqlDB * db)
     {
-        return insert_replace(db, true);
+        string error_str;
+        return insert_replace(db, true, error_str);
     }
 
     /**
diff --git a/install.sh b/install.sh
index 3d4e4e933d..cf822b82a8 100755
--- a/install.sh
+++ b/install.sh
@@ -180,7 +180,8 @@ fi
 SHARE_DIRS="$SHARE_LOCATION/examples \
             $SHARE_LOCATION/examples/tm"
 
-ETC_DIRS="$ETC_LOCATION/im_ec2 \
+ETC_DIRS="$ETC_LOCATION/image \
+          $ETC_LOCATION/im_ec2 \
           $ETC_LOCATION/vmm_ec2 \
           $ETC_LOCATION/vmm_exec \
           $ETC_LOCATION/tm_shared \
@@ -469,6 +470,7 @@ INSTALL_ETC_FILES=(
     VMWARE_ETC_FILES:$ETC_LOCATION
     VMM_EC2_ETC_FILES:$ETC_LOCATION/vmm_ec2
     VMM_EXEC_ETC_FILES:$ETC_LOCATION/vmm_exec
+    IMAGE_DRIVER_FS_ETC_FILES:$ETC_LOCATION/image/
     IM_EC2_ETC_FILES:$ETC_LOCATION/im_ec2
     TM_SHARED_ETC_FILES:$ETC_LOCATION/tm_shared
     TM_SSH_ETC_FILES:$ETC_LOCATION/tm_ssh
@@ -731,6 +733,9 @@ VMWARE_TM_COMMANDS_LIB_FILES="src/tm_mad/vmware/tm_clone.sh \
 # Image Repository drivers, to be installed under $REMOTES_LOCATION/image
 #   - FS based Image Repository, $REMOTES_LOCATION/image/fs
 #-------------------------------------------------------------------------------
+
+IMAGE_DRIVER_FS_ETC_FILES="src/image_mad/remotes/fs/fs.conf"
+
 IMAGE_DRIVER_FS_SCRIPTS="src/image_mad/remotes/fs/cp \
                          src/image_mad/remotes/fs/mkfs \
                          src/image_mad/remotes/fs/mv \
diff --git a/share/doc/xsd/README.txt b/share/doc/xsd/README.txt
new file mode 100644
index 0000000000..00d6a90185
--- /dev/null
+++ b/share/doc/xsd/README.txt
@@ -0,0 +1,9 @@
+These XML Schemas define the XMLs returned by OpenNebula's XML-RPC API.
+
+The included XML samples are not actual responses from OpenNebula, as it does
+not include the headers (namespace, schema location).
+
+
+To learn more, please read the API reference documentation at
+http://opennebula.org/documentation:documentation:api
+
diff --git a/share/doc/xsd/group.xsd b/share/doc/xsd/group.xsd
new file mode 100644
index 0000000000..eb36432fff
--- /dev/null
+++ b/share/doc/xsd/group.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:element name="GROUP">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="ID" type="xs:integer"/>
+        <xs:element name="NAME" type="xs:string"/>
+        <xs:element name="USERS">
+              <xs:complexType>
+                <xs:sequence>
+                  <xs:element name="ID" type="xs:integer" minOccurs="0" maxOccurs="unbounded"/>
+                </xs:sequence>
+              </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/group_pool.xsd b/share/doc/xsd/group_pool.xsd
new file mode 100644
index 0000000000..c8dc69c06b
--- /dev/null
+++ b/share/doc/xsd/group_pool.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:include schemaLocation="group.xsd"/>
+  <xs:element name="GROUP_POOL">
+    <xs:complexType>
+      <xs:sequence maxOccurs="1" minOccurs="1">
+        <xs:element ref="GROUP" maxOccurs="unbounded" minOccurs="0"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
\ No newline at end of file
diff --git a/share/doc/xsd/host.xsd b/share/doc/xsd/host.xsd
new file mode 100644
index 0000000000..58fa4d8bbe
--- /dev/null
+++ b/share/doc/xsd/host.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://opennebula.org/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema">
+  <xs:element name="HOST">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="ID" type="xs:integer"/>
+        <xs:element name="NAME" type="xs:string"/>
+        <xs:element name="STATE" type="xs:integer"/>
+        <xs:element name="IM_MAD" type="xs:string"/>
+        <xs:element name="VM_MAD" type="xs:string"/>
+        <xs:element name="VN_MAD" type="xs:string"/>
+        <xs:element name="TM_MAD" type="xs:string"/>
+        <xs:element name="LAST_MON_TIME" type="xs:integer"/>
+        <xs:element name="HOST_SHARE">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="DISK_USAGE" type="xs:integer"/>
+              <xs:element name="MEM_USAGE" type="xs:integer"/>
+              <xs:element name="CPU_USAGE" type="xs:integer"/>
+              <xs:element name="MAX_DISK" type="xs:integer"/>
+              <xs:element name="MAX_MEM" type="xs:integer"/>
+              <xs:element name="MAX_CPU" type="xs:integer"/>
+              <xs:element name="FREE_DISK" type="xs:integer"/>
+              <xs:element name="FREE_MEM" type="xs:integer"/>
+              <xs:element name="FREE_CPU" type="xs:integer"/>
+              <xs:element name="USED_DISK" type="xs:integer"/>
+              <xs:element name="USED_MEM" type="xs:integer"/>
+              <xs:element name="USED_CPU" type="xs:integer"/>
+              <xs:element name="RUNNING_VMS" type="xs:integer"/>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="TEMPLATE" type="xs:anyType"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/host_pool.xsd b/share/doc/xsd/host_pool.xsd
new file mode 100644
index 0000000000..5d797d3cbb
--- /dev/null
+++ b/share/doc/xsd/host_pool.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:include schemaLocation="host.xsd"/>
+  <xs:element name="HOST_POOL">
+    <xs:complexType>
+      <xs:sequence maxOccurs="1" minOccurs="1">
+        <xs:element ref="HOST" maxOccurs="unbounded" minOccurs="0"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/image.xsd b/share/doc/xsd/image.xsd
new file mode 100644
index 0000000000..207cee1bd0
--- /dev/null
+++ b/share/doc/xsd/image.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://opennebula.org/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema">
+  <xs:element name="IMAGE">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="ID" type="xs:integer"/>
+        <xs:element name="UID" type="xs:integer"/>
+        <xs:element name="GID" type="xs:integer"/>
+        <xs:element name="UNAME" type="xs:string"/>
+        <xs:element name="GNAME" type="xs:string"/>
+        <xs:element name="NAME" type="xs:string"/>
+        <xs:element name="TYPE" type="xs:integer"/>
+        <xs:element name="PUBLIC" type="xs:integer"/>
+        <xs:element name="PERSISTENT" type="xs:integer"/>
+        <xs:element name="REGTIME" type="xs:integer"/>
+        <xs:element name="SOURCE" type="xs:string"/>
+        <xs:element name="PATH" type="xs:string"/>
+        <xs:element name="FSTYPE" type="xs:string"/>
+        <xs:element name="SIZE" type="xs:integer"/>
+        <xs:element name="STATE" type="xs:integer"/>
+        <xs:element name="RUNNING_VMS" type="xs:integer"/>
+        <xs:element name="TEMPLATE" type="xs:anyType"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/image_pool.xsd b/share/doc/xsd/image_pool.xsd
new file mode 100644
index 0000000000..6e39f45267
--- /dev/null
+++ b/share/doc/xsd/image_pool.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:include schemaLocation="image.xsd"/>
+  <xs:element name="IMAGE_POOL">
+    <xs:complexType>
+      <xs:sequence maxOccurs="1" minOccurs="1">
+        <xs:element ref="IMAGE" maxOccurs="unbounded" minOccurs="0"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/samples/group/1.xml b/share/doc/xsd/samples/group/1.xml
new file mode 100644
index 0000000000..35813b2430
--- /dev/null
+++ b/share/doc/xsd/samples/group/1.xml
@@ -0,0 +1,12 @@
+<GROUP xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../group.xsd">
+  <ID>1</ID>
+  <NAME>users</NAME>
+  <USERS>
+    <ID>2</ID>
+    <ID>3</ID>
+    <ID>4</ID>
+    <ID>5</ID>
+  </USERS>
+</GROUP>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/group/2.xml b/share/doc/xsd/samples/group/2.xml
new file mode 100644
index 0000000000..83ec0ed02b
--- /dev/null
+++ b/share/doc/xsd/samples/group/2.xml
@@ -0,0 +1,7 @@
+<GROUP xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../group.xsd">
+  <ID>100</ID>
+  <NAME>new</NAME>
+  <USERS/>
+</GROUP>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/group_pool/1.xml b/share/doc/xsd/samples/group_pool/1.xml
new file mode 100644
index 0000000000..4c99b3289c
--- /dev/null
+++ b/share/doc/xsd/samples/group_pool/1.xml
@@ -0,0 +1,37 @@
+<GROUP_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../group.xsd">
+  <GROUP>
+    <ID>0</ID>
+    <NAME>oneadmin</NAME>
+    <USERS>
+      <ID>0</ID>
+      <ID>1</ID>
+    </USERS>
+  </GROUP>
+  <GROUP>
+    <ID>1</ID>
+    <NAME>users</NAME>
+    <USERS>
+      <ID>2</ID>
+      <ID>3</ID>
+      <ID>4</ID>
+      <ID>5</ID>
+    </USERS>
+  </GROUP>
+  <GROUP>
+    <ID>100</ID>
+    <NAME>new</NAME>
+    <USERS/>
+  </GROUP>
+  <GROUP>
+    <ID>101</ID>
+    <NAME>test</NAME>
+    <USERS/>
+  </GROUP>
+  <GROUP>
+    <ID>102</ID>
+    <NAME>abc</NAME>
+    <USERS/>
+  </GROUP>
+</GROUP_POOL>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/host/1.xml b/share/doc/xsd/samples/host/1.xml
new file mode 100644
index 0000000000..400cdf25f7
--- /dev/null
+++ b/share/doc/xsd/samples/host/1.xml
@@ -0,0 +1,27 @@
+<HOST xmlns="http://opennebula.org/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://opennebula.org/XMLSchema ../../image.xsd">
+  <ID>0</ID>
+  <NAME>localhost</NAME>
+  <STATE>3</STATE>
+  <IM_MAD>im_dummy</IM_MAD>
+  <VM_MAD>vmm_dummy</VM_MAD>
+  <VN_MAD>fw</VN_MAD>
+  <TM_MAD>tm_shared</TM_MAD>
+  <LAST_MON_TIME>0</LAST_MON_TIME>
+  <HOST_SHARE>
+    <DISK_USAGE>0</DISK_USAGE>
+    <MEM_USAGE>0</MEM_USAGE>
+    <CPU_USAGE>0</CPU_USAGE>
+    <MAX_DISK>0</MAX_DISK>
+    <MAX_MEM>0</MAX_MEM>
+    <MAX_CPU>0</MAX_CPU>
+    <FREE_DISK>0</FREE_DISK>
+    <FREE_MEM>0</FREE_MEM>
+    <FREE_CPU>0</FREE_CPU>
+    <USED_DISK>0</USED_DISK>
+    <USED_MEM>0</USED_MEM>
+    <USED_CPU>0</USED_CPU>
+    <RUNNING_VMS>0</RUNNING_VMS>
+  </HOST_SHARE>
+  <TEMPLATE/>
+</HOST>
diff --git a/share/doc/xsd/samples/host/2.xml b/share/doc/xsd/samples/host/2.xml
new file mode 100644
index 0000000000..bd9e6c6de0
--- /dev/null
+++ b/share/doc/xsd/samples/host/2.xml
@@ -0,0 +1,27 @@
+<HOST xmlns="http://opennebula.org/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://opennebula.org/XMLSchema ../../image.xsd">
+  <ID>0</ID>
+  <NAME>localhost</NAME>
+  <STATE>3</STATE>
+  <IM_MAD>im_dummy</IM_MAD>
+  <VM_MAD>vmm_dummy</VM_MAD>
+  <VN_MAD>fw</VN_MAD>
+  <TM_MAD>tm_shared</TM_MAD>
+  <LAST_MON_TIME>0</LAST_MON_TIME>
+  <HOST_SHARE>
+    <DISK_USAGE>0</DISK_USAGE>
+    <MEM_USAGE>0</MEM_USAGE>
+    <CPU_USAGE>0</CPU_USAGE>
+    <MAX_DISK>0</MAX_DISK>
+    <MAX_MEM>0</MAX_MEM>
+    <MAX_CPU>0</MAX_CPU>
+    <FREE_DISK>0</FREE_DISK>
+    <FREE_MEM>0</FREE_MEM>
+    <FREE_CPU>0</FREE_CPU>
+    <USED_DISK>0</USED_DISK>
+    <USED_MEM>0</USED_MEM>
+    <USED_CPU>0</USED_CPU>
+    <RUNNING_VMS>0</RUNNING_VMS>
+  </HOST_SHARE>
+  <TEMPLATE/>
+</HOST>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/host/3.xml b/share/doc/xsd/samples/host/3.xml
new file mode 100644
index 0000000000..c8585496a2
--- /dev/null
+++ b/share/doc/xsd/samples/host/3.xml
@@ -0,0 +1,38 @@
+<HOST xmlns="http://opennebula.org/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://opennebula.org/XMLSchema ../../image.xsd">
+  <ID>0</ID>
+  <NAME>localhost</NAME>
+  <STATE>2</STATE>
+  <IM_MAD>im_dummy</IM_MAD>
+  <VM_MAD>vmm_dummy</VM_MAD>
+  <VN_MAD>fw</VN_MAD>
+  <TM_MAD>tm_shared</TM_MAD>
+  <LAST_MON_TIME>1324039779</LAST_MON_TIME>
+  <HOST_SHARE>
+    <DISK_USAGE>0</DISK_USAGE>
+    <MEM_USAGE>0</MEM_USAGE>
+    <CPU_USAGE>0</CPU_USAGE>
+    <MAX_DISK>0</MAX_DISK>
+    <MAX_MEM>16777216</MAX_MEM>
+    <MAX_CPU>800</MAX_CPU>
+    <FREE_DISK>0</FREE_DISK>
+    <FREE_MEM>16777216</FREE_MEM>
+    <FREE_CPU>800</FREE_CPU>
+    <USED_DISK>0</USED_DISK>
+    <USED_MEM>0</USED_MEM>
+    <USED_CPU>0</USED_CPU>
+    <RUNNING_VMS>0</RUNNING_VMS>
+  </HOST_SHARE>
+  <TEMPLATE>
+    <CPUSPEED><![CDATA[2.2GHz]]></CPUSPEED>
+    <FREECPU><![CDATA[800]]></FREECPU>
+    <FREEMEMORY><![CDATA[16777216]]></FREEMEMORY>
+    <HOSTNAME><![CDATA[localhost]]></HOSTNAME>
+    <HYPERVISOR><![CDATA[dummy]]></HYPERVISOR>
+    <TEST><![CDATA[TEST]]></TEST>
+    <TOTALCPU><![CDATA[800]]></TOTALCPU>
+    <TOTALMEMORY><![CDATA[16777216]]></TOTALMEMORY>
+    <USEDCPU><![CDATA[0]]></USEDCPU>
+    <USEDMEMORY><![CDATA[0]]></USEDMEMORY>
+  </TEMPLATE>
+</HOST>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/host_pool/1.xml b/share/doc/xsd/samples/host_pool/1.xml
new file mode 100644
index 0000000000..066566a08f
--- /dev/null
+++ b/share/doc/xsd/samples/host_pool/1.xml
@@ -0,0 +1,41 @@
+<HOST_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../host_pool.xsd">
+  <HOST>
+    <ID>0</ID>
+    <NAME>localhost</NAME>
+    <STATE>2</STATE>
+    <IM_MAD>im_dummy</IM_MAD>
+    <VM_MAD>vmm_dummy</VM_MAD>
+    <VN_MAD>fw</VN_MAD>
+    <TM_MAD>tm_shared</TM_MAD>
+    <LAST_MON_TIME>1324048185</LAST_MON_TIME>
+    <HOST_SHARE>
+      <DISK_USAGE>0</DISK_USAGE>
+      <MEM_USAGE>0</MEM_USAGE>
+      <CPU_USAGE>0</CPU_USAGE>
+      <MAX_DISK>0</MAX_DISK>
+      <MAX_MEM>16777216</MAX_MEM>
+      <MAX_CPU>800</MAX_CPU>
+      <FREE_DISK>0</FREE_DISK>
+      <FREE_MEM>16777216</FREE_MEM>
+      <FREE_CPU>800</FREE_CPU>
+      <USED_DISK>0</USED_DISK>
+      <USED_MEM>0</USED_MEM>
+      <USED_CPU>0</USED_CPU>
+      <RUNNING_VMS>0</RUNNING_VMS>
+    </HOST_SHARE>
+    <TEMPLATE>
+      <CPUSPEED><![CDATA[2.2GHz]]></CPUSPEED>
+      <FREECPU><![CDATA[800]]></FREECPU>
+      <FREEMEMORY><![CDATA[16777216]]></FREEMEMORY>
+      <HOSTNAME><![CDATA[localhost]]></HOSTNAME>
+      <HYPERVISOR><![CDATA[dummy]]></HYPERVISOR>
+      <TEST><![CDATA[TEST]]></TEST>
+      <TOTALCPU><![CDATA[800]]></TOTALCPU>
+      <TOTALMEMORY><![CDATA[16777216]]></TOTALMEMORY>
+      <USEDCPU><![CDATA[0]]></USEDCPU>
+      <USEDMEMORY><![CDATA[0]]></USEDMEMORY>
+    </TEMPLATE>
+  </HOST>
+</HOST_POOL>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/host_pool/2.xml b/share/doc/xsd/samples/host_pool/2.xml
new file mode 100644
index 0000000000..b946372d3e
--- /dev/null
+++ b/share/doc/xsd/samples/host_pool/2.xml
@@ -0,0 +1,67 @@
+<HOST_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../host_pool.xsd">
+  <HOST>
+    <ID>0</ID>
+    <NAME>localhost</NAME>
+    <STATE>2</STATE>
+    <IM_MAD>im_dummy</IM_MAD>
+    <VM_MAD>vmm_dummy</VM_MAD>
+    <VN_MAD>fw</VN_MAD>
+    <TM_MAD>tm_shared</TM_MAD>
+    <LAST_MON_TIME>1324048436</LAST_MON_TIME>
+    <HOST_SHARE>
+      <DISK_USAGE>0</DISK_USAGE>
+      <MEM_USAGE>0</MEM_USAGE>
+      <CPU_USAGE>0</CPU_USAGE>
+      <MAX_DISK>0</MAX_DISK>
+      <MAX_MEM>16777216</MAX_MEM>
+      <MAX_CPU>800</MAX_CPU>
+      <FREE_DISK>0</FREE_DISK>
+      <FREE_MEM>16777216</FREE_MEM>
+      <FREE_CPU>800</FREE_CPU>
+      <USED_DISK>0</USED_DISK>
+      <USED_MEM>0</USED_MEM>
+      <USED_CPU>0</USED_CPU>
+      <RUNNING_VMS>0</RUNNING_VMS>
+    </HOST_SHARE>
+    <TEMPLATE>
+      <CPUSPEED><![CDATA[2.2GHz]]></CPUSPEED>
+      <FREECPU><![CDATA[800]]></FREECPU>
+      <FREEMEMORY><![CDATA[16777216]]></FREEMEMORY>
+      <HOSTNAME><![CDATA[localhost]]></HOSTNAME>
+      <HYPERVISOR><![CDATA[dummy]]></HYPERVISOR>
+      <TEST><![CDATA[TEST]]></TEST>
+      <TOTALCPU><![CDATA[800]]></TOTALCPU>
+      <TOTALMEMORY><![CDATA[16777216]]></TOTALMEMORY>
+      <USEDCPU><![CDATA[0]]></USEDCPU>
+      <USEDMEMORY><![CDATA[0]]></USEDMEMORY>
+    </TEMPLATE>
+  </HOST>
+  <HOST>
+    <ID>1</ID>
+    <NAME>vm</NAME>
+    <STATE>0</STATE>
+    <IM_MAD>im_dummy</IM_MAD>
+    <VM_MAD>vmm_dummy</VM_MAD>
+    <VN_MAD>fw</VN_MAD>
+    <TM_MAD>tm_shared</TM_MAD>
+    <LAST_MON_TIME>0</LAST_MON_TIME>
+    <HOST_SHARE>
+      <DISK_USAGE>0</DISK_USAGE>
+      <MEM_USAGE>0</MEM_USAGE>
+      <CPU_USAGE>0</CPU_USAGE>
+      <MAX_DISK>0</MAX_DISK>
+      <MAX_MEM>0</MAX_MEM>
+      <MAX_CPU>0</MAX_CPU>
+      <FREE_DISK>0</FREE_DISK>
+      <FREE_MEM>0</FREE_MEM>
+      <FREE_CPU>0</FREE_CPU>
+      <USED_DISK>0</USED_DISK>
+      <USED_MEM>0</USED_MEM>
+      <USED_CPU>0</USED_CPU>
+      <RUNNING_VMS>0</RUNNING_VMS>
+    </HOST_SHARE>
+    <TEMPLATE/>
+  </HOST>
+</HOST_POOL>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/host_pool/3.xml b/share/doc/xsd/samples/host_pool/3.xml
new file mode 100644
index 0000000000..dbfde4e3db
--- /dev/null
+++ b/share/doc/xsd/samples/host_pool/3.xml
@@ -0,0 +1,3 @@
+<HOST_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../host_pool.xsd"/>
diff --git a/share/doc/xsd/samples/image/1.xml b/share/doc/xsd/samples/image/1.xml
new file mode 100644
index 0000000000..5b05a09c6d
--- /dev/null
+++ b/share/doc/xsd/samples/image/1.xml
@@ -0,0 +1,23 @@
+<IMAGE xmlns="http://opennebula.org/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://opennebula.org/XMLSchema ../../image.xsd">
+  <ID>0</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>Ubuntu Desktop</NAME>
+  <TYPE>0</TYPE>
+  <PUBLIC>1</PUBLIC>
+  <PERSISTENT>0</PERSISTENT>
+  <REGTIME>1324047583</REGTIME>
+  <SOURCE>/var/lib/one/images/590815350477644ac13f7800f6a6789c</SOURCE>
+  <PATH>/boot/initrd.img-2.6.32-34-generic</PATH>
+  <FSTYPE/>
+  <SIZE>8</SIZE>
+  <STATE>1</STATE>
+  <RUNNING_VMS>0</RUNNING_VMS>
+  <TEMPLATE>
+    <DESCRIPTION><![CDATA[Ubuntu 10.04 desktop for students.]]></DESCRIPTION>
+    <DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX>
+  </TEMPLATE>
+</IMAGE>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/image/2.xml b/share/doc/xsd/samples/image/2.xml
new file mode 100644
index 0000000000..944fd39108
--- /dev/null
+++ b/share/doc/xsd/samples/image/2.xml
@@ -0,0 +1,22 @@
+<IMAGE xmlns="http://opennebula.org/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://opennebula.org/XMLSchema ../../image.xsd">
+  <ID>1</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>Experiment results</NAME>
+  <TYPE>2</TYPE>
+  <PUBLIC>0</PUBLIC>
+  <PERSISTENT>0</PERSISTENT>
+  <REGTIME>1324048803</REGTIME>
+  <SOURCE>/var/lib/one/images/5a785bd223a970ec3536733514f2c3db</SOURCE>
+  <PATH/>
+  <FSTYPE>ext3</FSTYPE>
+  <SIZE>30</SIZE>
+  <STATE>1</STATE>
+  <RUNNING_VMS>0</RUNNING_VMS>
+  <TEMPLATE>
+    <DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX>
+  </TEMPLATE>
+</IMAGE>
diff --git a/share/doc/xsd/samples/image_pool/1.xml b/share/doc/xsd/samples/image_pool/1.xml
new file mode 100644
index 0000000000..d3a901b549
--- /dev/null
+++ b/share/doc/xsd/samples/image_pool/1.xml
@@ -0,0 +1,3 @@
+<IMAGE_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../image_pool.xsd"/>
diff --git a/share/doc/xsd/samples/image_pool/2.xml b/share/doc/xsd/samples/image_pool/2.xml
new file mode 100644
index 0000000000..6975228bea
--- /dev/null
+++ b/share/doc/xsd/samples/image_pool/2.xml
@@ -0,0 +1,47 @@
+<IMAGE_POOL xmlns="http://opennebula.org/XMLSchema"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://opennebula.org/XMLSchema ../../image_pool.xsd">
+  <IMAGE>
+    <ID>0</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>Ubuntu Desktop</NAME>
+    <TYPE>0</TYPE>
+    <PUBLIC>1</PUBLIC>
+    <PERSISTENT>0</PERSISTENT>
+    <REGTIME>1324047583</REGTIME>
+    <SOURCE>/var/lib/one/images/590815350477644ac13f7800f6a6789c</SOURCE>
+    <PATH>/boot/initrd.img-2.6.32-34-generic</PATH>
+    <FSTYPE/>
+    <SIZE>8</SIZE>
+    <STATE>1</STATE>
+    <RUNNING_VMS>0</RUNNING_VMS>
+    <TEMPLATE>
+      <DESCRIPTION><![CDATA[Ubuntu 10.04 desktop for students.]]></DESCRIPTION>
+      <DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX>
+    </TEMPLATE>
+  </IMAGE>
+  <IMAGE>
+    <ID>1</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>Experiment results</NAME>
+    <TYPE>2</TYPE>
+    <PUBLIC>0</PUBLIC>
+    <PERSISTENT>0</PERSISTENT>
+    <REGTIME>1324048803</REGTIME>
+    <SOURCE>/var/lib/one/images/5a785bd223a970ec3536733514f2c3db</SOURCE>
+    <PATH/>
+    <FSTYPE>ext3</FSTYPE>
+    <SIZE>30</SIZE>
+    <STATE>1</STATE>
+    <RUNNING_VMS>0</RUNNING_VMS>
+    <TEMPLATE>
+      <DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX>
+    </TEMPLATE>
+  </IMAGE>
+</IMAGE_POOL>
diff --git a/share/doc/xsd/samples/image_pool/3.xml b/share/doc/xsd/samples/image_pool/3.xml
new file mode 100644
index 0000000000..01fb4ba810
--- /dev/null
+++ b/share/doc/xsd/samples/image_pool/3.xml
@@ -0,0 +1,25 @@
+<IMAGE_POOL xmlns="http://opennebula.org/XMLSchema"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://opennebula.org/XMLSchema ../../image_pool.xsd">
+  <IMAGE>
+    <ID>1</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>Experiment results</NAME>
+    <TYPE>2</TYPE>
+    <PUBLIC>0</PUBLIC>
+    <PERSISTENT>0</PERSISTENT>
+    <REGTIME>1324048803</REGTIME>
+    <SOURCE>/var/lib/one/images/5a785bd223a970ec3536733514f2c3db</SOURCE>
+    <PATH/>
+    <FSTYPE>ext3</FSTYPE>
+    <SIZE>30</SIZE>
+    <STATE>1</STATE>
+    <RUNNING_VMS>0</RUNNING_VMS>
+    <TEMPLATE>
+      <DEV_PREFIX><![CDATA[hd]]></DEV_PREFIX>
+    </TEMPLATE>
+  </IMAGE>
+</IMAGE_POOL>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/template/1.xml b/share/doc/xsd/samples/template/1.xml
new file mode 100644
index 0000000000..b580fb7d30
--- /dev/null
+++ b/share/doc/xsd/samples/template/1.xml
@@ -0,0 +1,16 @@
+<VMTEMPLATE xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../template.xsd">
+  <ID>0</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>vm-example</NAME>
+  <PUBLIC>0</PUBLIC>
+  <REGTIME>1324050180</REGTIME>
+  <TEMPLATE>
+    <NAME><![CDATA[vm-example]]></NAME>
+    <TEMPLATE_ID><![CDATA[0]]></TEMPLATE_ID>
+  </TEMPLATE>
+</VMTEMPLATE>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/template/2.xml b/share/doc/xsd/samples/template/2.xml
new file mode 100644
index 0000000000..48d50ce786
--- /dev/null
+++ b/share/doc/xsd/samples/template/2.xml
@@ -0,0 +1,16 @@
+<VMTEMPLATE xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../template.xsd">
+  <ID>0</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>vm-example</NAME>
+  <PUBLIC>0</PUBLIC>
+  <REGTIME>1324050180</REGTIME>
+  <TEMPLATE>
+    <NEW_ATT><![CDATA[NEW]]></NEW_ATT>
+    <NEW_NUM><![CDATA[123]]></NEW_NUM>
+  </TEMPLATE>
+</VMTEMPLATE>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/template/3.xml b/share/doc/xsd/samples/template/3.xml
new file mode 100644
index 0000000000..7ef2ba5e1b
--- /dev/null
+++ b/share/doc/xsd/samples/template/3.xml
@@ -0,0 +1,13 @@
+<VMTEMPLATE xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../template.xsd">
+  <ID>0</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>vm-example</NAME>
+  <PUBLIC>0</PUBLIC>
+  <REGTIME>1324050180</REGTIME>
+  <TEMPLATE/>
+</VMTEMPLATE>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/template_pool/1.xml b/share/doc/xsd/samples/template_pool/1.xml
new file mode 100644
index 0000000000..70a1e1f8e4
--- /dev/null
+++ b/share/doc/xsd/samples/template_pool/1.xml
@@ -0,0 +1,35 @@
+<VMTEMPLATE_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../template_pool.xsd">
+  <VMTEMPLATE>
+    <ID>0</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>vm-example</NAME>
+    <PUBLIC>0</PUBLIC>
+    <REGTIME>1324050180</REGTIME>
+    <TEMPLATE>
+      <NEW_ATT><![CDATA[NEW]]></NEW_ATT>
+      <NEW_NUM><![CDATA[123]]></NEW_NUM>
+    </TEMPLATE>
+  </VMTEMPLATE>
+  <VMTEMPLATE>
+    <ID>1</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>ONE</NAME>
+    <PUBLIC>0</PUBLIC>
+    <REGTIME>1324050461</REGTIME>
+    <TEMPLATE>
+      <DISK>
+        <IMAGE_ID><![CDATA[0]]></IMAGE_ID>
+      </DISK>
+      <NAME><![CDATA[ONE]]></NAME>
+      <TEMPLATE_ID><![CDATA[1]]></TEMPLATE_ID>
+    </TEMPLATE>
+  </VMTEMPLATE>
+</VMTEMPLATE_POOL>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/template_pool/2.xml b/share/doc/xsd/samples/template_pool/2.xml
new file mode 100644
index 0000000000..32f50bfe47
--- /dev/null
+++ b/share/doc/xsd/samples/template_pool/2.xml
@@ -0,0 +1,3 @@
+<VMTEMPLATE_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../template_pool.xsd"/>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/user/1.xml b/share/doc/xsd/samples/user/1.xml
new file mode 100644
index 0000000000..84944f9291
--- /dev/null
+++ b/share/doc/xsd/samples/user/1.xml
@@ -0,0 +1,12 @@
+<USER xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../user.xsd">
+  <ID>1</ID>
+  <GID>0</GID>
+  <GNAME>oneadmin</GNAME>
+  <NAME>serveradmin</NAME>
+  <PASSWORD>f72281eda1b97393f46041288b0baea528483b51</PASSWORD>
+  <AUTH_DRIVER>server_cipher</AUTH_DRIVER>
+  <ENABLED>1</ENABLED>
+  <TEMPLATE/>
+</USER>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/user/2.xml b/share/doc/xsd/samples/user/2.xml
new file mode 100644
index 0000000000..526c0f0edb
--- /dev/null
+++ b/share/doc/xsd/samples/user/2.xml
@@ -0,0 +1,12 @@
+<USER xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../user.xsd">
+  <ID>2</ID>
+  <GID>1</GID>
+  <GNAME>users</GNAME>
+  <NAME>abc</NAME>
+  <PASSWORD>a9993e364706816aba3e25717850c26c9cd0d89d</PASSWORD>
+  <AUTH_DRIVER>core</AUTH_DRIVER>
+  <ENABLED>1</ENABLED>
+  <TEMPLATE/>
+</USER>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/user/3.xml b/share/doc/xsd/samples/user/3.xml
new file mode 100644
index 0000000000..bdaf7f43e3
--- /dev/null
+++ b/share/doc/xsd/samples/user/3.xml
@@ -0,0 +1,21 @@
+<USER xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../user.xsd">
+  <ID>3</ID>
+  <GID>1</GID>
+  <GNAME>users</GNAME>
+  <NAME>1234</NAME>
+  <PASSWORD>7110eda4d09e062aa5e4a390b0a572ac0d2c0220</PASSWORD>
+  <AUTH_DRIVER>core</AUTH_DRIVER>
+  <ENABLED>1</ENABLED>
+  <TEMPLATE>
+    <ATT><![CDATA[OTHER VALUE]]></ATT>
+    <COMPLEX>
+      <ATT1><![CDATA[VAL1]]></ATT1>
+      <ATT2><![CDATA[VAL2]]></ATT2>
+      <NUM3><![CDATA[3]]></NUM3>
+    </COMPLEX>
+    <EXTRA><![CDATA[VALUE]]></EXTRA>
+    <NUM><![CDATA[123]]></NUM>
+  </TEMPLATE>
+</USER>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/user_pool/1.xml b/share/doc/xsd/samples/user_pool/1.xml
new file mode 100644
index 0000000000..86c5335373
--- /dev/null
+++ b/share/doc/xsd/samples/user_pool/1.xml
@@ -0,0 +1,53 @@
+<USER_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../user_pool.xsd">
+  <USER>
+    <ID>0</ID>
+    <GID>0</GID>
+    <GNAME>oneadmin</GNAME>
+    <NAME>oneadmin</NAME>
+    <PASSWORD>f72281eda1b97393f46041288b0baea528483b51</PASSWORD>
+    <AUTH_DRIVER>core</AUTH_DRIVER>
+    <ENABLED>1</ENABLED>
+    <TEMPLATE/>
+  </USER>
+  <USER>
+    <ID>1</ID>
+    <GID>0</GID>
+    <GNAME>oneadmin</GNAME>
+    <NAME>serveradmin</NAME>
+    <PASSWORD>f72281eda1b97393f46041288b0baea528483b51</PASSWORD>
+    <AUTH_DRIVER>server_cipher</AUTH_DRIVER>
+    <ENABLED>1</ENABLED>
+    <TEMPLATE/>
+  </USER>
+  <USER>
+    <ID>2</ID>
+    <GID>1</GID>
+    <GNAME>users</GNAME>
+    <NAME>abc</NAME>
+    <PASSWORD>a9993e364706816aba3e25717850c26c9cd0d89d</PASSWORD>
+    <AUTH_DRIVER>core</AUTH_DRIVER>
+    <ENABLED>1</ENABLED>
+    <TEMPLATE/>
+  </USER>
+  <USER>
+    <ID>3</ID>
+    <GID>1</GID>
+    <GNAME>users</GNAME>
+    <NAME>1234</NAME>
+    <PASSWORD>7110eda4d09e062aa5e4a390b0a572ac0d2c0220</PASSWORD>
+    <AUTH_DRIVER>core</AUTH_DRIVER>
+    <ENABLED>1</ENABLED>
+    <TEMPLATE>
+      <ATT><![CDATA[OTHER VALUE]]></ATT>
+      <COMPLEX>
+        <ATT1><![CDATA[VAL1]]></ATT1>
+        <ATT2><![CDATA[VAL2]]></ATT2>
+        <NUM3><![CDATA[3]]></NUM3>
+      </COMPLEX>
+      <EXTRA><![CDATA[VALUE]]></EXTRA>
+      <NUM><![CDATA[123]]></NUM>
+    </TEMPLATE>
+  </USER>
+</USER_POOL>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vm/1.xml b/share/doc/xsd/samples/vm/1.xml
new file mode 100644
index 0000000000..54b668d48f
--- /dev/null
+++ b/share/doc/xsd/samples/vm/1.xml
@@ -0,0 +1,26 @@
+<VM xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vm.xsd">
+  <ID>0</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>one-0</NAME>
+  <LAST_POLL>0</LAST_POLL>
+  <STATE>1</STATE>
+  <LCM_STATE>0</LCM_STATE>
+  <STIME>1324050700</STIME>
+  <ETIME>0</ETIME>
+  <DEPLOY_ID/>
+  <MEMORY>0</MEMORY>
+  <CPU>0</CPU>
+  <NET_TX>0</NET_TX>
+  <NET_RX>0</NET_RX>
+  <TEMPLATE>
+    <NAME><![CDATA[one-0]]></NAME>
+    <TEMPLATE_ID><![CDATA[2]]></TEMPLATE_ID>
+    <VMID><![CDATA[0]]></VMID>
+  </TEMPLATE>
+  <HISTORY_RECORDS/>
+</VM>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vm/2.xml b/share/doc/xsd/samples/vm/2.xml
new file mode 100644
index 0000000000..1111618103
--- /dev/null
+++ b/share/doc/xsd/samples/vm/2.xml
@@ -0,0 +1,81 @@
+<VM xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vm.xsd">
+  <ID>0</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>one-0</NAME>
+  <LAST_POLL>1324050881</LAST_POLL>
+  <STATE>3</STATE>
+  <LCM_STATE>3</LCM_STATE>
+  <STIME>1324050700</STIME>
+  <ETIME>0</ETIME>
+  <DEPLOY_ID>vm:one-0:dummy</DEPLOY_ID>
+  <MEMORY>0</MEMORY>
+  <CPU>0</CPU>
+  <NET_TX>0</NET_TX>
+  <NET_RX>0</NET_RX>
+  <TEMPLATE>
+    <NAME><![CDATA[one-0]]></NAME>
+    <TEMPLATE_ID><![CDATA[2]]></TEMPLATE_ID>
+    <VMID><![CDATA[0]]></VMID>
+  </TEMPLATE>
+  <HISTORY_RECORDS>
+    <HISTORY>
+      <SEQ>0</SEQ>
+      <HOSTNAME>vm</HOSTNAME>
+      <VM_DIR>/var/lib/one/</VM_DIR>
+      <HID>1</HID>
+      <STIME>1324050881</STIME>
+      <ETIME>1324050891</ETIME>
+      <VMMMAD>vmm_dummy</VMMMAD>
+      <VNMMAD>fw</VNMMAD>
+      <TMMAD>tm_shared</TMMAD>
+      <PSTIME>1324050881</PSTIME>
+      <PETIME>1324050881</PETIME>
+      <RSTIME>1324050881</RSTIME>
+      <RETIME>1324050891</RETIME>
+      <ESTIME>0</ESTIME>
+      <EETIME>0</EETIME>
+      <REASON>3</REASON>
+    </HISTORY>
+    <HISTORY>
+      <SEQ>1</SEQ>
+      <HOSTNAME>localhost</HOSTNAME>
+      <VM_DIR>/var/lib/one/</VM_DIR>
+      <HID>0</HID>
+      <STIME>1324050891</STIME>
+      <ETIME>1324050899</ETIME>
+      <VMMMAD>vmm_dummy</VMMMAD>
+      <VNMMAD>fw</VNMMAD>
+      <TMMAD>tm_shared</TMMAD>
+      <PSTIME>1324050891</PSTIME>
+      <PETIME>1324050892</PETIME>
+      <RSTIME>1324050892</RSTIME>
+      <RETIME>1324050899</RETIME>
+      <ESTIME>0</ESTIME>
+      <EETIME>0</EETIME>
+      <REASON>3</REASON>
+    </HISTORY>
+    <HISTORY>
+      <SEQ>2</SEQ>
+      <HOSTNAME>localhost</HOSTNAME>
+      <VM_DIR>/var/lib/one/</VM_DIR>
+      <HID>0</HID>
+      <STIME>1324050899</STIME>
+      <ETIME>0</ETIME>
+      <VMMMAD>vmm_dummy</VMMMAD>
+      <VNMMAD>fw</VNMMAD>
+      <TMMAD>tm_shared</TMMAD>
+      <PSTIME>0</PSTIME>
+      <PETIME>0</PETIME>
+      <RSTIME>1324050899</RSTIME>
+      <RETIME>0</RETIME>
+      <ESTIME>0</ESTIME>
+      <EETIME>0</EETIME>
+      <REASON>0</REASON>
+    </HISTORY>
+  </HISTORY_RECORDS>
+</VM>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vm/3.xml b/share/doc/xsd/samples/vm/3.xml
new file mode 100644
index 0000000000..99baa18bb8
--- /dev/null
+++ b/share/doc/xsd/samples/vm/3.xml
@@ -0,0 +1,81 @@
+<VM xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vm.xsd">
+  <ID>3</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>one-3</NAME>
+  <LAST_POLL>1324052447</LAST_POLL>
+  <STATE>6</STATE>
+  <LCM_STATE>0</LCM_STATE>
+  <STIME>1324052427</STIME>
+  <ETIME>1324052465</ETIME>
+  <DEPLOY_ID>localhost:one-3:dummy</DEPLOY_ID>
+  <MEMORY>0</MEMORY>
+  <CPU>0</CPU>
+  <NET_TX>0</NET_TX>
+  <NET_RX>0</NET_RX>
+  <TEMPLATE>
+    <NAME><![CDATA[one-3]]></NAME>
+    <TEMPLATE_ID><![CDATA[2]]></TEMPLATE_ID>
+    <VMID><![CDATA[3]]></VMID>
+  </TEMPLATE>
+  <HISTORY_RECORDS>
+    <HISTORY>
+      <SEQ>0</SEQ>
+      <HOSTNAME>localhost</HOSTNAME>
+      <VM_DIR>/var/lib/one/</VM_DIR>
+      <HID>0</HID>
+      <STIME>1324052447</STIME>
+      <ETIME>1324052452</ETIME>
+      <VMMMAD>vmm_dummy</VMMMAD>
+      <VNMMAD>fw</VNMMAD>
+      <TMMAD>tm_shared</TMMAD>
+      <PSTIME>1324052447</PSTIME>
+      <PETIME>1324052447</PETIME>
+      <RSTIME>1324052447</RSTIME>
+      <RETIME>1324052452</RETIME>
+      <ESTIME>0</ESTIME>
+      <EETIME>0</EETIME>
+      <REASON>3</REASON>
+    </HISTORY>
+    <HISTORY>
+      <SEQ>1</SEQ>
+      <HOSTNAME>vm</HOSTNAME>
+      <VM_DIR>/var/lib/one/</VM_DIR>
+      <HID>1</HID>
+      <STIME>1324052452</STIME>
+      <ETIME>1324052456</ETIME>
+      <VMMMAD>vmm_dummy</VMMMAD>
+      <VNMMAD>fw</VNMMAD>
+      <TMMAD>tm_shared</TMMAD>
+      <PSTIME>1324052452</PSTIME>
+      <PETIME>1324052452</PETIME>
+      <RSTIME>1324052452</RSTIME>
+      <RETIME>1324052456</RETIME>
+      <ESTIME>0</ESTIME>
+      <EETIME>0</EETIME>
+      <REASON>3</REASON>
+    </HISTORY>
+    <HISTORY>
+      <SEQ>2</SEQ>
+      <HOSTNAME>localhost</HOSTNAME>
+      <VM_DIR>/var/lib/one/</VM_DIR>
+      <HID>0</HID>
+      <STIME>1324052456</STIME>
+      <ETIME>1324052465</ETIME>
+      <VMMMAD>vmm_dummy</VMMMAD>
+      <VNMMAD>fw</VNMMAD>
+      <TMMAD>tm_shared</TMMAD>
+      <PSTIME>1324052456</PSTIME>
+      <PETIME>1324052456</PETIME>
+      <RSTIME>1324052456</RSTIME>
+      <RETIME>1324052465</RETIME>
+      <ESTIME>1324052465</ESTIME>
+      <EETIME>1324052465</EETIME>
+      <REASON>4</REASON>
+    </HISTORY>
+  </HISTORY_RECORDS>
+</VM>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vm_pool/1.xml b/share/doc/xsd/samples/vm_pool/1.xml
new file mode 100644
index 0000000000..c3772a666d
--- /dev/null
+++ b/share/doc/xsd/samples/vm_pool/1.xml
@@ -0,0 +1,161 @@
+<VM_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vm_pool.xsd">
+  <VM>
+    <ID>0</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>one-0</NAME>
+    <LAST_POLL>1324052091</LAST_POLL>
+    <STATE>3</STATE>
+    <LCM_STATE>3</LCM_STATE>
+    <STIME>1324050700</STIME>
+    <ETIME>0</ETIME>
+    <DEPLOY_ID>vm:one-0:dummy</DEPLOY_ID>
+    <MEMORY>0</MEMORY>
+    <CPU>0</CPU>
+    <NET_TX>12345</NET_TX>
+    <NET_RX>0</NET_RX>
+    <TEMPLATE>
+      <NAME><![CDATA[one-0]]></NAME>
+      <TEMPLATE_ID><![CDATA[2]]></TEMPLATE_ID>
+      <VMID><![CDATA[0]]></VMID>
+    </TEMPLATE>
+    <HISTORY_RECORDS>
+      <HISTORY>
+        <SEQ>2</SEQ>
+        <HOSTNAME>localhost</HOSTNAME>
+        <VM_DIR>/var/lib/one/</VM_DIR>
+        <HID>0</HID>
+        <STIME>1324050899</STIME>
+        <ETIME>0</ETIME>
+        <VMMMAD>vmm_dummy</VMMMAD>
+        <VNMMAD>fw</VNMMAD>
+        <TMMAD>tm_shared</TMMAD>
+        <PSTIME>0</PSTIME>
+        <PETIME>0</PETIME>
+        <RSTIME>1324050899</RSTIME>
+        <RETIME>0</RETIME>
+        <ESTIME>0</ESTIME>
+        <EETIME>0</EETIME>
+        <REASON>0</REASON>
+      </HISTORY>
+    </HISTORY_RECORDS>
+  </VM>
+  <VM>
+    <ID>1</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>one-1</NAME>
+    <LAST_POLL>0</LAST_POLL>
+    <STATE>1</STATE>
+    <LCM_STATE>0</LCM_STATE>
+    <STIME>1324052403</STIME>
+    <ETIME>0</ETIME>
+    <DEPLOY_ID/>
+    <MEMORY>0</MEMORY>
+    <CPU>0</CPU>
+    <NET_TX>0</NET_TX>
+    <NET_RX>0</NET_RX>
+    <TEMPLATE>
+      <NAME><![CDATA[one-1]]></NAME>
+      <TEMPLATE_ID><![CDATA[2]]></TEMPLATE_ID>
+      <VMID><![CDATA[1]]></VMID>
+    </TEMPLATE>
+    <HISTORY_RECORDS/>
+  </VM>
+  <VM>
+    <ID>2</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>one-2</NAME>
+    <LAST_POLL>1324052436</LAST_POLL>
+    <STATE>3</STATE>
+    <LCM_STATE>3</LCM_STATE>
+    <STIME>1324052411</STIME>
+    <ETIME>0</ETIME>
+    <DEPLOY_ID>vm:one-2:dummy</DEPLOY_ID>
+    <MEMORY>0</MEMORY>
+    <CPU>0</CPU>
+    <NET_TX>0</NET_TX>
+    <NET_RX>0</NET_RX>
+    <TEMPLATE>
+      <NAME><![CDATA[one-2]]></NAME>
+      <TEMPLATE_ID><![CDATA[2]]></TEMPLATE_ID>
+      <VMID><![CDATA[2]]></VMID>
+    </TEMPLATE>
+    <HISTORY_RECORDS>
+      <HISTORY>
+        <SEQ>0</SEQ>
+        <HOSTNAME>vm</HOSTNAME>
+        <VM_DIR>/var/lib/one/</VM_DIR>
+        <HID>1</HID>
+        <STIME>1324052436</STIME>
+        <ETIME>0</ETIME>
+        <VMMMAD>vmm_dummy</VMMMAD>
+        <VNMMAD>fw</VNMMAD>
+        <TMMAD>tm_shared</TMMAD>
+        <PSTIME>1324052436</PSTIME>
+        <PETIME>1324052436</PETIME>
+        <RSTIME>1324052436</RSTIME>
+        <RETIME>0</RETIME>
+        <ESTIME>0</ESTIME>
+        <EETIME>0</EETIME>
+        <REASON>0</REASON>
+      </HISTORY>
+    </HISTORY_RECORDS>
+  </VM>
+  <VM>
+    <ID>4</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>one-4</NAME>
+    <LAST_POLL>1324052488</LAST_POLL>
+    <STATE>7</STATE>
+    <LCM_STATE>0</LCM_STATE>
+    <STIME>1324052484</STIME>
+    <ETIME>1324052510</ETIME>
+    <DEPLOY_ID>localhost:one-4:dummy</DEPLOY_ID>
+    <MEMORY>0</MEMORY>
+    <CPU>0</CPU>
+    <NET_TX>0</NET_TX>
+    <NET_RX>0</NET_RX>
+    <TEMPLATE>
+      <ERROR>
+        <MESSAGE><![CDATA[Error excuting image transfer script: Could not move /var/lib/one//4/images to /var/lib/one/4]]></MESSAGE>
+        <TIMESTAMP><![CDATA[Fri Dec 16 08:21:50 2011]]></TIMESTAMP>
+      </ERROR>
+      <NAME><![CDATA[one-4]]></NAME>
+      <TEMPLATE_ID><![CDATA[2]]></TEMPLATE_ID>
+      <VMID><![CDATA[4]]></VMID>
+    </TEMPLATE>
+    <HISTORY_RECORDS>
+      <HISTORY>
+        <SEQ>2</SEQ>
+        <HOSTNAME>vm</HOSTNAME>
+        <VM_DIR>/var/lib/one/</VM_DIR>
+        <HID>1</HID>
+        <STIME>1324052502</STIME>
+        <ETIME>1324052510</ETIME>
+        <VMMMAD>vmm_dummy</VMMMAD>
+        <VNMMAD>fw</VNMMAD>
+        <TMMAD>tm_shared</TMMAD>
+        <PSTIME>1324052502</PSTIME>
+        <PETIME>1324052502</PETIME>
+        <RSTIME>1324052502</RSTIME>
+        <RETIME>1324052510</RETIME>
+        <ESTIME>1324052510</ESTIME>
+        <EETIME>1324052510</EETIME>
+        <REASON>1</REASON>
+      </HISTORY>
+    </HISTORY_RECORDS>
+  </VM>
+</VM_POOL>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vm_pool/2.xml b/share/doc/xsd/samples/vm_pool/2.xml
new file mode 100644
index 0000000000..2c7d359203
--- /dev/null
+++ b/share/doc/xsd/samples/vm_pool/2.xml
@@ -0,0 +1,3 @@
+<VM_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vm_pool.xsd"/>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vnet/1.xml b/share/doc/xsd/samples/vnet/1.xml
new file mode 100644
index 0000000000..58c2f01c61
--- /dev/null
+++ b/share/doc/xsd/samples/vnet/1.xml
@@ -0,0 +1,48 @@
+<VNET xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vnet.xsd">
+  <ID>0</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>Blue LAN</NAME>
+  <TYPE>1</TYPE>
+  <BRIDGE>vbr1</BRIDGE>
+  <VLAN>0</VLAN>
+  <PHYDEV/>
+  <VLAN_ID/>
+  <PUBLIC>0</PUBLIC>
+  <TOTAL_LEASES>0</TOTAL_LEASES>
+  <TEMPLATE>
+    <DNS><![CDATA[130.10.0.1]]></DNS>
+    <GATEWAY><![CDATA[130.10.0.1]]></GATEWAY>
+    <LOAD_BALANCER><![CDATA[130.10.0.4]]></LOAD_BALANCER>
+  </TEMPLATE>
+  <LEASES>
+    <LEASE>
+      <IP>130.10.0.1</IP>
+      <MAC>02:00:82:0a:00:01</MAC>
+      <USED>0</USED>
+      <VID>-1</VID>
+    </LEASE>
+    <LEASE>
+      <IP>130.10.0.2</IP>
+      <MAC>50:20:20:20:20:21</MAC>
+      <USED>0</USED>
+      <VID>-1</VID>
+    </LEASE>
+    <LEASE>
+      <IP>130.10.0.3</IP>
+      <MAC>02:00:82:0a:00:03</MAC>
+      <USED>0</USED>
+      <VID>-1</VID>
+    </LEASE>
+    <LEASE>
+      <IP>130.10.0.4</IP>
+      <MAC>02:00:82:0a:00:04</MAC>
+      <USED>0</USED>
+      <VID>-1</VID>
+    </LEASE>
+  </LEASES>
+</VNET>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vnet/2.xml b/share/doc/xsd/samples/vnet/2.xml
new file mode 100644
index 0000000000..7dd12dd226
--- /dev/null
+++ b/share/doc/xsd/samples/vnet/2.xml
@@ -0,0 +1,26 @@
+<VNET xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vnet.xsd">
+  <ID>1</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>R</NAME>
+  <TYPE>0</TYPE>
+  <BRIDGE>vbr0</BRIDGE>
+  <VLAN>0</VLAN>
+  <PHYDEV/>
+  <VLAN_ID/>
+  <RANGE>
+    <IP_START>10.10.10.1</IP_START>
+    <IP_END>10.10.10.254</IP_END>
+  </RANGE>
+  <PUBLIC>0</PUBLIC>
+  <TOTAL_LEASES>0</TOTAL_LEASES>
+  <TEMPLATE>
+    <CUSTOM><![CDATA[CARLOS]]></CUSTOM>
+    <NETWORK_MASK><![CDATA[255.255.255.0]]></NETWORK_MASK>
+  </TEMPLATE>
+  <LEASES/>
+</VNET>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vnet/3.xml b/share/doc/xsd/samples/vnet/3.xml
new file mode 100644
index 0000000000..65979e9c7e
--- /dev/null
+++ b/share/doc/xsd/samples/vnet/3.xml
@@ -0,0 +1,23 @@
+<VNET xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vnet.xsd">
+  <ID>3</ID>
+  <UID>0</UID>
+  <GID>0</GID>
+  <UNAME>oneadmin</UNAME>
+  <GNAME>oneadmin</GNAME>
+  <NAME>Empty</NAME>
+  <TYPE>1</TYPE>
+  <BRIDGE>vbr1</BRIDGE>
+  <VLAN>1</VLAN>
+  <PHYDEV>eth0</PHYDEV>
+  <VLAN_ID>34</VLAN_ID>
+  <PUBLIC>0</PUBLIC>
+  <TOTAL_LEASES>0</TOTAL_LEASES>
+  <TEMPLATE>
+    <DNS><![CDATA[130.10.0.1]]></DNS>
+    <GATEWAY><![CDATA[130.10.0.1]]></GATEWAY>
+    <LOAD_BALANCER><![CDATA[130.10.0.4]]></LOAD_BALANCER>
+  </TEMPLATE>
+  <LEASES/>
+</VNET>
\ No newline at end of file
diff --git a/share/doc/xsd/samples/vnet_pool/1.xml b/share/doc/xsd/samples/vnet_pool/1.xml
new file mode 100644
index 0000000000..4a98dc0af0
--- /dev/null
+++ b/share/doc/xsd/samples/vnet_pool/1.xml
@@ -0,0 +1,3 @@
+<VNET_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vnet_pool.xsd"/>
diff --git a/share/doc/xsd/samples/vnet_pool/2.xml b/share/doc/xsd/samples/vnet_pool/2.xml
new file mode 100644
index 0000000000..d489eea01b
--- /dev/null
+++ b/share/doc/xsd/samples/vnet_pool/2.xml
@@ -0,0 +1,63 @@
+<VNET_POOL xmlns="http://opennebula.org/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://opennebula.org/XMLSchema ../../vnet_pool.xsd">
+  <VNET>
+    <ID>0</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>Blue LAN</NAME>
+    <TYPE>1</TYPE>
+    <BRIDGE>vbr1</BRIDGE>
+    <VLAN>0</VLAN>
+    <PHYDEV/>
+    <VLAN_ID/>
+    <PUBLIC>0</PUBLIC>
+    <TOTAL_LEASES>0</TOTAL_LEASES>
+    <TEMPLATE/>
+  </VNET>
+  <VNET>
+    <ID>1</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>R</NAME>
+    <TYPE>0</TYPE>
+    <BRIDGE>vbr0</BRIDGE>
+    <VLAN>0</VLAN>
+    <PHYDEV/>
+    <VLAN_ID/>
+    <RANGE>
+      <IP_START>10.10.10.1</IP_START>
+      <IP_END>10.10.10.254</IP_END>
+    </RANGE>
+    <PUBLIC>0</PUBLIC>
+    <TOTAL_LEASES>0</TOTAL_LEASES>
+    <TEMPLATE>
+      <CUSTOM><![CDATA[CARLOS]]></CUSTOM>
+      <NETWORK_MASK><![CDATA[255.255.255.0]]></NETWORK_MASK>
+    </TEMPLATE>
+  </VNET>
+  <VNET>
+    <ID>3</ID>
+    <UID>0</UID>
+    <GID>0</GID>
+    <UNAME>oneadmin</UNAME>
+    <GNAME>oneadmin</GNAME>
+    <NAME>Empty</NAME>
+    <TYPE>1</TYPE>
+    <BRIDGE>vbr1</BRIDGE>
+    <VLAN>1</VLAN>
+    <PHYDEV>eth0</PHYDEV>
+    <VLAN_ID>34</VLAN_ID>
+    <PUBLIC>0</PUBLIC>
+    <TOTAL_LEASES>0</TOTAL_LEASES>
+    <TEMPLATE>
+      <DNS><![CDATA[130.10.0.1]]></DNS>
+      <GATEWAY><![CDATA[130.10.0.1]]></GATEWAY>
+      <LOAD_BALANCER><![CDATA[130.10.0.4]]></LOAD_BALANCER>
+    </TEMPLATE>
+  </VNET>
+</VNET_POOL>
\ No newline at end of file
diff --git a/share/doc/xsd/template.xsd b/share/doc/xsd/template.xsd
new file mode 100644
index 0000000000..6fb9523e72
--- /dev/null
+++ b/share/doc/xsd/template.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://opennebula.org/XMLSchema" elementFormDefault="qualified" targetNamespace="http://opennebula.org/XMLSchema">
+  <xs:element name="VMTEMPLATE">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="ID" type="xs:integer"/>
+        <xs:element name="UID" type="xs:integer"/>
+        <xs:element name="GID" type="xs:integer"/>
+        <xs:element name="UNAME" type="xs:string"/>
+        <xs:element name="GNAME" type="xs:string"/>
+        <xs:element name="NAME" type="xs:string"/>
+        <xs:element name="PUBLIC" type="xs:integer"/>
+        <xs:element name="REGTIME" type="xs:integer"/>
+        <xs:element name="TEMPLATE" type="xs:anyType"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/template_pool.xsd b/share/doc/xsd/template_pool.xsd
new file mode 100644
index 0000000000..cb377ea2c9
--- /dev/null
+++ b/share/doc/xsd/template_pool.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:include schemaLocation="template.xsd"/>
+  <xs:element name="VMTEMPLATE_POOL">
+    <xs:complexType>
+      <xs:sequence maxOccurs="1" minOccurs="1">
+        <xs:element ref="VMTEMPLATE" maxOccurs="unbounded" minOccurs="0"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/test.sh b/share/doc/xsd/test.sh
new file mode 100755
index 0000000000..0f5e0e24bd
--- /dev/null
+++ b/share/doc/xsd/test.sh
@@ -0,0 +1,5 @@
+
+for i in group_pool group host_pool host image_pool image template_pool template user_pool user vm_pool vm vnet_pool vnet
+do
+    xmllint --noout --schema $i.xsd samples/$i/*
+done
\ No newline at end of file
diff --git a/share/doc/xsd/user.xsd b/share/doc/xsd/user.xsd
new file mode 100644
index 0000000000..5add6f1685
--- /dev/null
+++ b/share/doc/xsd/user.xsd
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:element name="USER">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="ID" type="xs:integer"/>
+        <xs:element name="GID" type="xs:integer"/>
+        <xs:element name="GNAME" type="xs:string"/>
+        <xs:element name="NAME" type="xs:string"/>
+        <xs:element name="PASSWORD" type="xs:string"/>
+        <xs:element name="AUTH_DRIVER" type="xs:string"/>
+        <xs:element name="ENABLED" type="xs:integer"/>
+        <xs:element name="TEMPLATE" type="xs:anyType"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/user_pool.xsd b/share/doc/xsd/user_pool.xsd
new file mode 100644
index 0000000000..96657f384d
--- /dev/null
+++ b/share/doc/xsd/user_pool.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:include schemaLocation="user.xsd"/>
+  <xs:element name="USER_POOL">
+    <xs:complexType>
+      <xs:sequence maxOccurs="1" minOccurs="1">
+        <xs:element ref="USER" maxOccurs="unbounded" minOccurs="0"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
\ No newline at end of file
diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd
new file mode 100644
index 0000000000..57ea8dbf79
--- /dev/null
+++ b/share/doc/xsd/vm.xsd
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:element name="VM">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="ID" type="xs:integer"/>
+        <xs:element name="UID" type="xs:integer"/>
+        <xs:element name="GID" type="xs:integer"/>
+        <xs:element name="UNAME" type="xs:string"/>
+        <xs:element name="GNAME" type="xs:string"/>
+        <xs:element name="NAME" type="xs:string"/>
+        <xs:element name="LAST_POLL" type="xs:integer"/>
+        <xs:element name="STATE" type="xs:integer"/>
+        <xs:element name="LCM_STATE" type="xs:integer"/>
+        <xs:element name="STIME" type="xs:integer"/>
+        <xs:element name="ETIME" type="xs:integer"/>
+        <xs:element name="DEPLOY_ID" type="xs:string"/>
+        <xs:element name="MEMORY" type="xs:integer"/>
+        <xs:element name="CPU" type="xs:integer"/>
+        <xs:element name="NET_TX" type="xs:integer"/>
+        <xs:element name="NET_RX" type="xs:integer"/>
+        <xs:element name="TEMPLATE" type="xs:anyType"/>
+        <xs:element name="HISTORY_RECORDS">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="HISTORY" maxOccurs="unbounded" minOccurs="0">
+                <xs:complexType>
+                  <xs:sequence>
+                    <xs:element name="SEQ" type="xs:integer"/>
+                    <xs:element name="HOSTNAME" type="xs:string"/>
+                    <xs:element name="VM_DIR" type="xs:string"/>
+                    <xs:element name="HID" type="xs:integer"/>
+                    <xs:element name="STIME" type="xs:integer"/>
+                    <xs:element name="ETIME" type="xs:integer"/>
+                    <xs:element name="VMMMAD" type="xs:string"/>
+                    <xs:element name="VNMMAD" type="xs:string"/>
+                    <xs:element name="TMMAD" type="xs:string"/>
+                    <xs:element name="PSTIME" type="xs:integer"/>
+                    <xs:element name="PETIME" type="xs:integer"/>
+                    <xs:element name="RSTIME" type="xs:integer"/>
+                    <xs:element name="RETIME" type="xs:integer"/>
+                    <xs:element name="ESTIME" type="xs:integer"/>
+                    <xs:element name="EETIME" type="xs:integer"/>
+                    <xs:element name="REASON" type="xs:integer"/>
+                  </xs:sequence>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/vm_pool.xsd b/share/doc/xsd/vm_pool.xsd
new file mode 100644
index 0000000000..ce73df84ab
--- /dev/null
+++ b/share/doc/xsd/vm_pool.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"
+    targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+    <xs:include schemaLocation="vm.xsd"/>
+    <xs:element name="VM_POOL">
+        <xs:complexType>
+            <xs:sequence maxOccurs="1" minOccurs="1">
+                <xs:element ref="VM" maxOccurs="unbounded" minOccurs="0"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/vnet.xsd b/share/doc/xsd/vnet.xsd
new file mode 100644
index 0000000000..391a01d3fd
--- /dev/null
+++ b/share/doc/xsd/vnet.xsd
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:element name="VNET">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="ID" type="xs:integer"/>
+        <xs:element name="UID" type="xs:integer"/>
+        <xs:element name="GID" type="xs:integer"/>
+        <xs:element name="UNAME" type="xs:string"/>
+        <xs:element name="GNAME" type="xs:string"/>
+        <xs:element name="NAME" type="xs:string"/>
+        <xs:element name="TYPE" type="xs:integer"/>
+        <xs:element name="BRIDGE" type="xs:string"/>
+        <xs:element name="VLAN" type="xs:integer"/>
+        <xs:element name="PHYDEV" type="xs:string"/>
+        <xs:element name="VLAN_ID" type="xs:string"/>
+        <xs:element name="RANGE" minOccurs="0" maxOccurs="1">
+          <xs:complexType>
+            <xs:sequence>
+              <xs:element name="IP_START" type="xs:string"/>
+              <xs:element name="IP_END" type="xs:string"/>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+        <xs:element name="PUBLIC" type="xs:integer"/>
+        <xs:element name="TOTAL_LEASES" type="xs:integer"/>
+        <xs:element name="TEMPLATE" type="xs:anyType"/>
+        <xs:element name="LEASES" minOccurs="0" maxOccurs="1">
+          <xs:complexType>
+            <xs:sequence minOccurs="0">
+              <xs:element name="LEASE" minOccurs="0" maxOccurs="unbounded">
+                <xs:complexType>
+                  <xs:sequence>
+                    <xs:element name="IP" type="xs:string"/>
+                    <xs:element name="MAC" type="xs:string"/>
+                    <xs:element name="USED" type="xs:integer"/>
+                    <xs:element name="VID" type="xs:integer"/>
+                  </xs:sequence>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
+          </xs:complexType>
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/share/doc/xsd/vnet_pool.xsd b/share/doc/xsd/vnet_pool.xsd
new file mode 100644
index 0000000000..d67a0b33e3
--- /dev/null
+++ b/share/doc/xsd/vnet_pool.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
+  targetNamespace="http://opennebula.org/XMLSchema" xmlns="http://opennebula.org/XMLSchema">
+  <xs:include schemaLocation="vnet.xsd"/>
+  <xs:element name="VNET_POOL">
+    <xs:complexType>
+      <xs:sequence maxOccurs="1" minOccurs="1">
+        <xs:element ref="VNET" maxOccurs="unbounded" minOccurs="0"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
\ No newline at end of file
diff --git a/src/group/Group.cc b/src/group/Group.cc
index a6d8dbc54a..51030c404e 100644
--- a/src/group/Group.cc
+++ b/src/group/Group.cc
@@ -34,7 +34,7 @@ const char * Group::db_bootstrap = "CREATE TABLE IF NOT EXISTS group_pool ("
 /* Group :: Database Access Functions                                       */
 /* ************************************************************************ */
 
-int Group::insert_replace(SqlDB *db, bool replace)
+int Group::insert_replace(SqlDB *db, bool replace, string& error_str)
 {
     ostringstream   oss;
 
@@ -60,6 +60,11 @@ int Group::insert_replace(SqlDB *db, bool replace)
         goto error_body;
     }
 
+    if ( validate_xml(sql_xml) != 0 )
+    {
+        goto error_xml;
+    }
+
     if ( replace )
     {
         oss << "REPLACE";
@@ -83,9 +88,24 @@ int Group::insert_replace(SqlDB *db, bool replace)
 
     return rc;
 
+error_xml:
+    db->free_str(sql_name);
+    db->free_str(sql_xml);
+
+    error_str = "Error transforming the Group to XML.";
+
+    goto error_common;
+
 error_body:
     db->free_str(sql_name);
+    goto error_generic;
+
 error_name:
+    goto error_generic;
+
+error_generic:
+    error_str = "Error inserting Group in DB.";
+error_common:
     return -1;
 }
 
diff --git a/src/host/Host.cc b/src/host/Host.cc
index 484a44953b..25fca06b7f 100644
--- a/src/host/Host.cc
+++ b/src/host/Host.cc
@@ -69,36 +69,7 @@ const char * Host::db_bootstrap = "CREATE TABLE IF NOT EXISTS host_pool ("
 /* ------------------------------------------------------------------------ */
 /* ------------------------------------------------------------------------ */
 
-int Host::insert(SqlDB *db, string& error_str)
-{
-    int rc;
-
-    rc = insert_replace(db, false);
-
-    if ( rc != 0 )
-    {
-        error_str = "Error inserting Host in DB.";
-    }
-
-    return rc;
-}
-
-/* ------------------------------------------------------------------------ */
-/* ------------------------------------------------------------------------ */
-
-int Host::update(SqlDB *db)
-{
-    int    rc;
-
-    rc = insert_replace(db, true);
-
-    return rc;
-}
-
-/* ------------------------------------------------------------------------ */
-/* ------------------------------------------------------------------------ */
-
-int Host::insert_replace(SqlDB *db, bool replace)
+int Host::insert_replace(SqlDB *db, bool replace, string& error_str)
 {
     ostringstream   oss;
 
@@ -124,6 +95,11 @@ int Host::insert_replace(SqlDB *db, bool replace)
         goto error_body;
     }
 
+    if ( validate_xml(sql_xml) != 0 )
+    {
+        goto error_xml;
+    }
+
     if(replace)
     {
         oss << "REPLACE";
@@ -149,9 +125,24 @@ int Host::insert_replace(SqlDB *db, bool replace)
 
     return rc;
 
+error_xml:
+    db->free_str(sql_hostname);
+    db->free_str(sql_xml);
+
+    error_str = "Error transforming the Group to XML.";
+
+    goto error_common;
+
 error_body:
     db->free_str(sql_hostname);
+    goto error_generic;
+
 error_hostname:
+    goto error_generic;
+
+error_generic:
+    error_str = "Error inserting Group in DB.";
+error_common:
     return -1;
 }
 
diff --git a/src/image/Image.cc b/src/image/Image.cc
index 19b4b232cc..e5125bc0a7 100644
--- a/src/image/Image.cc
+++ b/src/image/Image.cc
@@ -190,12 +190,7 @@ int Image::insert(SqlDB *db, string& error_str)
     // Insert the Image
     //--------------------------------------------------------------------------
 
-    rc = insert_replace(db, false);
-
-    if ( rc == -1 )
-    {
-        error_str = "Error inserting Image in DB.";
-    }
+    rc = insert_replace(db, false, error_str);
 
     return rc;
 
@@ -237,13 +232,14 @@ error_common:
 
 int Image::update(SqlDB *db)
 {
-    return insert_replace(db, true);;
+    string error_str;
+    return insert_replace(db, true, error_str);
 }
 
 /* ------------------------------------------------------------------------ */
 /* ------------------------------------------------------------------------ */
 
-int Image::insert_replace(SqlDB *db, bool replace)
+int Image::insert_replace(SqlDB *db, bool replace, string& error_str)
 {
     ostringstream   oss;
 
@@ -270,6 +266,11 @@ int Image::insert_replace(SqlDB *db, bool replace)
         goto error_body;
     }
 
+    if ( validate_xml(sql_xml) != 0 )
+    {
+        goto error_xml;
+    }
+
     if(replace)
     {
         oss << "REPLACE";
@@ -296,9 +297,24 @@ int Image::insert_replace(SqlDB *db, bool replace)
 
     return rc;
 
+error_xml:
+    db->free_str(sql_name);
+    db->free_str(sql_xml);
+
+    error_str = "Error transforming the Image to XML.";
+
+    goto error_common;
+
 error_body:
     db->free_str(sql_name);
+    goto error_generic;
+
 error_name:
+    goto error_generic;
+
+error_generic:
+    error_str = "Error inserting Image in DB.";
+error_common:
     return -1;
 }
 
diff --git a/src/image_mad/remotes/fs/fs.conf b/src/image_mad/remotes/fs/fs.conf
new file mode 100644
index 0000000000..8e464991f9
--- /dev/null
+++ b/src/image_mad/remotes/fs/fs.conf
@@ -0,0 +1,38 @@
+# -------------------------------------------------------------------------- #
+# Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org)             #
+#                                                                            #
+# Licensed under the Apache License, Version 2.0 (the "License"); you may    #
+# not use this file except in compliance with the License. You may obtain    #
+# a copy of the License at                                                   #
+#                                                                            #
+# http://www.apache.org/licenses/LICENSE-2.0                                 #
+#                                                                            #
+# Unless required by applicable law or agreed to in writing, software        #
+# distributed under the License is distributed on an "AS IS" BASIS,          #
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
+# See the License for the specific language governing permissions and        #
+# limitations under the License.                                             #
+#--------------------------------------------------------------------------- #
+
+#                          PRESERVE BASH SYNTAX
+
+#*******************************************************************************
+#  Configuration File for File-System based Image Repositories
+#-------------------------------------------------------------------------------
+#  IMAGE_REPOSITORY: Path where the images will be stored. If not defined 
+#  defaults to /var/lib/one/images or $ONE_LOCATION/var/images
+#
+#  RESTRICTED_DIRS: Paths that can not be used to register images. A space 
+#  separated list of paths. This prevents users to access important files like
+#  oned.db or /etc/shadow. OpenNebula will automatically add its configuration 
+#  dirs:/var/lib/one, /etc/one and oneadmin's home ($HOME).
+#
+#  SAFE_DIRS: Paths that are safe to specify image paths. This will allow you to
+#  open specific paths within RESTRICTED_DIRS
+#*******************************************************************************
+
+#IMAGE_REPOSITORY_PATH=/var/lib/one/images
+
+RESTRICTED_DIRS="/etc/"
+
+SAFE_DIRS="$HOME/public/"
diff --git a/src/image_mad/remotes/fs/fsrc b/src/image_mad/remotes/fs/fsrc
index c8e7a58d3a..8cec0f0b05 100644
--- a/src/image_mad/remotes/fs/fsrc
+++ b/src/image_mad/remotes/fs/fsrc
@@ -22,12 +22,6 @@
 #   - RESTRICTED_DIRS: Paths that can not be used to register images
 #   - SAFE_DIRS: Paths that are safe to specify image paths 
 #------------------------------------------------------------------------------
-if [ -z "${ONE_LOCATION}" ]; then
-    export IMAGE_REPOSITORY_PATH=/var/lib/one/images
-else
-    export IMAGE_REPOSITORY_PATH=$ONE_LOCATION/var/images
-fi
-
 if [ -z "${ONE_LOCATION}" ]; then
     VAR_LOCATION=/var/lib/one/
     ETC_LOCATION=/etc/one/
@@ -36,8 +30,23 @@ else
     ETC_LOCATION=$ONE_LOCATION/etc/
 fi
 
-export RESTRICTED_DIRS="$VAR_LOCATION $ETC_LOCATION $HOME/ /etc/"
-export SAFE_DIRS="$HOME/public/"
+CONF_FILE=$ETC_LOCATION/image/fs.conf
+
+source $CONF_FILE
+
+if [ -z "${IMAGE_REPOSITORY_PATH}" ]; then
+	if [ -z "${ONE_LOCATION}" ]; then
+	    IMAGE_REPOSITORY_PATH=/var/lib/one/images
+	else
+	    IMAGE_REPOSITORY_PATH=$ONE_LOCATION/var/images
+	fi
+fi
+
+RESTRICTED_DIRS="$VAR_LOCATION $ETC_LOCATION $HOME/ $RESTRICTED_DIRS"
+
+export IMAGE_REPOSITORY_PATH
+export RESTRICTED_DIRS
+export SAFE_DIRS
 
 #------------------------------------------------------------------------------
 # Function used to generate Image names, you should not need to override this
@@ -86,7 +95,6 @@ function check_restricted {
 
 # Change the permissions of all the files inside directoriers (= VMware disks)
 function fix_owner_perms {
-
 	find $IMAGE_REPOSITORY_PATH -type d \
 	                            -mindepth 1 \
 	                            -maxdepth 1 \
diff --git a/src/mad/ruby/DriverExecHelper.rb b/src/mad/ruby/DriverExecHelper.rb
index d6b632b7e0..bb4b86d71b 100644
--- a/src/mad/ruby/DriverExecHelper.rb
+++ b/src/mad/ruby/DriverExecHelper.rb
@@ -44,6 +44,9 @@ module DriverExecHelper
         # dummy paths
         @remote_scripts_path = File.join(@remote_scripts_base_path, directory)
         @local_scripts_path  = File.join(@local_scripts_base_path, directory)
+
+        # mutex for logging
+        @send_mutex = Mutex.new
     end
 
     #
@@ -94,6 +97,14 @@ module DriverExecHelper
     #
     #                METHODS FOR LOGS & COMMAND OUTPUT
     #     
+    # Sends a message to the OpenNebula core through stdout
+    def send_message(action="-", result=RESULT[:failure], id="-", info="-")
+        @send_mutex.synchronize {
+            STDOUT.puts "#{action} #{result} #{id} #{info}"
+            STDOUT.flush
+        }
+    end
+
     # Sends a log message to ONE. The +message+ can be multiline, it will
     # be automatically splitted by lines.
     def log(number, message)
diff --git a/src/mad/ruby/OpenNebulaDriver.rb b/src/mad/ruby/OpenNebulaDriver.rb
index 758750aa75..18561f1fc7 100644
--- a/src/mad/ruby/OpenNebulaDriver.rb
+++ b/src/mad/ruby/OpenNebulaDriver.rb
@@ -57,23 +57,15 @@ class OpenNebulaDriver < ActionManager
 
         super(@options[:concurrency], @options[:threaded])
 
-        @retries       = @options[:retries]
+        @retries = @options[:retries]       
 
-        @send_mutex    = Mutex.new
-       
         #Set default values
         initialize_helper(directory, @options) 
 
         register_action(:INIT, method("init"))
     end
 
-    # Sends a message to the OpenNebula core through stdout
-    def send_message(action="-", result=RESULT[:failure], id="-", info="-")
-        @send_mutex.synchronize {
-            STDOUT.puts "#{action} #{result} #{id} #{info}"
-            STDOUT.flush
-        }
-    end
+
 
     # Calls remotes or local action checking the action name and
     # @local_actions. Optional arguments can be specified as a hash
diff --git a/src/onedb/3.1.0_to_3.1.80.rb b/src/onedb/3.1.0_to_3.1.80.rb
index 5644157197..022e096dfd 100644
--- a/src/onedb/3.1.0_to_3.1.80.rb
+++ b/src/onedb/3.1.0_to_3.1.80.rb
@@ -34,8 +34,8 @@ module Migrator
 
         vn_mad = ""
 
-        while !( ["802.1Q", "dummy", "ebtables", "ovswitch"].include?(vn_mad) ) do
-            print "      Driver name (802.1Q, dummy, ebtables, ovswitch): "
+        while !( ["802.1Q", "dummy", "ebtables", "ovswitch", "fw"].include?(vn_mad) ) do
+            print "      Driver name (802.1Q, dummy, ebtables, ovswitch, fw): "
             vn_mad = gets.chomp
             vn_mad = "dummy" if vn_mad.empty?
         end
diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js
index bdf52bc315..fcb660d857 100644
--- a/src/sunstone/public/js/plugins/vms-tab.js
+++ b/src/sunstone/public/js/plugins/vms-tab.js
@@ -750,20 +750,17 @@ function setupCreateVMDialog(){
         if (!template_id.length){
             notifyError("You have not selected a template");
             return false;
-        }
+        };
 
         if (n_times.length){
             n_times_int=parseInt(n_times,10);
-        }
+        };
 
-        if (n_times_int>1){
-            if (!vm_name.length){
-                vm_name = $('#template_id option:selected',this).text();
-            }
-            for (var i=0; i< n_times_int; i++){
-                Sunstone.runAction("Template.instantiate",template_id,vm_name+"_"+i);
-            };
-        } else {
+        if (!vm_name.length){
+            vm_name = $('#template_id option:selected',this).text();
+        };
+
+        for (var i=0; i< n_times_int; i++){
             Sunstone.runAction("Template.instantiate",template_id,vm_name);
         };
 
diff --git a/src/um/User.cc b/src/um/User.cc
index 5e02a320e9..ee78dc411f 100644
--- a/src/um/User.cc
+++ b/src/um/User.cc
@@ -44,25 +44,7 @@ const char * User::db_bootstrap = "CREATE TABLE IF NOT EXISTS user_pool ("
 /* -------------------------------------------------------------------------- */
 /* -------------------------------------------------------------------------- */
 
-int User::insert(SqlDB *db, string& error_str)
-{
-    int rc;
-
-    rc = insert_replace(db, false);
-
-    if ( rc != 0 )
-    {
-        error_str = "Error inserting User in DB.";
-        return rc;
-    }
-
-    return 0;
-}
-
-/* -------------------------------------------------------------------------- */
-/* -------------------------------------------------------------------------- */
-
-int User::insert_replace(SqlDB *db, bool replace)
+int User::insert_replace(SqlDB *db, bool replace, string& error_str)
 {
     ostringstream   oss;
 
@@ -88,6 +70,11 @@ int User::insert_replace(SqlDB *db, bool replace)
         goto error_body;
     }
 
+    if ( validate_xml(sql_xml) != 0 )
+    {
+        goto error_xml;
+    }
+
     // Construct the SQL statement to Insert or Replace
     if(replace)
     {
@@ -110,9 +97,24 @@ int User::insert_replace(SqlDB *db, bool replace)
 
     return rc;
 
+error_xml:
+    db->free_str(sql_username);
+    db->free_str(sql_xml);
+
+    error_str = "Error transforming the User to XML.";
+
+    goto error_common;
+
 error_body:
     db->free_str(sql_username);
+    goto error_generic;
+
 error_username:
+    goto error_generic;
+
+error_generic:
+    error_str = "Error inserting User in DB.";
+error_common:
     return -1;
 }
 
diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc
index 1180c0ef93..4443bb0b30 100644
--- a/src/vm/VirtualMachine.cc
+++ b/src/vm/VirtualMachine.cc
@@ -281,7 +281,7 @@ int VirtualMachine::insert(SqlDB * db, string& error_str)
     // Insert the VM
     // ------------------------------------------------------------------------
 
-    rc = insert_replace(db, false);
+    rc = insert_replace(db, false, error_str);
 
     if ( rc != 0 )
     {
@@ -291,7 +291,6 @@ int VirtualMachine::insert(SqlDB * db, string& error_str)
     return 0;
 
 error_update:
-    error_str = "Can not insert VM in the database.";
     goto error_rollback;
 
 error_context:
@@ -506,7 +505,7 @@ int VirtualMachine::parse_requirements(string& error_str)
 /* ------------------------------------------------------------------------ */
 /* ------------------------------------------------------------------------ */
 
-int VirtualMachine::insert_replace(SqlDB *db, bool replace)
+int VirtualMachine::insert_replace(SqlDB *db, bool replace, string& error_str)
 {
     ostringstream   oss;
     int             rc;
@@ -520,7 +519,7 @@ int VirtualMachine::insert_replace(SqlDB *db, bool replace)
 
     if ( sql_deploy_id == 0 )
     {
-        goto error_deploy;
+        goto error_generic;
     }
 
     sql_name =  db->escape_str(name.c_str());
@@ -537,6 +536,11 @@ int VirtualMachine::insert_replace(SqlDB *db, bool replace)
         goto error_body;
     }
 
+    if ( validate_xml(sql_xml) != 0 )
+    {
+        goto error_xml;
+    }
+
     if(replace)
     {
         oss << "REPLACE";
@@ -564,12 +568,27 @@ int VirtualMachine::insert_replace(SqlDB *db, bool replace)
 
     return rc;
 
+error_xml:
+    db->free_str(sql_deploy_id);
+    db->free_str(sql_name);
+    db->free_str(sql_xml);
+
+    error_str = "Error transforming the VM to XML.";
+
+    goto error_common;
 
 error_body:
+    db->free_str(sql_deploy_id);
     db->free_str(sql_name);
+    goto error_generic;
+
 error_name:
     db->free_str(sql_deploy_id);
-error_deploy:
+    goto error_generic;
+
+error_generic:
+    error_str = "Error inserting VM in DB.";
+error_common:
     return -1;
 }
 
diff --git a/src/vm_template/VMTemplate.cc b/src/vm_template/VMTemplate.cc
index b231ac1d44..96ba3eeedd 100644
--- a/src/vm_template/VMTemplate.cc
+++ b/src/vm_template/VMTemplate.cc
@@ -113,12 +113,7 @@ int VMTemplate::insert(SqlDB *db, string& error_str)
     // Insert the Template
     // ------------------------------------------------------------------------
 
-    rc = insert_replace(db, false);
-
-    if ( rc != 0 )
-    {
-        error_str = "Error inserting Template in DB.";
-    }
+    rc = insert_replace(db, false, error_str);
 
     return rc;
 }
@@ -126,7 +121,7 @@ int VMTemplate::insert(SqlDB *db, string& error_str)
 /* ------------------------------------------------------------------------ */
 /* ------------------------------------------------------------------------ */
 
-int VMTemplate::insert_replace(SqlDB *db, bool replace)
+int VMTemplate::insert_replace(SqlDB *db, bool replace, string& error_str)
 {
     ostringstream   oss;
 
@@ -152,6 +147,11 @@ int VMTemplate::insert_replace(SqlDB *db, bool replace)
         goto error_body;
     }
 
+    if ( validate_xml(sql_xml) != 0 )
+    {
+        goto error_xml;
+    }
+
     if(replace)
     {
         oss << "REPLACE";
@@ -178,9 +178,24 @@ int VMTemplate::insert_replace(SqlDB *db, bool replace)
 
     return rc;
 
+error_xml:
+    db->free_str(sql_name);
+    db->free_str(sql_xml);
+
+    error_str = "Error transforming the Template to XML.";
+
+    goto error_common;
+
 error_body:
     db->free_str(sql_name);
+    goto error_generic;
+
 error_name:
+    goto error_generic;
+
+error_generic:
+    error_str = "Error inserting Template in DB.";
+error_common:
     return -1;
 }
 
diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb
index 499f174e7d..4b854a697a 100755
--- a/src/vmm_mad/exec/one_vmm_exec.rb
+++ b/src/vmm_mad/exec/one_vmm_exec.rb
@@ -68,14 +68,14 @@ class VmmAction
         get_data(:dest_driver, :MIGR_NET_DRV)
 
         # Initialize streams and vnm
-        @ssh_src = @vmm.get_ssh_stream(@data[:host], @id)
+        @ssh_src = @vmm.get_ssh_stream(action, @data[:host], @id)
         @vnm_src = VirtualNetworkDriver.new(@data[:net_drv],
                             :local_actions  => @vmm.options[:local_actions],
                             :message        => @xml_data,
                             :ssh_stream     => @ssh_src)
 
         if @data[:dest_host] and !@data[:dest_host].empty?
-            @ssh_dst = @vmm.get_ssh_stream(@data[:dest_host], @id)
+            @ssh_dst = @vmm.get_ssh_stream(action, @data[:dest_host], @id)
             @vnm_dst = VirtualNetworkDriver.new(@data[:dest_driver],
                             :local_actions  => @vmm.options[:local_actions],
                             :message        => @xml_data,
@@ -155,7 +155,7 @@ class VmmAction
             end
 
             # Save the step info
-            @data["#{step[:action]}_info".to_sym] = info
+            @data["#{step[:action]}_info".to_sym] = info.strip
 
             # Roll back steps, store failed info and break steps
             if DriverExecHelper.failed?(result)
@@ -168,7 +168,7 @@ class VmmAction
                 break
             else
                 @vmm.log(@id,
-                         "Sussecfully execute #{DRIVER_NAMES[step[:driver]]} " \
+                         "Successfully execute #{DRIVER_NAMES[step[:driver]]} " \
                          "operation: #{step[:action]}.")
             end
         end
@@ -228,10 +228,16 @@ class ExecDriver < VirtualMachineDriver
     # @param[String] the hostname of the host
     # @param[String] id of the VM to log messages
     # @return [SshStreamCommand]
-    def get_ssh_stream(host, id)
-        SshStreamCommand.new(host,
-                             @remote_scripts_base_path,
-                             log_method(id))
+    def get_ssh_stream(aname, host, id)
+        stream = nil
+         
+        if not action_is_local?(aname)
+            stream = SshStreamCommand.new(host,
+                                          @remote_scripts_base_path,
+                                          log_method(id))
+        else
+            return nil
+        end
     end
 
     #---------------------------------------------------------------------------
diff --git a/src/vmm_mad/exec/one_vmm_sh b/src/vmm_mad/exec/one_vmm_sh
index 77aed093fe..6db516936c 100755
--- a/src/vmm_mad/exec/one_vmm_sh
+++ b/src/vmm_mad/exec/one_vmm_sh
@@ -22,4 +22,4 @@ else
     MAD_LOCATION=$ONE_LOCATION/lib/mads
 fi
 
-exec $MAD_LOCATION/one_vmm_exec -l deploy,shutdown,cancel,save,restore,migrate,poll $*
+exec $MAD_LOCATION/one_vmm_exec -l deploy,shutdown,cancel,save,restore,migrate,poll,pre,post,clean $*
diff --git a/src/vnm/VirtualNetwork.cc b/src/vnm/VirtualNetwork.cc
index fb2c5f4291..df74786313 100644
--- a/src/vnm/VirtualNetwork.cc
+++ b/src/vnm/VirtualNetwork.cc
@@ -228,7 +228,7 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
 
     TO_UPPER(vlan_attr);
 
-    vlan = (vlan_attr == "YES");
+    vlan = (vlan_attr == "YES") || (vlan_attr.empty() && !phydev.empty());
 
     // ------------ BRIDGE --------------------
 
@@ -302,7 +302,7 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
     //--------------------------------------------------------------------------
     // Insert the Virtual Network
     //--------------------------------------------------------------------------
-    rc = insert_replace(db, false);
+    rc = insert_replace(db, false, error_str);
 
     if ( rc != 0 )
     {
@@ -328,7 +328,7 @@ error_bridge:
     goto error_common;
 
 error_update:
-    ose << "Can not update Virtual Network.";
+    ose << error_str;
     goto error_common;
 
 error_ranged:
@@ -347,7 +347,7 @@ error_common:
 /* -------------------------------------------------------------------------- */
 /* -------------------------------------------------------------------------- */
 
-int VirtualNetwork::insert_replace(SqlDB *db, bool replace)
+int VirtualNetwork::insert_replace(SqlDB *db, bool replace, string& error_str)
 {
     ostringstream   oss;
     int             rc;
@@ -373,6 +373,11 @@ int VirtualNetwork::insert_replace(SqlDB *db, bool replace)
         goto error_body;
     }
 
+    if ( validate_xml(sql_xml) != 0 )
+    {
+        goto error_xml;
+    }
+
     // Construct the SQL statement to Insert or Replace
     if(replace)
     {
@@ -398,10 +403,24 @@ int VirtualNetwork::insert_replace(SqlDB *db, bool replace)
 
     return rc;
 
+error_xml:
+    db->free_str(sql_name);
+    db->free_str(sql_xml);
+
+    error_str = "Error transforming the Virtual Network to XML.";
+
+    goto error_common;
 
 error_body:
     db->free_str(sql_name);
+    goto error_generic;
+
 error_name:
+    goto error_generic;
+
+error_generic:
+    error_str = "Error inserting Virtual Network in DB.";
+error_common:
     return -1;
 }
 
diff --git a/src/vnm_mad/one_vnm.rb b/src/vnm_mad/one_vnm.rb
index 30c886e97a..27c2c10905 100644
--- a/src/vnm_mad/one_vnm.rb
+++ b/src/vnm_mad/one_vnm.rb
@@ -58,7 +58,7 @@ class VirtualNetworkDriver
 
         if action_is_local?(aname)
             execution = LocalCommand.run(cmd, log_method(id))
-        else
+        elsif @ssh_stream != nil
             if options[:stdin]
                 cmdin = "cat << EOT | #{cmd}"
                 stdin = "#{options[:stdin]}\nEOT\n"
@@ -68,8 +68,10 @@ class VirtualNetworkDriver
             end
 
             execution = @ssh_stream.run(cmdin, stdin, cmd)
+        else
+            return RESULT[:failure], "Network action #{aname} needs a ssh stream."
         end
 
-        result, info = get_info_from_execution(execution)
+        return get_info_from_execution(execution)
     end
 end
diff --git a/src/xml/ObjectXML.cc b/src/xml/ObjectXML.cc
index d0704eb9aa..566c7e013e 100644
--- a/src/xml/ObjectXML.cc
+++ b/src/xml/ObjectXML.cc
@@ -378,6 +378,24 @@ int ObjectXML::update_from_node(const xmlNodePtr node)
 /* -------------------------------------------------------------------------- */
 /* -------------------------------------------------------------------------- */
 
+int ObjectXML::validate_xml(const string &xml_doc)
+{
+    xmlDocPtr tmp_xml = 0;
+    tmp_xml = xmlParseMemory (xml_doc.c_str(),xml_doc.length());
+
+    if (tmp_xml == 0)
+    {
+        return -1;
+    }
+
+    xmlFreeDoc(tmp_xml);
+
+    return 0;
+}
+
+/* -------------------------------------------------------------------------- */
+/* -------------------------------------------------------------------------- */
+
 void ObjectXML::xml_parse(const string &xml_doc)
 {
     xml = xmlParseMemory (xml_doc.c_str(),xml_doc.length());