git://git.onelab.eu
/
nodemanager.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
reguire gnupg1 on f>=31; sense the system to use gpg1 when installed
[nodemanager.git]
/
plugins
/
rawdisk.py
diff --git
a/plugins/rawdisk.py
b/plugins/rawdisk.py
index
616d2c6
..
9f80c15
100644
(file)
--- a/
plugins/rawdisk.py
+++ b/
plugins/rawdisk.py
@@
-1,4
+1,4
@@
-#!/usr/bin/python -tt
+#!/usr/bin/python
3
-tt
# vim:set ts=4 sw=4 expandtab:
#
# NodeManager plugin to support mapping unused raw disks into a slice
# vim:set ts=4 sw=4 expandtab:
#
# NodeManager plugin to support mapping unused raw disks into a slice
@@
-30,8
+30,7
@@
def get_unused_devices():
for i in os.listdir("/sys/block"):
if not i.startswith("dm-"):
continue
for i in os.listdir("/sys/block"):
if not i.startswith("dm-"):
continue
- in_vg.extend(map(lambda x: x.replace("!", "/"),
- os.listdir("/sys/block/%s/slaves" % i)))
+ in_vg.extend([x.replace("!", "/") for x in os.listdir("/sys/block/%s/slaves" % i)])
# Read the list of partitions
with open("/proc/partitions") as partitions:
pat = re.compile("\s+")
# Read the list of partitions
with open("/proc/partitions") as partitions:
pat = re.compile("\s+")
@@
-51,13
+50,13
@@
def get_unused_devices():
def GetSlivers(data, config=None, plc=None):
if 'slivers' not in data:
def GetSlivers(data, config=None, plc=None):
if 'slivers' not in data:
- logger.log_missing_data("rawdisk.GetSlivers",'slivers')
+ logger.log_missing_data("rawdisk.GetSlivers",
'slivers')
return
devices = get_unused_devices()
for sliver in data['slivers']:
for attribute in sliver['attributes']:
return
devices = get_unused_devices()
for sliver in data['slivers']:
for attribute in sliver['attributes']:
- name = attribute.get('tagname',
attribute.get('name',
''))
+ name = attribute.get('tagname',
attribute.get('name',
''))
if name == 'rawdisk':
for i in devices:
st = os.stat(i)
if name == 'rawdisk':
for i in devices:
st = os.stat(i)
@@
-73,7
+72,7
@@
def GetSlivers(data, config=None, plc=None):
except:
pass
try:
except:
pass
try:
- os.makedirs(os.path.dirname(path), 0755)
+ os.makedirs(os.path.dirname(path), 0
o
755)
except:
pass
os.mknod(path, st.st_mode, st.st_rdev)
except:
pass
os.mknod(path, st.st_mode, st.st_rdev)