Ejemplo n.º 1
0
    def do_setup(self, context):
        """Set up LeftHand client."""
        try:
            self.client = client.HPLeftHandClient(
                self.configuration.hplefthand_api_url)
            self.client.login(self.configuration.hplefthand_username,
                              self.configuration.hplefthand_password)

            if self.configuration.hplefthand_debug:
                self.client.debug_rest(True)

            cluster_info = self.client.getClusterByName(
                self.configuration.hplefthand_clustername)
            self.cluster_id = cluster_info['id']
            virtual_ips = cluster_info['virtualIPAddresses']
            self.cluster_vip = virtual_ips[0]['ipV4Address']
            self._update_backend_status()
        except hpexceptions.HTTPNotFound:
            raise exception.DriverNotInitialized(
                _('LeftHand cluster not found'))
        except Exception as ex:
            raise exception.DriverNotInitialized(ex)
Ejemplo n.º 2
0
 def _create_client(self):
     return hp_lh_client.HPLeftHandClient(
         self.configuration.hplefthand_api_url)