text:
'''
Implements the RTS generic Target fabric classes.

This file is part of RTSLib.
Copyright (c) 2011-2013 by Datera, Inc.
Copyright (c) 2011-2014 by Red Hat, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
'''

import os
from glob import iglob as glob
from functools import partial
from six.moves import range
import uuid

from .node import CFSNode
from .utils import RTSLibBrokenLink, RTSLibError
from .utils import fread, fwrite, normalize_wwn, generate_wwn
from .utils import dict_remove, set_attributes, set_parameters, ignored
from .utils import _get_auth_attr, _set_auth_attr
from . import tcm

import six

auth_params = ('userid', 'password', 'mutual_userid', 'mutual_password')

class Target(CFSNode):
    '''
    This is an interface to Targets in configFS.
    A Target is identified by its wwn.
    To a Target is attached a list of TPG objects.
    '''

    # Target private stuff

    def __repr__(self):
        return "<Target %s/%s>" % (self.fabric_module.name, self.wwn)

    def __init__(self, fabric_module, wwn=None, mode='any'):
        '''
        @param fabric_module: The target's fabric module.
        @type fabric_module: FabricModule
        @param wwn: The optional Target's wwn.
            If no wwn is specified, one will be generated.
        @type wwn: string
        @param mode:An optionnal string containing the object creation mode:
            - I{'any'} means the configFS object will be either looked up
              or created.
            - I{'lookup'} means the object MUST already exist configFS.
            - I{'create'} means the object must NOT already exist in configFS.
        @type mode:string
        @return: A Target object.
        '''

        super(Target, self).__init__()
        self.fabric_module = fabric_module

        fabric_module._check_self()

        if wwn is not None:
            # old versions used wrong NAA prefix, fixup
            if wwn.startswith("naa.6"):
                wwn = "naa.5" + wwn[5:]
            self.wwn, self.wwn_type = fabric_module.to_normalized_wwn(wwn)
        elif not fabric_module.wwns:
            self.wwn = generate_wwn(fabric_module.wwn_types[0])
            self.wwn_type = fabric_module.wwn_types[0]
        else:
            raise RTSLibError("Fabric cannot generate WWN but it was not given")

        # Checking is done, convert to format the fabric wants
        fabric_wwn = fabric_module.to_fabric_wwn(self.wwn)
        self._path = "%s/%s" % (self.fabric_module.path, fabric_wwn)
        self._create_in_cfs_ine(mode)

    def _list_tpgs(self):
        self._check_self()
        for tpg_dir in glob("%s/tpgt*" % self.path):
            tag = os.path.basename(tpg_dir).split('_')[1]
            tag = int(tag)
            yield TPG(self, tag, 'lookup')

    # Target public stuff

    def has_feature(self, feature):
        '''
        Whether or not this Target has a certain feature.
        '''
        return self.fabric_module.has_feature(feature)

    def delete(self):
        '''
        Recursively deletes a Target object.
        This will delete all attached TPG objects and then the Target itself.
        '''
        self._check_self()
        for tpg in self.tpgs:
            tpg.delete()
        super(Target, self).delete()

    tpgs = property(_list_tpgs, doc="Get the list of TPG for the Target.")

    @classmethod
    def setup(cls, fm_obj, t, err_func):
        '''
        Set up target objects based upon t dict, from saved config.
        Guard against missing or bad dict items, but keep going.
        Call 'err_func' for each error.
        '''

        if 'wwn' not in t:
            err_func("'wwn' not defined for Target")
            return

        try:
            t_obj = Target(fm_obj, t['wwn'])
        except RTSLibError as e:
            err_func("Could not create Target object: %s" % e)
            return

        for tpg in t.get('tpgs', []):
            TPG.setup(t_obj, tpg, err_func)

    def dump(self):
        d = super(Target, self).dump()
        d['wwn'] = self.wwn
        d['fabric'] = self.fabric_module.name
        d['tpgs'] = [tpg.dump() for tpg in self.tpgs]
        return d

class TPG(CFSNode):
    '''
    This is a an interface to Target Portal Groups in configFS.
    A TPG is identified by its parent Target object and its TPG Tag.
    To a TPG object is attached a list of NetworkPortals. Targets without
    the 'tpgts' feature cannot have more than a single TPG, so attempts
    to create more will raise an exception.
    '''

    # TPG private stuff

    def __repr__(self):
        return "<TPG %d>" % self.tag

    def __init__(self, parent_target, tag=None, mode='any'):
        '''
        @param parent_target: The parent Target object of the TPG.
        @type parent_target: Target
        @param tag: The TPG Tag (TPGT).
        @type tag: int > 0
        @param mode:An optionnal string containing the object creation mode:
            - I{'any'} means the configFS object will be either looked up or
              created.
            - I{'lookup'} means the object MUST already exist configFS.
            - I{'create'} means the object must NOT already exist in configFS.
        @type mode:string
        @return: A TPG object.
        '''

        super(TPG, self).__init__()

        if tag is None:
            tags = [tpg.tag for tpg in parent_target.tpgs]
            for index in range(1048576):
                if index not in tags and index > 0:
                    tag = index
                    break
            if tag is None:
                raise RTSLibError("Cannot find an available TPG Tag")
        else:
            tag = int(tag)
            if not tag > 0:
                raise RTSLibError("The TPG Tag must be >0")
        self._tag = tag

        if isinstance(parent_target, Target):
            self._parent_target = parent_target
        else:
            raise RTSLibError("Invalid parent Target")

        self._path = "%s/tpgt_%d" % (self.parent_target.path, self.tag)

        target_path = self.parent_target.path
        if not self.has_feature('tpgts') and not os.path.isdir(self._path):
            for filename in os.listdir(target_path):
                if filename.startswith("tpgt_") \
                   and os.path.isdir("%s/%s" % (target_path, filename)) \
                   and filename != "tpgt_%d" % self.tag:
                    raise RTSLibError("Target cannot have multiple TPGs")

        self._create_in_cfs_ine(mode)
        if self.has_feature('nexus') and not self._get_nexus():
            self._set_nexus()

    def _get_tag(self):
        return self._tag

    def _get_parent_target(self):
        return self._parent_target

    def _list_network_portals(self):
        self._check_self()
        if not self.has_feature('nps'):
            return

        for network_portal_dir in os.listdir("%s/np" % self.path):
            (ip_address, port) = \
                os.path.basename(network_portal_dir).rsplit(":", 1)
            port = int(port)
            yield NetworkPortal(self, ip_address, port, 'lookup')

    def _get_enable(self):
        self._check_self()
        path = "%s/enable" % self.path
        # If the TPG does not have the enable attribute, then it is always
        # enabled.
        if os.path.isfile(path):
            return bool(int(fread(path)))
        else:
            return True

    def _set_enable(self, boolean):
        '''
        Enables or disables the TPG. If the TPG doesn't support the enable
        attribute, do nothing.
        '''
        self._check_self()
        path = "%s/enable" % self.path
        if os.path.isfile(path) and (boolean != self._get_enable()):
            try:
                fwrite(path, str(int(boolean)))
            except IOError as e:
                raise RTSLibError("Cannot change enable state: %s" % e)

    def _get_nexus(self):
        '''
        Gets the nexus initiator WWN, or None if the TPG does not have one.
        '''
        self._check_self()
        if self.has_feature('nexus'):
            try:
                nexus_wwn = fread("%s/nexus" % self.path)
            except IOError:
                nexus_wwn = ''
            return nexus_wwn
        else:
            return None

    def _set_nexus(self, nexus_wwn=None):
        '''
        Sets the nexus initiator WWN. Raises an exception if the nexus is
        already set or if the TPG does not use a nexus.
        '''
        self._check_self()

        if not self.has_feature('nexus'):
            raise RTSLibError("The TPG does not use a nexus")
        if self._get_nexus():
            raise RTSLibError("The TPG's nexus initiator WWN is already set")

        fm = self.parent_target.fabric_module

        if nexus_wwn:
            nexus_wwn = fm.to_normalized_wwn(nexus_wwn)[0]
        else:
            # Nexus wwn type should match parent target
            nexus_wwn = generate_wwn(self.parent_target.wwn_type)

        fwrite("%s/nexus" % self.path, fm.to_fabric_wwn(nexus_wwn))

    def _list_node_acls(self):
        self._check_self()
        if not self.has_feature('acls'):
            return

        node_acl_dirs = [os.path.basename(path)
                         for path in os.listdir("%s/acls" % self.path)]
        for node_acl_dir in node_acl_dirs:
            fm = self.parent_target.fabric_module
            yield NodeACL(self, fm.from_fabric_wwn(node_acl_dir), 'lookup')

    def _list_node_acl_groups(self):
        self._check_self()
        if not self.has_feature('acls'):
            return

        names = set([])

        for na in self.node_acls:
            tag = na.tag
            if tag:
                names.add(tag)

        return (NodeACLGroup(self, n) for n in names)

    def _list_luns(self):
        self._check_self()
        lun_dirs = [os.path.basename(path)
                    for path in os.listdir("%s/lun" % self.path)]
        for lun_dir in lun_dirs:
            lun = lun_dir.split('_')[1]
            lun = int(lun)
            yield LUN(self, lun)

    def _control(self, command):
        self._check_self()
        path = "%s/control" % self.path
        fwrite(path, "%s\n" % str(command))

    # TPG public stuff

    def has_feature(self, feature):
        '''
        Whether or not this TPG has a certain feature.
        '''
        return self.parent_target.has_feature(feature)

    def delete(self):
        '''
        Recursively deletes a TPG object.
        This will delete all attached LUN, NetworkPortal and Node ACL objects
        and then the TPG itself. Before starting the actual deletion process,
        all sessions will be disconnected.
        '''
        self._check_self()

        self.enable = False

        for acl in self.node_acls:
            acl.delete()
        for lun in self.luns:
            lun.delete()
        for portal in self.network_portals:
            portal.delete()
        super(TPG, self).delete()

    def node_acl(self, node_wwn, mode='any'):
        '''
        Same as NodeACL() but without specifying the parent_tpg.
        '''
        self._check_self()
        return NodeACL(self, node_wwn=node_wwn, mode=mode)

    def network_portal(self, ip_address, port, mode='any'):
        '''
        Same as NetworkPortal() but without specifying the parent_tpg.
        '''
        self._check_self()
        return NetworkPortal(self, ip_address=ip_address, port=port, mode=mode)

    def lun(self, lun, storage_object=None, alias=None):
        '''
        Same as LUN() but without specifying the parent_tpg.
        '''
        self._check_self()
        return LUN(self, lun=lun, storage_object=storage_object, alias=alias)

    tag = property(_get_tag,
            doc="Get the TPG Tag as an int.")
    parent_target = property(_get_parent_target,
                             doc="Get the parent Target object to which the " \
                             + "TPG is attached.")
    enable = property(_get_enable, _set_enable,
                      doc="Get or set a boolean value representing the " \
                      + "enable status of the TPG. " \
                      + "True means the TPG is enabled, False means it is " \
                      + "disabled.")
    network_portals = property(_list_network_portals,
            doc="Get the list of NetworkPortal objects currently attached " \
                               + "to the TPG.")
    node_acls = property(_list_node_acls,
                         doc="Get the list of NodeACL objects currently " \
                         + "attached to the TPG.")
    node_acl_groups = property(_list_node_acl_groups,
                         doc="Get the list of NodeACL groups currently " \
                         + "attached to the TPG.")
    luns = property(_list_luns,
                    doc="Get the list of LUN objects currently attached " \
                    + "to the TPG.")

    nexus = property(_get_nexus, _set_nexus,
                     doc="Get or set (once) the TPG's Nexus is used.")

    chap_userid = property(partial(_get_auth_attr, attribute='auth/userid', ignore=True),
                           partial(_set_auth_attr, attribute='auth/userid', ignore=True),
                           doc="Set or get the initiator CHAP auth userid.")
    chap_password = property(partial(_get_auth_attr, attribute='auth/password', ignore=True),
                             partial(_set_auth_attr, attribute='auth/password', ignore=True),
                             doc="Set or get the initiator CHAP auth password.")
    chap_mutual_userid = property(partial(_get_auth_attr, attribute='auth/userid_mutual', ignore=True),
                                  partial(_set_auth_attr, attribute='auth/userid_mutual', ignore=True),
                                  doc="Set or get the initiator CHAP auth userid.")
    chap_mutual_password = property(partial(_get_auth_attr, attribute='auth/password_mutual', ignore=True),
                                    partial(_set_auth_attr, attribute='auth/password_mutual', ignore=True),
                                    doc="Set or get the initiator CHAP auth password.")

    def _get_authenticate_target(self):
        self._check_self()
        path = "%s/auth/authenticate_target" % self.path
        try:
            return bool(int(fread(path)))
        except:
            return None

    authenticate_target = property(_get_authenticate_target,
                                   doc="Get the boolean authenticate target flag.")

    @classmethod
    def setup(cls, t_obj, tpg, err_func):
        tpg_obj = cls(t_obj, tag=tpg.get("tag", None))
        set_attributes(tpg_obj, tpg.get('attributes', {}), err_func)
        set_parameters(tpg_obj, tpg.get('parameters', {}), err_func)

        for lun in tpg.get('luns', []):
            LUN.setup(tpg_obj, lun, err_func)

        for p in tpg.get('portals', []):
            NetworkPortal.setup(tpg_obj, p, err_func)

        for acl in tpg.get('node_acls', []):
            NodeACL.setup(tpg_obj, acl, err_func)

        tpg_obj.enable = tpg.get('enable', True)
        dict_remove(tpg, ('luns', 'portals', 'node_acls', 'tag',
                          'attributes', 'parameters', 'enable'))
        for name, value in six.iteritems(tpg):
            if value:
                try:
                    setattr(tpg_obj, name, value)
                except:
                    err_func("Could not set tpg %s attribute '%s'" %
                             (tpg_obj.tag, name))

    def dump(self):
        d = super(TPG, self).dump()
        d['tag'] = self.tag
        d['enable'] = self.enable
        d['luns'] = [lun.dump() for lun in self.luns]
        d['portals'] = [portal.dump() for portal in self.network_portals]
        d['node_acls'] =  [acl.dump() for acl in self.node_acls]
        if self.has_feature("auth"):
            for attr in auth_params:
                val = getattr(self, "chap_" + attr, None)
                if val:
                    d["chap_" + attr] = val
        return d

class LUN(CFSNode):
    '''
    This is an interface to RTS Target LUNs in configFS.
    A LUN is identified by its parent TPG and LUN index.
    '''

    MAX_LUN = 255

    # LUN private stuff

    def __repr__(self):
        return "<LUN %d (%s/%s)>" % (self.lun, self.storage_object.plugin,
                                    self.storage_object.name)

    def __init__(self, parent_tpg, lun=None, storage_object=None, alias=None):
        '''
        A LUN object can be instanciated in two ways:
            - B{Creation mode}: If I{storage_object} is specified, the
              underlying configFS object will be created with that parameter.
              No LUN with the same I{lun} index can pre-exist in the parent TPG
              in that mode, or instanciation will fail.
            - B{Lookup mode}: If I{storage_object} is not set, then the LUN
              will be bound to the existing configFS LUN object of the parent
              TPG having the specified I{lun} index. The underlying configFS
              object must already exist in that mode.

        @param parent_tpg: The parent TPG object.
        @type parent_tpg: TPG
        @param lun: The LUN index.
        @type lun: 0-255
        @param storage_object: The storage object to be exported as a LUN.
        @type storage_object: StorageObject subclass
        @param alias: An optional parameter to manually specify the LUN alias.
        You probably do not need this.
        @type alias: string
        @return: A LUN object.
        '''
        super(LUN, self).__init__()

        if isinstance(parent_tpg, TPG):
            self._parent_tpg = parent_tpg
        else:
            raise RTSLibError("Invalid parent TPG")

        if lun is None:
            luns = [l.lun for l in self.parent_tpg.luns]
            for index in range(self.MAX_LUN+1):
                if index not in luns:
                    lun = index
                    break
            if lun is None:
                raise RTSLibError("All LUNs 0-%d in use" % self.MAX_LUN)
        else:
            lun = int(lun)
            if lun < 0 or lun > self.MAX_LUN:
                raise RTSLibError("LUN must be 0 to %d" % self.MAX_LUN)

        self._lun = lun

        self._path = "%s/lun/lun_%d" % (self.parent_tpg.path, self.lun)

        if storage_object is None and alias is not None:
            raise RTSLibError("The alias parameter has no meaning " \
                              + "without the storage_object parameter")

        if storage_object is not None:
            self._create_in_cfs_ine('create')
            try:
                self._configure(storage_object, alias)
            except:
                self.delete()
                raise
        else:
            self._create_in_cfs_ine('lookup')

    def _configure(self, storage_object, alias):
        self._check_self()
        if alias is None:
            alias = str(uuid.uuid4())[-10:]
        else:
            alias = str(alias).strip()
            if '/' in alias:
                raise RTSLibError("Invalid alias: %s", alias)

        destination = "%s/%s" % (self.path, alias)

        if storage_object.exists:
            source = storage_object.path
        else:
            raise RTSLibError("storage_object does not exist in configFS")

        os.symlink(source, destination)

    def _get_alias(self):
        self._check_self()
        for path in os.listdir(self.path):
            if os.path.islink("%s/%s" % (self.path, path)):
                return os.path.basename(path)

        raise RTSLibBrokenLink("Broken LUN in configFS, no storage object")

    def _get_storage_object(self):
        self._check_self()
        alias_path = os.path.realpath("%s/%s" % (self.path, self.alias))
        return tcm.StorageObject.so_from_path(alias_path)

    def _get_parent_tpg(self):
        return self._parent_tpg

    def _get_lun(self):
        return self._lun

    def _list_mapped_luns(self):
        self._check_self()

        tpg = self.parent_tpg
        if not tpg.has_feature('acls'):
            return

        for na in tpg.node_acls:
            for mlun in na.mapped_luns:
                if os.path.realpath("%s/%s" % (mlun.path, mlun.alias)) == self.path:
                    yield mlun

    # pass through backends will not have setup all the default
    # ALUA structs in the kernel. If the kernel has been setup,
    # a user created group or default_tg_pt_gp will be returned.
    # If the kernel was not properly setup an empty string is
    # return in alua_tg_pt_gp. Writing to alua_tg_pt_gp will crash
    # older kernels and will return a -Exyz code in newer ones.
    def _get_alua_tg_pt_gp_name(self):
        self._check_self()

        storage_object = self._get_storage_object()
        if storage_object.alua_supported is False:
            return None

        path = "%s/alua_tg_pt_gp" % self.path
        try:
            info = fread(path)
            if not info:
                return None
            group_line = info.splitlines()[0]
            return group_line.split(':')[1].strip()
        except IOError as e:
            return None

    def _set_alua_tg_pt_gp_name(self, group_name):
        self._check_self()

        if not self._get_alua_tg_pt_gp_name():
            return -1

        path = "%s/alua_tg_pt_gp" % self.path
        try:
            fwrite(path, group_name)
        except IOError as e:
            return -1

        return 0

    # LUN public stuff

    def delete(self):
        '''
        If the underlying configFS object does not exist, this method does
        nothing. If the underlying configFS object exists, this method attempts
        to delete it along with all MappedLUN objects referencing that LUN.
        '''
        self._check_self()

        for mlun in self.mapped_luns:
            mlun.delete()

        try:
            link = self.alias
        except RTSLibBrokenLink:
            pass
        else:
            if os.path.islink("%s/%s" % (self.path, link)):
                os.unlink("%s/%s" % (self.path, link))

        super(LUN, self).delete()

    parent_tpg = property(_get_parent_tpg,
            doc="Get the parent TPG object.")
    lun = property(_get_lun,
            doc="Get the LUN index as an int.")
    storage_object = property(_get_storage_object,
            doc="Get the storage object attached to the LUN.")
    alias = property(_get_alias,
            doc="Get the LUN alias.")
    mapped_luns = property(_list_mapped_luns,
            doc="List all MappedLUN objects referencing this LUN.")
    alua_tg_pt_gp_name = property(_get_alua_tg_pt_gp_name, _set_alua_tg_pt_gp_name,
            doc="Get and Set the LUN's ALUA Target Port Group")

    @classmethod
    def setup(cls, tpg_obj, lun, err_func):
        if 'index' not in lun:
            err_func("'index' missing from a LUN in TPG %d" % tpg_obj.tag)
            return

        try:
            bs_name, so_name = lun['storage_object'].split('/')[2:]
        except:
            err_func("Malformed storage object field for LUN %d" % lun['index'])
            return

        for so in tcm.StorageObject.all():
            if so_name == so.name and bs_name == so.plugin:
                match_so = so
                break
        else:
            err_func("Could not find matching StorageObject for LUN %d" % lun['index'])
            return

        try:
           lun_obj =  cls(tpg_obj, lun['index'], storage_object=match_so, alias=lun.get('alias'))
        except (RTSLibError, KeyError):
            err_func("Creating TPG %d LUN index %d failed" %
                     (tpg_obj.tag, lun['index']))

        try:
            lun_obj.alua_tg_pt_gp_name = lun['alua_tg_pt_gp_name']
        except KeyError:
            # alua_tg_pt_gp support not present in older versions
            pass

    def dump(self):
        d = super(LUN, self).dump()
        d['storage_object'] = "/backstores/%s/%s" % \
            (self.storage_object.plugin,  self.storage_object.name)
        d['index'] = self.lun
        d['alias'] = self.alias
        d['alua_tg_pt_gp_name'] = self.alua_tg_pt_gp_name
        return d

class NetworkPortal(CFSNode):
    '''
    This is an interface to NetworkPortals in configFS.  A NetworkPortal is
    identified by its IP and port, but here we also require the parent TPG, so
    instance objects represent both the NetworkPortal and its association to a
    TPG. This is necessary to get path information in order to create the
    portal in the proper configFS hierarchy.
    '''

    # NetworkPortal private stuff

    def __repr__(self):
        return "<NetworkPortal %s port %s>" % (self.ip_address, self.port)

    def __init__(self, parent_tpg, ip_address, port=3260, mode='any'):
        '''
        @param parent_tpg: The parent TPG object.
        @type parent_tpg: TPG
        @param ip_address: The ipv4/v6 IP address of the NetworkPortal. ipv6
            addresses should be surrounded by '[]'.
        @type ip_address: string
        @param port: The optional (defaults to 3260) NetworkPortal TCP/IP port.
        @type port: int
        @param mode: An optionnal string containing the object creation mode:
            - I{'any'} means the configFS object will be either looked up or
              created.
            - I{'lookup'} means the object MUST already exist configFS.
            - I{'create'} means the object must NOT already exist in configFS.
        @type mode:string
        @return: A NetworkPortal object.
        '''
        super(NetworkPortal, self).__init__()

        self._ip_address = str(ip_address)

        try:
            self._port = int(port)
        except ValueError:
            raise RTSLibError("Invalid port")

        if isinstance(parent_tpg, TPG):
            self._parent_tpg = parent_tpg
        else:
            raise RTSLibError("Invalid parent TPG")

        self._path = "%s/np/%s:%d" \
            % (self.parent_tpg.path, self.ip_address, self.port)

        try:
            self._create_in_cfs_ine(mode)
        except OSError as msg:
            raise RTSLibError(msg)

    def _get_ip_address(self):
        return self._ip_address

    def _get_port(self):
        return self._port

    def _get_parent_tpg(self):
        return self._parent_tpg

    def _get_iser(self):
        try:
            return bool(int(fread("%s/iser" % self.path)))
        except IOError:
            return False

    def _set_iser(self, boolean):
        path = "%s/iser" % self.path
        try:
            fwrite(path, str(int(boolean)))
        except IOError:
            # b/w compat: don't complain if iser entry is missing
            if os.path.isfile(path):
                raise RTSLibError("Cannot change iser")

    def _get_offload(self):
        try:
            # only offload at the moment is cxgbit
            return bool(int(fread("%s/cxgbit" % self.path)))
        except IOError:
            return False

    def _set_offload(self, boolean):
        path = "%s/cxgbit" % self.path
        try:
            fwrite(path, str(int(boolean)))
        except IOError:
            # b/w compat: don't complain if cxgbit entry is missing
            if os.path.isfile(path):
                raise RTSLibError("Cannot change offload")

    # NetworkPortal public stuff

    def delete(self):
        self.iser = False
        self.offload = False
        super(NetworkPortal, self).delete()

    parent_tpg = property(_get_parent_tpg,
            doc="Get the parent TPG object.")
    port = property(_get_port,
            doc="Get the NetworkPortal's TCP port as an int.")
    ip_address = property(_get_ip_address,
            doc="Get the NetworkPortal's IP address as a string.")
    iser = property(_get_iser, _set_iser,
                    doc="Get or set a boolean value representing if this " \
                        + "NetworkPortal supports iSER.")
    offload = property(_get_offload, _set_offload,
                    doc="Get or set a boolean value representing if this " \
                        + "NetworkPortal supports offload.")

    @classmethod
    def setup(cls, tpg_obj, p, err_func):
        if 'ip_address' not in p:
            err_func("'ip_address' field missing from a portal in TPG %d" % tpg_obj.tag)
            return
        if 'port' not in p:
            err_func("'port' field missing from a portal in TPG %d" % tpg_obj.tag)
            return

        try:
            np = cls(tpg_obj, p['ip_address'], p['port'])
            np.iser = p.get('iser', False)
            np.offload = p.get('offload', False)
        except (RTSLibError, KeyError) as e:
            err_func("Creating NetworkPortal object %s:%s failed: %s" %
                     (p['ip_address'], p['port'], e))

    def dump(self):
        d = super(NetworkPortal, self).dump()
        d['port'] = self.port
        d['ip_address'] = self.ip_address
        d['iser'] = self.iser
        d['offload'] = self.offload
        return d

class NodeACL(CFSNode):
    '''
    This is an interface to node ACLs in configFS.
    A NodeACL is identified by the initiator node wwn and parent TPG.
    '''

    # NodeACL private stuff

    def __repr__(self):
        return "<NodeACL %s>" % self.node_wwn

    def __init__(self, parent_tpg, node_wwn, mode='any'):
        '''
        @param parent_tpg: The parent TPG object.
        @type parent_tpg: TPG
        @param node_wwn: The wwn of the initiator node for which the ACL is
        created.
        @type node_wwn: string
        @param mode:An optionnal string containing the object creation mode:
            - I{'any'} means the configFS object will be either looked up or
            created.
            - I{'lookup'} means the object MUST already exist configFS.
            - I{'create'} means the object must NOT already exist in configFS.
        @type mode:string
        @return: A NodeACL object.
        '''

        super(NodeACL, self).__init__()

        if isinstance(parent_tpg, TPG):
            self._parent_tpg = parent_tpg
        else:
            raise RTSLibError("Invalid parent TPG")

        fm = self.parent_tpg.parent_target.fabric_module
        self._node_wwn, self.wwn_type = normalize_wwn(fm.wwn_types, node_wwn)
        self._path = "%s/acls/%s" % (self.parent_tpg.path, fm.to_fabric_wwn(self.node_wwn))
        self._create_in_cfs_ine(mode)

    def _get_node_wwn(self):
        return self._node_wwn

    def _get_parent_tpg(self):
        return self._parent_tpg

    def _get_tcq_depth(self):
        self._check_self()
        path = "%s/cmdsn_depth" % self.path
        return fread(path)

    def _set_tcq_depth(self, depth):
        self._check_self()
        path = "%s/cmdsn_depth" % self.path
        try:
            fwrite(path, "%s" % depth)
        except IOError as msg:
            msg = msg[1]
            raise RTSLibError("Cannot set tcq_depth: %s" % str(msg))

    def _get_tag(self):
        self._check_self()
        try:
            tag = fread("%s/tag" % self.path)
            if tag:
                return tag
            return None
        except IOError:
            return None

    def _set_tag(self, tag_str):
        with ignored(IOError):
            if tag_str is None:
                fwrite("%s/tag" % self.path, 'NULL')
            else:
                fwrite("%s/tag" % self.path, tag_str)

    def _list_mapped_luns(self):
        self._check_self()
        for mapped_lun_dir in glob("%s/lun_*" % self.path):
            mapped_lun = int(os.path.basename(mapped_lun_dir).split("_")[1])
            yield MappedLUN(self, mapped_lun)

    def _get_session(self):
        try:
            lines = fread("%s/info" % self.path).splitlines()
        except IOError:
            return None

        if lines[0].startswith("No active"):
            return None

        session = {}

        for line in lines:
            if line.startswith("InitiatorName:"):
                session['parent_nodeacl'] = self
                session['connections'] = []
            elif line.startswith("InitiatorAlias:"):
                session['alias'] = line.split(":")[1].strip()
            elif line.startswith("LIO Session ID:"):
                session['id'] = int(line.split(":")[1].split()[0])
                session['type'] = line.split("SessionType:")[1].split()[0].strip()
            elif "TARG_SESS_STATE_" in line:
                session['state'] = line.split("_STATE_")[1].split()[0]
            elif "TARG_CONN_STATE_" in line:
                cid = int(line.split(":")[1].split()[0])
                cstate = line.split("_STATE_")[1].split()[0]
                session['connections'].append(dict(cid=cid, cstate=cstate))
            elif "Address" in line:
                session['connections'][-1]['address'] = line.split()[1]
                session['connections'][-1]['transport'] = line.split()[2]

        return session

    # NodeACL public stuff
    def has_feature(self, feature):
        '''
        Whether or not this NodeACL has a certain feature.
        '''
        return self.parent_tpg.has_feature(feature)

    def delete(self):
        '''
        Delete the NodeACL, including all MappedLUN objects.
        If the underlying configFS object does not exist, this method does
        nothing.
        '''
        self._check_self()
        for mapped_lun in self.mapped_luns:
            mapped_lun.delete()
        super(NodeACL, self).delete()

    def mapped_lun(self, mapped_lun, tpg_lun=None, write_protect=None):
        '''
        Same as MappedLUN() but without the parent_nodeacl parameter.
        '''
        self._check_self()
        return MappedLUN(self, mapped_lun=mapped_lun, tpg_lun=tpg_lun,
                         write_protect=write_protect)

    tcq_depth = property(_get_tcq_depth, _set_tcq_depth,
                         doc="Set or get the TCQ depth for the initiator " \
                         + "sessions matching this NodeACL.")
    tag = property(_get_tag, _set_tag,
            doc="Set or get the NodeACL tag. If not supported, return None")
    parent_tpg = property(_get_parent_tpg,
            doc="Get the parent TPG object.")
    node_wwn = property(_get_node_wwn,
            doc="Get the node wwn.")
    mapped_luns = property(_list_mapped_luns,
            doc="Get the list of all MappedLUN objects in this NodeACL.")
    session = property(_get_session,
            doc="Gives a snapshot of the current session or C{None}")

    chap_userid = property(partial(_get_auth_attr, attribute='auth/userid'),
                           partial(_set_auth_attr, attribute='auth/userid'),
                           doc="Set or get the initiator CHAP auth userid.")
    chap_password = property(partial(_get_auth_attr, attribute='auth/password'),
                             partial(_set_auth_attr, attribute='auth/password',),
                             doc="Set or get the initiator CHAP auth password.")
    chap_mutual_userid = property(partial(_get_auth_attr, attribute='auth/userid_mutual'),
                                  partial(_set_auth_attr, attribute='auth/userid_mutual'),
                                  doc="Set or get the initiator CHAP auth userid.")
    chap_mutual_password = property(partial(_get_auth_attr, attribute='auth/password_mutual'),
                                    partial(_set_auth_attr, attribute='auth/password_mutual'),
                                    doc="Set or get the initiator CHAP auth password.")

    def _get_authenticate_target(self):
        self._check_self()
        path = "%s/auth/authenticate_target" % self.path
        return bool(int(fread(path)))

    authenticate_target = property(_get_authenticate_target,
                                   doc="Get the boolean authenticate target flag.")

    @classmethod
    def setup(cls, tpg_obj, acl, err_func):
        if 'node_wwn' not in acl:
            err_func("'node_wwn' missing in node_acl")
            return
        try:
            acl_obj = cls(tpg_obj, acl['node_wwn'])
        except RTSLibError as e:
            err_func("Error when creating NodeACL for %s: %s" % (acl['node_wwn'], e))
            return

        set_attributes(acl_obj, acl.get('attributes', {}), err_func)

        for mlun in acl.get('mapped_luns', []):
            MappedLUN.setup(tpg_obj, acl_obj, mlun, err_func)

        dict_remove(acl, ('attributes', 'mapped_luns', 'node_wwn'))
        for name, value in six.iteritems(acl):
            if value:
                try:
                    setattr(acl_obj, name, value)
                except:
                    err_func("Could not set nodeacl %s attribute '%s'" %
                             (acl['node_wwn'], name))

    def dump(self):
        d = super(NodeACL, self).dump()
        d['node_wwn'] = self.node_wwn
        d['mapped_luns'] = [lun.dump() for lun in self.mapped_luns]
        if self.tag:
            d['tag'] = self.tag
        if self.has_feature("auth"):
            for attr in auth_params:
                val = getattr(self, "chap_" + attr, None)
                if val:
                    d["chap_" + attr] = val
        return d

class MappedLUN(CFSNode):
    '''
    This is an interface to RTS Target Mapped LUNs.
    A MappedLUN is a mapping of a TPG LUN to a specific initiator node, and is
    part of a NodeACL. It allows the initiator to actually access the TPG LUN
    if ACLs are enabled for the TPG. The initial TPG LUN will then be seen by
    the initiator node as the MappedLUN.
    '''

    # MappedLUN private stuff

    def __repr__(self):
        return "<MappedLUN %s lun %d -> tpg%d lun %d>" % \
            (self.parent_nodeacl.node_wwn, self.mapped_lun,
             self.parent_nodeacl.parent_tpg.tag, self.tpg_lun.lun)

    def __init__(self, parent_nodeacl, mapped_lun,
                 tpg_lun=None, write_protect=None, alias=None):
        '''
        A MappedLUN object can be instanciated in two ways:
            - B{Creation mode}: If I{tpg_lun} is specified, the underlying
              configFS object will be created with that parameter. No MappedLUN
              with the same I{mapped_lun} index can pre-exist in the parent
              NodeACL in that mode, or instanciation will fail.
            - B{Lookup mode}: If I{tpg_lun} is not set, then the MappedLUN will
              be bound to the existing configFS MappedLUN object of the parent
              NodeACL having the specified I{mapped_lun} index. The underlying
              configFS object must already exist in that mode.

        @param mapped_lun: The mapped LUN index.
        @type mapped_lun: int
        @param tpg_lun: The TPG LUN index to map, or directly a LUN object that
        belong to the same TPG as the
        parent NodeACL.
        @type tpg_lun: int or LUN
        @param write_protect: The write-protect flag value, defaults to False
        (write-protection disabled).
        @type write_protect: bool
        '''

        super(MappedLUN, self).__init__()

        if not isinstance(parent_nodeacl, NodeACL):
            raise RTSLibError("The parent_nodeacl parameter must be " \
                              + "a NodeACL object")
        else:
            self._parent_nodeacl = parent_nodeacl
            if not parent_nodeacl.exists:
                raise RTSLibError("The parent_nodeacl does not exist")

        try:
            self._mapped_lun = int(mapped_lun)
        except ValueError:
            raise RTSLibError("The mapped_lun parameter must be an " \
                              + "integer value")

        self._path = "%s/lun_%d" % (self.parent_nodeacl.path, self.mapped_lun)

        if tpg_lun is None and write_protect is not None:
            raise RTSLibError("The write_protect parameter has no " \
                              + "meaning without the tpg_lun parameter")

        if tpg_lun is not None:
            self._create_in_cfs_ine('create')
            try:
                self._configure(tpg_lun, write_protect, alias)
            except:
                self.delete()
                raise
        else:
            self._create_in_cfs_ine('lookup')

    def _configure(self, tpg_lun, write_protect, alias):
        self._check_self()
        if isinstance(tpg_lun, LUN):
            tpg_lun = tpg_lun.lun
        else:
            try:
                tpg_lun = int(tpg_lun)
            except ValueError:
                raise RTSLibError("The tpg_lun must be either an "
                                  + "integer or a LUN object")
        # Check that the tpg_lun exists in the TPG
        for lun in self.parent_nodeacl.parent_tpg.luns:
            if lun.lun == tpg_lun:
                tpg_lun = lun
                break
        if not (isinstance(tpg_lun, LUN) and tpg_lun):
            raise RTSLibError("LUN %s does not exist in this TPG"
                              % str(tpg_lun))

        if not alias:
            alias = str(uuid.uuid4())[-10:]
        os.symlink(tpg_lun.path, "%s/%s" % (self.path, alias))

        try:
            self.write_protect = int(write_protect) > 0
        except:
            self.write_protect = False

    def _get_alias(self):
        self._check_self()
        for path in os.listdir(self.path):
            if os.path.islink("%s/%s" % (self.path, path)):
                return os.path.basename(path)

        raise RTSLibBrokenLink("Broken LUN in configFS, no storage object")

    def _get_mapped_lun(self):
        return self._mapped_lun

    def _get_parent_nodeacl(self):
        return self._parent_nodeacl

    def _set_write_protect(self, write_protect):
        self._check_self()
        path = "%s/write_protect" % self.path
        if write_protect:
            fwrite(path, "1")
        else:
            fwrite(path, "0")

    def _get_write_protect(self):
        self._check_self()
        path = "%s/write_protect" % self.path
        return bool(int(fread(path)))

    def _get_tpg_lun(self):
        self._check_self()
        path = os.path.realpath("%s/%s" % (self.path, self.alias))
        for lun in self.parent_nodeacl.parent_tpg.luns:
            if lun.path == path:
                return lun

        raise RTSLibBrokenLink("Broken MappedLUN, no TPG LUN found")

    def _get_node_wwn(self):
        self._check_self()
        return self.parent_nodeacl.node_wwn

    # MappedLUN public stuff

    def delete(self):
        '''
        Delete the MappedLUN.
        '''
        self._check_self()
        try:
            lun_link = "%s/%s" % (self.path, self.alias)
        except RTSLibBrokenLink:
            pass
        else:
            if os.path.islink(lun_link):
                os.unlink(lun_link)
        super(MappedLUN, self).delete()

    mapped_lun = property(_get_mapped_lun,
            doc="Get the integer MappedLUN mapped_lun index.")
    parent_nodeacl = property(_get_parent_nodeacl,
            doc="Get the parent NodeACL object.")
    write_protect = property(_get_write_protect, _set_write_protect,
            doc="Get or set the boolean write protection.")
    tpg_lun = property(_get_tpg_lun,
            doc="Get the TPG LUN object the MappedLUN is pointing at.")
    node_wwn = property(_get_node_wwn,
            doc="Get the wwn of the node for which the TPG LUN is mapped.")
    alias = property(_get_alias,
            doc="Get the MappedLUN alias.")

    @classmethod
    def setup(cls, tpg_obj, acl_obj, mlun, err_func):
        if 'tpg_lun' not in mlun:
            err_func("'tpg_lun' not in a mapped_lun")
            return
        if 'index' not in mlun:
            err_func("'index' not in a mapped_lun")
            return

        # Mapped lun needs to correspond with already-created
        # TPG lun
        for lun in tpg_obj.luns:
            if lun.lun == mlun['tpg_lun']:
                tpg_lun_obj = lun
                break
        else:
            err_func("Could not find matching TPG LUN %d for MappedLUN %s" %
                     (mlun['tpg_lun'], mlun['index']))
            return

        try:
            mlun_obj = cls(acl_obj, mlun['index'],
                           tpg_lun_obj, mlun.get('write_protect'),
                           mlun.get('alias'))
            mlun_obj.tag = mlun.get("tag", None)
        except (RTSLibError, KeyError):
            err_func("Creating MappedLUN object %d failed" % mlun['index'])

    def dump(self):
        d = super(MappedLUN, self).dump()
        d['write_protect'] = self.write_protect
        d['index'] = self.mapped_lun
        d['tpg_lun'] = self.tpg_lun.lun
        d['alias'] = self.alias
        return d

class Group(object):
    '''
    An abstract base class akin to CFSNode, but for classes that
    emulate a higher-level group object across the actual NodeACL
    configfs structure.
    '''
    def __init__(self, members_func):
        '''
        members_func is a function that takes a self argument
        and returns an iterator of the objects that the
        derived Group class is grouping.
        '''
        self._mem_func = members_func

    def _get_first_member(self):
        try:
            return next(self._mem_func(self))
        except StopIteration:
            raise IndexError("Group is empty")

    def _get_prop(self, prop):
        '''
        Helper fn to use with partial() to support getting a
        property value from the first member of the group.
        (All members of the group should be identical.)
        '''
        return getattr(self._get_first_member(), prop)

    def _set_prop(self, value, prop):
        '''
        Helper fn to use with partial() to support setting a
        property value in all members of the group.

        Caution: Arguments reversed!
        This is so partial() can be used on property name.
        '''

        for mem in self._mem_func(self):
            setattr(mem, prop, value)

    def list_attributes(self, writable=None):
        return self._get_first_member().list_attributes(writable)

    def list_parameters(self, writable=None):
        return self._get_first_member().list_parameters(writable)

    def set_attribute(self, attribute, value):
        for obj in self._mem_func(self):
            obj.set_attribute(attribute, value)

    def set_parameter(self, parameter, value):
        for obj in self._mem_func(self):
            obj.set_parameter(parameter, value)

    def get_attribute(self, attribute):
        return self._get_first_member().get_attribute(attribute)

    def get_parameter(self, parameter):
        return self._get_first_member().get_parameter(parameter)

    def delete(self):
        '''
        Delete all members of the group.
        '''
        for mem in self._mem_func(self):
            mem.delete()

    @property
    def exists(self):
        return any(self._mem_func(self))

def _check_group_name(name):
    # Since all WWNs have a '.' in them, let's avoid confusion.
    if '.' in name:
        raise RTSLibError("'.' not permitted in group names.")

class NodeACLGroup(Group):
    '''
    Allow a group of NodeACLs that share a tag to be managed collectively.
    '''
    def __repr__(self):
        return "<NodeACLGroup %s>" % self.name

    def __init__(self, parent_tpg, name):
        super(NodeACLGroup, self).__init__(NodeACLGroup._node_acls.fget)
        _check_group_name(name)
        self._name = name
        self._parent_tpg = parent_tpg

    def _get_name(self):
        return self._name

    def _set_name(self, name):
        _check_group_name(name)
        for na in self._node_acls:
            na.tag = name
        self._name = name

    @property
    def parent_tpg(self):
        '''
        Get the parent TPG object.
        '''
        return self._parent_tpg

    def add_acl(self, node_wwn):
        '''
        Add a WWN to the NodeACLGroup. If a NodeACL already exists for this WWN,
        its configuration will be changed to match the NodeACLGroup, except for its
        auth parameters, which can vary among group members.
        @param node_wwn: An initiator WWN
        @type node_wwn: string
        '''
        nacl = NodeACL(self.parent_tpg, node_wwn)

        if nacl in self._node_acls:
            return

        # if joining a group, take its config
        try:
            model = next(self._node_acls)
        except StopIteration:
            pass
        else:
            for mlun in nacl.mapped_luns:
                mlun.delete()

            for mlun in model.mapped_luns:
                MappedLUN(nacl, mlun.mapped_lun, mlun.tpg_lun, mlun.write_protect)

            for item in model.list_attributes(writable=True):
                nacl.set_attribute(item, model.get_attribute(item))
            for item in model.list_parameters(writable=True):
                nacl.set_parameter(item, model.get_parameter(item))
        finally:
            nacl.tag = self.name

    def remove_acl(self, node_wwn):
        '''
        Remove a WWN from the NodeACLGroup.
        @param node_wwn: An initiator WWN
        @type node_wwn: string
        '''
        nacl = NodeACL(self.parent_tpg, node_wwn, mode='lookup')

        nacl.delete()

    @property
    def _node_acls(self):
        '''
        Gives access to the underlying NodeACLs within this group.
        '''
        for na in self.parent_tpg.node_acls:
            if na.tag == self.name:
                yield na

    @property
    def wwns(self):
        '''
        Give the Node WWNs of members of this group.
        '''
        return (na.node_wwn for na in self._node_acls)

    def has_feature(self, feature):
        '''
        Whether or not this NodeACL has a certain feature.
        '''
        return self._parent_tpg.has_feature(feature)

    @property
    def sessions(self):
        '''
        Yields any current sessions.
        '''
        for na in self._node_acls:
            session = na.session
            if session:
                yield session

    def mapped_lun_group(self, mapped_lun, tpg_lun=None, write_protect=None):
        '''
        Add a mapped lun to all group members.
        '''
        return MappedLUNGroup(self, mapped_lun=mapped_lun, tpg_lun=tpg_lun,
                      write_protect=write_protect)

    @property
    def mapped_lun_groups(self):
        '''
        Generates all MappedLUNGroup objects in this NodeACLGroup.
        '''
        try:
            first = self._get_first_member()
        except IndexError:
            return

        for mlun in first.mapped_luns:
            yield MappedLUNGroup(self, mlun.mapped_lun)

    name = property(_get_name, _set_name,
                    doc="Get/set NodeACLGroup name.")

    def _get_chap(self, name):
        for na in self._node_acls:
            yield (na.node_wwn, getattr(na, "chap_" + name))

    def _set_chap(self, name, value, wwn):
        for na in self._node_acls:
            if not wwn:
                setattr(na, "chap_" + name, value)
            elif wwn == na.node_wwn:
                setattr(na, "chap_" + name, value)
                break

    def get_userids(self):
        '''
        Returns a (wwn, userid) tuple for each member of the group.
        '''
        return self._get_chap(name="userid")

    def set_userids(self, value, wwn=None):
        '''
        If wwn, set the userid for just that wwn, otherwise set it for
        all group members.
        '''
        return self._set_chap("userid", value, wwn)

    def get_passwords(self):
        '''
        Returns a (wwn, password) tuple for each member of the group.
        '''
        return self._get_chap(name="password")

    def set_passwords(self, value, wwn=None):
        '''
        If wwn, set the password for just that wwn, otherwise set it for
        all group members.
        '''
        return self._set_chap("password", value, wwn)

    def get_mutual_userids(self):
        '''
        Returns a (wwn, mutual_userid) tuple for each member of the group.
        '''
        return self._get_chap(name="mutual_userid")

    def set_mutual_userids(self, value, wwn=None):
        '''
        If wwn, set the mutual_userid for just that wwn, otherwise set it for
        all group members.
        '''
        return self._set_chap("mutual_userid", value, wwn)

    def get_mutual_passwords(self):
        '''
        Returns a (wwn, mutual_password) tuple for each member of the group.
        '''
        return self._get_chap(name="mutual_password")

    def set_mutual_passwords(self, value, wwn=None):
        '''
        If wwn, set the mutual_password for just that wwn, otherwise set it for
        all group members.
        '''
        return self._set_chap("mutual_password", value, wwn)

    tcq_depth = property(partial(Group._get_prop, prop="tcq_depth"),
                         partial(Group._set_prop, prop="tcq_depth"),
                         doc="Set or get the TCQ depth for the initiator "
                         + "sessions matching this NodeACLGroup")
    authenticate_target = property(partial(Group._get_prop, prop="authenticate_target"),
                                   doc="Get the boolean authenticate target flag.")

class MappedLUNGroup(Group):
    '''
    Used with NodeACLGroup, this aggregates all MappedLUNs with the same LUN
    so that it can be configured across all members of the NodeACLGroup.
    '''

    def __repr__(self):
        return "<MappedLUNGroup %s:lun %d>" % (self._nag.name, self._mapped_lun)

    def __init__(self, nodeaclgroup, mapped_lun, *args, **kwargs):
        super(MappedLUNGroup, self).__init__(MappedLUNGroup._mapped_luns.fget)
        self._nag = nodeaclgroup
        self._mapped_lun = mapped_lun
        for na in self._nag._node_acls:
            MappedLUN(na, mapped_lun=mapped_lun, *args, **kwargs)

    @property
    def _mapped_luns(self):
        for na in self._nag._node_acls:
            for mlun in na.mapped_luns:
                if mlun.mapped_lun == self.mapped_lun:
                    yield mlun

    @property
    def mapped_lun(self):
        '''
        Get the integer MappedLUN mapped_lun index.
        '''
        return self._mapped_lun

    @property
    def parent_nodeaclgroup(self):
        '''
        Get the parent NodeACLGroup object.
        '''
        return self._nag

    write_protect = property(partial(Group._get_prop, prop="write_protect"),
                             partial(Group._set_prop, prop="write_protect"),
                             doc="Get or set the boolean write protection.")
    tpg_lun = property(partial(Group._get_prop, prop="tpg_lun"),
                       doc="Get the TPG LUN object the MappedLUN is pointing at.")

def _test():
    from doctest import testmod
    testmod()

if __name__ == "__main__":
    _test()

redpajama_set_name: RedPajamaGithub


text:
Luke Bryan Tour Dates & Concert Tickets
Luke Bryan Tour Dates and Concert Tickets
Ever since being crowned as the Top New Artist at the 2010 Academy of Country Music awards, Luke Bryan tour dates have been country music's hottest ticket. While Bryan is now riding the success of back-to-back #1 singles, his dream of moving to Nashville was briefly derailed after he suffered... read more
Mar 22 Houston Rodeo - Luke Bryan NRG Stadium Houston, Texas
May 23 Luke Bryan Indianapolis Motor Speedway Indianapolis, Indiana
May 24 Luke Bryan & Dylan Scott Soaring Eagle Casino & Resort Mount Pleasant, Michigan
May 28 Luke Bryan Riverbend Music Center Cincinnati, Ohio
May 29 Luke Bryan Hollywood Casino Amphitheater (St. Louis) Maryland Heights, Missouri
May 30 Luke Bryan Brandon Amphitheater Brandon, Mississippi
Jun 5 Luke Bryan The Wharf Amphitheater Orange Beach, Alabama
Jun 12 Trailblazer Music Festival: Dierks Bentley, Thomas Rhett & Luke Bryan - 3 Day Pass Hunter Mountain Resort Hunter, New York
Jun 18 Luke Bryan Darien Lake Performing Arts Center Darien Center, New York
Jun 19 Luke Bryan Xfinity Theatre Hartford, Connecticut
Jun 20 Luke Bryan Merriweather Post Pavilion Columbia, Maryland
Jun 25 Luke Bryan American Family Insurance Amphitheater Milwaukee, Wisconsin
Jul 16 Luke Bryan North Island Credit Union Amphitheatre (formerly Mattress Firm ) Chula Vista, California
Jul 17 Luke Bryan Shoreline Amphitheatre Mountain View, California
Jul 18 Luke Bryan Toyota Amphitheatre Wheatland, California
More About Luke Bryan
Recommendations Similar to Luke Bryan
Luke Bryan VIDEOS
MORE INFO ABOUT Luke Bryan
Ever since being crowned as the Top New Artist at the 2010 Academy of Country Music awards, Luke Bryan tour dates have been country music's hottest ticket. While Bryan is now riding the success of back-to-back #1 singles, his dream of moving to Nashville was briefly derailed after he suffered the tragedy of losing his older brother in an accident the weekend he was set to move. Instead, Bryan enrolled at Georgia Southern University and was a member of the Sigma Chi fraternity. It was not until 2001 that Bryan finally got his chance for stardom when he moved to the country music capital.
Luke Bryan got his chance when he was spotted by a Capital Records A&R executive at a local honky-tonk, who signed him to a record deal in 2005. The country newcomer released his first album, I'll Stay, in 2007, which featured the hit singles "All My Friends Say" and "We Rode in Trucks." In addition, Bryan is credited with penning Billy Currington's #1 Country hit "Good Directions," also released in 2007. In support of his debut album, Luke Bryan tour dates had him traveling around the nation playing at county fairs and mid-sized venues. It was with the release of his sophomore set, Doin' My Thing, and its onslaught of chart topping singles that brought Bryan to the big leagues. The first single, "Do I," melted the hearts of southern belles all over the country and peaked at #2 in 2009. The next two singles, "Rain is a Good Thing" and "Someone Else Calling you Baby," proved to be even more successful when they each hit #1 on the same survey. As the ACM's top new artist of 2010, country music fans everywhere are demanding Luke Bryan tour dates at a venue near them.
Lucky for fans, Bryan's concert schedule has him touring with Tim McGraw and the Band Perry at various cities throughout the country this Spring and Summer 2011. Don't miss out on catching one of country music's rising stars: use Eventful as your resource for news and updates on Luke Bryan tour dates.
Categories: Music | Country | Rock
Luke Bryan Official Site | Luke Bryan on MySpace

redpajama_set_name: RedPajamaCommonCrawl


text:
is a railway station in the town of Wakasa, Mikatakaminaka District, Fukui Prefecture, Japan, operated by West Japan Railway Company (JR West).

Lines
Kiyama Station is served by the Obama Line, and is located 21.4 kilometers from the terminus of the line at .

Station layout
The station consists of one side platform serving a single bi-directional track. There is no station building, but only a shelter on the platform. The station is unattended.

Adjacent stations

History
Kiyama Station opened on 1 August 1961.  With the privatization of Japanese National Railways (JNR) on 1 April 1987, the station came under the control of JR West.

Passenger statistics
In fiscal 2016, the station was used by an average of 304 passengers daily (boarding passengers only).

Surrounding area

Uwase Jinja

See also
 List of railway stations in Japan

References

External links

Railway stations in Fukui Prefecture
Stations of West Japan Railway Company
Railway stations in Japan opened in 1961
Obama Line
Wakasa, Fukui

redpajama_set_name: RedPajamaWikipedia


text:
Q: Why n+ contact of p type Ge is 700um thick compared to p+ contact of n type Ge only 0.3um? Whether the reason is as follows?
Predominantly HPGe is p type. So compensation of large p type impurity requires more n+ contact. (700um)
But n type Ge is made by doping of excess addition of n type impurity in p type HPGe. So n type impurity addition always slightly excess of p type impurity. Hence, slight excess n type impurity in n type HPGe requires, p+ contact with very less thickness. (0.3um)

A: Read the references  as suggested....but still not got answer
 Li is added by diffusion process but B is added by implantation. In Ion implantation we can achieve thin contact, but in diffusion we can get only Thick contact. Fine. It is liks DJD vs PIPS detector for alpha. Can you tell me why Li is also not added as contact by Ion implantation method?

redpajama_set_name: RedPajamaStackExchange


text:
What is the NCES Kids' Zone?
The purpose of the National Center for Education Statistics' Kids' Zone is to provide information to help you learn about schools; decide on a college; find a public library; engage in several games, quizzes and skill building about math, probability, graphing, and mathematicians; and to learn many interesting facts about education. Of course, all of these things have been designed to be fun too, so jump in!
Who is NCES?
Part of the U.S. Department of Education's Institute of Education Sciences, the National Center for Education Statistics (NCES) is the primary federal entity for collecting and analyzing education-related data. NCES fulfills a Congressional mandate to collect, analyze, and report statistics on American education; conduct and publish reports; and review and report on education activities internationally.
Who uses NCES Statistics?
Well, you do if you've checked out our College Search; Find A Library or, Find A School! These statistics have lots of other readers too, for example:
Congress uses them to plan federal education programs, to divide federal funds among the states, and to serve the needs of constituents.
Federal agencies use them to figure out how many educated people are coming out of our schools and colleges, and to know what they studied.
State and local officials use them to figure out how to hire teachers and pay for public education.
Educational organizations, use them to plan their research.
The news media use them to inform the public about things like school and college enrollment, and academic performance.
Business organizations use them to make decisions about the demand for their products and for locating potential employees.
The general public uses them to stay informed and to make smart decisions about educational issues.
How are these statistics disseminated?
Our statistics are available in publications, data sets, but of course most of all on our website, for every level of education (from pre-kindergarten through adult learning) for the United States and the world. If you want to check out any NCES publications, visit the NCES Publications and Products Search.
How can we make this site better?
What other features or games would you like to see here? Send us your ideas. What do you think of this site? How could it be better? Come on, tell us.
NCES Home | Contact Us | Site Index | Help
This site uses Adobe Flash Player to provide a more rich web experience. Download a free copy now.


The mobile app-install ad — an ad unit that directs users to download a mobile app - arguably offers the most measurable return on investment (ROI) of any major mobile ad format, and has seen a massive rise in popularity among marketers.
These ads are becoming an essential tool for apps seeking to stand out among the millions of mobile apps on the Google Play and the Apple app stores. On top of strong performance, including high clickthrough rates, marketers like app-install ads because their value can often be accurately quantified.
And, for major mobile platforms, including Facebook, Twitter, Yahoo, Google, and smaller mobile ad platforms like Millennial Media, the high prices these ads commands make them very attractive inventory.
New and exclusive data from BI Intelligence finds that US mobile app-install ad revenue will top $4.6 billion this year and grow to $6.8 billion by the end of 2019, increasing by a compound annual growth rate of 14% from 2014. We believe mobile app install ads accounted for about 30% of mobile ad revenue last year.
Mobile app-install ads are becoming extremely popular ad units among different types of app publishers, not just game-app developers. App marketers — including e-commerce companies and a few brands — like these ads because they result in significant downloads and measurable ROI. Social networks and ad exchanges like them because they can sell the units at significantly higher prices than other ads.
Easy-to-measure ROI drives demand. In many cases, once an app-install ad generates a download, everything a customer does in the app, such as "lifetime customer value," can be attributed back to that specific ad.
On Facebook, mobile app-install ads cost significantly more than standard units, due to performance and targeting capabilities. The report includes CPM pricing and CTR rates compared to the average Facebook ad.
Prices will hold relatively steady as supply and demand rise in tandem. The mobile install ad is a fairly mature ad unit at this point, and a good deal of competing supply is now available from Twitter and Google. But continued increases in demand for these ads among app marketers will keep prices from declining.
Top mobile publishers and ad networks are competing fiercely for mobile app-install ad dollars, and for the favor of app developers. Twitter and Facebook are doing their best to lure app builders to their platforms and app-install ads with advanced ad analytics and developer tools.


Exit M621 at junction 2A towards Beeston/Holbeck, then turn left at Cemetery Road followed by another left at Malvern Road. Turn left onto Beeston Road. The clinic is located inside Hillside Enterprise Centre.
The clinic offers free off-street parking, which can be accessed from Beeston Road.
There are nearby bus stops on Malvern Road and Lady Pit Lane. Alternatively, Leeds railway station is approximately 2.1 miles and Cottingley railway station is approximately 2.7 miles from the centre.
The clinic car park offers disabled parking and direct access to the clinic and treatment room.


Is there a tool to search different tipy on candles on the charts?
If i would to find all semildojy in a graph, or any other candel is there a pludin or a code for this?
Thanks, the first link is ok, the second i need a pass lo see, so i couldn9t see do you know how to see the second link?
3. Add to any time-frame TS chart.
Again, this is not my work and all credit is due to Suri Duddella aka. demicron.
Thanks a lot.Now I am going to install.Do you know others patterns i could insert in mc, for exemples NR4 or HVR (the Historic Volatility Ratio)?
I don't have something in my mind, but I am pretty sure that you will find something via google. As you are able to use ELA, ELS or ELD files from TS directly, chances are that you'll find something that suits you.
Marina, how do I load this candle program into MC? Your assistance would be greatly appreciated. Thank you.


text:
Home Technology Statement of Michael Zamagias, Chairman, TeleTracking Technologies, in response to U.S. Supreme...
Statement of Michael Zamagias, Chairman, TeleTracking Technologies, in response to U.S. Supreme Court's Healthcare Decision
The U.S. Supreme Court decision on the Affordable Care Act leaves the doors to America's hospitals open to the largest onslaught of potential patients in the nation's history, an estimated 30-40 million people who currently do not have coverage plus the leading edge of the 70-million-strong Baby Boom Generation.
The ruling is good news for suppliers of the type of medical information technology which helps hospitals maximize the use of existing capacity. Resource optimization will be crucial to the success of hospitals which must deal with a large influx of new patients without benefit of adding new capacity. Hospitals needing to do more with less now have access to operational tools, such as real-time capacity management, which can optimize space, staff and equipment resources while easing overcrowding, reducing waste and increasing revenue.
Reimbursement changes and a shift to disease prevention and more primary care may shift volume but capacity problems in hospitals are more complex than that. Fewer EDs, changing reimbursement models, lack of access to capital and the aging population coupled with ongoing challenges with community access to primary care, which may take years or even decades to fix, means it will continue to be increasingly important to the financial well-being of all hospitals to make the best use of existing capacity and resources.
Regardless of the Supreme Court decision, hospitals need to manage for what's ahead without bleeding more red ink. The real-time enterprise of the industrial world may now experience a higher adoption rate in America's hospitals because it achieves a key objective of Affordable Care Organizations (ACOs), to stabilize or reduce costs while improving patient care.
Previous articleHAP Responds to U.S. Supreme Court's Affordable Care Act Decision
Next articleWesty-THON Raises Funds for Conemaugh Trauma Program
The Risks and Rewards of Medical Science Startups
Using Modern Day Tools to Improve Patient Wellbeing
Impact of Artificial Intelligence to the Health Sector
Why High-Pressure Homogenizers Work Best at Particle Size Reduction
The Western PA Healthcare News Team - August 19, 2019 0
Top Three Data Breach Threats
The Western PA Healthcare News Team - November 2, 2012 0
Creating Game-Changing Communication and Interactive Tools
The Western PA Healthcare News Team - December 16, 2011 0


text:
Maternal Autoimmune Disorder Diagnosed by Fetal Complete Heart Block with Postnatally Diagnosed Down Syndrome
Shilotri M*, More V**, Satia MN***
(** Second year resident, **Assistant Professor, *** Professor, Department of Obstetrics and Gynecology, Seth G. S. Medical College and KEM Hospital, Mumbai, India.)
Congenital complete atrioventricular block may result from a congenital cardiac anomaly or the presence of anti-Ro and/or anti-La antibodies in women who have systemic lupus erythematosus, Sjogren's syndrome, undifferentiated autoimmune disorder, or are asymptomatic. The prognosis of the baby depends on the time of diagnosis and presence of a cardiac anomaly. Down syndrome has a high incidence of congenital cardiac anomalies, however, complete atrioventricular block is rarely seen. We present a case of a 23 year old gravida 2, para 1, living 1 who was asymptomatic and was diagnosed to have autoimmune antibodies on evaluation for fetal bradycardia which was later diagnosed as complete heart block on fetal echocardiography. The neonate was later incidentally diagnosed to have Down syndrome with atrial septal defect.
Congenital complete atrioventricular block is a rare disorder with an incidence of 1 in 22,000 live births.[1] Congenital cardiac anomalies are seen in 44% of Down syndrome cases.[2] Amongst cases of Down syndrome, varying degrees of heart block are seen with atrioventricular septal defects while atrial septal defect is only associated with PR interval prolongation on ECG.[3] Congenital complete atrioventricular block may be diagnosed antenatally as early as 16 weeks gestation. It has a high perinatal morbidity and mortality. Women with positive anti-Ro and/or anti-La antibodies should be monitored with serial fetal echocardiography to detect early any congenital conduction defects. Although there are no guidelines for antenatal treatment of fetal heart block, there are many promising therapies being studied.
A 23 year old gravida 2 para 1, living 1 registered antenatally at our clinic at 23.5 weeks gestation. She had no history of any significant medical or surgical illness. She had a previous full term normal delivery and the child was well. At 28.5 weeks gestation the fetal heart sounds were found to be irregular ranging from 60 beats/ minute to 120 beats/ minute, as heard on a stethoscope and confirmed on a hand-held Doppler device during a routine antenatal examination. She was advised admission for evaluation of possible fetal cardiac anomaly. However she was not willing for the same. An obstetric ultrasonography for fetal anomalies and a fetal echocardiography was advised. At her next antenatal visit at 31.5 weeks, the baseline fetal heart rate was 50 beats/ minute. Ultrasonography for fetal malformations at 29 weeks showed evidence of fetal bradycardia (53 beats per minute) most probably due to conduction defect with a complete heart block, mild pericardial effusion and reverse flow in ductus venosus suggestive of early fetal hydrops. No other anomalies were evident. As she was not willing for admission, she was advised to do blood investigations such as anti-nuclear (ANA) antibodies, anti-double stranded DNA (dsDNA) antibodies, anti-Ro (SSA), anti-La (SSB) antibodies and blood sugars. She was advised to follow up with the reports in the outdoor patient department. Patient later returned to the hospital in active labor at 37.1 weeks and delivered uneventfully. She delivered a female child of 1.672 kg with an Apgar score of 8/10. On examination of the neonate, Mongoloid features were observed (slanting eyes, low set ears and depressed nasal bridge) with clinodactyly and bradycardia. Baby was immediately shifted to the neonatal intensive care unit for further evaluation. ECG of the neonate was suggestive of complete heart block with atrial rate of 160 beats/ minute and ventricular rate of 60 beats/ minute. Echocardiography showed a 3 mm atrial septal defect of ostium secundum type. No other cardiac anomalies were detected. Cardiology opinion was taken who advised monthly follow up of the baby. The neonate's blood counts, hepatic and renal function tests were within normal limits. Karyotype and thyroid function tests of the baby were sent in view of the Mongoloid features. The baby was discharged on full feeds and advised to follow up with the above reports and was diagnosed to have Down syndrome on karyotyping. On maternal evaluation, the patient tested positive for ANA , anti-Ro and anti-La antibodies and was negative for anti-dsDNA antibodies. Rheumatology opinion was sought and was advised urine routine examination and complement levels (C3, C4) which were normal. CRP levels were raised and thyroid function tests were suggestive of hypothyroidism. Her complete blood counts, renal and liver function tests and blood sugars were normal. She had no complaints of rash, photosensitivity, arthritis or long standing fever. She was asked to follow up in the rheumatology outpatient department for further evaluation of type of autoimmune disorder. Thus, the patient was diagnosed to have an autoimmune disorder on evaluation for the fetal heart block.
Congenital complete atrioventricular heart block may manifest any time from 16 weeks gestation to young adulthood. In the antenatal period it may first be detected as bradycardia on auscultation during an obstetric examination, as in our case, or on a routine obstetric ultrasonography. Fetal congenital heart block may be a result of an underlying cardiac structural anomaly as seen in 30 – 53% of cases.[1] The most common cardiac anomaly associated with heart block is left atrial isomerism with or without atrioventricular septal defect and levo-transposition of great arteries.[4] In a structurally normal heart, congenital heart block in the form of neonatal lupus is a result of maternal autoantibodies to intracellular ribonucleoprotiens {anti-Ro (SS-A) and/ or anti-La (SS-B)}, detected on enzyme linked immunosorbent assay. Women that test positive for anti-Ro antibodies have a 3% risk of bearing a child with neonatal lupus.[2] At the time of diagnosis of the fetal heart block the mother may be a known case of systemic lupus erythematosus (26%), Sjogren's disease (14%), an undifferentiated autoimmune disorder (19%) or may be completely asymptomatic (40%).[3] It is postulated that these autoantibodies are passively transferred through placental circulation which in turn injure a formerly normal fetal heart. The heart block varies from first to third degree and the antibody mediated injury may result in a late cardiomyopathy as seen in 5-11% of cases.[4] Neonatal lupus has other manifestations such as an annular, photosensitive rash on the face, low counts of red blood cells, white blood cells, platelets and deranged liver function tests. These manifestations usually resolve spontaneously, however, the cardiac changes are permanent.
Down syndrome is associated with atrioventricular septal defects (30%), atrial septal defect (25%), ventricular septal defect (22%), patent ductus arteriosus (5%), coarctation of aorta (5%) and tetralogy of Fallot (3%).[2] The type of conduction disorder seen in Down syndrome depends upon the cardiac anomaly. Varying degrees of heart block are seen with atrioventricular septal defects while atrial septal defect is only associated with PR interval prolongation on ECG. Isolated complete congenital heart block in a case of Down syndrome is rare.[7] Thus, in our case, the fetal complete heart block was most likely caused by the maternal autoimmune antibodies.
On diagnosis of congenital heart block, the fetus is monitored by serial echocardiograms. Several antenatal therapies for neonatal lupus have been attempted such as dexamethasone therapy, plasmapheresis, beta stimulation by salbutamol, hydroxychloroquine, intravenous immunoglobulins etc.[8] However, no therapy has been approved as standard protocol for antenatal management of neonatal lupus. In neonates and children cardiac pacing may be required if they are symptomatic, have congestive cardiac failure or in asymptomatic neonates with awake baseline heart rate of less than 55/min.[1] As the neonate in our case had a baseline heart rate of 60/minute and was asymptomatic, pacing was not done.
Complete heart block predisposes the baby to cardiac failure, hydrops fetalis, fetal or neonatal death. Prognosis depends on the presence of an underlying cardiac structural abnormality with a survival beyond the neonatal period of only 14% as compared to 85% in autoimmune congenital heart block.[1] Prognosis is also determined by the time of diagnosis of the disease, with those diagnosed in the newborn period having a better fate than those that are detected in-utero as it is thought that those with severe disease perish in-utero and those with a milder disease survive for a longer time. Although women who test positive for anti-Ro and/or anti-La antibodies may be asymptomatic at the time of diagnosis, there are reports of them becoming symptomatic a few years after the affected delivery, the median time being 1.5 years.[3] Thus it is worthwhile to advise these patients to follow up with a rheumatologist.
Kertesz NJ, Fenrich AL, Friedman RA. Congenital complete atrioventricular block. Tex Heart Inst J. 1997;24(4):301-307.
Stoll C, Dott B, Alembik Y, Roth MP. Associated congenital anomalies among cases with Down syndrome. Eur J Med Genet. 2015 Dec;58(12):674-80.
Clark EB, Kugler JD. Preoperative secundum atrial septal defect with coexisting sinus node and atrioventricular node dysfunction. Circulation. 1982;65(5):976-80. PubMed PMID: 7074763
Friedman DM, Duncanson LJ, Glickstein J, Buyon JP. A review of congenital heart block. Images Paediatr Cardiol. 2003;5(3):36-48.
Waltuck J, Buyon JP. Autoantibody-associated congenital heart block: outcome in mothers and children. Ann Intern Med 1994;120:544-51.
Moak JP, Barron KS, Hougen TJ, Wiles HB, Balaji S, Sreeram N, et al. Congenital heart block: development of late-onset cardiomyopathy, a previously underappreciated sequela. J Am Coll Cardiol. 2001;37(1): 238–242. [PubMed: 11153745]
Machakanur V. Congenital Complete Heart Block in Down Syndrome: A Rare Case Report. Journal of Evolution of Medical and Dental Sciences. 2015; 47(4): 8254-8257, DOI: 10.14260/jemds/2015/1197
Hunter LE, Simpson JM. Atrioventricular block during fetal life. J Saudi Heart Assoc. 2015; 27(3): 164-178. doi:10.1016/j.jsha.2014.07.001
Shilotri M, More V, Satia MN. Maternal Autoimmune Disorder diagnosed by Fetal Heart Block. JPGO 2016. Volume 3 No. 3. Available from: http://www.jpgo.org/2016/03/maternal-autoimmune-disorder-diagnosed.html
Volume 3 Issue 3, March 2016
Maternal Autoimmune Disorder Diagnosed by Fetal Co...
Ovarian Hyperstimulation Syndrome In a Spontaneous...
Vulval Leiomyoma: a Case Report
Ovarian Fibroma: An Unusual Case
Intrapartum Pubic Diastasis
Cervical Fibroid Mimicking Uterine Inversion
Vaginal Myomectomy For Intrauterine Submucous Leio...
Torsion Of A Hydrosalpinx – a Diagnostic Puzzle
Spontaneous Conception Through Perforated Transver...


Craft NI Chief Executive Alan Kane from Coleraine and world renowned ceramic artist Jack Doherty from Portrush launch the tenth August Craft Month with Doherty's exhibition 'Waypoint' at the Market Place Theatre in Armagh in conjunction with the John Hewitt International Summer School.
Ballymoney is celebrating August Craft Month with a series of festivals, events and workshops taking place throughout the month.
The second 'Five Artists Show in a Byre' Exhibition takes place at the Byre at the Old Frosses Road, from August 13 to 29.
This is an exhibition of sculpture, furniture, ceramics and print at the studio of artist and maker, Sharon Adams in a converted cowshed at her farmhouse in the Glarryford/Cloughmills area.
The exhibition features one off work by Sharon, metal artist and blacksmith Eamonn Higgins from Martinstown, furniture maker Noel McCullough from Cloughwater, painter/weaver/printmaker Cecilia Stephens from Portaferry and fine artist Anushiya Sundaralingam from Belfast via Sri Lanka.
Eamonn Higgins will also be hosting an Introduction to Blacksmithing and Blade Smithing at Hot Milk Forge, at his family farm in Martinstown, Glenravel from August 24-26.
There will also be a two day Silver Jewellery Workshop run by tutor Diane Lyness, a chance to make your own necklace, earrings or bracelet at Ballymoney Town Hall from August 5-6.
And this year, the two festivals of craft, Creative Peninsula and Craft Fest have been joined by a new kid on the block, Creative Coast organised by the Causeway Coast Artists Collective.
The NI Year and Food and Drink is recognised in this year's programme with a number of craft and food related events.
Alan Kane, Chief Executive of Craft NI, who co-ordinates August Craft Month, said the contemporary craft sector continues to grow from strength to strength in Northern Ireland.
For full details of all August Craft Month events, visit the Craft NI website: www.craftni.org and click on the August Craft Month section. To find out about all the makers and events in your area, click on the interactive craft map.


The Yoneda lemma can be realized as the Kan extension along Identity However, having this special instance allows us to define Yoneda f as a monad, comonad, etc. based on whatever properties the base functor has, without limiting ourselves to what Ran f f can manage.
Performance wise, Yoneda may make your monad more efficient at handling a bunch of fmaps, while CoYoneda may do the same for a comonad assuming you require a greater than linear amount of time to fmap over your structure. You can apply each in either role but the asymptotics will probably not be in your favor.


text:
THE HIGH LEARYS
The High Learys – Photography by Rachael Barrett
Thee Gold Blooms/Custom Royal
Kicking off an old-style-rock inspired night with their 1970's garage rock style, Thee Gold Blooms started with their upbeat tune, I Want You So Much. Using their raspy vocals and catchy riffs, they maintained an energetic performance, even when slowing the tempo for some change in dynamics. The band seemed to have really good co-ordination, and as they continued to change their pace throughout their performance, they used really captivating guitar solos and thrashy cymbals, along with killer vocal harmonies to create some really cool combinations.
Custom Royal then followed with an explosively exciting set, immediately pulling out their fast-tempo-ed material with some groovy guitar riffs and tight dynamic changes. With their style sounding somewhat similar to The Hives, they continued to make their performance better and better with each subsequent song, using some tricky instrument fills and catchy chorus lines. Using distortion on the guitars gave a real hard rock feel to the music, which was complemented by mind-blowingly fast guitar and drum solos sure to impress everyone in the room.
The crowd was filled from the back to the front as The High Learys came on stage. Michael Nutt started the show off with his Doors-esque sounding organ, leading into an array of hip shakin' tunes. The second song was welcomed with The Beehives Go-Go dancers, who shook and shimmied with all their might. Singer/bassist Jamie Turner's John Lennon-like vocal style mixed well with the Beach Boys-sounding guitar tones, giving a unique twist to their '60s style setlist. They performed a newer song, the B-side to their new single, called I'm a Fool For You, which maintained a retro rock sound, before proceeding to the single being launched, Clear My Mind. Their new single had an effortlessly great sound about it, using interesting strumming techniques and a smooth flowing melody.
They held the audience's interest with another 'newer' song called Medicine Man, laying out some awesome bass lines and an excitingly good organ solo. The High Learys persisted to play the hit song, Let You Down, despite having broken the harmonica prior to the event, and so it was replaced with an amazing keyboard solo instead. With even more upcoming music, the band got a harder edge with more aggressive sounding vocals, epic guitar solos and solid drum beats while still keeping to their retro style, followed by a smashing finish.
Once off stage, the crowd demanded they come back on for an encore, which they then returned and delivered yet another dance-able rock tune. While Turner was thanking the band members on stage, Nutt re-started the show for one last cover song, which was none other than The Kingsmen's take on Richard Berry's Louie Louie. Also accompanying the bands for the night was burlesque entertainer, Vivian Marlowe, who put on a sensational performance, and had an artist paint an amazing portrait of her live in front of the stage.
ASHLEIGH BYRNE