Revision c4feafe8 lib/backend.py
b/lib/backend.py | ||
---|---|---|
163 | 163 |
exclude = [os.path.normpath(i) for i in exclude] |
164 | 164 |
|
165 | 165 |
for rel_name in utils.ListVisibleFiles(path): |
166 |
full_name = os.path.normpath(os.path.join(path, rel_name))
|
|
166 |
full_name = utils.PathJoin(path, rel_name)
|
|
167 | 167 |
if full_name in exclude: |
168 | 168 |
continue |
169 | 169 |
if os.path.isfile(full_name) and not os.path.islink(full_name): |
... | ... | |
907 | 907 |
|
908 | 908 |
|
909 | 909 |
def _GetBlockDevSymlinkPath(instance_name, idx): |
910 |
return os.path.join(constants.DISK_LINKS_DIR,
|
|
911 |
"%s:%d" % (instance_name, idx)) |
|
910 |
return utils.PathJoin(constants.DISK_LINKS_DIR,
|
|
911 |
"%s:%d" % (instance_name, idx))
|
|
912 | 912 |
|
913 | 913 |
|
914 | 914 |
def _SymlinkBlockDev(instance_name, device_path, idx): |
... | ... | |
1995 | 1995 |
export_env['EXPORT_DEVICE'] = real_disk.dev_path |
1996 | 1996 |
export_env['EXPORT_INDEX'] = str(idx) |
1997 | 1997 |
|
1998 |
destdir = os.path.join(constants.EXPORT_DIR, instance.name + ".new")
|
|
1998 |
destdir = utils.PathJoin(constants.EXPORT_DIR, instance.name + ".new")
|
|
1999 | 1999 |
destfile = disk.physical_id[1] |
2000 | 2000 |
|
2001 | 2001 |
# the target command is built out of three individual commands, |
... | ... | |
2035 | 2035 |
@rtype: None |
2036 | 2036 |
|
2037 | 2037 |
""" |
2038 |
destdir = os.path.join(constants.EXPORT_DIR, instance.name + ".new")
|
|
2039 |
finaldestdir = os.path.join(constants.EXPORT_DIR, instance.name)
|
|
2038 |
destdir = utils.PathJoin(constants.EXPORT_DIR, instance.name + ".new")
|
|
2039 |
finaldestdir = utils.PathJoin(constants.EXPORT_DIR, instance.name)
|
|
2040 | 2040 |
|
2041 | 2041 |
config = objects.SerializableConfigParser() |
2042 | 2042 |
|
... | ... | |
2079 | 2079 |
|
2080 | 2080 |
config.set(constants.INISECT_INS, 'disk_count' , '%d' % disk_total) |
2081 | 2081 |
|
2082 |
utils.WriteFile(os.path.join(destdir, constants.EXPORT_CONF_FILE),
|
|
2082 |
utils.WriteFile(utils.PathJoin(destdir, constants.EXPORT_CONF_FILE),
|
|
2083 | 2083 |
data=config.Dumps()) |
2084 | 2084 |
shutil.rmtree(finaldestdir, True) |
2085 | 2085 |
shutil.move(destdir, finaldestdir) |
... | ... | |
2096 | 2096 |
export info |
2097 | 2097 |
|
2098 | 2098 |
""" |
2099 |
cff = os.path.join(dest, constants.EXPORT_CONF_FILE)
|
|
2099 |
cff = utils.PathJoin(dest, constants.EXPORT_CONF_FILE)
|
|
2100 | 2100 |
|
2101 | 2101 |
config = objects.SerializableConfigParser() |
2102 | 2102 |
config.read(cff) |
... | ... | |
2179 | 2179 |
@rtype: None |
2180 | 2180 |
|
2181 | 2181 |
""" |
2182 |
target = os.path.join(constants.EXPORT_DIR, export)
|
|
2182 |
target = utils.PathJoin(constants.EXPORT_DIR, export)
|
|
2183 | 2183 |
|
2184 | 2184 |
try: |
2185 | 2185 |
shutil.rmtree(target) |
Also available in: Unified diff