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())
47
45
virtimage = virtinst.ImageParser.parse_file("tests/image-xml/image.xml")
49
offdskpaths = [ "/dev", ]
50
for path in offdskpaths:
51
createPool(testconn, virtinst.Storage.StoragePool.TYPE_DISK,
52
tpath=path, start=False, fmt="dos")
54
dirpaths = [ "/var/lib/libvirt/images", "/", "/tmp" ]
56
createPool(testconn, virtinst.Storage.StoragePool.TYPE_DIR,
57
tpath=path, start=True)
59
dskpaths = [ "/somedev", "/dev/disk/by-uuid" ]
61
createPool(testconn, virtinst.Storage.StoragePool.TYPE_DISK,
62
fmt="dos", tpath=path, start=False)
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",
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 ],
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"),
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"),
198
179
'init_conns' : [ testconn, None ],
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"),
204
'valid' : ['/dev/null', ("pool-exist", "vol-exist"),
185
'valid' : ['/dev/null', ("default-pool", "default-vol"),