'Get device name from the target name.'

def get_device_name(self):

    cmd = 'iscsiadm    -m    session    -P    3'
    device_name = ''
    if self.logged_in():
        output = utils.system_output(cmd)
        pattern = ('Target:\\s+%s.*?disk\\s(\\w+)\\s+\\S+\\srunning' % self.target)
        device_name = re.findall(pattern, output, re.S)
        try:
            device_name = ('/dev/%s' % device_name[0])
        except IndexError:
            logging.error("Can    not    find    target    '%s'    after    login.", self.target)
    else:
        logging.error('Session    is    not    logged    in    yet.')
    return device_name
