blob: 835dfa9b1d77c7d6f721ff224504c1e6361e03cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2005
# Author: Dan Smith <danms@us.ibm.com>
from XmTestLib import *
from XmTestLib.block_utils import block_detach
if ENABLE_HVM_SUPPORT:
SKIP("Block-detach not supported for HVM domains")
config = {"disk":"phy:/dev/ram0,hda1,w"}
domain = XmTestDomain(extraConfig=config)
try:
console = domain.start()
except DomainError, e:
if verbose:
print e.extra
FAIL("Unable to create domain")
try:
console.setHistorySaveCmds(value=True)
run = console.runCmd("cat /proc/partitions | grep hda1")
run2 = console.runCmd("cat /proc/partitions")
except ConsoleError, e:
FAIL(str(e))
if run["return"] != 0:
FAIL("block device isn't attached; can't detach!")
block_detach(domain, "hda1")
try:
run = console.runCmd("cat /proc/partitions | grep hda1")
except ConsoleError, e:
saveLog(console.getHistory())
FAIL(str(e))
domain.closeConsole()
domain.stop()
if run["return"] == 0:
FAIL("domU reported block device still connected!")
|