diff --git a/_modules/cinderv3/__init__.py b/_modules/cinderv3/__init__.py
new file mode 100644
index 0000000..650a6a2
--- /dev/null
+++ b/_modules/cinderv3/__init__.py
@@ -0,0 +1,33 @@
+try:
+    import os_client_config
+    REQUIREMENTS_MET = True
+except ImportError:
+    REQUIREMENTS_MET = False
+import os
+import sys
+
+# i failed to load module witjout this
+# seems bugs in salt or it is only me
+sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
+
+import volume
+
+volume_list = volume.volume_list
+volume_type_list = volume.volume_type_list
+volume_type_get = volume.volume_type_get
+volume_type_create = volume.volume_type_create
+volume_type_delete = volume.volume_type_delete
+keys_volume_type_get = volume.keys_volume_type_get
+keys_volume_type_set = volume.keys_volume_type_set
+
+__all__ = ('volume_list', 'volume_type_list', 'volume_type_get',
+           'volume_type_create', 'keys_volume_type_get',
+           'keys_volume_type_set', 'volume_type_delete')
+
+
+def __virtual__():
+    if REQUIREMENTS_MET:
+        return 'cinderv3'
+    else:
+        return False, ("The cinderv3 execution module cannot be loaded: "
+                       "os_client_config are unavailable.")
diff --git a/_modules/cinderv3/common.py b/_modules/cinderv3/common.py
new file mode 100644
index 0000000..93477a3
--- /dev/null
+++ b/_modules/cinderv3/common.py
@@ -0,0 +1,106 @@
+import six
+import logging
+import uuid
+
+import os_client_config
+from salt import exceptions
+
+
+log = logging.getLogger(__name__)
+
+SERVICE_KEY = 'volumev3'
+
+
+def get_raw_client(cloud_name):
+    config = os_client_config.OpenStackConfig()
+    cloud = config.get_one_cloud(cloud_name)
+    adapter = cloud.get_session_client(SERVICE_KEY)
+    adapter.version = '3'
+    try:
+        access_info = adapter.session.auth.get_access(adapter.session)
+        endpoints = access_info.service_catalog.get_endpoints()
+    except (AttributeError, ValueError) as exc:
+        six.raise_from(exc, exceptions.SaltInvocationError(
+            "Cannot load keystoneauth plugin. Please check your environment "
+            "configuration."))
+    if SERVICE_KEY not in endpoints:
+        raise exceptions.SaltInvocationError("Cannot find cinder endpoint in "
+                                             "environment endpoint list.")
+    return adapter
+
+
+def send(method):
+    def wrap(func):
+        @six.wraps(func)
+        def wrapped_f(*args, **kwargs):
+            cloud_name = kwargs.pop('cloud_name', None)
+            if not cloud_name:
+                raise exceptions.SaltInvocationError(
+                    "No cloud_name specified. Please provide cloud_name "
+                    "parameter")
+            adapter = get_raw_client(cloud_name)
+            kwarg_keys = list(kwargs.keys())
+            for k in kwarg_keys:
+                if k.startswith('__'):
+                    kwargs.pop(k)
+            url, request_kwargs = func(*args, **kwargs)
+            try:
+                response = getattr(adapter, method.lower())(url,
+                                                            **request_kwargs)
+            except Exception as e:
+                log.exception("Error occured when executing request")
+                return {"result": False,
+                        "comment": str(e),
+                        "status_code": getattr(e, "http_status", 500)}
+            return {"result": True,
+                    "body": response.json() if response.content else {},
+                    "status_code": response.status_code}
+        return wrapped_f
+    return wrap
+
+
+def _check_uuid(val):
+    try:
+        return str(uuid.UUID(val)) == val
+    except (TypeError, ValueError, AttributeError):
+        return False
+
+
+def get_by_name_or_uuid(resource_list, resp_key):
+    def wrap(func):
+        @six.wraps(func)
+        def wrapped_f(*args, **kwargs):
+            if 'name' in kwargs:
+                ref = kwargs.pop('name', None)
+                start_arg = 0
+            else:
+                start_arg = 1
+                ref = args[0]
+            item_id = None
+            if _check_uuid(ref):
+                item_id = ref
+            else:
+                cloud_name = kwargs['cloud_name']
+                # seems no filtering on volume type name in cinder
+                resp = resource_list(cloud_name=cloud_name)["body"][resp_key]
+                # so need to search in list directly
+                for item in resp:
+                    if item["name"] == ref:
+                        if item_id is not None:
+                            msg = ("Multiple resource: {resource} " 
+                                   "with name: {name} found ").format(
+                                    resource=resp_key, name=ref)
+                            return {"result": False,
+                                    "body": msg,
+                                    "status_code": 400}
+                        item_id = item["id"]
+                if not item_id:
+                    msg = ("Uniq {resource} resource "
+                           "with name={name} not found.").format(
+                            resource=resp_key, name=ref)
+                    return {"result": False,
+                            "body": msg,
+                            "status_code": 404}
+            return func(item_id, *args[start_arg:], **kwargs)
+        return wrapped_f
+    return wrap
diff --git a/_modules/cinderv3/volume.py b/_modules/cinderv3/volume.py
new file mode 100644
index 0000000..deaaf6d
--- /dev/null
+++ b/_modules/cinderv3/volume.py
@@ -0,0 +1,95 @@
+from __future__ import absolute_import
+
+import common
+
+try:
+    from urllib.parse import urlencode
+except ImportError:
+    from urllib import urlencode
+
+
+@common.send("get")
+def volume_list(**kwargs):
+    """
+    Return list of cinder volumes.
+    """
+    url = '/volumes?{}'.format(urlencode(kwargs))
+    return url, {}
+
+
+@common.send("get")
+def volume_type_list(**kwargs):
+    """
+    Return list of volume types
+    """
+    url = '/types?{}'.format(urlencode(kwargs))
+    return url, {}
+
+
+@common.get_by_name_or_uuid(volume_type_list, 'volume_types')
+@common.send("get")
+def volume_type_get(volume_type_id, **kwargs):
+    """
+    Returns id of the specified volume type name
+    """
+    url = "/types/{volume_type_id}".format(volume_type_id=volume_type_id)
+    return url, {}
+
+
+@common.get_by_name_or_uuid(volume_type_list, 'volume_types')
+@common.send("delete")
+def volume_type_delete(volume_type_id, **kwargs):
+    """
+    delete the specified volume type
+    """
+    url = "/types/{volume_type_id}".format(volume_type_id=volume_type_id)
+    return url, {}
+
+
+@common.send("post")
+def volume_type_create(name, **kwargs):
+    """
+    Create cinder volume type
+    """
+    url = "/types"
+    req = {"volume_type": {"name": name}}
+    return url, {'json': req}
+
+
+@common.get_by_name_or_uuid(volume_type_list, 'volume_types')
+@common.send("get")
+def keys_volume_type_get(volume_type_id, **kwargs):
+    """
+    Return extra specs of the specified volume type.
+    """
+    url = "/types/{volume_type_id}/extra_specs".format(
+        volume_type_id=volume_type_id)
+    return url, {}
+
+
+@common.send("put")
+def _key_volume_type_set(type_id, key, value, **kwargs):
+    url = "/types/{volume_type_id}/extra_specs/{key}".format(
+        volume_type_id=type_id, key=key)
+    return url, {'json': {str(key): str(value)}}
+
+
+@common.get_by_name_or_uuid(volume_type_list, 'volume_types')
+def keys_volume_type_set(volume_type_id, keys=None, **kwargs):
+    """
+    Set extra specs of the specified volume type.
+    """
+    if keys is None:
+        keys = {}
+    cloud_name = kwargs["cloud_name"]
+    cur_keys = keys_volume_type_get(
+        volume_type_id, cloud_name=cloud_name)["body"]["extra_specs"]
+
+    for k, v in keys.items():
+        if (k, v) in cur_keys.items():
+            continue
+        resp = _key_volume_type_set(volume_type_id, k, v, cloud_name=cloud_name)
+        if resp.get("result") is False:
+            return resp
+
+    return {"result": True}
