render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From 88c5f4f82ea78857962ff3bd601aaa25dcb7d8bf Mon Sep 17 00:00:00 2001
Message-Id: <88c5f4f82ea78857962ff3bd601aaa25dcb7d8bf.1383922565.git.jdenemar@redhat.com>
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
Date: Thu, 7 Nov 2013 18:55:21 +0100
Subject: [PATCH] Allow root directory in filesystem source dir schema

Use absDirPath instead of absFilePath.

https://bugzilla.redhat.com/show_bug.cgi?id=1028107
(cherry picked from commit eab51940bd9d3b5f8b73f52c50ba6d00648f0909)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 docs/schemas/domaincommon.rng                  |  4 ++--
 tests/lxcxml2xmldata/lxc-filesystem-ram.xml    |  4 ++++
 tests/lxcxml2xmldata/lxc-filesystem-root.xml   | 25 +++++++++++++++++++++++++
 tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml |  4 ++++
 tests/lxcxml2xmltest.c                         |  1 +
 5 files changed, 36 insertions(+), 2 deletions(-)
 create mode 100644 tests/lxcxml2xmldata/lxc-filesystem-root.xml

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 5540745..c7eaf00 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1628,7 +1628,7 @@
           <interleave>
             <element name="source">
               <attribute name="dir">
-                <ref name="absFilePath"/>
+                <ref name="absDirPath"/>
               </attribute>
               <empty/>
             </element>
@@ -1646,7 +1646,7 @@
           <interleave>
             <element name="source">
               <attribute name="dir">
-                <ref name="absFilePath"/>
+                <ref name="absDirPath"/>
               </attribute>
               <empty/>
             </element>
diff --git a/tests/lxcxml2xmldata/lxc-filesystem-ram.xml b/tests/lxcxml2xmldata/lxc-filesystem-ram.xml
index 002fde6..58ae344 100644
--- a/tests/lxcxml2xmldata/lxc-filesystem-ram.xml
+++ b/tests/lxcxml2xmldata/lxc-filesystem-ram.xml
@@ -14,6 +14,10 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/libexec/libvirt_lxc</emulator>
+    <filesystem type='bind'>
+        <source dir='/'/>
+        <target dir='/'/>
+    </filesystem>
     <filesystem type='ram'>
         <source usage='1048576'/>
         <target dir='/mnt/mississippi'/>
diff --git a/tests/lxcxml2xmldata/lxc-filesystem-root.xml b/tests/lxcxml2xmldata/lxc-filesystem-root.xml
new file mode 100644
index 0000000..1ce2b32
--- /dev/null
+++ b/tests/lxcxml2xmldata/lxc-filesystem-root.xml
@@ -0,0 +1,25 @@
+<domain type='lxc'>
+  <name>demo</name>
+  <uuid>8369f1ac-7e46-e869-4ca5-759d51478066</uuid>
+  <memory unit='KiB'>500000</memory>
+  <currentMemory unit='KiB'>500000</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64'>exe</type>
+    <init>/bin/sh</init>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <emulator>/usr/libexec/libvirt_lxc</emulator>
+    <filesystem type='mount' accessmode='passthrough'>
+      <source dir='/'/>
+      <target dir='/'/>
+    </filesystem>
+    <console type='pty'>
+      <target type='lxc' port='0'/>
+    </console>
+  </devices>
+</domain>
diff --git a/tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml b/tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml
index d2369a2..93162b3 100644
--- a/tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml
+++ b/tests/lxcxml2xmloutdata/lxc-filesystem-ram.xml
@@ -14,6 +14,10 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/libexec/libvirt_lxc</emulator>
+    <filesystem type='bind' accessmode='passthrough'>
+      <source dir='/'/>
+      <target dir='/'/>
+    </filesystem>
     <filesystem type='ram' accessmode='passthrough'>
       <source usage='1048576' units='KiB'/>
       <target dir='/mnt/mississippi'/>
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index f8b5959..8f66f82 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -132,6 +132,7 @@ mymain(void)
     DO_TEST("hostdev");
     DO_TEST("disk-formats");
     DO_TEST_DIFFERENT("filesystem-ram");
+    DO_TEST("filesystem-root");
 
     virObjectUnref(caps);
     virObjectUnref(xmlopt);
-- 
1.8.4.2