# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack LLC.
# All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Volume driver for Solaris ZFS NFS storage
"""
import os
]
"""Local ZFS NFS volume operations."""
self.last_rr_pos = None
"""Retrieve volume status info."""
stats = {}
global_capacity = 0
global_free = 0
global_free += free
"""Creates a sparse file of a given size in GiB."""
"""Creates a regular file of given size in GiB."""
block_size_mb = 1
'bs=%dM' % block_size_mb,
'count=%d' % block_count)
"""Sets access permissions for given NFS path.
:param path: the volume file path.
"""
"""Sets 666 permissions for the path."""
"""Sets read-write permissions to the owner for the path."""
"""Calculate available space on the NFS share.
"""
"""
Implement a round robin generator for share list
"""
if self.last_rr_pos is None:
start_pos = 0
else:
while True:
break
"""Choose NFS share among available ones for given volume size.
For instances with more than one share that meets the criteria, the
share with the least "allocated" space will be selected.
:param volume_size_in_gib: int size in GB
"""
if not self._mounted_shares:
raise exception.NfsNoSharesMounted()
target_share = None
# Round Robin volume placement on shares
continue
break
else:
# Place volume on share with the most free space.
continue
if target_share is not None:
else:
if target_share is None:
raise exception.NfsNoSuitableShareFound(
return target_share
"""Extend an existing volume to the new size."""
' extend volume %s to %sG'
"""Secure NAS options.
For Solaris we always operate in a secure mode and do not
rely on root or any rootwrap utilities.
With RBAC we can do what we need as the cinder user. We
set the nas_secure_file.XXX to be true by default. We ignore
any conf file setting for these string vars.
We don't ever use these nas_secure_file_XXX vars in this driver
from opening bugs stating we are not running in a secure mode.
"""