From ff8bbcfbb6bc3442b5c67b5c29071e91df71c336 Mon Sep 17 00:00:00 2001 From: Luis Fernandez Alvarez Date: Tue, 18 Mar 2014 10:29:59 +0100 Subject: [PATCH] First version of openstack_hyper_v to align with stackforge/puppet-openstack --- Modulefile | 15 +- Puppetfile | 12 +- files/NovaComputeWindowsService.py | 119 --------- files/policy.json | 123 --------- .../provider/nova_config/ini_setting.rb | 36 --- lib/puppet/type/nova_config.rb | 39 --- manifests/compute.pp | 115 +++++++++ manifests/init.pp | 240 ------------------ manifests/nova_dependencies.pp | 125 --------- manifests/openstack/folders.pp | 33 --- manifests/params.pp | 61 ----- metadata.json | 2 +- spec/classes/openstack_hyper_v_spec.rb | 48 ---- 13 files changed, 121 insertions(+), 847 deletions(-) delete mode 100644 files/NovaComputeWindowsService.py delete mode 100644 files/policy.json delete mode 100644 lib/puppet/provider/nova_config/ini_setting.rb delete mode 100644 lib/puppet/type/nova_config.rb create mode 100644 manifests/compute.pp delete mode 100644 manifests/init.pp delete mode 100644 manifests/nova_dependencies.pp delete mode 100644 manifests/openstack/folders.pp delete mode 100644 manifests/params.pp delete mode 100644 spec/classes/openstack_hyper_v_spec.rb diff --git a/Modulefile b/Modulefile index aab5f42..5262a81 100644 --- a/Modulefile +++ b/Modulefile @@ -1,17 +1,10 @@ -name 'ppouliot-openstack_hyper_v' +name 'puppet-openstack_hyper_v' version '0.0.1' -source 'https://github.com/ppouliot/ppouliot-openstack_hyper_v.git' +source 'https://github.com/openstack-hyper-v/puppet-openstack_hyper_v.git' author 'Peter Pouliot ' license 'Apache 2.0' summary 'Module for building hyper-v/openstack compute' description 'puppet module for creating a hyper-v compute nodes' -dependency 'joshcooper/powershell' -dependency 'cprice404/inifile', '>= 0.9.0' -dependency 'basti1302/windows_path' -dependency 'puppetlabs/registry' dependency 'puppetlabs/stdlib' -dependency 'puppetlabs/vcsrepo' -dependency 'openstack-hyper-v/windows_git' -dependency 'openstack-hyper-v/windows_7zip' -dependency 'openstack-hyper-v/windows_common' -dependency 'openstack-hyper-v/hyper_v' +dependency 'openstack-hyper-v/nova_hyper_v' +dependency 'openstack-hyper-v/ceilometer_hyper_v' diff --git a/Puppetfile b/Puppetfile index a6657aa..dca46de 100644 --- a/Puppetfile +++ b/Puppetfile @@ -2,15 +2,5 @@ git_protocol=ENV['git_protocol'] || 'git' base_url = "#{git_protocol}://github.com" - # OpenStack Hyper-V Modules -mod 'puppetlabs/powershell', :git => "#{base_url}/joshcooper/puppetlabs-powershell" -mod 'puppetlabs/registry', :git => "#{base_url}/puppetlabs/puppetlabs-registry" -mod 'cprice404/inifile', :git => "#{base_url}/cprice-puppet/puppetlabs-inifile" -mod 'basti1302/windows-path', :git => "#{base_url}/basti1302/puppet-windows-path" -mod 'ppouliot/openstack_hyper_v', :git => "#{base_url}/ppouliot/ppouliot-openstack_hyper_v" -mod 'puppetlabs/stdlib', :git => "#{base_url}/puppetlabs/puppetlabs-stdlib" -mod 'puppetlabs/vcsrepo', :git => "#{base_url}/puppetlabs/puppetlabs-vcsrepo" -mod 'openstack-hyper-v/hyper_v', :git => "#{base_url}/openstack-hyper-v/puppet-hyper_v" -mod 'openstack-hyper-v/windows_common', :git => "#{base_url}/openstack-hyper-v/puppet-windows_common" -mod 'openstack-hyper-v/windows_git', :git => "#{base_url}/openstack-hyper-v/puppet-windows_git" +mod 'openstack-hyper-v/nova_hyper_v', :git => "#{base_url}/openstack-hyper-v/puppet-hyper_v" diff --git a/files/NovaComputeWindowsService.py b/files/NovaComputeWindowsService.py deleted file mode 100644 index a5a23c1..0000000 --- a/files/NovaComputeWindowsService.py +++ /dev/null @@ -1,119 +0,0 @@ -#!c:\Python27\python.exe -# vim: tabstop=4 shiftwidth=4 softtabstop=4 - -# Copyright 2010 United States Government as represented by the -# Administrator of the National Aeronautics and Space Administration. -# 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# 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. - -"""Starter script for Nova Compute.""" - -import eventlet -import os -import sys - -if os.name == 'nt': - # eventlet monkey patching causes subprocess.Popen to fail on Windows - # when using pipes due to missing non blocking I/O support - eventlet.monkey_patch(os=False) - import win32service - import win32serviceutil - import time - # using the service launcher messes up the dir tree so do this - NOVAPATH = sys.path[0] - NOVAPATH = NOVAPATH[:-3] - sys.path.insert(0, NOVAPATH) -else: - eventlet.monkey_patch() - -import os -import sys -import traceback - -from oslo.config import cfg - -# If ../nova/__init__.py exists, add ../ to Python search path, so that -# it will override what happens to be installed in /usr/(local/)lib/python... -POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), - os.pardir, - os.pardir)) -if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')): - sys.path.insert(0, POSSIBLE_TOPDIR) - - -from nova import config -import nova.db.api -from nova import exception -from nova.openstack.common import log as logging -from nova import service -from nova import utils - -CONF = cfg.CONF -CONF.import_opt('compute_topic', 'nova.compute.rpcapi') -CONF.import_opt('use_local', 'nova.conductor.api', group='conductor') -LOG = logging.getLogger('nova.compute') - - -def block_db_access(): - class NoDB(object): - def __getattr__(self, attr): - return self - - def __call__(self, *args, **kwargs): - stacktrace = "".join(traceback.format_stack()) - LOG.error('No db access allowed in nova-compute: %s' % stacktrace) - raise exception.DBNotAllowed('nova-compute') - - nova.db.api.IMPL = NoDB() - -class NovaComputeWindowsService(win32serviceutil.ServiceFramework): - _svc_name_ = "nova-compute" - _svc_display_name_ = "nova-compute" - _svc_description_ = "OpenStack Nova compute service for Hyper-V" - - def __init__(self,args): - win32serviceutil.ServiceFramework.__init__(self,args) - config.parse_args(sys.argv) - logging.setup('nova') - utils.monkey_patch() - - if not CONF.conductor.use_local: - block_db_access() - self.isAlive = True - - def SvcDoRun(self): - import servicemanager - - servicemanager.LogInfoMsg("OpenStack Compute: Starting") - - server = service.Service.create(binary='nova-compute', - topic=CONF.compute_topic, - db_allowed=False) - service.serve(server) - - while self.isAlive : - time.sleep(5) - - servicemanager.LogInfoMsg("OpenStack Compute: Stopped") - - def SvcStop(self): - import servicemanager - - servicemanager.LogInfoMsg("OpenStack Compute: Recieved stop signal") - self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) - self.isAlive = False - -if __name__ == '__main__': - win32serviceutil.HandleCommandLine(NovaComputeWindowsService) - diff --git a/files/policy.json b/files/policy.json deleted file mode 100644 index 03c0363..0000000 --- a/files/policy.json +++ /dev/null @@ -1,123 +0,0 @@ -{ - "context_is_admin": "role:admin", - "admin_or_owner": "is_admin:True or project_id:%(project_id)s", - "default": "rule:admin_or_owner", - - - "compute:create": "", - "compute:create:attach_network": "", - "compute:create:attach_volume": "", - "compute:create:forced_host": "is_admin:True", - "compute:get_all": "", - - - "admin_api": "is_admin:True", - "compute_extension:accounts": "rule:admin_api", - "compute_extension:admin_actions": "rule:admin_api", - "compute_extension:admin_actions:pause": "rule:admin_or_owner", - "compute_extension:admin_actions:unpause": "rule:admin_or_owner", - "compute_extension:admin_actions:suspend": "rule:admin_or_owner", - "compute_extension:admin_actions:resume": "rule:admin_or_owner", - "compute_extension:admin_actions:lock": "rule:admin_api", - "compute_extension:admin_actions:unlock": "rule:admin_api", - "compute_extension:admin_actions:resetNetwork": "rule:admin_api", - "compute_extension:admin_actions:injectNetworkInfo": "rule:admin_api", - "compute_extension:admin_actions:createBackup": "rule:admin_or_owner", - "compute_extension:admin_actions:migrateLive": "rule:admin_api", - "compute_extension:admin_actions:resetState": "rule:admin_api", - "compute_extension:admin_actions:migrate": "rule:admin_api", - "compute_extension:aggregates": "rule:admin_api", - "compute_extension:certificates": "", - "compute_extension:cloudpipe": "rule:admin_api", - "compute_extension:console_output": "", - "compute_extension:consoles": "", - "compute_extension:createserverext": "", - "compute_extension:deferred_delete": "", - "compute_extension:disk_config": "", - "compute_extension:extended_server_attributes": "rule:admin_api", - "compute_extension:extended_status": "", - "compute_extension:fixed_ips": "rule:admin_api", - "compute_extension:flavor_access": "", - "compute_extension:flavor_disabled": "", - "compute_extension:flavor_rxtx": "", - "compute_extension:flavor_swap": "", - "compute_extension:flavorextradata": "", - "compute_extension:flavorextraspecs": "", - "compute_extension:flavormanage": "rule:admin_api", - "compute_extension:floating_ip_dns": "", - "compute_extension:floating_ip_pools": "", - "compute_extension:floating_ips": "", - "compute_extension:hosts": "rule:admin_api", - "compute_extension:hypervisors": "rule:admin_api", - "compute_extension:instance_usage_audit_log": "rule:admin_api", - "compute_extension:keypairs": "", - "compute_extension:multinic": "", - "compute_extension:networks": "rule:admin_api", - "compute_extension:networks:view": "", - "compute_extension:quotas:show": "", - "compute_extension:quotas:update": "rule:admin_api", - "compute_extension:quota_classes": "", - "compute_extension:rescue": "", - "compute_extension:security_groups": "", - "compute_extension:server_diagnostics": "rule:admin_api", - "compute_extension:services": "rule:admin_api", - "compute_extension:simple_tenant_usage:show": "rule:admin_or_owner", - "compute_extension:simple_tenant_usage:list": "rule:admin_api", - "compute_extension:users": "rule:admin_api", - "compute_extension:virtual_interfaces": "", - "compute_extension:virtual_storage_arrays": "", - "compute_extension:volumes": "", - "compute_extension:volumetypes": "", - - - "volume:create": "", - "volume:get_all": "", - "volume:get_volume_metadata": "", - "volume:get_snapshot": "", - "volume:get_all_snapshots": "", - - - "volume_extension:types_manage": "rule:admin_api", - "volume_extension:types_extra_specs": "rule:admin_api", - "volume_extension:volume_admin_actions:reset_status": "rule:admin_api", - "volume_extension:snapshot_admin_actions:reset_status": "rule:admin_api", - "volume_extension:volume_admin_actions:force_delete": "rule:admin_api", - - - "network:get_all_networks": "", - "network:get_network": "", - "network:delete_network": "", - "network:disassociate_network": "", - "network:get_vifs_by_instance": "", - "network:allocate_for_instance": "", - "network:deallocate_for_instance": "", - "network:validate_networks": "", - "network:get_instance_uuids_by_ip_filter": "", - - "network:get_floating_ip": "", - "network:get_floating_ip_pools": "", - "network:get_floating_ip_by_address": "", - "network:get_floating_ips_by_project": "", - "network:get_floating_ips_by_fixed_address": "", - "network:allocate_floating_ip": "", - "network:deallocate_floating_ip": "", - "network:associate_floating_ip": "", - "network:disassociate_floating_ip": "", - - "network:get_fixed_ip": "", - "network:get_fixed_ip_by_address": "", - "network:add_fixed_ip_to_instance": "", - "network:remove_fixed_ip_from_instance": "", - "network:add_network_to_project": "", - "network:get_instance_nw_info": "", - - "network:get_dns_domains": "", - "network:add_dns_entry": "", - "network:modify_dns_entry": "", - "network:delete_dns_entry": "", - "network:get_dns_entries_by_address": "", - "network:get_dns_entries_by_name": "", - "network:create_private_dns_domain": "", - "network:create_public_dns_domain": "", - "network:delete_dns_domain": "" -} diff --git a/lib/puppet/provider/nova_config/ini_setting.rb b/lib/puppet/provider/nova_config/ini_setting.rb deleted file mode 100644 index 08ada51..0000000 --- a/lib/puppet/provider/nova_config/ini_setting.rb +++ /dev/null @@ -1,36 +0,0 @@ -Puppet::Type.type(:nova_config).provide( - :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) -) do - - # the setting is always default - # this if for backwards compat with the old puppet providers for nova_config - def section - resource[:name].split('/', 2)[0] - end - - # assumes that the name was the setting - # this is to maintain backwards compat with the the older - # stuff - def setting - resource[:name].split('/', 2)[1] - end - - def separator - '=' - end - - def self.file_path - if Facter['kernel'].value == 'windows' - 'C:/OpenStack/etc/nova.conf' - else - '/etc/nova/nova.conf' - end - end - - # this needs to be removed. This has been replaced with the class method - def file_path - self.class.file_path - end - -end diff --git a/lib/puppet/type/nova_config.rb b/lib/puppet/type/nova_config.rb deleted file mode 100644 index 1be791e..0000000 --- a/lib/puppet/type/nova_config.rb +++ /dev/null @@ -1,39 +0,0 @@ -Puppet::Type.newtype(:nova_config) do - -# def self.default_target -# "/etc/nova/nova.conf" -# end - - ensurable - - newparam(:name, :namevar => true) do - validate do |value| - unless value =~ /\S+\/\S+/ - fail("Invalid nova_config #{value}, entries without sections are no longer supported, please add an explicit section (probably DEFAULT) to all nova_config resources") - end - end - end - - newproperty(:value) do - munge do |value| - value.to_s - end - newvalues(/^[\S ]+$/) - end - - #newproperty(:target) do - # desc "Path to our nova config file" - # defaultto { - # Puppet::Type.type(:nova_config).default_target - # } - #end - - validate do - if self[:ensure] == :present - if self[:value].nil? || self[:value] == '' - raise Puppet::Error, "Property value must be set for #{self[:name]} when ensure is present" - end - end - end - -end diff --git a/manifests/compute.pp b/manifests/compute.pp new file mode 100644 index 0000000..4ea9330 --- /dev/null +++ b/manifests/compute.pp @@ -0,0 +1,115 @@ +# +# == Class: openstack_hyper_v::compute +# +# Manifest to install/configure nova-compute +# +# [purge_nova_config] +# Whether unmanaged nova.conf entries should be purged. +# (optional) Defaults to false. +# +# [rabbit_hosts] An array of IP addresses or Virttual IP address for connecting to a RabbitMQ Cluster. +# Optional. Defaults to false. +# +# === Examples +# +# class { 'openstack::compute': +# internal_address => '192.168.2.2', +# vncproxy_host => '192.168.1.1', +# nova_user_password => 'changeme', +# } + +class openstack_hyper_v::compute ( + # Required Network + $internal_address, + # Required Rabbit + $rabbit_password, + # Network + $network_manager = 'nova.network.manager.FlatDHCPManager', + # Nova + $purge_nova_config = true, + # Rabbit + $rabbit_host = '127.0.0.1', + $rabbit_hosts = false, + $rabbit_user = 'openstack', + $rabbit_virtual_host = '/', + # Glance + $glance_api_servers = false, + # Virtualization + $virtualization_driver = 'hyperv', + # Hyper-V + $mkisofs_cmd = undef, + $qemu_img_cmd = undef, + $instances_path = 'C:\OpenStack\instances', + $virtual_switch_address = $::ipaddress, + $hyperv_service_user = 'LocalSystem', + $hyperv_service_pass = '', + # General + $nova_repository = "git+https://github.com/openstack/nova.git", + $nova_version = "2013.1.4", + $nova_source = false, + $migration_support = false, + $verbose = false, + $debug = false, + $force_config_drive = false, + $enabled = true +) { + # + # indicates that all nova config entries that we did + # not specifify in Puppet should be purged from file + # + if ! defined( Resources[hyperv_nova_config] ) { + if ($purge_nova_config) { + resources { 'hyperv_nova_config': + purge => true, + } + } + } + + class { 'nova_hyper_v': + rabbit_userid => $rabbit_user, + rabbit_password => $rabbit_password, + image_service => 'nova.image.glance.GlanceImageService', + glance_api_servers => $glance_api_servers, + verbose => $verbose, + debug => $debug, + rabbit_host => $rabbit_host, + rabbit_hosts => $rabbit_hosts, + rabbit_virtual_host => $rabbit_virtual_host, + rabbit_config_cluster => true, + nova_repository => $nova_repository, + nova_version => $nova_version, + nova_source => $nova_source, + } + + # Install / configure nova-compute + class { '::nova_hyper_v::compute': + enabled => $enabled, + force_config_drive => $force_config_drive, + hyperv_service_user => $hyperv_service_user, + hyperv_service_pass => $hyperv_service_pass, + } + + # Configure virtualization driver for nova-compute + case $virtualization_driver { + #'libvirt': { + # class { 'nova_hyper_v::compute::libvirt': + # libvirt_type => $libvirt_type, + # vncserver_listen => $vncserver_listen_real, + # migration_support => $migration_support, + # } + #} + 'hyperv': { + class { 'nova_hyper_v::compute::hyperv': + live_migration => $migration_support, + instances_path => $instances_path, + } + } + default: { + fail("Unsupported virtualization driver: $virtualization_driver, module ${module_name} only support drivers: hyperv") + } + } + + class { 'nova_hyper_v::network': + network_manager => $network_manager, + } +} diff --git a/manifests/init.pp b/manifests/init.pp deleted file mode 100644 index efca439..0000000 --- a/manifests/init.pp +++ /dev/null @@ -1,240 +0,0 @@ -# === Class: openstack_hyper_v -# -# This module contains basic configuration tasks for building openstack_hyper_v -# compute nodes for openstack -# -# === Parameters -# -# [*nova_compute*] -# Enable or not nova compute service. Defaults to true. -# [*network_manager*] -# [*rabbit_host*] -# Location of rabbitmq installation. Optional. Defaults to localhost. -# [*rabbit_port*] -# Port for rabbitmq instance. Optional. Defaults to 5672. -# [*rabbit_userid*] -# User used to connect to rabbitmq. Optional. Defaults to guest. -# [*rabbit_password*] -# Password used to connect to rabbitmq. Optional. Defaults to guest. -# [*rabbit_virtual_host*] -# Location of rabbitmq installation. Optional. Defaults to localhost. -# [*image_service*] -# Service used to search for and retrieve images. Optional. Defaults to -# 'nova.image.local.LocalImageService' -# [*glance_api_servers*] -# List of addresses for api servers. Optional. Defaults to localhost:9292 -# [*instances_path*] -# [*mkisofs_cmd*] -# [*qemu_img_cmd*] -# [*auth_strategy*] -# Auth strategy used. Defaults to 'keystone'. -# [*live_migration*] -# Specify if the compute node will have the live migration enabled -# [*live_migration_type*] -# Authentication method used for migration: 'Kerberos' or 'CredSSP' -# [*live_migration_networks*] -# Comma separated list of the networks allowed in live migration. If the -# value is undef, any network will be allowed. -# [*virtual_switch_name*] -# Name of the virtual switch to define in the hypervisor. -# [*virtual_switch_address*] -# IP address of the physical adapter where the switch will be bound -# [*virtual_switch_os_managed*] -# Specifies if the management OS is to have access to the physical adapter -# [*purge_nova_config*] -# Specifies if the nova_config file will only have values configured with -# puppet. -# [*verbose*] -# Rather to print more verbose output. Optional. Defaults to false. -# [*debug*] -# -# == Examples -# -# class { 'openstack_hyper_v': -# live_migration => true, -# live_migration_type => 'Kerberos', -# live_migration_networks => '192.168.0.0/24', -# virtual_switch_name => 'br100', -# virtual_switch_address => '192.168.1.133', -# virtual_switch_os_managed => true, -# } -# -# == Authors -# -class openstack_hyper_v ( - # Services - $nova_compute = true, - # Network - $network_manager = 'nova.network.manager.FlatDHCPManager', - # Rabbit - $rabbit_hosts = false, - $rabbit_host = 'localhost', - $rabbit_port = '5672', - $rabbit_userid = 'guest', - $rabbit_password = 'guest', - $rabbit_virtual_host = '/', - #General - $image_service = 'nova.image.glance.GlanceImageService', - $glance_api_servers = 'localhost:9292', - $instances_path = 'C:\OpenStack\instances', - $mkisofs_cmd = undef, - $qemu_img_cmd = undef, - $auth_strategy = 'keystone', - # Live Migration - $live_migration = false, - $live_migration_type = 'Kerberos', - $live_migration_networks = undef, - # Virtual Switch - $virtual_switch_name = 'br100', - $virtual_switch_address = $::ipaddress, - $virtual_switch_os_managed = true, - # Others - $purge_nova_config = true, - $verbose = false, - $debug = false -){ - Class['openstack_hyper_v::openstack::folders'] -> Nova_config <| |> - Nova_config<| |> -> File['C:/OpenStack/etc/nova.conf'] - Nova_config<| |> ~> Service['nova-compute'] - - class { 'openstack_hyper_v::openstack::folders': } - - file { 'C:/OpenStack/etc/policy.json': - ensure => file, - source => "puppet:///modules/openstack_hyper_v/policy.json", - require => Class['openstack_hyper_v::openstack::folders'], - } - - class { 'hyper_v': } - - class { 'hyper_v::live_migration': - enable => $live_migration, - authentication_type => $live_migration_type, - allowed_networks => $live_migration_networks, - require => Class['hyper_v'], - } - - virtual_switch { $virtual_switch_name: - notes => 'OpenStack Compute Virtual Switch', - interface_address => $virtual_switch_address, - type => 'External', - os_managed => $virtual_switch_os_managed, - require => Class['hyper_v'], - } - - if ! defined( Resources[nova_config] ) { - if $purge_nova_config { - resources { 'nova_config': - purge => true, - } - } - } - - file { 'C:/OpenStack/etc/nova.conf': - ensure => file, - } - - nova_config { - # Network - 'DEFAULT/network_manager': value => $network_manager; - # Glance - 'DEFAULT/image_service': value => $image_service; - 'DEFAULT/glance_api_servers': value => $glance_api_servers; - # General - 'DEFAULT/logdir': value => 'C:\OpenStack\Log'; - 'DEFAULT/verbose': value => $verbose; - 'DEFAULT/debug': value => $debug; - 'DEFAULT/auth_strategy': value => $auth_strategy; - 'DEFAULT/volume_api_class': value => 'nova.volume.cinder.API'; - 'DEFAULT/rpc_backend': value => 'nova.openstack.common.rpc.impl_kombu'; - 'DEFAULT/use_cow_images': value => 'true'; - 'DEFAULT/config_drive_inject_password': value => 'false'; - 'DEFAULT/policy_file': value => 'C:\OpenStack\etc\policy.json'; - 'DEFAULT/allow_resize_to_same_host': value => 'true'; - 'DEFAULT/running_deleted_instance_action': value => 'reap'; - 'DEFAULT/running_deleted_instance_poll_interval': value => 120; - 'DEFAULT/resize_confirm_window': value => 5; - # Hyper-V - 'DEFAULT/vswitch_name': value => $virtual_switch_name; - 'DEFAULT/instances_path': value => $instances_path; - 'DEFAULT/limit_cpu_features': value => 'false'; - 'DEFAULT/mkisofs_cmd': value => $mkisofs_cmd; - 'DEFAULT/qemu_img_cmd': value => $qemu_img_cmd; - 'DEFAULT/compute_driver': value => 'nova.virt.hyperv.driver.HyperVDriver'; - } - - nova_config { - 'DEFAULT/rabbit_password': value => $rabbit_password; - 'DEFAULT/rabbit_userid': value => $rabbit_userid; - 'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host; - } - - if $rabbit_hosts { - nova_config { - 'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ','); - 'DEFAULT/rabbit_ha_queues': value => true; - } - } else { - nova_config { - 'DEFAULT/rabbit_host': value => $rabbit_host; - 'DEFAULT/rabbit_port': value => $rabbit_port; - 'DEFAULT/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}"; - 'DEFAULT/rabbit_ha_queues': value => false; - } - } - - class { 'openstack_hyper_v::nova_dependencies': } - - class { 'windows_git': } - - $nova_version = '2013.1.3' - - vcsrepo { "${::temp}\\nova-clone": - ensure => present, - provider => git, - source => 'https://github.com/openstack/nova', - revision => $nova_version, - require => Class['windows_git'], - } - - exec { 'install-nova-from-source': - command => 'python.exe setup.py install', - unless => "\$output = pip freeze; exit !(\$output.Contains('nova==${nova_version}'))", - cwd => "${::temp}\\nova-clone", - provider => powershell, - require => [Vcsrepo["${::temp}\\nova-clone"], - Class['openstack_hyper_v::nova_dependencies']], - } - - file { 'C:/OpenStack/scripts/NovaComputeWindowsService.py': - ensure => file, - source => "puppet:///modules/openstack_hyper_v/NovaComputeWindowsService.py", - require => Class['openstack_hyper_v::openstack::folders'], - } - - windows_python::windows_service { 'nova-compute': - description => 'OpenStack Nova compute service for Hyper-V', - start => auto, - arguments => '--config-file=C:\OpenStack\etc\nova.conf', - script => 'C:\OpenStack\scripts\NovaComputeWindowsService.NovaComputeWindowsService', - require => [File['C:/OpenStack/scripts/NovaComputeWindowsService.py'], - Class['hyper_v'], - Class['hyper_v::live_migration'], - Virtual_switch[$virtual_switch_name], - Exec['install-nova-from-source'],], - } - - if $nova_compute { - $service_state = 'running' - }else{ - $service_state = 'stopped' - } - - service { 'nova-compute': - name => 'nova-compute', - ensure => $service_state, - enable => true, - hasrestart => true, - require => Windows_python::Windows_service['nova-compute'], - } -} diff --git a/manifests/nova_dependencies.pp b/manifests/nova_dependencies.pp deleted file mode 100644 index 1d91ad1..0000000 --- a/manifests/nova_dependencies.pp +++ /dev/null @@ -1,125 +0,0 @@ -class openstack_hyper_v::nova_dependencies inherits openstack_hyper_v::params { - - Class['windows_python'] -> Class['mingw'] -> Windows_python::Dependency<| |> - - class { 'mingw': } - - class { 'windows_python': - python_source => $python_source, - python_installdir => $python_installdir, - easyinstall_source => $easyinstall_source, - pip_source => $pip_source, - } - - file { "C:/Python27/Lib/site-packages/posix_ipc-0.9.8-py2.7.egg-info": - ensure => file, - source => "puppet:///extra_files/hv-files/posix_ipc-0.9.8-py2.7.egg-info", - require => Class['windows_python'], - } - - file { "C:/Python27/Lib/site-packages/posix_ipc.pyd": - ensure => file, - source => "puppet:///extra_files/hv-files/posix_ipc.pyd", - require => Class['windows_python'], - } - - windows_python::dependency{ 'pbr': - source => $py_pbr_source, - version => $py_pbr_version, - type => pip, - require => Windows_python::Dependency['setuptools-git'], - } - - windows_python::dependency{ 'M2Crypto': - remote_url => $py_m2crypto_url, - source => $py_m2crypto_source, - version => $py_m2crypto_version, - type => exe, - } - - windows_python::dependency{ 'MySQL-python': - remote_url => $py_mysql_url, - source => $py_mysql_source, - version => $py_mysql_version, - type => exe, - } - - windows_python::dependency{ 'pycrypto': - remote_url => $py_pycrypto_url, - source => $py_pycrypto_source, - version => $py_pycrypto_version, - type => exe, - } - - windows_python::dependency{ 'pywin32': - remote_url => $py_pywin32_url, - source => $py_pywin32_source, - version => $py_pywin32_version, - type => exe, - } - - exec { 'pywin32-postinstall-script': - command => "${python_installdir}/python.exe ${python_installdir}/Scripts/pywin32_postinstall.py -install", - refreshonly => true, - subscribe => Windows_python::Dependency['pywin32'], - } - - windows_python::dependency{ 'greenlet': - remote_url => $py_greenlet_url, - source => $py_greenlet_source, - version => $py_greenlet_version, - type => exe, - } - - windows_python::dependency{ 'lxml': - remote_url => $py_lxml_url, - source => $py_lxml_source, - version => $py_lxml_version, - type => exe, - } - - windows_python::dependency{ 'virtualenv': - source => $py_virtualenv_source, - version => $py_virtualenv_version, - type => pip, - } - - windows_python::dependency{ 'eventlet': - source => $py_eventlet_source, - version => $py_eventlet_version, - type => pip, - require => Windows_python::Dependency['greenlet'], - } - - windows_python::dependency{ 'setuptools-git': - source => $py_setuptools_git_source, - version => $py_setuptools_git_version, - type => pip, - } - - windows_python::dependency{ 'numpy': - source => $py_numpy_source, - remote_url => $py_numpy_url, - version => $py_numpy_version, - type => exe, - } - - windows_python::dependency{ 'oslo.config': - source => $py_oslo_config_source, - version => $py_oslo_config_version, - type => pip, - } - - windows_python::dependency{ 'oslo.messaging': - source => $py_oslo_messaging_source, - version => $py_oslo_messaging_version, - type => pip, - } - - windows_python::dependency{ 'pyopenssl': - remote_url => $py_pyopenssl_url, - source => $py_pyopenssl_source, - version => $py_pyopenssl_version, - type => exe, - } -} diff --git a/manifests/openstack/folders.pp b/manifests/openstack/folders.pp deleted file mode 100644 index c67813e..0000000 --- a/manifests/openstack/folders.pp +++ /dev/null @@ -1,33 +0,0 @@ -# Class: openstack_hyper_v::openstack::folders -# -# This creates the default folder layout for the running configuration of openstack -# -# Parameters: none -# -# Actions: -# -class openstack_hyper_v::openstack::folders { - file { 'C:/OpenStack': - ensure => directory, - } - - file { 'C:/OpenStack/scripts': - ensure => directory, - require => File['C:/OpenStack'], - } - - file { 'C:/OpenStack/etc': - ensure => directory, - require => File['C:/OpenStack'], - } - - file { 'C:/OpenStack/Log': - ensure => directory, - require => File['C:/OpenStack'], - } - - file { 'C:/OpenStack/instances': - ensure => directory, - require => File['C:/OpenStack'], - } -} diff --git a/manifests/params.pp b/manifests/params.pp deleted file mode 100644 index 07ee735..0000000 --- a/manifests/params.pp +++ /dev/null @@ -1,61 +0,0 @@ -class openstack_hyper_v::params { - # Python base installation - $python_source = undef - $python_installdir = 'C:\Python27' - $easyinstall_source = undef - $pip_source = undef - - # Python dependencies - $py_pbr_source = undef - $py_pbr_version = latest - - $py_m2crypto_version = '0.21.1' -# $py_m2crypto_url = 'http://chandlerproject.org/pub/Projects/MeTooCrypto/M2Crypto-0.21.1.win32-py2.7.exe' - $py_m2crypto_url = 'http://10.21.7.22/hv-files/M2Crypto-0.21.1.exe' - $py_m2crypto_source = undef - - $py_mysql_version = latest #'1.2.3' - $py_mysql_url = 'http://10.21.7.22/hv-files/MySQL-python-1.2.5.win32-py2.7.exe' -# $py_mysql_url = undef #'http://www.codegood.com/download/10/' - $py_mysql_source = undef - - $py_pycrypto_version = '2.6' - $py_pycrypto_url = 'http://www.voidspace.org.uk/downloads/pycrypto26/pycrypto-2.6.win32-py2.7.exe' - $py_pycrypto_source = undef - - $py_pywin32_version = '217' - $py_pywin32_url = 'http://sourceforge.net/projects/pywin32/files/pywin32/Build%20217/pywin32-217.win32-py2.7.exe/download' - $py_pywin32_source = undef - - $py_greenlet_version = '0.4.4' - $py_greenlet_url = 'https://pypi.python.org/packages/2.7/g/greenlet/greenlet-0.4.4.win32-py2.7.exe' - $py_greenlet_source = undef - - $py_lxml_version = '2.3' - $py_lxml_url = 'https://pypi.python.org/packages/2.7/l/lxml/lxml-2.3.win32-py2.7.exe#md5=9c02aae672870701377750121f5a6f84' - $py_lxml_source = undef - - $py_eventlet_source = undef - $py_eventlet_version = '0.15.2' - - $py_setuptools_git_source = undef - $py_setuptools_git_version = '0.4.0' - - $py_numpy_version = '1.7.1' - $py_numpy_url = 'https://pypi.python.org/packages/2.7/n/numpy/numpy-1.7.1.win32-py2.7.exe' - $py_numpy_source = undef - - $py_oslo_config_source = undef - $py_oslo_config_version = '1.4.0' - - $py_oslo_messaging_source = undef - $py_oslo_messaging_version = '1.4.1' - - $py_pyopenssl_source = undef - $py_pyopenssl_url = 'https://pypi.python.org/packages/2.7/p/pyOpenSSL/pyOpenSSL-0.13.1.win32-py2.7.exe' - $py_pyopenssl_version = '0.13.1' - - $py_virtualenv_source = undef - $py_virtualenv_version = undef -} - diff --git a/metadata.json b/metadata.json index dbbd9ef..abd8469 100644 --- a/metadata.json +++ b/metadata.json @@ -1,5 +1,5 @@ { - "name": "ppouliot-openstack_hyper_v", + "name": "puppet-openstack_hyper_v", "author": "Peter J. Pouliot", "description": "Starting Point for building openstack windows compute nodes\n", "license": "Apache", diff --git a/spec/classes/openstack_hyper_v_spec.rb b/spec/classes/openstack_hyper_v_spec.rb deleted file mode 100644 index 674fc95..0000000 --- a/spec/classes/openstack_hyper_v_spec.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'spec_helper' - -describe 'openstack_hyper_v', :type => :class do - - context "On Windows platforms" do - - let :facts do - { - :osfamily => 'windows' - } - end - - it { - should contain_service('nova-compute').with( { 'ensure' => 'running' } ) - } - end - - context "On Windows platforms with a Virtual Switch name specified" do - let :params do - { - :virtual_switch_name => 'virtual_switch_name' - } - end - - let :facts do - { - :osfamily => 'windows' - } - end - - it { - should contain_virtual_switch('virtual_switch_name').with( {'name' => 'virtual_switch_name'} ) - } - end - - context "On an unsupported OS" do - - let :facts do - { - :osfamily => 'linux' - } - end - - it { - expect { should raise_error(Puppet::Error) } - } - end -end