def attachLogicalVolume(self, data): eventid, lvolstruct = mand_keys(data, 'eventid', 'lvolstruct') self.event_record.lock() if self.event_record.event_exist(eventid): self.event_record.unlock() return 0 start_worker(self.__attach_worker, eventid, lvolstruct) self.event_record.add_event(eventid, EVENT_STATUS['PROGRESS']) self.event_record.unlock() return 0
def replaceMirrorDisk(self, data): eventid, mirrorid, add_lvolstruct, remove_lvolstruct = \ mand_keys(data, 'eventid', 'mirrorid', 'add', 'remove') self.event_record.lock() if self.event_record.event_exist(eventid): self.event_record.unlock() return 0 dextid = add_lvolstruct['lvolid'] status = get_mirror_status(mirrorid) if not status: # mirror not exist self.event_record.unlock() raise xmlrpclib.Fault(errno.ENOENT, 'ENOENT') if not status.has_key(dextid) or status[dextid] == "faulty": # start rebuild start_worker(self.__mirror_worker, eventid, mirrorid, add_lvolstruct, remove_lvolstruct) self.event_record.add_event(eventid, EVENT_STATUS['PROGRESS'], 0, \ self.__check_mirror_status, (mirrorid, add_lvolstruct['lvolid'])) elif status[dextid] == "in_sync": # rebuild done already self.event_record.add_event(eventid, EVENT_STATUS['DONE'], 0) elif status[dextid] == "spare": # rebuild started already self.event_record.add_event(eventid, EVENT_STATUS['PROGRESS'], 0, \ self.__check_mirror_status, (mirrorid, add_lvolstruct['lvolid'])) # else: that's all self.event_record.unlock() return 0