Revision 726d7d68
b/lib/backend.py | ||
---|---|---|
1606 | 1606 |
# TODO: redundant: on load can read nics until it doesn't exist |
1607 | 1607 |
config.set(constants.INISECT_INS, 'nic_count' , '%d' % nic_count) |
1608 | 1608 |
|
1609 |
disk_count = 0
|
|
1609 |
disk_total = 0
|
|
1610 | 1610 |
for disk_count, disk in enumerate(snap_disks): |
1611 | 1611 |
if disk: |
1612 |
disk_total += 1 |
|
1612 | 1613 |
config.set(constants.INISECT_INS, 'disk%d_ivname' % disk_count, |
1613 | 1614 |
('%s' % disk.iv_name)) |
1614 | 1615 |
config.set(constants.INISECT_INS, 'disk%d_dump' % disk_count, |
1615 | 1616 |
('%s' % disk.physical_id[1])) |
1616 | 1617 |
config.set(constants.INISECT_INS, 'disk%d_size' % disk_count, |
1617 | 1618 |
('%d' % disk.size)) |
1618 |
config.set(constants.INISECT_INS, 'disk_count' , '%d' % disk_count) |
|
1619 | 1619 |
|
1620 |
cff = os.path.join(destdir, constants.EXPORT_CONF_FILE) |
|
1621 |
cfo = open(cff, 'w') |
|
1622 |
try: |
|
1623 |
config.write(cfo) |
|
1624 |
finally: |
|
1625 |
cfo.close() |
|
1620 |
config.set(constants.INISECT_INS, 'disk_count' , '%d' % disk_total) |
|
1626 | 1621 |
|
1622 |
utils.WriteFile(os.path.join(destdir, constants.EXPORT_CONF_FILE), |
|
1623 |
data=config.Dumps()) |
|
1627 | 1624 |
shutil.rmtree(finaldestdir, True) |
1628 | 1625 |
shutil.move(destdir, finaldestdir) |
1629 | 1626 |
|
... | ... | |
1691 | 1688 |
import_env['IMPORT_INDEX'] = str(idx) |
1692 | 1689 |
result = utils.RunCmd(command, env=import_env) |
1693 | 1690 |
if result.failed: |
1694 |
logging.error("disk import command '%s' returned error: %s" |
|
1695 |
" output: %s", command, result.fail_reason, result.output) |
|
1691 |
logging.error("Disk import command '%s' returned error: %s" |
|
1692 |
" output: %s", command, result.fail_reason, |
|
1693 |
result.output) |
|
1696 | 1694 |
final_result.append(False) |
1697 | 1695 |
else: |
1698 | 1696 |
final_result.append(True) |
b/lib/cmdlib.py | ||
---|---|---|
3606 | 3606 |
if instance_disks < export_disks: |
3607 | 3607 |
raise errors.OpPrereqError("Not enough disks to import." |
3608 | 3608 |
" (instance: %d, export: %d)" % |
3609 |
(2, export_disks))
|
|
3609 |
(instance_disks, export_disks))
|
|
3610 | 3610 |
|
3611 | 3611 |
self.op.os_type = export_info.get(constants.INISECT_EXP, 'os') |
3612 | 3612 |
disk_images = [] |
... | ... | |
3824 | 3824 |
cluster_name) |
3825 | 3825 |
for idx, result in enumerate(import_result): |
3826 | 3826 |
if not result: |
3827 |
self.LogWarning("Could not image %s for on instance %s, disk %d,"
|
|
3828 |
" on node %s" % (src_images[idx], instance, idx,
|
|
3829 |
pnode_name))
|
|
3827 |
self.LogWarning("Could not import the image %s for instance"
|
|
3828 |
" %s, disk %d, on node %s" %
|
|
3829 |
(src_images[idx], instance, idx, pnode_name))
|
|
3830 | 3830 |
else: |
3831 | 3831 |
# also checked in the prereq part |
3832 | 3832 |
raise errors.ProgrammerError("Unknown OS initialization mode '%s'" |
Also available in: Unified diff