Refactor cinder plugin and extend it with multiple backends support

Closes-Bug: rhbz#1139246
Change-Id: I9803939d45e9bafea9b21274a4c64248a037cd33
This commit is contained in:
Lukas Bezdicka
2014-09-03 09:39:35 -04:00
parent 67b98ec179
commit 770d5da931
14 changed files with 786 additions and 753 deletions

View File

@@ -163,8 +163,7 @@ Cinder Config parameters
The password to use for the Cinder to authenticate with Keystone. The password to use for the Cinder to authenticate with Keystone.
**CONFIG_CINDER_BACKEND** **CONFIG_CINDER_BACKEND**
The Cinder backend to use ['lvm', 'gluster', 'nfs', 'vmdk', 'netapp']. A comma separated ordered list of the Cinder backends to use, valid options are: lvm, gluster, nfs, vmdk.
Cinder volume create Config parameters Cinder volume create Config parameters
-------------------------------------- --------------------------------------

View File

@@ -36,7 +36,8 @@ NETAPP_DEFAULT_STORAGE_PROTOCOL = "nfs"
def initConfig(controller): def initConfig(controller):
params = [ conf_params = {
"CINDER": [
{"CMD_OPTION": "cinder-db-passwd", {"CMD_OPTION": "cinder-db-passwd",
"USAGE": "The password to use for the Cinder to access DB", "USAGE": "The password to use for the Cinder to access DB",
"PROMPT": "Enter the password for the Cinder DB access", "PROMPT": "Enter the password for the Cinder DB access",
@@ -51,8 +52,8 @@ def initConfig(controller):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-ks-passwd", {"CMD_OPTION": "cinder-ks-passwd",
"USAGE": ("The password to use for the Cinder to authenticate with " "USAGE": ("The password to use for the Cinder to authenticate "
"Keystone"), "with Keystone"),
"PROMPT": "Enter the password for the Cinder Keystone access", "PROMPT": "Enter the password for the Cinder Keystone access",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@@ -77,25 +78,14 @@ def initConfig(controller):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDER",
"DESCRIPTION": "Cinder Config parameters",
"PRE_CONDITION": "CONFIG_CINDER_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_lvm_options(config): "CINDERVOLUMECREATE": [
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm')
params = [
{"CMD_OPTION": "cinder-volumes-create", {"CMD_OPTION": "cinder-volumes-create",
"USAGE": ("Create Cinder's volumes group. This should only be done " "USAGE": ("Create Cinder's volumes group. This should only be "
"for testing on a proof-of-concept installation of Cinder. " "done for testing on a proof-of-concept installation "
"This will create a file-backed volume group and is not " "of Cinder. This will create a file-backed volume group"
"suitable for production usage."), " and is not suitable for production usage."),
"PROMPT": ("Should Cinder's volumes group be created (for " "PROMPT": ("Should Cinder's volumes group be created (for "
"proof-of-concept installation)?"), "proof-of-concept installation)?"),
"OPTION_LIST": ["y", "n"], "OPTION_LIST": ["y", "n"],
@@ -107,24 +97,13 @@ def initConfig(controller):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERVOLUMECREATE",
"DESCRIPTION": "Cinder volume create Config parameters",
"PRE_CONDITION": check_lvm_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_lvm_vg_options(config): "CINDERVOLUMESIZE": [
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'lvm' and
config.get('CONFIG_CINDER_VOLUMES_CREATE', 'y') == 'y')
params = [
{"CMD_OPTION": "cinder-volumes-size", {"CMD_OPTION": "cinder-volumes-size",
"USAGE": ("Cinder's volumes group size. Note that actual volume size " "USAGE": ("Cinder's volumes group size. Note that actual volume "
"will be extended with 3% more space for VG metadata."), "size will be extended with 3% more space for VG "
"metadata."),
"PROMPT": "Enter Cinder's volumes group usable size", "PROMPT": "Enter Cinder's volumes group usable size",
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@@ -135,25 +114,15 @@ def initConfig(controller):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERVOLUMESIZE",
"DESCRIPTION": "Cinder volume size Config parameters",
"PRE_CONDITION": check_lvm_vg_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_gluster_options(config): "CINDERGLUSTERMOUNTS": [
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'gluster')
params = [
{"CMD_OPTION": "cinder-gluster-mounts", {"CMD_OPTION": "cinder-gluster-mounts",
"USAGE": ("A single or comma separated list of gluster volume shares " "USAGE": ("A single or comma separated list of gluster volume "
"to mount, eg: ip-address:/vol-name, domain:/vol-name "), "shares to mount, eg: ip-address:/vol-name, "
"PROMPT": ("Enter a single or comma separated list of gluster volume " "domain:/vol-name "),
"shares to use with Cinder"), "PROMPT": ("Enter a single or comma separated list of gluster "
"volume shares to use with Cinder"),
"OPTION_LIST": ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'", "OPTION_LIST": ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'",
"^'[a-zA-Z0-9][\-\.\w]*:/.*'"], "^'[a-zA-Z0-9][\-\.\w]*:/.*'"],
"VALIDATORS": [validators.validate_multi_regexp], "VALIDATORS": [validators.validate_multi_regexp],
@@ -165,25 +134,14 @@ def initConfig(controller):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERGLUSTERMOUNTS",
"DESCRIPTION": "Cinder gluster Config parameters",
"PRE_CONDITION": check_gluster_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_nfs_options(config): "CINDERNFSMOUNTS": [
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'nfs')
params = [
{"CMD_OPTION": "cinder-nfs-mounts", {"CMD_OPTION": "cinder-nfs-mounts",
"USAGE": ("A single or comma seprated list of NFS exports to mount, " "USAGE": ("A single or comma seprated list of NFS exports to "
"eg: ip-address:/export-name "), "mount, eg: ip-address:/export-name "),
"PROMPT": ("Enter a single or comma seprated list of NFS exports to " "PROMPT": ("Enter a single or comma seprated list of NFS exports "
"use with Cinder"), "to use with Cinder"),
"OPTION_LIST": ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'"], "OPTION_LIST": ["^'([\d]{1,3}\.){3}[\d]{1,3}:/.*'"],
"VALIDATORS": [validators.validate_multi_regexp], "VALIDATORS": [validators.validate_multi_regexp],
"PROCESSORS": [processors.process_add_quotes_around_values], "PROCESSORS": [processors.process_add_quotes_around_values],
@@ -194,20 +152,9 @@ def initConfig(controller):
"USE_DEFAULT": False, "USE_DEFAULT": False,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERNFSMOUNTS",
"DESCRIPTION": "Cinder NFS Config parameters",
"PRE_CONDITION": check_nfs_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_netapp_options(config): "CINDERNETAPPMAIN": [
return (config.get('CONFIG_CINDER_INSTALL', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'netapp')
params = [
{"CMD_OPTION": "cinder-netapp-login", {"CMD_OPTION": "cinder-netapp-login",
"USAGE": ("(required) Administrative user account name used to " "USAGE": ("(required) Administrative user account name used to "
"access the storage system or proxy server. "), "access the storage system or proxy server. "),
@@ -223,8 +170,8 @@ def initConfig(controller):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-password", {"CMD_OPTION": "cinder-netapp-password",
"USAGE": ("(required) Password for the administrative user account " "USAGE": ("(required) Password for the administrative user "
"specified in the netapp_login parameter."), "account specified in the netapp_login parameter."),
"PROMPT": ("Enter a NetApp password"), "PROMPT": ("Enter a NetApp password"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@@ -237,8 +184,8 @@ def initConfig(controller):
"NEED_CONFIRM": True, "NEED_CONFIRM": True,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-hostname", {"CMD_OPTION": "cinder-netapp-hostname",
"USAGE": ("(required) The hostname (or IP address) for the storage " "USAGE": ("(required) The hostname (or IP address) for the "
"system or proxy server."), "storage system or proxy server."),
"PROMPT": ("Enter a NetApp hostname"), "PROMPT": ("Enter a NetApp hostname"),
"OPTION_LIST": [], "OPTION_LIST": [],
"VALIDATORS": [validators.validate_not_empty], "VALIDATORS": [validators.validate_not_empty],
@@ -252,11 +199,11 @@ def initConfig(controller):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-server-port", {"CMD_OPTION": "cinder-netapp-server-port",
"USAGE": ("(optional) The TCP port to use for communication with " "USAGE": ("(optional) The TCP port to use for communication with "
"ONTAPI on the storage system. Traditionally, port 80 is " "ONTAPI on the storage system. Traditionally, port 80 "
"used for HTTP and port 443 is used for HTTPS; however, " "is used for HTTP and port 443 is used for HTTPS; "
"this value should be changed if an alternate port has " "however, this value should be changed if an alternate "
"been configured on the storage system or proxy server. " "port has been configured on the storage system or "
"Defaults to 80."), "proxy server. Defaults to 80."),
"PROMPT": ("Enter a NetApp server port"), "PROMPT": ("Enter a NetApp server port"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
"VALIDATORS": [validators.validate_port], "VALIDATORS": [validators.validate_port],
@@ -270,9 +217,9 @@ def initConfig(controller):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-storage-family", {"CMD_OPTION": "cinder-netapp-storage-family",
"USAGE": ("(optional) The storage family type used on the storage" "USAGE": ("(optional) The storage family type used on the storage"
"system; valid values are ontap_7mode for using Data ONTAP " " system; valid values are ontap_7mode for using Data "
"operating in 7-Mode or ontap_cluster for using clustered " "ONTAP operating in 7-Mode or ontap_cluster for using "
"Data ONTAP, or eseries for NetApp E-Series. " "clustered Data ONTAP, or eseries for NetApp E-Series. "
"Defaults to %s." % NETAPP_DEFAULT_STORAGE_FAMILY), "Defaults to %s." % NETAPP_DEFAULT_STORAGE_FAMILY),
"PROMPT": ("Enter a NetApp storage family"), "PROMPT": ("Enter a NetApp storage family"),
"OPTION_LIST": ["ontap_7mode", "ontap_cluster", "eseries"], "OPTION_LIST": ["ontap_7mode", "ontap_cluster", "eseries"],
@@ -286,9 +233,9 @@ def initConfig(controller):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-transport-type", {"CMD_OPTION": "cinder-netapp-transport-type",
"USAGE": ("(optional) The transport protocol used when communicating " "USAGE": ("(optional) The transport protocol used when "
"with ONTAPI on the storage system or proxy server. Valid " "communicating with ONTAPI on the storage system or "
"values are http or https. " "proxy server. Valid values are http or https. "
"Defaults to http."), "Defaults to http."),
"PROMPT": ("Enter a NetApp transport type"), "PROMPT": ("Enter a NetApp transport type"),
"OPTION_LIST": ["http", "https"], "OPTION_LIST": ["http", "https"],
@@ -317,32 +264,14 @@ def initConfig(controller):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERNETAPPMAIN", "CINDERNETAPPONTAPISCSI": [
"DESCRIPTION": "Cinder NetApp main configuration",
"PRE_CONDITION": check_netapp_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_netapp_ontap_iscsi_options(config):
storage_family = config.get('CONFIG_CINDER_NETAPP_STORAGE_FAMILY',
NETAPP_DEFAULT_STORAGE_FAMILY)
storage_protocol = config.get('CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL',
NETAPP_DEFAULT_STORAGE_PROTOCOL)
return (check_netapp_options(config) and
storage_family in ['ontap_cluster', 'ontap_7mode'] and
storage_protocol == "iscsi")
params = [
{"CMD_OPTION": "cinder-netapp-size-multiplier", {"CMD_OPTION": "cinder-netapp-size-multiplier",
"USAGE": ("(optional) The quantity to be multiplied by the requested " "USAGE": ("(optional) The quantity to be multiplied by the "
"volume size to ensure enough space is available on the " "requested volume size to ensure enough space is "
"virtual storage server (Vserver) to fulfill the volume " "available on the virtual storage server (Vserver)"
"creation request. " " to fulfill the volume creation request. "
"Defaults to 1.0."), "Defaults to 1.0."),
"PROMPT": ("Enter a NetApp size multiplier"), "PROMPT": ("Enter a NetApp size multiplier"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
@@ -355,30 +284,17 @@ def initConfig(controller):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERNETAPPONTAPISCSI ",
"DESCRIPTION": "Cinder NetApp ONTAP-iSCSI configuration",
"PRE_CONDITION": check_netapp_ontap_iscsi_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_netapp_nfs_settings(config): "CINDERNETAPPNFS": [
storage_protocol = config.get('CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL',
NETAPP_DEFAULT_STORAGE_PROTOCOL)
return (check_netapp_options(config) and
storage_protocol == "nfs")
params = [
{"CMD_OPTION": "cinder-netapp-expiry-thres-minutes", {"CMD_OPTION": "cinder-netapp-expiry-thres-minutes",
"USAGE": ("(optional) This parameter specifies the threshold for " "USAGE": ("(optional) This parameter specifies the threshold for "
"last access time for images in the NFS image cache. When " "last access time for images in the NFS image cache. "
"a cache cleaning cycle begins, images in the cache that " "When a cache cleaning cycle begins, images in the "
"have not been accessed in the last M minutes, where M is " "cache that have not been accessed in the last M "
"the value of this parameter, will be deleted from the " "minutes, where M is the value of this parameter, will "
"cache to create free space on the NFS share. " "be deleted from the cache to create free space on the "
"Defaults to 720."), "NFS share. Defaults to 720."),
"PROMPT": ("Enter a threshold"), "PROMPT": ("Enter a threshold"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
"VALIDATORS": [validators.validate_integer], "VALIDATORS": [validators.validate_integer],
@@ -392,8 +308,8 @@ def initConfig(controller):
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-thres-avl-size-perc-start", {"CMD_OPTION": "cinder-netapp-thres-avl-size-perc-start",
"USAGE": ("(optional) If the percentage of available space for an" "USAGE": ("(optional) If the percentage of available space for an"
"NFS share has dropped below the value specified by this " " NFS share has dropped below the value specified by "
"parameter, the NFS image cache will be cleaned. " "this parameter, the NFS image cache will be cleaned. "
"Defaults to 20"), "Defaults to 20"),
"PROMPT": ("Enter a value"), "PROMPT": ("Enter a value"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
@@ -407,12 +323,12 @@ def initConfig(controller):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-thres-avl-size-perc-stop", {"CMD_OPTION": "cinder-netapp-thres-avl-size-perc-stop",
"USAGE": ("(optional) When the percentage of available space on an " "USAGE": ("(optional) When the percentage of available space on "
"NFS share has reached the percentage specified by this " "an NFS share has reached the percentage specified by "
"parameter, the driver will stop clearing files from the " "this parameter, the driver will stop clearing files "
"NFS image cache that have not been accessed in the last M " "from the NFS image cache that have not been accessed "
"minutes, where M is the value of the expiry_thres_minutes " "in the last M minutes, where M is the value of the "
"parameter. " "expiry_thres_minutes parameter. "
"Defaults to 60."), "Defaults to 60."),
"PROMPT": ("Enter a value"), "PROMPT": ("Enter a value"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
@@ -439,31 +355,15 @@ def initConfig(controller):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERNETAPPNFS",
"DESCRIPTION": "Cinder NetApp NFS configuration",
"PRE_CONDITION": check_netapp_nfs_settings,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_netapp_7modeiscsi_options(config): "CINDERNETAPPISCSI7MODE": [
storage_family = config.get('CONFIG_CINDER_NETAPP_STORAGE_FAMILY',
NETAPP_DEFAULT_STORAGE_FAMILY)
storage_protocol = config.get('CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL',
NETAPP_DEFAULT_STORAGE_PROTOCOL)
return (check_netapp_options(config) and
storage_family == 'ontap_7mode' and
storage_protocol == 'iscsi')
params = [
{"CMD_OPTION": "cinder-netapp-volume-list", {"CMD_OPTION": "cinder-netapp-volume-list",
"USAGE": ("(optional) This parameter is only utilized when the " "USAGE": ("(optional) This parameter is only utilized when the "
"storage protocol is configured to use iSCSI. This " "storage protocol is configured to use iSCSI. This "
"parameter is used to restrict provisioning to the " "parameter is used to restrict provisioning to the "
"specified controller volumes. Specify the value of this " "specified controller volumes. Specify the value of "
"parameter to be a comma separated list of NetApp " "this parameter to be a comma separated list of NetApp "
"controller volume names to be used for provisioning. " "controller volume names to be used for provisioning. "
"Defaults to ''."), "Defaults to ''."),
"PROMPT": ("Enter a NetApp volume list"), "PROMPT": ("Enter a NetApp volume list"),
@@ -478,13 +378,13 @@ def initConfig(controller):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-vfiler", {"CMD_OPTION": "cinder-netapp-vfiler",
"USAGE": ("(optional) The vFiler unit on which provisioning of block " "USAGE": ("(optional) The vFiler unit on which provisioning of "
"storage volumes will be done. This parameter is only used " "block storage volumes will be done. This parameter is "
"by the driver when connecting to an instance with a " "only used by the driver when connecting to an instance"
"storage family of Data ONTAP operating in 7-Mode and the " " with a storage family of Data ONTAP operating in "
"storage protocol selected is iSCSI. Only use this " "7-Mode and the storage protocol selected is iSCSI. "
"parameter when utilizing the MultiStore feature on the " "Only use this parameter when utilizing the MultiStore "
"NetApp storage system. " "feature on the NetApp storage system. "
"Defaults to ''."), "Defaults to ''."),
"PROMPT": ("Enter a NetApp vFiler"), "PROMPT": ("Enter a NetApp vFiler"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
@@ -497,38 +397,22 @@ def initConfig(controller):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERNETAPPISCSI7MODE",
"DESCRIPTION": "Cinder NetApp iSCSI & 7-mode configuration",
"PRE_CONDITION": check_netapp_7modeiscsi_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_netapp_vserver_options(config): "CINDERNETAPPVSERVER": [
storage_family = config.get('CONFIG_CINDER_NETAPP_STORAGE_FAMILY',
NETAPP_DEFAULT_STORAGE_FAMILY)
storage_protocol = config.get('CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL',
NETAPP_DEFAULT_STORAGE_PROTOCOL)
return (check_netapp_options(config) and
storage_family == "ontap_cluster" and
storage_protocol in ['nfs', 'iscsi'])
params = [
{"CMD_OPTION": "cinder-netapp-vserver", {"CMD_OPTION": "cinder-netapp-vserver",
"USAGE": ("(optional) This parameter specifies the virtual storage " "USAGE": ("(optional) This parameter specifies the virtual "
"server (Vserver) name on the storage cluster on which " "storage server (Vserver) name on the storage cluster "
"provisioning of block storage volumes should occur. If " "on which provisioning of block storage volumes should "
"using the NFS storage protocol, this parameter is " "occur. If using the NFS storage protocol, this "
"mandatory for storage service catalog support (utilized " "parameter is mandatory for storage service catalog "
"by Cinder volume type extra_specs support). If this " "support (utilized by Cinder volume type extra_specs "
"parameter is specified, the exports belonging to the " "support). If this parameter is specified, the exports "
"Vserver will only be used for provisioning in the future. " "belonging to the Vserver will only be used for "
"Block storage volumes on exports not belonging to the " "provisioning in the future. Block storage volumes on "
"Vserver specified by this parameter will continue to " "exports not belonging to the Vserver specified by this"
"function normally. " " parameter will "
"continue to function normally. "
"Defaults to ''."), "Defaults to ''."),
"PROMPT": ("Enter a NetApp Vserver"), "PROMPT": ("Enter a NetApp Vserver"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
@@ -541,29 +425,16 @@ def initConfig(controller):
"USE_DEFAULT": True, "USE_DEFAULT": True,
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ],
group = {"GROUP_NAME": "CINDERNETAPPVSERVER",
"DESCRIPTION": "Cinder NetApp vServer configuration",
"PRE_CONDITION": check_netapp_vserver_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True}
controller.addGroup(group, params)
def check_netapp_eseries_options(config): "CINDERNETAPPESERIES": [
storage_family = config.get('CONFIG_CINDER_NETAPP_STORAGE_FAMILY',
NETAPP_DEFAULT_STORAGE_FAMILY)
return (check_netapp_options(config) and
storage_family == "eseries")
params = [
{"CMD_OPTION": "cinder-netapp-controller-ips", {"CMD_OPTION": "cinder-netapp-controller-ips",
"USAGE": ("(optional) This option is only utilized when the storage " "USAGE": ("(optional) This option is only utilized when the "
"family is configured to eseries. This option is used to " "storage family is configured to eseries. This option "
"restrict provisioning to the specified controllers. " "is used to restrict provisioning to the specified "
"Specify the value of this option to be a comma separated " "controllers. Specify the value of this option to be a "
"list of controller hostnames or IP addresses to be used " "comma separated list of controller hostnames or IP "
"for provisioning. " "addresses to be used for provisioning. "
"Defaults to ''."), "Defaults to ''."),
"PROMPT": ("Enter a value"), "PROMPT": ("Enter a value"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
@@ -592,12 +463,12 @@ def initConfig(controller):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-webservice-path", {"CMD_OPTION": "cinder-netapp-webservice-path",
"USAGE": ("(optional) This option is used to specify the path to the " "USAGE": ("(optional) This option is used to specify the path to "
"E-Series proxy application on a proxy server. The value " "the E-Series proxy application on a proxy server. The "
"is combined with the value of the netapp_transport_type, " "value is combined with the value of the "
"netapp_server_hostname, and netapp_server_port options to " "netapp_transport_type, netapp_server_hostname, and "
"create the URL used by the driver to connect to the proxy " "netapp_server_port options to create the URL used by "
"application. " "the driver to connect to the proxy application. "
"Defaults to '/devmgr/v2'."), "Defaults to '/devmgr/v2'."),
"PROMPT": ("Enter a path"), "PROMPT": ("Enter a path"),
"OPTION_LIST": ["^[/].*$"], "OPTION_LIST": ["^[/].*$"],
@@ -611,11 +482,11 @@ def initConfig(controller):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
{"CMD_OPTION": "cinder-netapp-storage-pools", {"CMD_OPTION": "cinder-netapp-storage-pools",
"USAGE": ("(optional) This option is used to restrict provisioning " "USAGE": ("(optional) This option is used to restrict "
"to the specified storage pools. Only dynamic disk pools " "provisioning to the specified storage pools. Only "
"are currently supported. Specify the value of this option " "dynamic disk pools are currently supported. Specify "
"to be a comma separated list of disk pool names to be " "the value of this option to be a comma separated list "
"used for provisioning. " "of disk pool names to be used for provisioning. "
"Defaults to ''."), "Defaults to ''."),
"PROMPT": ("Enter a value"), "PROMPT": ("Enter a value"),
"OPTION_LIST": [""], "OPTION_LIST": [""],
@@ -629,19 +500,100 @@ def initConfig(controller):
"NEED_CONFIRM": False, "NEED_CONFIRM": False,
"CONDITION": False}, "CONDITION": False},
] ]
group = {"GROUP_NAME": "CINDERNETAPPESERIES", }
conf_groups = [
{"GROUP_NAME": "CINDER",
"DESCRIPTION": "Cinder Config parameters",
"PRE_CONDITION": "CONFIG_CINDER_INSTALL",
"PRE_CONDITION_MATCH": "y",
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERVOLUMECREATE",
"DESCRIPTION": "Cinder volume create Config parameters",
"PRE_CONDITION": check_lvm_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERVOLUMESIZE",
"DESCRIPTION": "Cinder volume size Config parameters",
"PRE_CONDITION": check_lvm_vg_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERGLUSTERMOUNTS",
"DESCRIPTION": "Cinder gluster Config parameters",
"PRE_CONDITION": check_gluster_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERNFSMOUNTS",
"DESCRIPTION": "Cinder NFS Config parameters",
"PRE_CONDITION": check_nfs_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERNETAPPMAIN",
"DESCRIPTION": "Cinder NetApp main configuration",
"PRE_CONDITION": check_netapp_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERNETAPPONTAPISCSI",
"DESCRIPTION": "Cinder NetApp ONTAP-iSCSI configuration",
"PRE_CONDITION": check_netapp_ontap_iscsi_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERNETAPPNFS",
"DESCRIPTION": "Cinder NetApp NFS configuration",
"PRE_CONDITION": check_netapp_nfs_settings,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERNETAPPISCSI7MODE",
"DESCRIPTION": "Cinder NetApp iSCSI & 7-mode configuration",
"PRE_CONDITION": check_netapp_7modeiscsi_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERNETAPPVSERVER",
"DESCRIPTION": "Cinder NetApp vServer configuration",
"PRE_CONDITION": check_netapp_vserver_options,
"PRE_CONDITION_MATCH": True,
"POST_CONDITION": False,
"POST_CONDITION_MATCH": True},
{"GROUP_NAME": "CINDERNETAPPESERIES",
"DESCRIPTION": "Cinder NetApp E-Series configuration", "DESCRIPTION": "Cinder NetApp E-Series configuration",
"PRE_CONDITION": check_netapp_eseries_options, "PRE_CONDITION": check_netapp_eseries_options,
"PRE_CONDITION_MATCH": True, "PRE_CONDITION_MATCH": True,
"POST_CONDITION": False, "POST_CONDITION": False,
"POST_CONDITION_MATCH": True} "POST_CONDITION_MATCH": True},
]
for group in conf_groups:
params = conf_params[group["GROUP_NAME"]]
controller.addGroup(group, params) controller.addGroup(group, params)
def initSequences(controller): def initSequences(controller):
if controller.CONF['CONFIG_CINDER_INSTALL'] != 'y': config = controller.CONF
if config['CONFIG_CINDER_INSTALL'] != 'y':
return return
config['CONFIG_CINDER_BACKEND'] = str(
[i.strip() for i in config['CONFIG_CINDER_BACKEND'].split(',') if i]
)
cinder_steps = [ cinder_steps = [
{'title': 'Adding Cinder Keystone manifest entries', {'title': 'Adding Cinder Keystone manifest entries',
'functions': [create_keystone_manifest]}, 'functions': [create_keystone_manifest]},
@@ -649,13 +601,71 @@ def initSequences(controller):
'functions': [create_manifest]} 'functions': [create_manifest]}
] ]
if controller.CONF['CONFIG_CINDER_BACKEND'] == 'lvm': if 'lvm' in config['CONFIG_CINDER_BACKEND']:
cinder_steps.append( cinder_steps.append(
{'title': 'Checking if the Cinder server has a cinder-volumes vg', {'title': 'Checking if the Cinder server has a cinder-volumes vg',
'functions': [check_cinder_vg]}) 'functions': [check_cinder_vg]})
controller.addSequence("Installing OpenStack Cinder", [], [], cinder_steps) controller.addSequence("Installing OpenStack Cinder", [], [], cinder_steps)
#------------------------- helper functions -------------------------
def check_lvm_options(config):
return (config['CONFIG_CINDER_INSTALL'] == 'y' and
'lvm' in config['CONFIG_CINDER_BACKEND'])
def check_lvm_vg_options(config):
return (config['CONFIG_CINDER_INSTALL'] == 'y' and
'lvm' in config['CONFIG_CINDER_BACKEND'] and
config['CONFIG_CINDER_VOLUMES_CREATE'] == 'y')
def check_gluster_options(config):
return (config['CONFIG_CINDER_INSTALL'] == 'y' and
'gluster' in config['CONFIG_CINDER_BACKEND'])
def check_nfs_options(config):
return (config['CONFIG_CINDER_INSTALL'] == 'y' and
'nfs' in config['CONFIG_CINDER_BACKEND'])
def check_netapp_options(config):
return (config['CONFIG_CINDER_INSTALL'] == 'y' and
'netapp' in config['CONFIG_CINDER_BACKEND'])
def check_netapp_ontap_iscsi_options(config):
return (check_netapp_options(config) and
config['CONFIG_CINDER_NETAPP_STORAGE_FAMILY'] in
['ontap_cluster', 'ontap_7mode'] and
config['CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL'] == "iscsi")
def check_netapp_nfs_settings(config):
return (check_netapp_options(config) and
config['CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL'] == "nfs")
def check_netapp_7modeiscsi_options(config):
return (check_netapp_options(config) and
config['CONFIG_CINDER_NETAPP_STORAGE_FAMILY'] == 'ontap_7mode' and
config['CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL'] == 'iscsi')
def check_netapp_vserver_options(config):
return (check_netapp_options(config) and
config['CONFIG_CINDER_NETAPP_STORAGE_FAMILY'] == "ontap_cluster"
and config['CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL'] in
['nfs', 'iscsi'])
def check_netapp_eseries_options(config):
return (check_netapp_options(config) and
config['CONFIG_CINDER_NETAPP_STORAGE_FAMILY'] == "eseries")
#-------------------------- step functions -------------------------- #-------------------------- step functions --------------------------
def check_cinder_vg(config, messages): def check_cinder_vg(config, messages):
@@ -663,57 +673,11 @@ def check_cinder_vg(config, messages):
if config['CONFIG_UNSUPPORTED'] != 'y': if config['CONFIG_UNSUPPORTED'] != 'y':
config['CONFIG_STORAGE_HOST'] = config['CONFIG_CONTROLLER_HOST'] config['CONFIG_STORAGE_HOST'] = config['CONFIG_CONTROLLER_HOST']
# Do we have a cinder-volumes vg?
have_cinders_volume = False
server = utils.ScriptRunner(config['CONFIG_STORAGE_HOST'])
server.append('vgdisplay %s' % cinders_volume)
try:
server.execute()
have_cinders_volume = True
except exceptions.ScriptRuntimeError:
pass
# Configure system LVM settings (snapshot_autoextend)
server = utils.ScriptRunner(config['CONFIG_STORAGE_HOST'])
server.append('sed -i -r "s/^ *snapshot_autoextend_threshold +=.*/'
' snapshot_autoextend_threshold = 80/" '
'/etc/lvm/lvm.conf')
server.append('sed -i -r "s/^ *snapshot_autoextend_percent +=.*/'
' snapshot_autoextend_percent = 20/" '
'/etc/lvm/lvm.conf')
try:
server.execute()
except exceptions.ScriptRuntimeError:
logging.info("Warning: Unable to set system LVM settings.")
if config["CONFIG_CINDER_VOLUMES_CREATE"] != "y": if config["CONFIG_CINDER_VOLUMES_CREATE"] != "y":
if not have_cinders_volume: if not have_cinders_volume:
raise exceptions.MissingRequirements("The cinder server should " raise exceptions.MissingRequirements("The cinder server should "
"contain a cinder-volumes " "contain a cinder-volumes "
"volume group") "volume group")
else:
if have_cinders_volume:
messages.append(
output_messages.INFO_CINDER_VOLUMES_EXISTS)
return
# TO-DO: This is implemented in cinder::setup_test_volume class.
# We should use it instead of this Python code
server = utils.ScriptRunner(config['CONFIG_STORAGE_HOST'])
server.append('systemctl')
try:
server.execute()
rst_cmd = 'systemctl restart openstack-cinder-volume.service'
except exceptions.ScriptRuntimeError:
rst_cmd = 'service openstack-cinder-volume restart'
server.clear()
logging.info("A new cinder volumes group will be created")
server.append('yum install -y lvm2')
cinders_volume_path = '/var/lib/cinder'
server.append('mkdir -p %s' % cinders_volume_path)
logging.debug("Volume's path: %s" % cinders_volume_path)
match = re.match('^(?P<size>\d+)G$', match = re.match('^(?P<size>\d+)G$',
config['CONFIG_CINDER_VOLUMES_SIZE'].strip()) config['CONFIG_CINDER_VOLUMES_SIZE'].strip())
@@ -725,45 +689,7 @@ def check_cinder_vg(config, messages):
cinders_reserve = int(cinders_volume_size * 0.03) cinders_reserve = int(cinders_volume_size * 0.03)
cinders_volume_size = cinders_volume_size + cinders_reserve cinders_volume_size = cinders_volume_size + cinders_reserve
cinders_volume_path = os.path.join(cinders_volume_path, cinders_volume) config['CONFIG_CINDER_VOLUMES_SIZE'] = 'sM' % cinders_volume_size
server.append('dd if=/dev/zero of=%s bs=1 count=0 seek=%sM'
% (cinders_volume_path, cinders_volume_size))
server.append('LOFI=$(losetup --show -f %s)' % cinders_volume_path)
server.append('pvcreate $LOFI')
server.append('vgcreate %s $LOFI' % cinders_volume)
# Add the loop device on boot
server.append('grep %(volume)s /etc/rc.d/rc.local || '
'echo "losetup -f %(path)s && '
'vgchange -a y %(volume)s && '
'%(restart_cmd)s" '
'>> /etc/rc.d/rc.local' %
{'volume': cinders_volume, 'restart_cmd': rst_cmd,
'path': cinders_volume_path})
server.append('grep "#!" /etc/rc.d/rc.local || '
'sed -i \'1i#!/bin/sh\' /etc/rc.d/rc.local')
server.append('chmod +x /etc/rc.d/rc.local')
# Let's make sure it exists
server.append('vgdisplay %s' % cinders_volume)
try:
server.execute()
except exceptions.ScriptRuntimeError:
# Release loop device if cinder's volume creation
# fails.
try:
logging.debug("Release loop device, volume creation failed")
server = utils.ScriptRunner(config['CONFIG_STORAGE_HOST'])
server.append('losetup -d $(losetup -j %s | cut -d : -f 1)'
% cinders_volume_path)
server.execute()
except:
pass
raise exceptions.MissingRequirements("Cinder's volume group '%s' "
"could not be created"
% cinders_volume)
def create_keystone_manifest(config, messages): def create_keystone_manifest(config, messages):
@@ -783,21 +709,15 @@ def create_manifest(config, messages):
manifestfile = "%s_cinder.pp" % config['CONFIG_STORAGE_HOST'] manifestfile = "%s_cinder.pp" % config['CONFIG_STORAGE_HOST']
manifestdata += getManifestTemplate("cinder.pp") manifestdata += getManifestTemplate("cinder.pp")
if config['CONFIG_CINDER_BACKEND'] == "lvm": backends = config['CONFIG_CINDER_BACKEND'].strip('[]')
manifestdata += getManifestTemplate("cinder_lvm.pp") backends = [i.strip('\' ') for i in backends.split(',')]
elif config['CONFIG_CINDER_BACKEND'] == "gluster": if 'netapp' in backends:
manifestdata += getManifestTemplate("cinder_gluster.pp") backends.remove('netapp')
elif config['CONFIG_CINDER_BACKEND'] == "nfs":
manifestdata += getManifestTemplate("cinder_nfs.pp")
elif config['CONFIG_CINDER_BACKEND'] == "vmdk":
manifestdata += getManifestTemplate("cinder_vmdk.pp")
if config['CONFIG_CINDER_BACKEND'] == "netapp":
puppet_cdot_iscsi = "cinder_netapp_cdot_iscsi.pp" puppet_cdot_iscsi = "cinder_netapp_cdot_iscsi.pp"
puppet_cdot_nfs = "cinder_netapp_cdot_nfs.pp" puppet_cdot_nfs = "cinder_netapp_cdot_nfs.pp"
puppet_7mode_iscsi = "cinder_netapp_7mode_iscsi.pp" puppet_7mode_iscsi = "cinder_netapp_7mode_iscsi.pp"
puppet_7mode_nfs = "cinder_netapp_7mode_nfs.pp" puppet_7mode_nfs = "cinder_netapp_7mode_nfs.pp"
puppet_eseries = "cinder_netapp_eseries.pp" puppet_eseries = "cinder_netapp_eseries.pp"
if config['CONFIG_CINDER_NETAPP_STORAGE_FAMILY'] == "ontap_cluster": if config['CONFIG_CINDER_NETAPP_STORAGE_FAMILY'] == "ontap_cluster":
if config['CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL'] == "iscsi": if config['CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL'] == "iscsi":
manifestdata += getManifestTemplate(puppet_cdot_iscsi) manifestdata += getManifestTemplate(puppet_cdot_iscsi)
@@ -810,6 +730,9 @@ def create_manifest(config, messages):
manifestdata += getManifestTemplate(puppet_7mode_nfs) manifestdata += getManifestTemplate(puppet_7mode_nfs)
elif config['CONFIG_CINDER_NETAPP_STORAGE_FAMILY'] == "eseries": elif config['CONFIG_CINDER_NETAPP_STORAGE_FAMILY'] == "eseries":
manifestdata += getManifestTemplate(puppet_eseries) manifestdata += getManifestTemplate(puppet_eseries)
for backend in backends:
manifestdata += getManifestTemplate('cinder_%s.pp' % backend)
if config['CONFIG_CEILOMETER_INSTALL'] == 'y': if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate('cinder_ceilometer.pp') manifestdata += getManifestTemplate('cinder_ceilometer.pp')
if config['CONFIG_SWIFT_INSTALL'] == 'y': if config['CONFIG_SWIFT_INSTALL'] == 'y':

View File

@@ -511,11 +511,11 @@ def create_compute_manifest(config, messages):
manifestdata += getManifestTemplate("nova_compute_libvirt.pp") manifestdata += getManifestTemplate("nova_compute_libvirt.pp")
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'gluster'): 'gluster' in config['CONFIG_CINDER_BACKEND']):
manifestdata += getManifestTemplate("nova_gluster.pp") manifestdata += getManifestTemplate("nova_gluster.pp")
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'nfs'): 'nfs' in config['CONFIG_CINDER_BACKEND']):
manifestdata += getManifestTemplate("nova_nfs.pp") manifestdata += getManifestTemplate("nova_nfs.pp")
manifestfile = "%s_nova.pp" % host manifestfile = "%s_nova.pp" % host

View File

@@ -19,3 +19,17 @@ class {'cinder::scheduler':
class {'cinder::volume': class {'cinder::volume':
} }
class {'cinder::client':
}
# Cinder::Type requires keystone credentials
Cinder::Type {
os_password => '%(CONFIG_CINDER_KS_PW)s',
os_tenant_name => "services",
os_username => "cinder",
os_auth_url => "http://%(CONFIG_CONTROLLER_HOST)s:5000/v2.0/",
}
class { 'cinder::backends':
enabled_backends => %(CONFIG_CINDER_BACKEND)s,
}

View File

@@ -1,6 +1,13 @@
package { 'glusterfs-fuse': ensure => present } package { 'glusterfs-fuse': ensure => present }
class { 'cinder::volume::glusterfs': cinder::backend::glusterfs { 'gluster':
glusterfs_shares => [%(CONFIG_CINDER_GLUSTER_MOUNTS)s], glusterfs_shares => [%(CONFIG_CINDER_GLUSTER_MOUNTS)s],
require => Package['glusterfs-fuse'], require => Package['glusterfs-fuse'],
glusterfs_shares_config => '/etc/cinder/glusterfs_shares.conf',
}
cinder::type { 'glusterfs':
set_key => 'volume_backend_name',
set_value => 'gluster',
require => Class['cinder::api'],
} }

View File

@@ -1,9 +1,81 @@
class { 'cinder::setup_test_volume':
package { 'lvm2': size => '%(CONFIG_CINDER_VOLUMES_SIZE)s',
ensure => installed, loopback_device => '/dev/loop2',
volume_path => '/var/lib/cinder',
volume_name => 'cinder-volumes',
} }
class {'cinder::volume::iscsi': # Add loop device on boot
$el_releases = ["RedHat", "CentOS", "Scientific"]
if $::operatingsystem in $el_releases and $::operatingsystemmajrelease < 7 {
file_line{ 'rc.local_losetup_cinder_volume':
path => '/etc/rc.d/rc.local',
match => '^.*/var/lib/cinder/cinder-volumes.*$',
line => 'losetup -f /var/lib/cinder/cinder-volumes && service openstack-cinder-volume restart',
}
file { '/etc/rc.d/rc.local':
mode => '0755',
}
} else {
file { 'openstack-losetup':
path => '/usr/lib/systemd/system/openstack-losetup.service',
before => Service['openstack-losetup'],
notify => Exec['/usr/bin/systemctl daemon-reload'],
content => '[Unit]
Description=Setup cinder-volume loop device
DefaultDependencies=false
Before=openstack-cinder-volume.service
After=local-fs.target
[Service]
Type=oneshot
ExecStart=/usr/bin/sh -c \'/usr/sbin/losetup -j /var/lib/cinder/cinder-volumes | /usr/bin/grep /var/lib/cinder/cinder-volumes || /usr/sbin/losetup -f /var/lib/cinder/cinder-volumes\'
ExecStop=/usr/bin/sh -c \'/usr/sbin/losetup -j /var/lib/cinder/cinder-volumes | /usr/bin/cut -d : -f 1 | /usr/bin/xargs /usr/sbin/losetup -d\'
TimeoutSec=60
RemainAfterExit=yes
[Install]
RequiredBy=openstack-cinder-volume.service',
}
exec { '/usr/bin/systemctl daemon-reload':
refreshonly => true,
before => Service['openstack-losetup'],
}
service { 'openstack-losetup':
ensure => running,
enable => true,
require => Class['cinder::setup_test_volume'],
}
}
file_line { 'snapshot_autoextend_threshold':
path => '/etc/lvm/lvm.conf',
match => '^ *snapshot_autoextend_threshold +=.*',
line => ' snapshot_autoextend_threshold = 80',
require => Package['lvm2'],
}
file_line { 'snapshot_autoextend_percent':
path => '/etc/lvm/lvm.conf',
match => '^ *snapshot_autoextend_percent +=.*',
line => ' snapshot_autoextend_percent = 20',
require => Package['lvm2'],
}
cinder::backend::iscsi { 'lvm':
iscsi_ip_address => '%(CONFIG_STORAGE_HOST)s', iscsi_ip_address => '%(CONFIG_STORAGE_HOST)s',
require => Package['lvm2'], require => Package['lvm2'],
} }
cinder::type { 'iscsi':
set_key => 'volume_backend_name',
set_value => 'lvm',
require => Class['cinder::api'],
}

View File

@@ -2,11 +2,7 @@
package { 'iscsi-initiator-utils': ensure => present } package { 'iscsi-initiator-utils': ensure => present }
cinder_config { cinder::backend::netapp { 'netapp':
"DEFAULT/enabled_backends": value => "myBackend";
}
cinder::backend::netapp{ 'myBackend':
netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s", netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s",
netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s", netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s",
netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s", netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s",
@@ -17,6 +13,11 @@ cinder::backend::netapp{ 'myBackend':
netapp_transport_type => "%(CONFIG_CINDER_NETAPP_TRANSPORT_TYPE)s", netapp_transport_type => "%(CONFIG_CINDER_NETAPP_TRANSPORT_TYPE)s",
netapp_vfiler => "%(CONFIG_CINDER_NETAPP_VFILER)s", netapp_vfiler => "%(CONFIG_CINDER_NETAPP_VFILER)s",
netapp_volume_list => ["%(CONFIG_CINDER_NETAPP_VOLUME_LIST)s"], netapp_volume_list => ["%(CONFIG_CINDER_NETAPP_VOLUME_LIST)s"],
require => Package['iscsi-initiator-utils'], require => Package['iscsi-initiator-utils'],
} }
cinder::type { 'cinder_netapp_7mode_iscsi':
set_key => 'volume_backend_name',
set_value => 'netapp',
require => Class['cinder::api'],
}

View File

@@ -2,11 +2,7 @@
package { 'nfs-utils': ensure => present } package { 'nfs-utils': ensure => present }
cinder_config { cinder::backend::netapp { 'netapp':
"DEFAULT/enabled_backends": value => "myBackend";
}
cinder::backend::netapp{ 'myBackend':
netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s", netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s",
netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s", netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s",
netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s", netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s",
@@ -18,6 +14,11 @@ cinder::backend::netapp{ 'myBackend':
thres_avl_size_perc_start => "%(CONFIG_CINDER_NETAPP_THRES_AVL_SIZE_PERC_START)s", thres_avl_size_perc_start => "%(CONFIG_CINDER_NETAPP_THRES_AVL_SIZE_PERC_START)s",
thres_avl_size_perc_stop => "%(CONFIG_CINDER_NETAPP_THRES_AVL_SIZE_PERC_STOP)s", thres_avl_size_perc_stop => "%(CONFIG_CINDER_NETAPP_THRES_AVL_SIZE_PERC_STOP)s",
nfs_shares_config => "%(CONFIG_CINDER_NETAPP_NFS_SHARES_CONFIG)s", nfs_shares_config => "%(CONFIG_CINDER_NETAPP_NFS_SHARES_CONFIG)s",
require => Package['nfs-utils'], require => Package['nfs-utils'],
} }
cinder::type { 'cinder_netapp_7mode_nfs':
set_key => 'volume_backend_name',
set_value => 'netapp',
require => Class['cinder::api'],
}

View File

@@ -2,11 +2,7 @@
package { 'iscsi-initiator-utils': ensure => present } package { 'iscsi-initiator-utils': ensure => present }
cinder_config { cinder::backend::netapp { 'netapp':
"DEFAULT/enabled_backends": value => "myBackend";
}
cinder::backend::netapp{ 'myBackend':
netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s", netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s",
netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s", netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s",
netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s", netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s",
@@ -16,6 +12,11 @@ cinder::backend::netapp{ 'myBackend':
netapp_storage_protocol => "%(CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL)s", netapp_storage_protocol => "%(CONFIG_CINDER_NETAPP_STORAGE_PROTOCOL)s",
netapp_transport_type => "%(CONFIG_CINDER_NETAPP_TRANSPORT_TYPE)s", netapp_transport_type => "%(CONFIG_CINDER_NETAPP_TRANSPORT_TYPE)s",
netapp_vserver => "%(CONFIG_CINDER_NETAPP_VSERVER)s", netapp_vserver => "%(CONFIG_CINDER_NETAPP_VSERVER)s",
require => Package['iscsi-initiator-utils'], require => Package['iscsi-initiator-utils'],
} }
cinder::type { 'cinder_netapp_cdot_iscsi':
set_key => 'volume_backend_name',
set_value => 'netapp',
require => Class['cinder::api'],
}

View File

@@ -2,11 +2,7 @@
package { 'nfs-utils': ensure => present } package { 'nfs-utils': ensure => present }
cinder_config { cinder::backend::netapp { 'netapp':
"DEFAULT/enabled_backends": value => "myBackend";
}
cinder::backend::netapp{ 'myBackend':
netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s", netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s",
netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s", netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s",
netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s", netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s",
@@ -19,6 +15,11 @@ cinder::backend::netapp{ 'myBackend':
thres_avl_size_perc_start => "%(CONFIG_CINDER_NETAPP_THRES_AVL_SIZE_PERC_START)s", thres_avl_size_perc_start => "%(CONFIG_CINDER_NETAPP_THRES_AVL_SIZE_PERC_START)s",
thres_avl_size_perc_stop => "%(CONFIG_CINDER_NETAPP_THRES_AVL_SIZE_PERC_STOP)s", thres_avl_size_perc_stop => "%(CONFIG_CINDER_NETAPP_THRES_AVL_SIZE_PERC_STOP)s",
nfs_shares_config => "%(CONFIG_CINDER_NETAPP_NFS_SHARES_CONFIG)s", nfs_shares_config => "%(CONFIG_CINDER_NETAPP_NFS_SHARES_CONFIG)s",
require => Package['nfs-utils'], require => Package['nfs-utils'],
} }
cinder::type { 'cinder_netapp_cdot_nfs':
set_key => 'volume_backend_name',
set_value => 'netapp',
require => Class['cinder::api'],
}

View File

@@ -2,11 +2,7 @@
package { 'iscsi-initiator-utils': ensure => present } package { 'iscsi-initiator-utils': ensure => present }
cinder_config { cinder::backend::netapp { 'netapp':
"DEFAULT/enabled_backends": value => "myBackend";
}
cinder::backend::netapp{ 'myBackend':
netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s", netapp_login => "%(CONFIG_CINDER_NETAPP_LOGIN)s",
netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s", netapp_password => "%(CONFIG_CINDER_NETAPP_PASSWORD)s",
netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s", netapp_server_hostname => "%(CONFIG_CINDER_NETAPP_HOSTNAME)s",
@@ -18,6 +14,11 @@ cinder::backend::netapp{ 'myBackend':
netapp_sa_password => "%(CONFIG_CINDER_NETAPP_SA_PASSWORD)s", netapp_sa_password => "%(CONFIG_CINDER_NETAPP_SA_PASSWORD)s",
netapp_storage_pools => "%(CONFIG_CINDER_NETAPP_STORAGE_POOLS)s", netapp_storage_pools => "%(CONFIG_CINDER_NETAPP_STORAGE_POOLS)s",
netapp_webservice_path => "%(CONFIG_CINDER_NETAPP_WEBSERVICE_PATH)s", netapp_webservice_path => "%(CONFIG_CINDER_NETAPP_WEBSERVICE_PATH)s",
require => Package['iscsi-initiator-utils'], require => Package['iscsi-initiator-utils'],
} }
cinder::type { 'cinder_netapp_eseries':
set_key => 'volume_backend_name',
set_value => 'netapp',
require => Class['cinder::api'],
}

View File

@@ -1,6 +1,13 @@
package { 'nfs-utils': ensure => present } package { 'nfs-utils': ensure => present }
class { 'cinder::volume::nfs': cinder::backend::nfs { 'nfs':
nfs_servers => [%(CONFIG_CINDER_NFS_MOUNTS)s], nfs_servers => [%(CONFIG_CINDER_NFS_MOUNTS)s],
require => Package['nfs-utils'], require => Package['nfs-utils'],
nfs_shares_config => '/etc/cinder/nfs_shares.conf',
}
cinder::type { 'nfs':
set_key => 'volume_backend_name',
set_value => 'nfs',
require => Class['cinder::api'],
} }

View File

@@ -1,5 +1,11 @@
class { 'cinder::volume::vmdk': cinder::backend::vmdk { 'vmdk':
host_ip => "%(CONFIG_VCENTER_HOST)s", host_ip => "%(CONFIG_VCENTER_HOST)s",
host_username => "%(CONFIG_VCENTER_USER)s", host_username => "%(CONFIG_VCENTER_USER)s",
host_password => "%(CONFIG_VCENTER_PASSWORD)s", host_password => "%(CONFIG_VCENTER_PASSWORD)s",
} }
cinder::type { 'vmdk':
set_key => 'volume_backend_name',
set_value => 'vmdk',
require => Class['cinder::api'],
}