Revision c657dcc9 lib/backend.py
b/lib/backend.py | ||
---|---|---|
44 | 44 |
from ganeti import ssconf |
45 | 45 |
|
46 | 46 |
|
47 |
def _GetConfig(): |
|
48 |
return ssconf.SimpleConfigReader() |
|
49 |
|
|
50 |
|
|
47 | 51 |
def _GetSshRunner(): |
48 | 52 |
return ssh.SshRunner() |
49 | 53 |
|
... | ... | |
88 | 92 |
|
89 | 93 |
""" |
90 | 94 |
try: |
91 |
ss = ssconf.SimpleStore()
|
|
92 |
master_netdev = ss.GetMasterNetdev()
|
|
93 |
master_ip = ss.GetMasterIP()
|
|
94 |
master_node = ss.GetMasterNode()
|
|
95 |
cfg = _GetConfig()
|
|
96 |
master_netdev = cfg.GetMasterNetdev()
|
|
97 |
master_ip = cfg.GetMasterIP()
|
|
98 |
master_node = cfg.GetMasterNode()
|
|
95 | 99 |
except errors.ConfigurationError, err: |
96 | 100 |
logging.exception("Cluster configuration incomplete") |
97 | 101 |
return (None, None) |
... | ... | |
307 | 311 |
" primary/secondary IP" |
308 | 312 |
" in the node list") |
309 | 313 |
else: |
310 |
port = ssconf.SimpleStore().GetNodeDaemonPort()
|
|
314 |
port = utils.GetNodeDaemonPort()
|
|
311 | 315 |
for name, pip, sip in what['node-net-test']: |
312 | 316 |
fail = [] |
313 | 317 |
if not utils.TcpPing(pip, port, source=my_pip): |
... | ... | |
495 | 499 |
swap_disk: the instance-visible name of the swap device |
496 | 500 |
|
497 | 501 |
""" |
502 |
cfg = _GetConfig() |
|
498 | 503 |
inst_os = OSFromDisk(instance.os) |
499 | 504 |
|
500 | 505 |
create_script = inst_os.create_script |
... | ... | |
530 | 535 |
inst_os.path, create_script, instance.name, |
531 | 536 |
real_os_dev.dev_path, real_swap_dev.dev_path, |
532 | 537 |
logfile) |
533 |
env = {'HYPERVISOR': ssconf.SimpleStore().GetHypervisorType()}
|
|
538 |
env = {'HYPERVISOR': cfg.GetHypervisorType()}
|
|
534 | 539 |
|
535 | 540 |
result = utils.RunCmd(command, env=env) |
536 | 541 |
if result.failed: |
... | ... | |
1072 | 1077 |
constants.SSH_KNOWN_HOSTS_FILE, |
1073 | 1078 |
constants.VNC_PASSWORD_FILE, |
1074 | 1079 |
] |
1075 |
allowed_files.extend(ssconf.SimpleStore().GetFileList()) |
|
1076 | 1080 |
|
1077 | 1081 |
if file_name not in allowed_files: |
1078 | 1082 |
logging.error("Filename passed to UploadFile not in allowed" |
... | ... | |
1446 | 1450 |
False in case of error, True otherwise. |
1447 | 1451 |
|
1448 | 1452 |
""" |
1453 |
cfg = _GetConfig() |
|
1449 | 1454 |
inst_os = OSFromDisk(instance.os) |
1450 | 1455 |
import_script = inst_os.import_script |
1451 | 1456 |
|
... | ... | |
1487 | 1492 |
logfile) |
1488 | 1493 |
|
1489 | 1494 |
command = '|'.join([utils.ShellQuoteArgs(remotecmd), comprcmd, impcmd]) |
1490 |
env = {'HYPERVISOR': ssconf.SimpleStore().GetHypervisorType()}
|
|
1495 |
env = {'HYPERVISOR': cfg.GetHypervisorType()}
|
|
1491 | 1496 |
|
1492 | 1497 |
result = utils.RunCmd(command, env=env) |
1493 | 1498 |
|
... | ... | |
1573 | 1578 |
normalized file_storage_dir (string) if valid, None otherwise |
1574 | 1579 |
|
1575 | 1580 |
""" |
1581 |
cfg = _GetConfig() |
|
1576 | 1582 |
file_storage_dir = os.path.normpath(file_storage_dir) |
1577 |
base_file_storage_dir = ssconf.SimpleStore().GetFileStorageDir()
|
|
1583 |
base_file_storage_dir = cfg.GetFileStorageDir()
|
|
1578 | 1584 |
if (not os.path.commonprefix([file_storage_dir, base_file_storage_dir]) == |
1579 | 1585 |
base_file_storage_dir): |
1580 | 1586 |
logging.error("file storage directory '%s' is not under base file" |
Also available in: Unified diff