[PATCH 7/7] tests: docs: Add schema and testcase for domainsnapshot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alter the schema of domainsnapshot to add inactive XML of a snapshot.
As, snapshot already has active XML configuration of domain, the inactive
XMl is embedded in <inactiveDomain> tags. Sample XML is:

  <domainsnapshot>
    ....
    ....
    <domain>
    </domain>
    <inactiveDomain>
      <domain>
      </domain>
    </inactiveDomain>
  </domainsnapshot>

Alter the domainsnapshotxml2xmltest to validate the format.

Signed-off-by: Kothapally Madhu Pavan <kmp@xxxxxxxxxxxxxxxxxx>
---
 docs/schemas/domainsnapshot.rng                    | 19 +++++
 .../full_domain_withinactive.xml                   | 83 ++++++++++++++++++++++
 tests/domainsnapshotxml2xmltest.c                  |  1 +
 3 files changed, 103 insertions(+)
 create mode 100644 tests/domainsnapshotxml2xmlout/full_domain_withinactive.xml

diff --git a/docs/schemas/domainsnapshot.rng b/docs/schemas/domainsnapshot.rng
index 2680887..2a58a84 100644
--- a/docs/schemas/domainsnapshot.rng
+++ b/docs/schemas/domainsnapshot.rng
@@ -84,6 +84,25 @@
           </choice>
         </optional>
         <optional>
+          <choice>
+            <element name='inactiveDomain'>
+              <choice>
+                <element name='domain'>
+                  <element name='uuid'>
+                    <ref name="UUID"/>
+                  </element>
+                </element>
+                <!-- Nested grammar ensures that any of our overrides of
+                     storagecommon/domaincommon defines do not conflict
+                     with any domain.rng overrides.  -->
+                <grammar>
+                  <include href='domain.rng'/>
+                </grammar>
+              </choice>
+            </element>
+          </choice>
+        </optional>
+        <optional>
           <element name='parent'>
             <element name='name'>
               <text/>
diff --git a/tests/domainsnapshotxml2xmlout/full_domain_withinactive.xml b/tests/domainsnapshotxml2xmlout/full_domain_withinactive.xml
new file mode 100644
index 0000000..d6d1b39
--- /dev/null
+++ b/tests/domainsnapshotxml2xmlout/full_domain_withinactive.xml
@@ -0,0 +1,83 @@
+<domainsnapshot>
+  <name>my snap name</name>
+  <description>!@#$%^</description>
+  <state>running</state>
+  <parent>
+    <name>earlier_snap</name>
+  </parent>
+  <creationTime>1272917631</creationTime>
+  <memory snapshot='internal'/>
+  <domain type='qemu'>
+    <name>QEMUGuest1</name>
+    <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+    <memory unit='KiB'>219100</memory>
+    <currentMemory unit='KiB'>219100</currentMemory>
+    <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+    <os>
+      <type arch='i686' machine='pc'>hvm</type>
+      <boot dev='hd'/>
+    </os>
+    <clock offset='utc'/>
+    <on_poweroff>destroy</on_poweroff>
+    <on_reboot>restart</on_reboot>
+    <on_crash>destroy</on_crash>
+    <devices>
+      <emulator>/usr/bin/qemu-system-i686</emulator>
+      <disk type='block' device='disk'>
+        <source dev='/dev/HostVG/QEMUGuest1'/>
+        <target dev='hda' bus='ide'/>
+        <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+      </disk>
+      <controller type='usb' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+      </controller>
+      <controller type='ide' index='0'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+      </controller>
+      <controller type='pci' index='0' model='pci-root'/>
+      <input type='mouse' bus='ps2'/>
+      <input type='keyboard' bus='ps2'/>
+      <memballoon model='virtio'>
+        <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+      </memballoon>
+    </devices>
+  </domain>
+  <inactiveDomain>
+    <domain type='qemu'>
+      <name>QEMUGuest1</name>
+      <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+      <memory unit='KiB'>219100</memory>
+      <currentMemory unit='KiB'>219100</currentMemory>
+      <vcpu placement='static' cpuset='1-4,8-20,525'>1</vcpu>
+      <os>
+        <type arch='i686' machine='pc'>hvm</type>
+        <boot dev='hd'/>
+      </os>
+      <clock offset='utc'/>
+      <on_poweroff>destroy</on_poweroff>
+      <on_reboot>restart</on_reboot>
+      <on_crash>destroy</on_crash>
+      <devices>
+        <emulator>/usr/bin/qemu-system-i686</emulator>
+        <disk type='block' device='disk'>
+          <source dev='/dev/HostVG/QEMUGuest1'/>
+          <target dev='hda' bus='ide'/>
+          <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+        </disk>
+        <controller type='usb' index='0'>
+          <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+        </controller>
+        <controller type='ide' index='0'>
+          <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+        </controller>
+        <controller type='pci' index='0' model='pci-root'/>
+        <input type='mouse' bus='ps2'/>
+        <input type='keyboard' bus='ps2'/>
+        <memballoon model='virtio'>
+          <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+        </memballoon>
+      </devices>
+    </domain>
+  </inactiveDomain>
+  <active>1</active>
+</domainsnapshot>
diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c
index 3a6f86b..ebec2de 100644
--- a/tests/domainsnapshotxml2xmltest.c
+++ b/tests/domainsnapshotxml2xmltest.c
@@ -205,6 +205,7 @@ mymain(void)
     DO_TEST_OUT("all_parameters", "9d37b878-a7cc-9f9a-b78f-49b3abad25a8", true);
     DO_TEST_OUT("disk_snapshot_redefine", "c7a5fdbd-edaf-9455-926a-d65c16db1809", true);
     DO_TEST_OUT("full_domain", "c7a5fdbd-edaf-9455-926a-d65c16db1809", true);
+    DO_TEST_OUT("full_domain_withinactive", "c7a5fdbd-edaf-9455-926a-d65c16db1809", true);
     DO_TEST_OUT("noparent_nodescription_noactive", NULL, false);
     DO_TEST_OUT("noparent_nodescription", NULL, true);
     DO_TEST_OUT("noparent", "9d37b878-a7cc-9f9a-b78f-49b3abad25a8", false);
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux