Skip to content

Commit

Permalink
liberty support on R3.0
Browse files Browse the repository at this point in the history
Fabric changes to support liberty openstack release with contrail

Partial-Bug: #1547784

Change-Id: I0e9936391e9d46fd6a11186aa9b956f1d95ae9b3
  • Loading branch information
a committed Mar 10, 2016
1 parent 6b3c31f commit a155781
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 13 deletions.
47 changes: 35 additions & 12 deletions fabfile/tasks/helpers.py
Expand Up @@ -488,11 +488,19 @@ def add_images(image=None):
return
sudo("wget http://%s/%s" % (mount, local))
sudo("gunzip " + remote_gz)

cmd = "source /etc/contrail/openstackrc; {PRECMD}"\
" glance image-create --name {IMGNAME}"\
" --is-public True --container-format {IMGFORMAT}"\
" --disk-format {DISKFORMAT} {IMGFILE_OPT}"
os_type = detect_ostype()
openstack_sku = get_openstack_sku()

if os_type in ['ubuntu'] and openstack_sku in ['liberty']:
cmd = "source /etc/contrail/openstackrc; {PRECMD}"\
" glance image-create --name {IMGNAME}"\
" --visibility public --container-format {IMGFORMAT}"\
" --disk-format {DISKFORMAT} {IMGFILE_OPT}"
else:
cmd = "source /etc/contrail/openstackrc; {PRECMD}"\
" glance image-create --name {IMGNAME}"\
" --is-public True --container-format {IMGFORMAT}"\
" --disk-format {DISKFORMAT} {IMGFILE_OPT}"
if ".vmdk" in loc:
glance_kwargs = {'PRECMD': '',
'IMGNAME' : name,
Expand Down Expand Up @@ -581,15 +589,30 @@ def add_basic_images(image=None):
remote_gz = remote+".gz"
run("wget http://%s/%s" % (mount, local))
run("gunzip " + remote_gz)
if ".vmdk" in loc:
if 'converts' in loc:
glance_id = run("(source /etc/contrail/openstackrc; glance image-create --name '"+name+"' --is-public True --container-format bare --disk-format vmdk --property vmware_disktype='sparse' --property vmware_adaptertype='ide' < "+remote+" | grep -e 'id\>' | awk '{printf $4}')")

os_type = detect_ostype()
openstack_sku = get_openstack_sku()

if os_type in ['ubuntu'] and openstack_sku in ['liberty']:
if ".vmdk" in loc:
if 'converts' in loc:
glance_id = run("(source /etc/contrail/openstackrc; glance image-create --name '"+name+"' --visibility public --container-format bare --disk-format vmdk --property vmware_disktype='sparse' --property vmware_adaptertype='ide' < "+remote+" | grep -e 'id\>' | awk '{printf $4}')")
else:
glance_id = run("(source /etc/contrail/openstackrc; glance add name='"+name+"' --visibility public container_format=ovf disk_format=vmdk < "+remote+" | grep -e 'id\>' | awk '{printf $4}')")
if glance_id.succeeded:
preload_image_to_esx('http://%s/%s' % (mount,local), glance_id, sizes, openstack_version)
else:
glance_id = run("(source /etc/contrail/openstackrc; glance add name='"+name+"' is_public=true container_format=ovf disk_format=vmdk < "+remote+" | grep -e 'id\>' | awk '{printf $4}')")
if glance_id.succeeded:
preload_image_to_esx('http://%s/%s' % (mount,local), glance_id, sizes, openstack_version)
run("(source /etc/contrail/openstackrc; glance image-create --name '"+name+"' --visibility public --container-format ovf --disk-format qcow2 --property hypervisor_type=qemu < "+remote+")")
else:
run("(source /etc/contrail/openstackrc; glance image-create --name '"+name+"' --is-public True --container-format ovf --disk-format qcow2 --property hypervisor_type=qemu < "+remote+")")
if ".vmdk" in loc:
if 'converts' in loc:
glance_id = run("(source /etc/contrail/openstackrc; glance image-create --name '"+name+"' --is-public True --container-format bare --disk-format vmdk --property vmware_disktype='sparse' --property vmware_adaptertype='ide' < "+remote+" | grep -e 'id\>' | awk '{printf $4}')")
else:
glance_id = run("(source /etc/contrail/openstackrc; glance add name='"+name+"' is_public=true container_format=ovf disk_format=vmdk < "+remote+" | grep -e 'id\>' | awk '{printf $4}')")
if glance_id.succeeded:
preload_image_to_esx('http://%s/%s' % (mount,local), glance_id, sizes, openstack_version)
else:
run("(source /etc/contrail/openstackrc; glance image-create --name '"+name+"' --is-public True --container-format ovf --disk-format qcow2 --property hypervisor_type=qemu < "+remote+")")
run("rm "+remote)

#end add_basic_images
Expand Down
9 changes: 8 additions & 1 deletion fabfile/tasks/tester.py
Expand Up @@ -4,6 +4,7 @@
import string
import socket
import tempfile
from string import whitespace
from random import randrange
from datetime import datetime as dt
from fabfile.config import *
Expand Down Expand Up @@ -351,7 +352,13 @@ def setup_test_env():
if detect_ostype() in ['centos', 'redhat', 'centoslinux']:
sudo('yum -y install python-pip')
pkg = 'fixtures==1.0.0 testtools==1.7.1 testresources==0.2.7 discover \
testrepository junitxml pytun requests==2.3.0 pyvmomi==5.5.0 eventlet'
testrepository junitxml pytun pyvmomi==5.5.0 eventlet'
output = sudo('pip show requests | grep Version')
if output.succeeded:
version = output.split(':')[1].translate(None, whitespace)
if version <= 2.3:
if (LooseVersion(version) < LooseVersion('2.3.0')):
pkg += ' requests==2.3.0'
elif 'ubuntu' == detect_ostype():
pkg = 'fixtures==1.0.0 testtools==1.7.1 testresources==0.2.7 \
testrepository junitxml pytun requests==2.3.0 pyvmomi==5.5.0 eventlet'
Expand Down
2 changes: 2 additions & 0 deletions fabfile/utils/fabos.py
Expand Up @@ -51,6 +51,8 @@ def get_openstack_sku(use_install_repo=False):
openstack_sku = 'juno'
elif pkg_ver.find('2015.1') != -1:
openstack_sku = 'kilo'
elif pkg_ver.find('12.0') != -1:
openstack_sku = 'liberty'
else:
print "OpenStack distribution unknown.. assuming icehouse.."
openstack_sku = 'icehouse'
Expand Down

0 comments on commit a155781

Please sign in to comment.