Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 6b4e008

Browse files
committed
tests: Add some pool capacity checks to disk validation suite.
1 parent 9e1c3ce commit 6b4e008

3 files changed

Lines changed: 63 additions & 2 deletions

File tree

tests/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
os.environ["HOME"] = "/testdir"
4444
os.environ["DISPLAY"] = ":3.4"
4545

46+
def open_testdriver():
47+
return libvirt.open("test:///%s/tests/testdriver.xml" % os.getcwd())
48+
4649
# Register libvirt handler
4750
def libvirt_callback(ignore, err):
4851
logging.warn("libvirt errmsg: %s" % err[2])

tests/testdriver.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,58 @@
133133
</volume>
134134
</pool>
135135

136+
<pool type='dir'>
137+
<name>full-pool</name>
138+
<uuid>35bb2ad9-388a-cdfe-461a-b8907f6e5555</uuid>
139+
<capacity>1</capacity>
140+
<allocation>1</allocation>
141+
<available>0</available>
142+
<source>
143+
</source>
144+
<target>
145+
<path>/full-pool</path>
146+
<permissions>
147+
<mode>0700</mode>
148+
<owner>10736</owner>
149+
<group>10736</group>
150+
</permissions>
151+
</target>
152+
<volume>
153+
<name>testvol1.img</name>
154+
<capacity>107374182400</capacity>
155+
<allocation>107374182400</allocation>
156+
<target/>
157+
</volume>
158+
</pool>
159+
160+
<pool type='disk'>
161+
<name>halffull-pool</name>
162+
<uuid>35bb2ad9-388a-cdfe-461a-b8907f6e5444</uuid>
163+
<capacity>1</capacity>
164+
<allocation>1</allocation>
165+
<available>0</available>
166+
<source>
167+
</source>
168+
<target>
169+
<path>/halffull-pool</path>
170+
<permissions>
171+
<mode>0700</mode>
172+
<owner>10736</owner>
173+
<group>10736</group>
174+
</permissions>
175+
</target>
176+
<volume>
177+
<name>testvol1.img</name>
178+
<capacity>30000000000</capacity>
179+
<allocation>30000000000</allocation>
180+
<target/>
181+
</volume>
182+
<volume>
183+
<name>testvol2.img</name>
184+
<capacity>30000000000</capacity>
185+
<allocation>30000000000</allocation>
186+
<target/>
187+
</volume>
188+
</pool>
189+
136190
</node>

tests/validation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
1515
# MA 02110-1301 USA.
1616

17-
import libvirt
1817
import virtinst
1918
from virtinst import VirtualDisk
2019

2120
# Test helpers
21+
import tests
2222
from storage import createPool, createVol
2323

2424
import unittest
@@ -41,7 +41,7 @@
4141
# We install several storage pools on the connection to ensure
4242
# we aren't bumping up against errors in that department.
4343
logging.debug("\n\nStarting 'validation' storage setup.")
44-
testconn = libvirt.open("test:///default")
44+
testconn = tests.open_testdriver()
4545
testcaps = virtinst.CapabilitiesParser.parse(testconn.getCapabilities())
4646

4747
virtimage = virtinst.ImageParser.parse_file("tests/image-xml/image.xml")
@@ -138,6 +138,8 @@
138138
{ 'conn' : testconn, 'volName' : ("pool-exist", "vol-noexist")},
139139
{ 'conn' : testconn, 'volName' : ( 1234, "vol-noexist")},
140140
{ 'path' : 'valid', 'size' : 1, 'driverCache' : 'invalid' },
141+
{ 'conn' : testconn, "path" : "/full-pool/newvol.img", "size" : 1,
142+
'sparse' : False },
141143
],
142144

143145
'valid' : [
@@ -151,6 +153,8 @@
151153
{ 'conn' : testconn, 'path' : "/pool-exist/vol-noexist", 'size' : 1 },
152154
{ 'conn' : testconn, 'volInstall': volinst},
153155
{ 'path' : 'nonexist', 'size' : 1, 'driverCache' : 'writethrough' },
156+
# Full pool, but we are nonsparse
157+
{ 'conn' : testconn, "path" : "/full-pool/newvol.img", "size" : 1 },
154158
]
155159
},
156160

0 commit comments

Comments
 (0)