~ubuntu-branches/ubuntu/raring/virtinst/raring-proposed

« back to all changes in this revision

Viewing changes to tests/validation.py

  • Committer: Bazaar Package Importer
  • Author(s): Guido Günther
  • Date: 2009-12-07 10:04:22 UTC
  • mto: (1.6.3 sid)
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: james.westby@ubuntu.com-20091207100422-2izjffd5ljvqun47
Tags: upstream-0.500.1
Import upstream version 0.500.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
# Test helpers
21
21
import tests
22
 
from storage import createPool, createVol
23
22
 
24
23
import unittest
25
24
import logging
40
39
 
41
40
# We install several storage pools on the connection to ensure
42
41
# we aren't bumping up against errors in that department.
43
 
logging.debug("\n\nStarting 'validation' storage setup.")
44
42
testconn = tests.open_testdriver()
45
43
testcaps = virtinst.CapabilitiesParser.parse(testconn.getCapabilities())
46
44
 
47
45
virtimage = virtinst.ImageParser.parse_file("tests/image-xml/image.xml")
48
46
 
49
 
offdskpaths = [ "/dev", ]
50
 
for path in offdskpaths:
51
 
    createPool(testconn, virtinst.Storage.StoragePool.TYPE_DISK,
52
 
               tpath=path, start=False, fmt="dos")
53
 
 
54
 
dirpaths = [ "/var/lib/libvirt/images", "/", "/tmp" ]
55
 
for path in dirpaths:
56
 
    createPool(testconn, virtinst.Storage.StoragePool.TYPE_DIR,
57
 
               tpath=path, start=True)
58
 
 
59
 
dskpaths = [ "/somedev", "/dev/disk/by-uuid" ]
60
 
for path in dskpaths:
61
 
    createPool(testconn, virtinst.Storage.StoragePool.TYPE_DISK,
62
 
               fmt="dos", tpath=path, start=False)
63
 
 
64
 
# Create a usable pool/vol pairs
65
 
p = createPool(testconn, virtinst.Storage.StoragePool.TYPE_DIR,
66
 
               tpath="/pool-exist", start=True, poolname="pool-exist")
67
 
dirvol = createVol(p, "vol-exist")
68
 
volinst = virtinst.Storage.StorageVolume(pool=p, name="somevol", capacity=1)
69
 
logging.debug("Ending 'validation' storage setup.\n\n")
 
47
volinst = virtinst.Storage.StorageVolume(conn=testconn,
 
48
                                         pool_name="default-pool",
 
49
                                         name="val-vol",
 
50
                                         capacity=1)
70
51
 
71
52
args = {
72
53
 
133
114
    { 'path' : None },
134
115
    { 'path' : "noexist", 'size' : 900000, 'sparse' : False },
135
116
    { 'path' : "noexist", 'type' : VirtualDisk.DEVICE_CDROM},
136
 
    { 'volName' : ("pool-exist", "vol-exist")},
137
 
    { 'conn' : testconn, 'volName' : ("pool-noexist", "vol-exist")},
138
 
    { 'conn' : testconn, 'volName' : ("pool-exist", "vol-noexist")},
 
117
    { 'volName' : ("default-pool", "default-vol")},
 
118
    { 'conn' : testconn, 'volName' : ("pool-noexist", "default-vol")},
 
119
    { 'conn' : testconn, 'volName' : ("default-pool", "vol-noexist")},
139
120
    { 'conn' : testconn, 'volName' : ( 1234, "vol-noexist")},
140
121
    { 'path' : 'valid', 'size' : 1, 'driverCache' : 'invalid' },
141
122
    { 'conn' : testconn, "path" : "/full-pool/newvol.img", "size" : 1,
148
129
    { 'path' :'/dev/null'},
149
130
    { 'path' : None, 'device' : VirtualDisk.DEVICE_CDROM},
150
131
    { 'path' : None, 'device' : VirtualDisk.DEVICE_FLOPPY},
151
 
    { 'conn' : testconn, 'volName' : ("pool-exist", "vol-exist")},
152
 
    { 'conn' : testconn, 'path' : "/pool-exist/vol-exist" },
153
 
    { 'conn' : testconn, 'path' : "/pool-exist/vol-noexist", 'size' : 1 },
 
132
    { 'conn' : testconn, 'volName' : ("default-pool", "default-vol")},
 
133
    { 'conn' : testconn, 'path' : "/default-pool/default-vol" },
 
134
    { 'conn' : testconn, 'path' : "/default-pool/vol-noexist", 'size' : 1 },
154
135
    { 'conn' : testconn, 'volInstall': volinst},
155
136
    { 'path' : 'nonexist', 'size' : 1, 'driverCache' : 'writethrough' },
156
137
    # Full pool, but we are nonsparse
185
166
    'init_conns' : [ testconn, None ],
186
167
    'location'  : {
187
168
        'invalid' : ['nogood', 'http:/nogood', [], None,
188
 
                     ("pool-noexist", "vol-exist"),
189
 
                     ("pool-exist", "vol-noexist"),
 
169
                     ("pool-noexist", "default-vol"),
 
170
                     ("default-pool", "vol-noexist"),
190
171
                    ],
191
172
        'valid'   : ['/dev/null', 'http://web', 'ftp://ftp', 'nfs:nfsserv',
192
173
                     '/tmp', # For installing from local dir tree
193
 
                     ("pool-exist", "vol-exist"),
 
174
                     ("default-pool", "default-vol"),
194
175
                    ]}
195
176
},
196
177
 
198
179
    'init_conns' : [ testconn, None ],
199
180
    'location'  : {
200
181
        'invalid' : ['path-noexist',
201
 
                     ("pool-noexist", "vol-exist"),
202
 
                     ("pool-exist", "vol-noexist"),
 
182
                     ("pool-noexist", "default-vol"),
 
183
                     ("default-pool", "vol-noexist"),
203
184
                    ],
204
 
        'valid'   : ['/dev/null', ("pool-exist", "vol-exist"),
 
185
        'valid'   : ['/dev/null', ("default-pool", "default-vol"),
205
186
                    ]}
206
187
},
207
188