Override TestVM-VMDK to use TinyCoreLinux image

* Add simple cloud-init to TinyCoreLinux image (for SSH key integration)
* Rebuild deb with TinyCoreLinux image
* Override hiera data for upload TinyCoreLinux image as 'TestVM-VMDK'

Change-Id: I464840b81a6d16f27de9bb2965762ab3017b2feb
This commit is contained in:
Artem Savinov 2015-10-28 14:45:32 +03:00
parent 4135f53158
commit 5c99c7c80d
6 changed files with 25 additions and 46 deletions

View File

@ -1,10 +0,0 @@
notice('fuel-plugin-nsxv: upload-glance-image.pp')
$access_hash = hiera_hash('access',{})
$controller_node = hiera('service_endpoint')
class { '::nsxv::upload_image':
os_username => $access_hash['user'],
os_password => $access_hash['password'],
os_auth_url => "http://${controller_node}:5000/v2.0/",
}

View File

@ -42,12 +42,28 @@ class nsxv::hiera_override (
<%= network_scheme.to_yaml %>") <%= network_scheme.to_yaml %>")
$neutron_advanced_configuration = inline_template("<%- $neutron_advanced_configuration = inline_template("<%-
require 'yaml'
neutron_advanced_configuration = { 'neutron_advanced_configuration' => scope.function_hiera(['neutron_advanced_configuration']) } neutron_advanced_configuration = { 'neutron_advanced_configuration' => scope.function_hiera(['neutron_advanced_configuration']) }
neutron_advanced_configuration['neutron_advanced_configuration']['neutron_dvr'] = false neutron_advanced_configuration['neutron_advanced_configuration']['neutron_dvr'] = false
neutron_advanced_configuration['neutron_advanced_configuration']['neutron_l2_pop'] = false neutron_advanced_configuration['neutron_advanced_configuration']['neutron_l2_pop'] = false
-%> -%>
<%= neutron_advanced_configuration.to_yaml %>") <%= neutron_advanced_configuration.to_yaml %>")
$override_testvm_image = inline_template("<%-
require 'yaml'
test_vm_image = {}
test_vm_image['os_name'] = 'TinyCoreLinux'
test_vm_image['img_path'] = '/usr/share/tcl-testvm/tcl.vmdk'
test_vm_image['container_format'] = 'bare'
test_vm_image['min_ram'] = '128'
test_vm_image['disk_format'] = 'vmdk'
test_vm_image['glance_properties'] = '--property hypervisor_type=vmware --property vmware_disktype=streamOptimized --property vmware_adaptertype=lsiLogic'
test_vm_image['img_name'] = 'TestVM-VMDK'
test_vm_image['public'] = 'true'
override_testvm_image = { 'test_vm_image' => test_vm_image }
-%>
<%= override_testvm_image.to_yaml %>")
file { $override_dir: file { $override_dir:
ensure => directory, ensure => directory,
} -> } ->
@ -81,6 +97,12 @@ class nsxv::hiera_override (
content => regsubst($neutron_advanced_configuration,'---',''), content => regsubst($neutron_advanced_configuration,'---',''),
order => '30' order => '30'
} }
concat::fragment{ 'override-testvm-image':
ensure => present,
target => $override_file,
content => regsubst($override_testvm_image,'---',''),
order => '40'
}
file_line {"${plugin_name}_hiera_override": file_line {"${plugin_name}_hiera_override":
path => '/etc/hiera.yaml', path => '/etc/hiera.yaml',

View File

@ -27,6 +27,9 @@ class nsxv (
package { $neutron_plugin_name: package { $neutron_plugin_name:
ensure => latest, ensure => latest,
} }
package { 'tcl-testvm':
ensure => latest,
}
$nsxv_config_dirs = [ '/etc/neutron', '/etc/neutron/plugins', '/etc/neutron/plugins/vmware' ] $nsxv_config_dirs = [ '/etc/neutron', '/etc/neutron/plugins', '/etc/neutron/plugins/vmware' ]
file { $nsxv_config_dirs: file { $nsxv_config_dirs:

View File

@ -1,29 +0,0 @@
class nsxv::upload_image (
$os_tenant_name = 'admin',
$os_username,
$os_password,
$os_auth_url,
$disk_format = 'vmdk',
$container_format = 'bare',
$public = 'true',
$img_name = 'TestVM-TCL',
$img_path = '/usr/share/tcl-testvm/tcl.vmdk',
$min_ram = 128,
) {
package { 'tcl-testvm':
ensure => latest,
}
exec { 'upload-img':
path => '/sbin:/usr/sbin:/bin:/usr/bin',
environment => [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
'OS_ENDPOINT_TYPE=internalURL',
],
command => "glance -k image-create --name=${img_name} --is-public=${public} --container-format=${container_format} --disk-format=${disk_format} --property hypervisor_type='vmware' --property vmware_disktype='streamOptimized' --property vmware_adaptertype='lsilogic' --min-ram ${min_ram} < ${img_path}",
unless => "glance -k image-list && (glance -k image-list | grep ${img_name})",
require => Package['tcl-testvm'],
}
}

View File

@ -5,10 +5,3 @@
puppet_manifest: puppet/manifests/patch-neutron-manifest.pp puppet_manifest: puppet/manifests/patch-neutron-manifest.pp
puppet_modules: puppet/modules puppet_modules: puppet/modules
timeout: 120 timeout: 120
- role: ['primary-controller']
stage: post_deployment/6010
type: puppet
parameters:
puppet_manifest: puppet/manifests/upload-glance-image.pp
puppet_modules: puppet/modules
timeout: 300