def probe(self): self.uuid = util.gen_uuid() # When multipathing is enabled, since we don't refcount the multipath maps, # we should not attempt to do the iscsi.attach/detach when the map is already present, # as this will remove it (which may well be in use). if self.mpath == 'true' and self.dconf.has_key('SCSIid'): maps = [] mpp_lun = False try: if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])): mpp_lun = True link=glob.glob('/dev/disk/mpInuse/%s-*' % self.dconf['SCSIid']) else: maps = mpath_cli.list_maps() except: pass if (mpp_lun): if (len(link)): raise xs_errors.XenError('SRInUse') else: if self.dconf['SCSIid'] in maps: raise xs_errors.XenError('SRInUse') self.iscsi.attach(self.uuid) if not self.iscsi._attach_LUN_bySCSIid(self.SCSIid): util.SMlog("Unable to detect LUN") raise xs_errors.XenError('InvalidDev') self._pathrefresh(LVHDoISCSISR) out = LVHDSR.LVHDSR.probe(self) self.iscsi.detach(self.uuid) return out
def probe(self): if self.mpath == "true" and self.dconf.has_key('SCSIid'): # When multipathing is enabled, since we don't refcount the multipath maps, # we should not attempt to do the iscsi.attach/detach when the map is already present, # as this will remove it (which may well be in use). maps = [] try: maps = mpath_cli.list_maps() except: pass if self.dconf['SCSIid'] in maps: if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])): mpath_cli.remove_map(self.dconf['SCSIid']) else: raise xs_errors.XenError('SRInUse') else: if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])): link=glob.glob('/dev/disk/mpInuse/%s-*' % self.dconf['SCSIid']) if (len(link)): raise xs_errors.XenError('SRInUse') self.mpathmodule.refresh(self.SCSIid,0) try: self._pathrefresh(LVHDoHBASR) result = LVHDSR.LVHDSR.probe(self) if self.mpath == "true": self.mpathmodule.reset(self.SCSIid,True) return result except: if self.mpath == "true": self.mpathmodule.reset(self.SCSIid,True) raise
def probe(self): self.uuid = util.gen_uuid() if self.mpath == 'true' and self.dconf.has_key('SCSIid'): # When multipathing is enabled, since we don't refcount the # multipath maps, we should not attempt to do the iscsi.attach/ # detach when the map is already present, as this will remove it # (which may well be in use). maps = [] try: maps = mpath_cli.list_maps() except: pass if self.dconf['SCSIid'] in maps: raise xs_errors.XenError('SRInUse') self.iscsi.attach(self.uuid) if not self.iscsi._attach_LUN_bySCSIid(self.SCSIid): util.SMlog("Unable to detect LUN") raise xs_errors.XenError('InvalidDev') self._pathrefresh(OCFSoISCSISR) out = OCFSSR.OCFSSR.probe(self) self.iscsi.detach(self.uuid) return out
def probe(self): if self.mpath == "true" and 'SCSIid' in self.dconf: # When multipathing is enabled, since we don't refcount the # multipath maps, we should not attempt to do the iscsi.attach/ # detach when the map is already present, as this will remove it # (which may well be in use). maps = [] try: maps = mpath_cli.list_maps() except: pass if self.dconf['SCSIid'] in maps: raise xs_errors.XenError('SRInUse') self.mpathmodule.refresh(self.SCSIid,0) try: self._pathrefresh(OCFSoHBASR) result = super(OCFSoHBASR, self).probe() if self.mpath == "true": self.mpathmodule.reset(self.SCSIid,True) return result except: if self.mpath == "true": self.mpathmodule.reset(self.SCSIid,True) raise
def deactivate(): util.SMlog("MPATH: multipath deactivate called") cmd = ['ln', '-sf', iscsi_default_file, iscsi_file] if os.path.exists(iscsi_default_file): # Only do this if using our customized open-iscsi package util.pread2(cmd) # Stop the updatempppathd daemon if _is_mpp_daemon_running(): cmd = ["service", "updatempppathd", "stop"] util.pread2(cmd) if _is_mpath_daemon_running(): # Flush the multipath nodes for sid in mpath_cli.list_maps(): reset(sid,True) # Disable any active MPP LUN maps (except the root dev) systemroot = os.path.realpath(util.getrootdev()) for dev in glob.glob(DEVBYMPPPATH + "/*"): if os.path.realpath(dev) != systemroot: sid = os.path.basename(dev).split('-')[0] reset(sid) else: util.SMlog("MPP: Found root dev node, not resetting") # Check the ISCSI daemon doesn't have any active sessions, if not, # restart in the new mode if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT(): iscsilib.restart_daemon() util.SMlog("MPATH: multipath deactivated.")
def probe(self): if self.mpath == "true" and self.dconf.has_key('SCSIid'): # When multipathing is enabled, since we don't refcount the multipath maps, # we should not attempt to do the iscsi.attach/detach when the map is already present, # as this will remove it (which may well be in use). maps = [] try: maps = mpath_cli.list_maps() except: pass if self.dconf['SCSIid'] in maps: if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])): mpath_cli.remove_map(self.dconf['SCSIid']) else: raise xs_errors.XenError('SRInUse') else: if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])): link = glob.glob('/dev/disk/mpInuse/%s-*' % self.dconf['SCSIid']) if (len(link)): raise xs_errors.XenError('SRInUse') self.mpathmodule.refresh(self.SCSIid, 0) try: self._pathrefresh(LVHDoHBASR) result = LVHDSR.LVHDSR.probe(self) if self.mpath == "true": self.mpathmodule.reset(self.SCSIid, True) return result except: if self.mpath == "true": self.mpathmodule.reset(self.SCSIid, True) raise
def probe(self): if self.mpath == "true" and self.dconf.has_key('SCSIid'): # When multipathing is enabled, since we don't refcount the # multipath maps, we should not attempt to do the iscsi.attach/ # detach when the map is already present, as this will remove it # (which may well be in use). maps = [] try: maps = mpath_cli.list_maps() except: pass if self.dconf['SCSIid'] in maps: raise xs_errors.XenError('SRInUse') self.mpathmodule.refresh(self.SCSIid,0) try: self._pathrefresh(OCFSoHBASR) result = super(OCFSoHBASR, self).probe() if self.mpath == "true": self.mpathmodule.reset(self.SCSIid,True) return result except: if self.mpath == "true": self.mpathmodule.reset(self.SCSIid,True) raise
def probe(self): self.uuid = util.gen_uuid() # When multipathing is enabled, since we don't refcount the multipath maps, # we should not attempt to do the iscsi.attach/detach when the map is already present, # as this will remove it (which may well be in use). if self.mpath == 'true' and self.dconf.has_key('SCSIid'): maps = [] mpp_lun = False try: if (mpp_luncheck.is_RdacLun(self.dconf['SCSIid'])): mpp_lun = True link = glob.glob('/dev/disk/mpInuse/%s-*' % self.dconf['SCSIid']) else: maps = mpath_cli.list_maps() except: pass if (mpp_lun): if (len(link)): raise xs_errors.XenError('SRInUse') else: if self.dconf['SCSIid'] in maps: raise xs_errors.XenError('SRInUse') self.iscsi.attach(self.uuid) if not self.iscsi._attach_LUN_bySCSIid(self.SCSIid): util.SMlog("Unable to detect LUN") raise xs_errors.XenError('InvalidDev') self._pathrefresh(LVHDoISCSISR) out = LVHDSR.LVHDSR.probe(self) self.iscsi.detach(self.uuid) return out
def deactivate(): util.SMlog("MPATH: multipath deactivate called") # Adjust any HBAs on the host cmd = [hba_script, "disable"] util.SMlog(util.pread2(cmd)) cmd = ['ln', '-sf', iscsi_default_file, iscsi_file] util.pread2(cmd) # Stop the updatempppathd daemon if _is_mpp_daemon_running(): cmd = ["/etc/init.d/updatempppathd", "stop"] util.pread2(cmd) if _is_mpath_daemon_running(): # Flush the multipath nodes for sid in mpath_cli.list_maps(): reset(sid, True) # Disable any active MPP LUN maps (except the root dev) systemroot = os.path.realpath(util.getrootdev()) for dev in glob.glob(DEVBYMPPPATH + "/*"): if os.path.realpath(dev) != systemroot: sid = os.path.basename(dev).split('-')[0] reset(sid) else: util.SMlog("MPP: Found root dev node, not resetting") # Check the ISCSI daemon doesn't have any active sessions, if not, # restart in the new mode if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT(): iscsilib.restart_daemon() util.SMlog("MPATH: multipath deactivated.")
def deactivate(): util.SMlog("MPATH: multipath deactivate called") # Adjust any HBAs on the host cmd = [hba_script, "disable"] util.SMlog(util.pread2(cmd)) cmd = ['ln', '-sf', iscsi_default_file, iscsi_file] util.pread2(cmd) # Stop the updatempppathd daemon if _is_mpp_daemon_running(): cmd = ["/etc/init.d/updatempppathd", "stop"] util.pread2(cmd) if _is_mpath_daemon_running(): # Flush the multipath nodes for sid in mpath_cli.list_maps(): reset(sid,True) # Disable any active MPP LUN maps (except the root dev) systemroot = os.path.realpath(util.getrootdev()) for dev in glob.glob(DEVBYMPPPATH + "/*"): if os.path.realpath(dev) != systemroot: sid = os.path.basename(dev).split('-')[0] reset(sid) else: util.SMlog("MPP: Found root dev node, not resetting") # Check the ISCSI daemon doesn't have any active sessions, if not, # restart in the new mode if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT(): iscsilib.restart_daemon() util.SMlog("MPATH: multipath deactivated.")
def deactivate(): util.SMlog("MPATH: multipath deactivate called") cmd = ['ln', '-sf', iscsi_default_file, iscsi_file] if os.path.exists(iscsi_default_file): # Only do this if using our customized open-iscsi package util.pread2(cmd) # Stop the updatempppathd daemon if _is_mpp_daemon_running(): cmd = ["service", "updatempppathd", "stop"] util.pread2(cmd) if _is_mpath_daemon_running(): # Flush the multipath nodes for sid in mpath_cli.list_maps(): reset(sid, True) # Disable any active MPP LUN maps (except the root dev) systemroot = os.path.realpath(util.getrootdev()) for dev in glob.glob(DEVBYMPPPATH + "/*"): if os.path.realpath(dev) != systemroot: sid = os.path.basename(dev).split('-')[0] reset(sid) else: util.SMlog("MPP: Found root dev node, not resetting") # Check the ISCSI daemon doesn't have any active sessions, if not, # restart in the new mode if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT(): iscsilib.restart_daemon() util.SMlog("MPATH: multipath deactivated.")
def deactivate(): util.SMlog("MPATH: dm-multipath deactivate called") # Adjust any HBAs on the host if os.path.realpath(mpath_file) != mpath_disable_file: cmd = [hba_script, "disable"] util.SMlog(util.pread2(cmd)) cmd = ['ln', '-sf', mpath_disable_file, mpath_file] util.pread2(cmd) cmd = ['ln', '-sf', iscsi_default_file, iscsi_file] util.pread2(cmd) if _is_mpath_daemon_running(): # Flush the multipath nodes for sid in mpath_cli.list_maps(): reset(sid,True) # ...then stop the daemon cmd = ["/etc/init.d/multipathd", "stop"] util.pread2(cmd) # Check the ISCSI daemon doesn't have any active sessions, if not, # restart in the new mode if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT(): iscsilib.restart_daemon() util.SMlog("MPATH: dm-multipath deactivated.")
def deactivate(): util.SMlog("MPATH: multipath deactivate called") if _is_mpath_daemon_running(): # Flush the multipath nodes for sid in mpath_cli.list_maps(): reset(sid, True) # Disable any active MPP LUN maps (except the root dev) systemroot = os.path.realpath(util.getrootdev()) for dev in glob.glob(DEVBYMPPPATH + "/*"): if os.path.realpath(dev) != systemroot: sid = os.path.basename(dev).split('-')[0] reset(sid) else: util.SMlog("MPP: Found root dev node, not resetting") # Check the ISCSI daemon doesn't have any active sessions, if not, # restart in the new mode if iscsilib.is_iscsi_daemon_running() and not iscsilib._checkAnyTGT(): iscsilib.restart_daemon() util.SMlog("MPATH: multipath deactivated.")
def list(): maps = mpath_cli.list_maps() for m in maps: print(m)
def list(): maps = mpath_cli.list_maps() for m in maps: print m
assert hconf["multipathhandle"] == "dmp" except: mpc_exit(session, 0) # Check root disk if multipathed try: if get_root_dev_major() == get_dm_major(): def _remove(key): session.xenapi.host.remove_from_other_config(localhost, key) def _add(key, val): session.xenapi.host.add_to_other_config(localhost, key, val) config = session.xenapi.host.get_other_config(localhost) maps = mpath_cli.list_maps() # Ensure output headers are not in the list if "name" in maps: maps.remove("name") # first map will always correspond to the root dev, dm-0 assert len(maps) > 0 i = maps[0] if (not match_bySCSIid) or i == SCSIid: util.SMlog("Matched SCSIid %s, updating " " Host.other-config:mpath-boot " % i) key = "mpath-boot" if not config.has_key(key): update_config(key, i, "", _remove, _add) else: update_config(key, i, config[key], _remove, _add) except: util.SMlog("MPATH: Failure updating Host.other-config:mpath-boot db")
if get_root_dev_major() != get_dm_major(): hconf = session.xenapi.host.get_other_config(localhost) assert(hconf['multipathing'] == 'true') mpath_enabled = True except: mpath_enabled = False # Check root disk if multipathed try: if get_root_dev_major() == get_dm_major(): def _remove(key): session.xenapi.host.remove_from_other_config(localhost,key) def _add(key, val): session.xenapi.host.add_to_other_config(localhost,key,val) config = session.xenapi.host.get_other_config(localhost) maps = mpath_cli.list_maps() # Ensure output headers are not in the list if 'name' in maps: maps.remove('name') # first map will always correspond to the root dev, dm-0 assert(len(maps) > 0) i = maps[0] if (not match_bySCSIid) or i == SCSIid: util.SMlog("Matched SCSIid %s, updating " \ " Host.other-config:mpath-boot " % i) key="mpath-boot" if not config.has_key(key): update_config(key, i, "", _remove, _add) else: update_config(key, i, config[key], _remove, _add) except: