'Perform internal driver setup.'

def do_setup(self, context):

    version_info = self.backend.get_version()
    LOG.info('HNAS    NFS    driver.')
    LOG.info('HNAS    model:    %(mdl)s', {'mdl': version_info['model']})
    LOG.info('HNAS    version:    %(ver)s', {'ver': version_info['version']})
    LOG.info('HNAS    hardware:    %(hw)s', {'hw': version_info['hardware']})
    LOG.info('HNAS    S/N:    %(sn)s', {'sn': version_info['serial']})
    self.context = context
    self._load_shares_config(getattr(self.configuration, (self.driver_prefix + '_shares_config')))
    LOG.info('Review    shares:    %(shr)s', {'shr': self.shares})
    elist = self.backend.get_export_list()
    for (svc_name, svc_info) in self.config['services'].items():
        server_ip = svc_info['hdp'].split(':')[0]
        mountpoint = svc_info['hdp'].split(':')[1]
        export_configured = False
        for export in elist:
            if ((mountpoint == export['name']) and (server_ip in export['evs'])):
                svc_info['export'] = export
                export_configured = True
        try:
            (out, err) = self._execute('showmount', '-e', server_ip)
        except processutils.ProcessExecutionError:
            LOG.exception('NFS    server    %(srv)s    not    reachable!', {'srv': server_ip})
            raise
        export_list = out.split('\n')[1:]
        export_list.pop()
        mountpoint_not_found = (mountpoint not in map((lambda x: x.split()[0]), export_list))
        if ((len(export_list) < 1) or mountpoint_not_found or (not export_configured)):
            LOG.error('Configured    share    %(share)s    is    not    presentin    %(srv)s.', {'share': mountpoint, 'srv': server_ip})
            msg = (_('Section:    %(svc_name)s') % {'svc_name': svc_name})
            raise exception.InvalidParameterValue(err=msg)
    LOG.debug('Loading    services:    %(svc)s', {'svc': self.config['services']})
    service_list = self.config['services'].keys()
    for svc in service_list:
        svc = self.config['services'][svc]
        pool = {}
        pool['pool_name'] = svc['pool_name']
        pool['service_label'] = svc['pool_name']
        pool['fs'] = svc['hdp']
        self.pools.append(pool)
    LOG.debug('Configured    pools:    %(pool)s', {'pool': self.pools})
    LOG.info('HNAS    NFS    Driver    loaded    successfully.')
