Merge "[RFE] Added support for vmware vcenter in packstack" into havana

This commit is contained in:
Jenkins
2014-03-20 17:58:15 +00:00
committed by Gerrit Code Review
9 changed files with 207 additions and 59 deletions

View File

@@ -14,11 +14,14 @@ def filtered_hosts(config, exclude=True, dbhost=True):
if i.strip()])
result = set()
dbinst = config.get('CONFIG_MYSQL_INSTALL') == 'y'
vcenter = config.get('CONFIG_VMWARE_BACKEND') == 'y'
for hosttype, hostname in utils.host_iter(config):
# if dbhost is being taken into account and we are not installing MySQL
# then we should omit the MySQL host
if dbhost and not dbinst and hosttype == 'CONFIG_MYSQL_HOST':
continue
if vcenter and hosttype == 'CONFIG_VCENTER_HOST':
continue
result.add(hostname)
if exclude:
result = result - exclset

View File

@@ -73,9 +73,9 @@ def initConfig(controllerObject):
"CONDITION" : False },
{"CMD_OPTION" : "cinder-backend",
"USAGE" : ("The Cinder backend to use, valid options are: "
"lvm, gluster, nfs"),
"lvm, gluster, nfs, vmdk"),
"PROMPT" : "Enter the Cinder backend to be configured",
"OPTION_LIST" : ["lvm", "gluster", "nfs"],
"OPTION_LIST" : ["lvm", "gluster", "nfs", "vmdk"],
"VALIDATORS" : [validators.validate_options],
"DEFAULT_VALUE" : "lvm",
"MASK_INPUT" : False,
@@ -220,6 +220,57 @@ def initConfig(controllerObject):
controller.addGroup(groupDict, paramsList)
def check_vcenter_options(config):
return (config.get('CONFIG_NOVA_INSTALL', 'y') == 'n' and
config.get('CONFIG_VMWARE_BACKEND', 'n') == 'y' and
config.get('CONFIG_CINDER_BACKEND', 'lvm') == 'vmdk')
paramsList = [
{"CMD_OPTION" : "cinder-vcenter-host",
"USAGE" : ("The IP address of the VMware vCenter datastore"),
"PROMPT" : ("Enter the IP address of the VMware vCenter datastore to use with Cinder"),
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ip],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "cinder-vcenter-username",
"USAGE" : ("The username to authenticate to VMware vCenter datastore"),
"PROMPT" : ("Enter the username to authenticate on VMware vCenter datastore"),
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_USER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False,},
{"CMD_OPTION" : "cinder-vcenter-password",
"USAGE" : ("The password to authenticate to VMware vCenter datastore"),
"PROMPT" : ("Enter the password to authenticate on VMware vCenter datastore"),
"VALIDATORS" : [validators.validate_not_empty],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_PASSWORD",
"VALIDATORS" : [validators.validate_not_empty],
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False,},
]
groupDict = { "GROUP_NAME" : "CINDERVCENTEROPTIONS",
"DESCRIPTION" : "Cinder VMware vCenter Config parameters",
"PRE_CONDITION" : check_vcenter_options,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True}
controller.addGroup(groupDict, paramsList)
def initSequences(controller):
if controller.CONF['CONFIG_CINDER_INSTALL'] != 'y':
@@ -362,6 +413,8 @@ def create_manifest(config):
manifestdata += getManifestTemplate("cinder_gluster.pp")
if config['CONFIG_CINDER_BACKEND'] == "nfs":
manifestdata += getManifestTemplate("cinder_nfs.pp")
if config['CONFIG_CINDER_BACKEND'] == "vmdk":
manifestdata += getManifestTemplate("cinder_vmdk.pp")
if config['CONFIG_CEILOMETER_INSTALL'] == 'y':
manifestdata += getManifestTemplate('cinder_ceilometer.pp')
if config['CONFIG_SWIFT_INSTALL'] == 'y':

View File

@@ -9,6 +9,7 @@ from packstack.installer import validators
from packstack.installer import basedefs, output_messages
from packstack.installer import utils
from packstack.modules.common import filtered_hosts
from packstack.modules.ospluginutils import gethostlist,\
getManifestTemplate,\
appendManifestFile
@@ -104,7 +105,7 @@ def createmanifest(config):
# I should be adding service entries with nagios_service but it appears to be broken
# http://projects.puppetlabs.com/issues/3420
service_entries = ''
for hostname in gethostlist(controller.CONF):
for hostname in gethostlist(config):
manifest_entries += nagios_host(hostname, address=hostname, use='linux-server')
service_entries += _serviceentry(name='load5-%s'%hostname, service_description='5 minute load average',
@@ -168,7 +169,7 @@ def createmanifest(config):
appendManifestFile(manifestfile, manifestdata)
def createnrpemanifests(config):
for hostname in gethostlist(controller.CONF):
for hostname in filtered_hosts(controller.CONF):
controller.CONF['CONFIG_NRPE_HOST'] = hostname
manifestfile = "%s_nagios_nrpe.pp" % hostname
manifestdata = getManifestTemplate("nagios_nrpe.pp")

View File

@@ -307,6 +307,50 @@ def initConfig(controllerObject):
"NEED_CONFIRM" : False,
"CONDITION" : False },
],
"NOVA_VCENTER": [
{"CMD_OPTION" : "nova-vcenter-host",
"USAGE" : ("The IP address of the VMware vCenter server"),
"PROMPT" : ("Enter the IP address of the VMware vCenter server to use with Nova"),
"OPTION_LIST" : [],
"VALIDATORS" : [validators.validate_ip],
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_HOST",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "nova-vcenter-username",
"USAGE" : ("The username to authenticate to VMware vCenter server"),
"PROMPT" : ("Enter the username to authenticate on VMware vCenter server"),
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_USER",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False,},
{"CMD_OPTION" : "nova-vcenter-password",
"USAGE" : ("The password to authenticate to VMware vCenter server"),
"PROMPT" : ("Enter the password to authenticate on VMware vCenter server"),
"DEFAULT_VALUE" : "",
"MASK_INPUT" : True,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_PASSWORD",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False,},
{"CMD_OPTION" : "nova-vcenter-cluster",
"USAGE" : ("The name of the vCenter cluster"),
"PROMPT" : ("Enter the name of the vCenter datastore"),
"DEFAULT_VALUE" : "",
"MASK_INPUT" : False,
"LOOSE_VALIDATION": True,
"CONF_NAME" : "CONFIG_VCENTER_CLUSTER_NAME",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False,},
],
}
def use_nova_network(config):
@@ -319,6 +363,10 @@ def initConfig(controllerObject):
config['CONFIG_NEUTRON_INSTALL'] != 'y' and \
config['CONFIG_NOVA_NETWORK_MANAGER'] == manager
def use_nova_vcenter(config):
return (config['CONFIG_NOVA_INSTALL'] == 'y' and
config['CONFIG_VMWARE_BACKEND'] == 'y')
nova_groups = [
{"GROUP_NAME" : "NOVA",
"DESCRIPTION" : "Nova Options",
@@ -338,6 +386,12 @@ def initConfig(controllerObject):
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True},
{"GROUP_NAME" : "NOVA_VCENTER",
"DESCRIPTION" : "Nova VMware vCenter Config parameters",
"PRE_CONDITION" : use_nova_vcenter,
"PRE_CONDITION_MATCH" : True,
"POST_CONDITION" : False,
"POST_CONDITION_MATCH" : True},
]
for group in nova_groups:
@@ -446,9 +500,17 @@ def createcomputemanifest(config):
for host in compute_hosts:
config["CONFIG_NOVA_COMPUTE_HOST"] = host
manifestdata = getManifestTemplate("nova_compute.pp")
if config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'gluster':
if config['CONFIG_VMWARE_BACKEND'] == 'y':
manifestdata += getManifestTemplate("nova_compute_vmware.pp")
else:
manifestdata += getManifestTemplate("nova_compute_libvirt.pp")
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'gluster'):
manifestdata += getManifestTemplate("nova_gluster.pp")
if config['CONFIG_CINDER_INSTALL'] == 'y' and config['CONFIG_CINDER_BACKEND'] == 'nfs':
if (config['CONFIG_VMWARE_BACKEND'] != 'y' and
config['CONFIG_CINDER_INSTALL'] == 'y' and
config['CONFIG_CINDER_BACKEND'] == 'nfs'):
manifestdata += getManifestTemplate("nova_nfs.pp")
manifestfile = "%s_nova.pp" % host

View File

@@ -212,6 +212,21 @@ def initConfig(controllerObject):
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "os-vmware",
"USAGE" : ("Set to 'y' if you want to use "
"VMware vCenter as hypervisor and storage"
"Otherwise set to 'n'."),
"PROMPT" : ("Do you want to use VMware vCenter as"
" hypervisor and datastore"),
"OPTION_LIST" : ["y","n"],
"DEFAULT_VALUE" : "n",
"VALIDATORS" : [validators.validate_options],
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "CONFIG_VMWARE_BACKEND",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "GLOBAL",
"DESCRIPTION" : "Global Options",

View File

@@ -0,0 +1,5 @@
class { 'cinder::volume::vmdk':
host_ip => "%(CONFIG_VCENTER_HOST)s",
host_username => "%(CONFIG_VCENTER_USER)s",
host_password => "%(CONFIG_VCENTER_PASSWORD)s",
}

View File

@@ -1,23 +1,8 @@
# Ensure Firewall changes happen before libvirt service start
# preventing a clash with rules being set by libvirt
Firewall <| |> -> Class['nova::compute::libvirt']
if $::is_virtual_packstack == "true" {
$libvirt_type = "qemu"
nova_config{
"DEFAULT/libvirt_cpu_mode": value => "none";
}
}else{
$libvirt_type = "kvm"
}
package{'python-cinderclient':
before => Class["nova"]
}
nova_config{
"DEFAULT/libvirt_inject_partition": value => "-1";
"DEFAULT/volume_api_class": value => "nova.volume.cinder.API";
}
@@ -27,24 +12,6 @@ class {"nova::compute":
vncserver_proxyclient_address => "%(CONFIG_NOVA_COMPUTE_HOST)s",
}
exec { 'qemu-kvm':
path => '/usr/bin',
command => 'yum install -y qemu-kvm',
before => Class['nova::compute::libvirt']
}
class { 'nova::compute::libvirt':
libvirt_type => "$libvirt_type",
vncserver_listen => "%(CONFIG_NOVA_COMPUTE_HOST)s",
}
exec {'load_kvm':
user => 'root',
command => '/bin/sh /etc/sysconfig/modules/kvm.modules',
onlyif => '/usr/bin/test -e /etc/sysconfig/modules/kvm.modules',
}
Class['nova::compute']-> Exec["load_kvm"]
# Note : remove this once we're installing a version of openstack that isn't
# supported on RHEL 6.3
@@ -72,23 +39,3 @@ exec {'tuned-virtual-host':
command => '/usr/sbin/tuned-adm profile virtual-host',
require => Service['tuned'],
}
file_line { 'libvirt-guests':
path => '/etc/sysconfig/libvirt-guests',
line => 'ON_BOOT=ignore',
match => '^[\s#]*ON_BOOT=.*',
require => Class['nova::compute::libvirt']
}
# Remove libvirt's default network (usually virbr0) as it's unnecessary and can be confusing
exec {'virsh-net-destroy-default':
onlyif => '/usr/bin/virsh net-list | grep default',
command => '/usr/bin/virsh net-destroy default',
require => Package['libvirt'],
}
exec {'virsh-net-undefine-default':
onlyif => '/usr/bin/virsh net-list --inactive | grep default',
command => '/usr/bin/virsh net-undefine default',
require => Exec['virsh-net-destroy-default'],
}

View File

@@ -0,0 +1,56 @@
Firewall <| |> -> Class['nova::compute::libvirt']
# Ensure Firewall changes happen before libvirt service start
# preventing a clash with rules being set by libvirt
if $::is_virtual_packstack == "true" {
$libvirt_type = "qemu"
nova_config{
"DEFAULT/libvirt_cpu_mode": value => "none";
}
}else{
$libvirt_type = "kvm"
}
nova_config{
"DEFAULT/libvirt_inject_partition": value => "-1";
}
exec { 'qemu-kvm':
path => '/usr/bin',
command => 'yum install -y qemu-kvm',
before => Class['nova::compute::libvirt']
}
class { 'nova::compute::libvirt':
libvirt_type => "$libvirt_type",
vncserver_listen => "%(CONFIG_NOVA_COMPUTE_HOST)s",
}
exec {'load_kvm':
user => 'root',
command => '/bin/sh /etc/sysconfig/modules/kvm.modules',
onlyif => '/usr/bin/test -e /etc/sysconfig/modules/kvm.modules',
}
Class['nova::compute']-> Exec["load_kvm"]
file_line { 'libvirt-guests':
path => '/etc/sysconfig/libvirt-guests',
line => 'ON_BOOT=ignore',
match => '^[\s#]*ON_BOOT=.*',
require => Class['nova::compute::libvirt']
}
# Remove libvirt's default network (usually virbr0) as it's unnecessary and can be confusing
exec {'virsh-net-destroy-default':
onlyif => '/usr/bin/virsh net-list | grep default',
command => '/usr/bin/virsh net-destroy default',
require => Package['libvirt'],
}
exec {'virsh-net-undefine-default':
onlyif => '/usr/bin/virsh net-list --inactive | grep default',
command => '/usr/bin/virsh net-undefine default',
require => Exec['virsh-net-destroy-default'],
}

View File

@@ -0,0 +1,6 @@
class { 'nova::compute::vmware':
host_ip => "%(CONFIG_VCENTER_HOST)s",
host_username => "%(CONFIG_VCENTER_USER)s",
host_password => "%(CONFIG_VCENTER_PASSWORD)s",
cluster_name => "%(CONFIG_VCENTER_CLUSTER_NAME)s",
}