except DomainError, e:
    FAIL(str(e))

# Attach a console to it
try:
    console.setHistorySaveCmds(value=True)
    # Run 'ls'
    run = console.runCmd("ls")
except ConsoleError, e:
    saveLog(console.getHistory())
    FAIL(str(e))


# Explicitly label the 1st resource
ACMLabelResource(resource1, resourcelabel1)
block_utils.block_attach(domain, resource1, "xvda1")

try:
    run1 = console.runCmd("cat /proc/partitions")
except ConsoleError, e:
    FAIL(str(e))

#Explicitly label the 2nd resource
ACMLabelResource(resource2, resourcelabel2)
#Cannot call block_attach here since we legally may fail the command
status, output = traceCommand("xm block-attach %s %s %s w" %
                               (domain.getName(), resource2, "xvda2" ))

for i in range(10):
    if block_utils.get_state(domain, "xvda2") == 4:
        break
from XmTestLib.block_utils import block_attach

if ENABLE_HVM_SUPPORT:
    SKIP("Block-list not supported for HVM domains")

domain = XmTestDomain()

try:
    console = domain.start()
except DomainError, e:
    if verbose:
        print e.extra
    FAIL("Unable to create domain")

#Attach one virtual block device to domainU
block_attach(domain, "phy:/dev/ram0", "xvda1")

#Verify block-list on Domain0
status, output = traceCommand("xm block-list %s" % domain.getId())
eyecatcher = "51713"
where = output.find(eyecatcher)
if status != 0:
    FAIL("xm block-list returned bad status, expected 0, status is %i" % status)
elif where < 0 :
    FAIL("Fail to list block device")

#Verify attached block device on DomainU
try:
    run = console.runCmd("cat /proc/partitions | grep xvda1")
except ConsoleError, e:
    saveLog(console.getHistory())
Example #3
0
    console = domain.start()
except DomainError, e:
    FAIL(str(e))

# Attach a console to it
try:
    console.setHistorySaveCmds(value=True)
    # Run 'ls'
    run = console.runCmd("ls")
except ConsoleError, e:
    saveLog(console.getHistory())
    FAIL(str(e))

# Explicitly label the 1st resource
ACMLabelResource(resource1, resourcelabel1)
block_utils.block_attach(domain, resource1, "xvda1")

try:
    run1 = console.runCmd("cat /proc/partitions")
except ConsoleError, e:
    FAIL(str(e))

#Explicitly label the 2nd resource
ACMLabelResource(resource2, resourcelabel2)
#Cannot call block_attach here since we legally may fail the command
status, output = traceCommand("xm block-attach %s %s %s w" %
                              (domain.getName(), resource2, "xvda2"))

for i in range(10):
    if block_utils.get_state(domain, "xvda2") == 4:
        break
from XmTestLib.block_utils import block_attach

if ENABLE_HVM_SUPPORT:
    SKIP("Block-list not supported for HVM domains")

domain = XmTestDomain()

try:
    console = domain.start()
except DomainError, e:
    if verbose:
        print e.extra
    FAIL("Unable to create domain")

#Attach one virtual block device to domainU
block_attach(domain, "phy:/dev/ram0", "xvda1")

#Verify block-list on Domain0
status, output = traceCommand("xm block-list %s" % domain.getId())
eyecatcher = "51713"
where = output.find(eyecatcher)
if status != 0:
    FAIL("xm block-list returned bad status, expected 0, status is %i" %
         status)
elif where < 0:
    FAIL("Fail to list block device")

#Verify attached block device on DomainU
try:
    run = console.runCmd("cat /proc/partitions | grep xvda1")
except ConsoleError, e: