示例#1
0
文件: nfs.py 项目: jcru/cinder
 def _update_cluster_vol_stats(self, data):
     """Updates vol stats with cluster config."""
     if self.ssc_vols:
         data["netapp_mirrored"] = "true" if self.ssc_vols["mirrored"] else "false"
         data["netapp_unmirrored"] = (
             "true" if len(self.ssc_vols["all"]) > len(self.ssc_vols["mirrored"]) else "false"
         )
         data["netapp_dedup"] = "true" if self.ssc_vols["dedup"] else "false"
         data["netapp_nodedupe"] = "true" if len(self.ssc_vols["all"]) > len(self.ssc_vols["dedup"]) else "false"
         data["netapp_compression"] = "true" if self.ssc_vols["compression"] else False
         data["netapp_nocompression"] = (
             "true" if len(self.ssc_vols["all"]) > len(self.ssc_vols["compression"]) else "false"
         )
         data["netapp_thin_provisioned"] = "true" if self.ssc_vols["thin"] else "false"
         data["netapp_thick_provisioned"] = (
             "true" if len(self.ssc_vols["all"]) > len(self.ssc_vols["thin"]) else "false"
         )
         vol_max = max(self.ssc_vols["all"])
         data["total_capacity_gb"] = int(vol_max.space["size_total_bytes"]) / units.GiB
         data["free_capacity_gb"] = int(vol_max.space["size_avl_bytes"]) / units.GiB
     elif self.ssc_enabled:
         LOG.warn(_("No cluster ssc stats found." " Wait for next volume stats update."))
     if self.ssc_enabled:
         ssc_utils.refresh_cluster_ssc(self, self._client, self.vserver)
     else:
         LOG.warn(_("No vserver set in config. SSC will be disabled."))
示例#2
0
文件: iscsi.py 项目: jcru/cinder
 def _update_cluster_vol_stats(self, data):
     """Updates vol stats with cluster config."""
     if self.ssc_vols:
         data['netapp_mirrored'] = 'true'\
             if self.ssc_vols['mirrored'] else 'false'
         data['netapp_unmirrored'] = 'true'\
             if len(self.ssc_vols['all']) > len(self.ssc_vols['mirrored'])\
             else 'false'
         data['netapp_dedup'] = 'true'\
             if self.ssc_vols['dedup'] else 'false'
         data['netapp_nodedupe'] = 'true'\
             if len(self.ssc_vols['all']) > len(self.ssc_vols['dedup'])\
             else 'false'
         data['netapp_compression'] = 'true'\
             if self.ssc_vols['compression'] else False
         data['netapp_nocompression'] = 'true'\
             if len(self.ssc_vols['all']) >\
             len(self.ssc_vols['compression'])\
             else 'false'
         data['netapp_thin_provisioned'] = 'true'\
             if self.ssc_vols['thin'] else 'false'
         data['netapp_thick_provisioned'] = 'true'\
             if len(self.ssc_vols['all']) >\
             len(self.ssc_vols['thin']) else 'false'
         vol_max = max(self.ssc_vols['all'])
         data['total_capacity_gb'] =\
             int(vol_max.space['size_total_bytes']) / units.GiB
         data['free_capacity_gb'] =\
             int(vol_max.space['size_avl_bytes']) / units.GiB
     else:
         LOG.warn(_("Cluster ssc is not updated. No volume stats found."))
     ssc_utils.refresh_cluster_ssc(self, self.client, self.vserver)
示例#3
0
 def _do_custom_setup(self):
     """Does custom setup for ontap cluster."""
     self.vserver = self.configuration.netapp_vserver
     self.vserver = self.vserver if self.vserver else self.DEFAULT_VS
     # We set vserver in client permanently.
     # To use tunneling enable_tunneling while invoking api
     self.client.set_vserver(self.vserver)
     # Default values to run first api
     self.client.set_api_version(1, 15)
     (major, minor) = self._get_ontapi_version()
     self.client.set_api_version(major, minor)
     self.ssc_vols = None
     self.stale_vols = set()
     ssc_utils.refresh_cluster_ssc(self, self.client, self.vserver)
示例#4
0
文件: nfs.py 项目: jcru/cinder
 def _do_custom_setup(self, client):
     """Do the customized set up on client for cluster mode."""
     # Default values to run first api
     client.set_api_version(1, 15)
     (major, minor) = self._get_ontapi_version()
     client.set_api_version(major, minor)
     self.vserver = self.configuration.netapp_vserver
     self.ssc_vols = None
     self.stale_vols = set()
     if self.vserver:
         self.ssc_enabled = True
         LOG.warn(_("Shares on vserver %s will only" " be used for provisioning.") % (self.vserver))
         ssc_utils.refresh_cluster_ssc(self, self._client, self.vserver)
     else:
         self.ssc_enabled = False
         LOG.warn(_("No vserver set in config. SSC will be disabled."))
示例#5
0
 def _do_custom_setup(self, client):
     """Do the customized set up on client for cluster mode."""
     # Default values to run first api
     client.set_api_version(1, 15)
     (major, minor) = self._get_ontapi_version()
     client.set_api_version(major, minor)
     self.vserver = self.configuration.netapp_vserver
     self.ssc_vols = None
     self.stale_vols = set()
     if self.vserver:
         self.ssc_enabled = True
         LOG.warn(
             _("Shares on vserver %s will only"
               " be used for provisioning.") % (self.vserver))
         ssc_utils.refresh_cluster_ssc(self, self._client, self.vserver)
     else:
         self.ssc_enabled = False
         LOG.warn(_("No vserver set in config. SSC will be disabled."))
示例#6
0
 def _update_cluster_vol_stats(self, data):
     """Updates vol stats with cluster config."""
     if self.ssc_vols:
         data['netapp_mirrored'] = 'true'\
             if self.ssc_vols['mirrored'] else 'false'
         data['netapp_unmirrored'] = 'true'\
             if len(self.ssc_vols['all']) >\
             len(self.ssc_vols['mirrored']) else 'false'
         data['netapp_dedup'] = 'true'\
             if self.ssc_vols['dedup'] else 'false'
         data['netapp_nodedupe'] = 'true'\
             if len(self.ssc_vols['all']) >\
             len(self.ssc_vols['dedup']) else 'false'
         data['netapp_compression'] = 'true'\
             if self.ssc_vols['compression'] else False
         data['netapp_nocompression'] = 'true'\
             if len(self.ssc_vols['all']) >\
             len(self.ssc_vols['compression']) else 'false'
         data['netapp_thin_provisioned'] = 'true'\
             if self.ssc_vols['thin'] else 'false'
         data['netapp_thick_provisioned'] = 'true'\
             if len(self.ssc_vols['all']) >\
             len(self.ssc_vols['thin']) else 'false'
         vol_max = max(self.ssc_vols['all'])
         data['total_capacity_gb'] =\
             int(vol_max.space['size_total_bytes']) / units.GiB
         data['free_capacity_gb'] =\
             int(vol_max.space['size_avl_bytes']) / units.GiB
     elif self.ssc_enabled:
         LOG.warn(
             _("No cluster ssc stats found."
               " Wait for next volume stats update."))
     if self.ssc_enabled:
         ssc_utils.refresh_cluster_ssc(self, self._client, self.vserver)
     else:
         LOG.warn(_("No vserver set in config. SSC will be disabled."))