diff options
Diffstat (limited to 'raidguessfs.py')
-rwxr-xr-x | raidguessfs.py | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/raidguessfs.py b/raidguessfs.py index c9c3833..fba2187 100755 --- a/raidguessfs.py +++ b/raidguessfs.py @@ -61,19 +61,19 @@ class RaidGuessFS(fuse.Fuse): self.settings = [ 'disk_count', - 'raid_start', 'raid_chunk_size', 'raid_disk_order', + 'raid_start', 'raid_end', 'raid_chunk_size', 'raid_disk_order', 'bmp_height', 'bmp_width', 'bmp_start_offset' ] self.settings_getters = [ self.d.get_disk_count, - self.raid.get_raid_start, self.raid.get_raid_chunk_size, self.raid.get_raid_disk_order_str, + self.raid.get_raid_start, self.raid.get_raid_end, self.raid.get_raid_chunk_size, self.raid.get_raid_disk_order_str, self.bmp.get_bmp_height, self.bmp.get_bmp_width, self.bmp.get_bmp_start_offset ] self.settings_updaters = [ self.update_disk_count, - self.update_raid_start, self.update_raid_chunk_size, self.update_raid_disk_order, + self.update_raid_start, self.update_raid_end, self.update_raid_chunk_size, self.update_raid_disk_order, self.update_bmp_height, self.update_bmp_width, self.update_bmp_start_offset ] @@ -137,9 +137,9 @@ class RaidGuessFS(fuse.Fuse): self.d.set_disk_count(i) self.d.open_disks() self._refresh_disk_dentries() + self.raid.set_disks(self.d.disks) self.raid.set_raid_end(min(self.d.disks_size)-1) self.update_raid_disk_order(range(i)) - self._refresh_raid_fattr() def update_bmp_start_offset(self, arg): i = int(arg) @@ -168,6 +168,12 @@ class RaidGuessFS(fuse.Fuse): self.raid.set_raid_start(i) self._refresh_raid_fattr() + def update_raid_end(self, arg): + i = int(arg) + assert (i >= 0), "Negative value make no sense here" + self.raid.set_raid_end(i) + self._refresh_raid_fattr() + def update_raid_chunk_size(self, arg): i = int(arg) assert (i > 0), "Non-positive value make no sense here" @@ -176,17 +182,18 @@ class RaidGuessFS(fuse.Fuse): def update_raid_disk_order(self, arg): logging.debug("Enter update_raid_disk_order(%s)"%arg) if type(arg) is str: - l = arg.split() + l = map(int,arg.split()) elif type(arg) is list: l = arg else: raise TypeError('update_raid_disk_order() wants a list or str') logging.debug("==> %s (%d/%d)"%(l,len(l),self.d.disk_count)) - if len(l) != self.d.disk_count: - raise ValueError('Value count does not match disk count') + #if len(l) != self.d.disk_count: + # raise ValueError('Value count does not match disk count') self.raid.set_raid_disk_order(l) + self._refresh_raid_fattr() logging.debug("Exit. update_raid_disk_order(%s)"%arg) @@ -280,11 +287,11 @@ class RaidGuessFS(fuse.Fuse): raid_type=path_chuncks[2] if raid_type in self.raid.raid_types: if path_chuncks[4] == 'disk_parity': - return self.raid.read_disk_parity(raid_type,self.d.disks,offset,size) + return self.raid.read_disk_parity(raid_type,offset,size) if path_chuncks[4] == 'disk_xor': - return self.raid.read_disk_xor(raid_type,self.d.disks,offset,size) + return self.raid.read_disk_xor(raid_type,offset,size) if path_chuncks[4] == 'raid_result': - return self.raid.read_raid_result(raid_type,self.d.disks,offset,size) + return self.raid.read_raid_result(raid_type,offset,size) except Exception as e: logging.exception(e) |