utils.py (manila-8.1.3) | : | utils.py (manila-8.1.4) | ||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
# License for the specific language governing permissions and limitations | # License for the specific language governing permissions and limitations | |||
# under the License. | # under the License. | |||
import types | import types | |||
from oslo_config import cfg | from oslo_config import cfg | |||
from oslo_log import log | from oslo_log import log | |||
from oslo_utils import fnmatch | from oslo_utils import fnmatch | |||
from oslo_utils import netutils | from oslo_utils import netutils | |||
from oslo_utils import timeutils | from oslo_utils import timeutils | |||
from oslo_utils import units | ||||
import ssl | import ssl | |||
CONF = cfg.CONF | CONF = cfg.CONF | |||
LOG = log.getLogger(__name__) | LOG = log.getLogger(__name__) | |||
def decorate_all_methods(decorator, debug_only=False): | def decorate_all_methods(decorator, debug_only=False): | |||
if debug_only and not CONF.debug: | if debug_only and not CONF.debug: | |||
return lambda cls: cls | return lambda cls: cls | |||
def _decorate_all_methods(cls): | def _decorate_all_methods(cls): | |||
skipping to change at line 175 | skipping to change at line 176 | |||
#Literal_IPv6_addresses_in_UNC_path_names | #Literal_IPv6_addresses_in_UNC_path_names | |||
- https://en.wikipedia.org/wiki/Path_(computing)#Uniform_Naming_Convention | - https://en.wikipedia.org/wiki/Path_(computing)#Uniform_Naming_Convention | |||
:param ip_addr: IPv6 address. | :param ip_addr: IPv6 address. | |||
:return: UNC path. | :return: UNC path. | |||
""" | """ | |||
unc_suffix = '.ipv6-literal.net' | unc_suffix = '.ipv6-literal.net' | |||
if netutils.is_valid_ipv6(ip_addr): | if netutils.is_valid_ipv6(ip_addr): | |||
ip_addr = ip_addr.replace(':', '-') + unc_suffix | ip_addr = ip_addr.replace(':', '-') + unc_suffix | |||
return ip_addr | return ip_addr | |||
def bytes_to_gb(size): | ||||
return round(float(size) / units.Gi, 2) | ||||
def mb_to_gb(size): | ||||
return bytes_to_gb(size * units.Mi) | ||||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 1 lines changed or added |