1. remove wrap from bind in interface.xml

2. in MountPoint, add refresh ability
This commit is contained in:
Li Zhi
2010-08-24 08:34:28 +07:59
parent c2ec243021
commit 07ead0ed3c
6 changed files with 33 additions and 24 deletions

View File

@@ -281,21 +281,37 @@ class MountPoint:
@staticmethod
def change(dev, dir, fs, fm):
for i in range(len(MountPoint.list)):
if MountPoint.list[i].device == dev:
MountPoint.list[i].directory = dir
MountPoint.list[i].filesystem = fs
MountPoint.list[i].format = fm
for mp in MountPoint.list:
if mp.device == dev:
mp.directory = dir
mp.filesystem = fs
mp.format = fm
def device(self):
return self.device
@staticmethod
def init_from_internal():
''' init MountPoint from internal class Partition and class Raid '''
devs = [ m.device for m in MountPoint.list ]
for p in Partition.list:
if p.id != 'fd':
if p.id != 'fd' and p.device not in devs:
MountPoint(p.device, sz=p.size)
for r in Raid.list:
MountPoint(r,device, sz=r.size)
if r.device not in devs:
MountPoint(r.device, sz=r.size)
# now process whether a partition or raid was removed
s1 = set([ m.device for m in MountPoint.list ])
s2 = set([ p.device for p in Partition.list ] + [ r.device for r in Raid.list])
for dev in s1-s2:
for i in range(len(MountPoint.list)):
if dev == MountPoint.list[i].device:
del MountPoint.list[i]
break
# sort
MountPoint.list.sort(key=MountPoint.device)
@staticmethod
def init_from_xml(node):