Revision 62c9ec92 lib/backend.py
b/lib/backend.py | ||
---|---|---|
48 | 48 |
return ssconf.SimpleConfigReader() |
49 | 49 |
|
50 | 50 |
|
51 |
def _GetSshRunner(): |
|
52 |
return ssh.SshRunner(_GetConfig().GetClusterName())
|
|
51 |
def _GetSshRunner(cluster_name):
|
|
52 |
return ssh.SshRunner(cluster_name)
|
|
53 | 53 |
|
54 | 54 |
|
55 | 55 |
def _CleanDirectory(path, exclude=[]): |
... | ... | |
264 | 264 |
return outputarray |
265 | 265 |
|
266 | 266 |
|
267 |
def VerifyNode(what): |
|
267 |
def VerifyNode(what, cluster_name):
|
|
268 | 268 |
"""Verify the status of the local node. |
269 | 269 |
|
270 | 270 |
Args: |
... | ... | |
294 | 294 |
result['nodelist'] = {} |
295 | 295 |
random.shuffle(what['nodelist']) |
296 | 296 |
for node in what['nodelist']: |
297 |
success, message = _GetSshRunner().VerifyNodeHostname(node) |
|
297 |
success, message = _GetSshRunner(cluster_name).VerifyNodeHostname(node)
|
|
298 | 298 |
if not success: |
299 | 299 |
result['nodelist'][node] = message |
300 | 300 |
if 'node-net-test' in what: |
... | ... | |
1295 | 1295 |
(disk.unique_id, disk.dev_type)) |
1296 | 1296 |
|
1297 | 1297 |
|
1298 |
def ExportSnapshot(disk, dest_node, instance): |
|
1298 |
def ExportSnapshot(disk, dest_node, instance, cluster_name):
|
|
1299 | 1299 |
"""Export a block device snapshot to a remote node. |
1300 | 1300 |
|
1301 | 1301 |
Args: |
... | ... | |
1336 | 1336 |
|
1337 | 1337 |
destcmd = utils.BuildShellCmd("mkdir -p %s && cat > %s/%s", |
1338 | 1338 |
destdir, destdir, destfile) |
1339 |
remotecmd = _GetSshRunner().BuildCmd(dest_node, constants.GANETI_RUNAS, |
|
1340 |
destcmd) |
|
1339 |
remotecmd = _GetSshRunner(cluster_name).BuildCmd(dest_node, |
|
1340 |
constants.GANETI_RUNAS, |
|
1341 |
destcmd) |
|
1341 | 1342 |
|
1342 | 1343 |
# all commands have been checked, so we're safe to combine them |
1343 | 1344 |
command = '|'.join([expcmd, comprcmd, utils.ShellQuoteArgs(remotecmd)]) |
... | ... | |
1436 | 1437 |
return config |
1437 | 1438 |
|
1438 | 1439 |
|
1439 |
def ImportOSIntoInstance(instance, os_disk, swap_disk, src_node, src_image): |
|
1440 |
def ImportOSIntoInstance(instance, os_disk, swap_disk, src_node, src_image, |
|
1441 |
cluster_name): |
|
1440 | 1442 |
"""Import an os image into an instance. |
1441 | 1443 |
|
1442 | 1444 |
Args: |
... | ... | |
1482 | 1484 |
os.mkdir(constants.LOG_OS_DIR, 0750) |
1483 | 1485 |
|
1484 | 1486 |
destcmd = utils.BuildShellCmd('cat %s', src_image) |
1485 |
remotecmd = _GetSshRunner().BuildCmd(src_node, constants.GANETI_RUNAS, |
|
1486 |
destcmd) |
|
1487 |
remotecmd = _GetSshRunner(cluster_name).BuildCmd(src_node, |
|
1488 |
constants.GANETI_RUNAS, |
|
1489 |
destcmd) |
|
1487 | 1490 |
|
1488 | 1491 |
comprcmd = "gunzip" |
1489 | 1492 |
impcmd = utils.BuildShellCmd("(cd %s; %s -i %s -b %s -s %s &>%s)", |
Also available in: Unified diff