HOL9821 Foster HOL9821 Enterprise Cloud Part1

Embed Size (px)

Citation preview

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    1/25

    !"#$%&%'($ *%'+,#$ -./01

    2&$"3#,45 6$&./78$"# '" 9: ;'"0#$(

    ?"#%/104#'/"

    "#$%&'# (& ()*+ ,-.%$# ,/#0 "&-$1 $.2 3 ().04+ 5&- 6&*0*07 8+9

    :)*+ $.2 ;*$$ (.4# >9 ,/#0=(.%4 *+ . /&/8$.- &/#0 +&8-%# %$&81 *05-.+(-8%(8-# ().(

    ).+ 2##0 *0(#7-.(#1 *0(& ,-.%$# =&$.-*+ >>9?9 ,/#0=(.%4 *0%$81#+ . 08'2#- &5

    +#-@*%#+ ().( )#$/

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    2/25

    P0*5*#1 K-%)*@# ;.+ %-#.(#1 .01 '.1# .@.*$.2$# ;)*%) '.4#+ 1#/$&>S1&;0$&.1+S80*5*#1T.-%)*@#+T??UVUWW9)('$

    N&;#@#-A 5&- ()*+ $.2 ;# ;*$$ %)&&+# . '.08.$ -&8(# (& 7*@#

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    3/25

    # svcadm enable rabbitmq# svcs rabbitmqSTATE STIME FMRIonline 23:58:04 svc:/application/rabbitmq:default

    9B -/"E'C0%'"C F$7(#/"$

    J#

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    4/25

    | adminurl | http://localhost:$(admin_port)s/v2.0 || id | cdd38de578ffe450a4ebd17e6345ed72 || internalurl | http://localhost:$(public_port)s/v2.0 || publicurl | http://localhost:$(public_port)s/v2.0 || region | RegionOne || service_id | db9909b96b916b6ed04a818c6f407df0 |+-------------+---------------------------------------++-------------+------------------------------------------------------+

    | Property | Value |+-------------+------------------------------------------------------+| adminurl | http://localhost:$(compute_port)s/v1.1/$(tenant_id)s || id | 48d62b0291f44c258f0bef5fe72024b9 || internalurl | http://localhost:$(compute_port)s/v1.1/$(tenant_id)s || publicurl | http://localhost:$(compute_port)s/v1.1/$(tenant_id)s || region | RegionOne || service_id | c38ced19a4894a5bc61cbb77e9868bbf |+-------------+------------------------------------------------------++-------------+----------------------------------------+| Property | Value |+-------------+----------------------------------------+| adminurl | http://localhost:8776/v1/$(tenant_id)s || id | 975e3db88eb56836e779e1b0e8d2dd21 || internalurl | http://localhost:8776/v1/$(tenant_id)s || publicurl | http://localhost:8776/v1/$(tenant_id)s || region | RegionOne |

    | service_id | 39daf3d31c0348f0ae32b04a2ed3dbc4 |+-------------+----------------------------------------++-------------+----------------------------------+| Property | Value |+-------------+----------------------------------+| adminurl | http://localhost:9292 || id | a77c1ed7d1a44751afeed55e2e0bbc99 || internalurl | http://localhost:9292 || publicurl | http://localhost:9292 || region | RegionOne || service_id | 903f1738fc066deed8a8c4a38925d1e5 |+-------------+----------------------------------++-------------+--------------------------------------+| Property | Value |+-------------+--------------------------------------+| adminurl | http://localhost:8773/services/Admin || id | 86d0e7f081d7e512b6638534f391b6ee |

    | internalurl | http://localhost:8773/services/Cloud || publicurl | http://localhost:8773/services/Cloud || region | RegionOne || service_id | 86b96889f88be522abf19d7ff8e7db18 |+-------------+--------------------------------------++-------------+---------------------------------------------+| Property | Value |+-------------+---------------------------------------------+| adminurl | http://localhost:8080/v1 || id | 756642548112e822be94a5da3a73588e || internalurl | http://localhost:8080/v1/AUTH_$(tenant_id)s || publicurl | http://localhost:8080/v1/AUTH_$(tenant_id)s || region | RegionOne || service_id | 6d22986ee9c76880e0f0c0da4aa8fe0f |+-------------+---------------------------------------------++-------------+----------------------------------+| Property | Value |+-------------+----------------------------------+| adminurl | http://localhost:9696/ || id | bbe5bf886bff4c089c0dbc42a65fa521 || internalurl | http://localhost:9696/ || publicurl | http://localhost:9696/ || region | RegionOne || service_id | f5c6aeb5a53bceb6f022b85e0b63956f |+-------------+----------------------------------+

    ^#(_+ @#-*5< ()*+ -#+8$( 2< +#((*07 #0@*-&0'#0(.$ @.-*.2$#+A =][`ME]a]DGX,MD:

    .01 =][`ME]a:,J]DA .01 -800*07 ()# 4#

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    5/25

    +----------------------------------+---------+---------+-------+| 5bdefb773d3c61fed79d96c5540f9766 | admin | True | || 8b54a70c235ee1179f15a198a70be099 | cinder | True | || 7949ac987dd5c514e778ba3932586109 | ec2 | True | || d79d19dc2945ed758747c2e2d8ab7e89 | glance | True | || ac11eb0e1aed68f2c45085797c8bade5 | neutron | True | || d9e6d0ddfbaf4ca6a6ee9bb951877d3d | nova | True | || eb3237eea75ae619aba6cf75a49f798f | swift | True | |

    +----------------------------------+---------+---------+-------+

    GB -/"E'C0%'"C H.,"4$

    L$.0%# *+ . +#-@*%# ().( /-&@*1#+ *'.7# '.0.7#'#0( *0 ,/#0=(.%49 M( -#+/&0+*2$#

    5&- +(&-*07 ()# .--.< &5 *'.7#+ ().(

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    6/25

    2'/" =I -%$,#$ 7/0% /J" K"'E'$1 L%4D'+$I

    =*0%# ;# 8+# ,-.%$# =&$.-*+ Y&0#+ .+ ()# @*-(8.$*B.(*&0 (#%)0&$&7< 5&- %&'/8(#A

    ;# ;*$$ 0##1 (& %-#.(# . 0&0T7$&2.$ B&0#9 M5

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    7/25

    GD= G& 0&( %&05*78-# GD=

    D.'# =#-@*%#+ D&0#

    :*'#B&0#S^&%.$# E)&&+# .0>

    SC profile successfully generated as:/etc/svc/profile/sysconfig/sysconfig-20140911-002744/sc_profile.xml

    Exiting System Configuration Tool. Log is available at:/system/volatile/sysconfig/sysconfig.log.4666Hostname: myzone

    myzone console login:

    "# %.0 0&; $&7 *0 ;*() -&&(S+&$.-*+>>C

    myzone console login: rootPassword: solaris11Sep 11 00:33:57 myzone login: ROOT LOGIN /dev/consoleOracle Corporation SunOS 5.11 11.2 June 2014

    [800*07 ()# @*-(*05& %&''.01A ;# %.0 +## ().( ;#_-# *0 . 0&0T7$&2.$ B&0#9

    root@myzone:~# virtinfoNAME CLASSnon-global-zone currentlogical-domain parent

    X-*&- (& %-#.(*07 ()# P0*5*#1 K-%)*@#A ;# 0##1 (& 1& &0# '&-# %&05*78-.(*&0 (-*%49

    ")#0 ;# 1#/$&< *0+(.0%#+ 8+*07 ,/#0=(.%4 ;# (

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    8/25

    Beginning final archive assembly...Archive creation complete

    K01 8/$&.1 ()*+ *'.7# (& L$.0%#C%1# export OS_AUTH_URL=http://localhost:5000/v2.0/# export OS_PASSWORD=glance

    # export OS_USERNAME=glance# export OS_TENANT_NAME=service# glance image-create --container-format bare --disk-format raw --is-public true --name "Base Zone" --property architecture=sparc64 --propertyhypervisor_type=solariszones --property vm_mode=solariszones < myzone.uar+----------------------------+--------------------------------------+| Property | Value |+----------------------------+--------------------------------------+| Property 'architecture' | sparc64 || Property 'hypervisor_type' | solariszones || Property 'vm_mode' | solariszones || checksum | 336bdfe5f76876fe24907e35479101e7 || container_format | bare || created_at | 2014-09-11T00:52:14.269232 || deleted | False || deleted_at | None || disk_format | raw |

    | id | b42e47ee-d8dc-e50c-d6e0-9206d761ce41 || is_public | True || min_disk | 0 || min_ram | 0 || name | Base Zone || owner | f17341f0a2a24ec9ec5f9ca497e8c0cc || protected | False || size | 1277245440 || status | active || updated_at | 2014-09-11T00:52:42.352947 |+----------------------------+--------------------------------------+

    2'/" 9I K($ #D$ !M'(#'"C K"'E'$1 L%4D'+$I

    "# ).@# /-#T%-#.(#1 . P0*5*#1 K-%)*@# ().(

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    9/25

    | 37f73649-a046-e40c-eb34-e2b914c22005 | Base Zone | raw | bare |1276948480 | active |+--------------------------------------+-----------+-------------+------------------+------------+--------+

    NB -/"E'C0%'"C O/+,

    D&@. *+ ()# %&'/8(# +#-@*%# *0 ,/#0=(.%4 -#+/&0+*2$# 5&- +%)#18$*07 .01

    1#/$&

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    10/25

    +-------------+--------------------------------------+| ec2 | Value |+-------------+--------------------------------------+| adminURL | http://localhost:8773/services/Admin || id | 1558b719141ae2fed54ff0bfe80cb646 || internalURL | http://localhost:8773/services/Cloud || publicURL | http://localhost:8773/services/Cloud || region | RegionOne |

    +-------------+--------------------------------------++-------------+----------------------------------------------------------------+| swift | Value |+-------------+----------------------------------------------------------------+| adminURL | http://localhost:8080/v1 || id | 51f1908de52f68af984c849985924e0b || internalURL | http://localhost:8080/v1/AUTH_f17341f0a2a24ec9ec5f9ca497e8c0cc || publicURL | http://localhost:8080/v1/AUTH_f17341f0a2a24ec9ec5f9ca497e8c0cc || region | RegionOne |+-------------+----------------------------------------------------------------++-------------+----------------------------------+| keystone | Value |+-------------+----------------------------------+| adminURL | http://localhost:35357/v2.0 || id | 371c73559bd842d6b961d021eeeaa2e5 || internalURL | http://localhost:5000/v2.0 || publicURL | http://localhost:5000/v2.0 |

    | region | RegionOne |+-------------+----------------------------------+

    M( $&&4+ (& 2# 580%(*&0*07 /-&/#-$

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    11/25

    ^#(_+ 5*-+( 7#0#-.(# ==N 4#

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    12/25

    # evsadm set-controlprop -p uplink-port=net0# evsadm show-controlpropPROPERTY PERM VALUE DEFAULT HOSTl2-type rw vxlan vlan --uplink-port rw net0 -- --vlan-range rw -- -- --vlan-range-avail r- -- -- --vxlan-addr rw 0.0.0.0 0.0.0.0 --

    vxlan-ipvers rw v4 v4 --vxlan-mgroup rw 0.0.0.0 0.0.0.0 --vxlan-range rw 200-300 -- --vxlan-range-avail r- 200-300 -- --

    D&; ().( ;# ).@# 1&0# ()# 2.+*% %&05*78-.(*&0 ;*() ]`=A ;# %.0 7& .)#.1 .01

    %&05*78-# D#8(-&0 (& 8+# ()*+ %&05*78-.(*&09 "# ;*$$ 8+# ()# +%-*/( 5&-

    %&0@#0*#0%#9

    # ./hol_single_host.py neutronconfiguring neutron# svcadm enable -rs neutron-server neutron-dhcp-agent

    ^#(_+ (#+( D#8(-&0 .01 '.4# +8-# ()*07+ .-# ;&-4*07C

    # export OS_AUTH_URL=http://localhost:5000/v2.0/# export OS_PASSWORD=neutron# export OS_USERNAME=neutron# export OS_TENANT_NAME=service# neutron net-list

    "# +## .0 #'/(< -#+8$(9 :)*+ *+ #R/#%(#1 +*0%# ;# ).@#0_( %-#.(#1 .0< 0#(;&-4+

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    13/25

    K5(#- +*70*07 *0

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    14/25

    "# %.0 +## ().( ()#-# .-# . 5#; 8+#-+ .$-#.1< 1#5*0#1 3 ()#+# 8+#-+ #*()#-

    -#/-#+#0( ()# .1'*0*+(-.(&- &- .-# 5&- ()# @.-*&8+ ,/#0=(.%4 +#-@*%#+9 ^#(_+ 7&

    .)#.1 .01 %$*%4 &0 ()# E-#.(# P+#- 28((&0 .01 5*$$ *0 +&'# 1#(.*$+ 5&- ()*+ 8+#-9

    "# ;*$$ *0%$81# ()#' *0 ()# 1#'& /-&6#%( 5&- 0&;A 28( ;# %&8$1 #Q8.$$< ).@#

    %-#.(#1 . 0#; /-&6#%( *5 ;# ;.0(#1 (&9

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    15/25

    =*70 &8( .01 $&7 *0 .+ ()*+ 0#; 8+#-9 :)# 0#R( ()*07 ;# 0##1 (& 1& *+ (& .11 .

    4#

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    16/25

    :)#-# .-# 0& 0#(;&-4+ %8--#0($< 1#5*0#19 ^#(_+ %-#.(# . 0#(;&-4 2< %$*%4*07 &0

    ()# E-#.(# D#(;&-4 28((&09 ^#(_+ %-#.(# . 0#(;&-4 %.$$#1 mynetwork;*() .+820#( %.$$#1 mysubnet8+*07 ()# 192.168.x.0/24.11-#++ -.07#9 :)*+'#.0+ ().( *0+(.0%#+ ().( %)&&+# ()*+ 0#(;&-4 ;*$$ 2# %-#.(#1 ;*()*0 ()*+ -.07#

    +(.-(*07 .( 192.168.x.39

    ,0%# ;# %-#.(# &8- 0#(;&-4A ;# +)&8$1 +## *( +8%%#++58$$< %-#.(#1 *0 ()#

    5&$$&;*07 +%-##0C

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    17/25

    D&; ;# .-# -#.1< (& $.80%) . 0#; *0+(.0%#9 E)&&+# ()# M0+(.0%#+ '#08 #0(-< (&

    7#( ()# 5&$$&;*07 +%-##0C

    VB @,0"4D'"C ," ?"(#,"4$

    ^#(_+ $.80%) . 0#; *0+(.0%# 2< %$*%4*07 &0 ()# ^.80%) M0+(.0%# 28((&09 "# ;*$$

    %.$$ &8- *0+(.0%# myinstance9 "# ;*$$ 7*@# *( .0 ,-.%$# =&$.-*+ 0&0T7$&2.$ B&0#3 (*0< 5$.@&-9 O$.@&-+ -#/-#+#0( ()# +*B# &5 ()# -#+&8-%#+ ().( ;# +)&8$1 7*@# ()*+

    *0+(.0%#9 "# %.0 +## )#-# ().( ;# ;*$$ 7#( . -&&( 1*+4 &5 >eLF .01 ?AeUWZF [KZ9

    "# ;*$$ %)&&+# (& 2&&( ()*+ *0+(.0%# 5-&' ()# *'.7# ().(_+ +(&-#1 *0 L$.0%# ().(

    ;# 8/$&.1#1 %.$$#1 F.+# Y&0#9

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    18/25

    ,0%# ;# .-# ).//< ;*() ()# G#(.*$+ (.2A ;# %.0 '&@# &0(& ()# K%%#++ h =#%8-*(>S1&;0$&.1+S80*5*#1T.-%)*@#+T??UVUWW9)('$

    ,-.%$# ,/#0=(.%4 &0 ,-.%$# =&$.-*+ :#%)0&$&7< X.7#

    )((/CSS;;;9&-.%$#9%&'S(#%)0#(;&-4S+#-@#-T

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    22/25

    +(&-.7#S+&$.-*+>>S(#%)0&$&7*#+S&/#0+(.%4T?>jVkkj9)('$

    L#((*07 =(.-(#1 ;*() ,/#0=(.%4 &0 ,-.%$# =&$.-*+

    )((/CSS;;;9&-.%$#9%&'S(#%)0#(;&-4S.-(*%$#+S+#-@#-+T+(&-.7#T.1'*0S7#((*07T

    +(.-(#1T&/#0+(.%4T&+>>T?T?>cVjWe9)('$

    =9B L&&$"1'M X 2&$"3#,45 -/"E'C0%,#'/" 34%'

    #!/usr/bin/python

    # Copyright (c) 2013, 2014, Oracle and/or its affiliates. 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.

    import ConfigParserimport grpimport osimport pwdimport shutilimport sysimport time

    import netifaces

    from M2Crypto import RSAfrom subprocess import CalledProcessError, Popen, PIPE, check_call

    def keystone():print "configuring keystone"config = ConfigParser.RawConfigParser()config.readfp(open("/etc/keystone/keystone.conf"))config.set("DEFAULT", "admin_token", "ADMIN")config.set("identity", "driver", "keystone.identity.backends.sql.Identity")config.set("catalog", "driver", "keystone.catalog.backends.sql.Catalog")config.set("token", "provider", "keystone.token.providers.uuid.Provider")config.set("signing", "token_format", "UUID")

    with open("/etc/keystone/keystone.conf", "wb") as fh:config.write(fh)

    def glance():print "configuring glance"

    config = ConfigParser.RawConfigParser()config.readfp(open("/etc/glance/glance-api.conf"))config.set("keystone_authtoken", "admin_tenant_name", "service")config.set("keystone_authtoken", "admin_user", "glance")config.set("keystone_authtoken", "admin_password", "glance")

    with open("/etc/glance/glance-api.conf", "wb") as fh:config.write(fh)

    config = ConfigParser.RawConfigParser()config.readfp(open("/etc/glance/glance-cache.conf"))config.set("DEFAULT", "auth_url", "http://127.0.0.1:5000/v2.0/")config.set("DEFAULT", "admin_tenant_name", "service")config.set("DEFAULT", "admin_user", "glance")config.set("DEFAULT", "admin_password", "glance")

    with open("/etc/glance/glance-cache.conf", "wb") as fh:config.write(fh)

    config = ConfigParser.RawConfigParser()config.readfp(open("/etc/glance/glance-registry.conf"))

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    23/25

    config.set("keystone_authtoken", "admin_tenant_name", "service")config.set("keystone_authtoken", "admin_user", "glance")config.set("keystone_authtoken", "admin_password", "glance")

    with open("/etc/glance/glance-registry.conf", "wb") as fh:config.write(fh)

    config = ConfigParser.RawConfigParser()config.readfp(open("/etc/glance/glance-api-paste.ini"))

    config.set("pipeline:glance-api","pipeline", "versionnegotiation authtoken context apiv1app")config.set("filter:authtoken", "auth_host", "127.0.0.1")config.set("filter:authtoken", "auth_port", "35357")config.set("filter:authtoken", "auth_protocol", "http")config.set("filter:authtoken", "admin_tenant_name", "service")config.set("filter:authtoken", "admin_user", "glance")config.set("filter:authtoken", "admin_password", "glance")

    with open("/etc/glance/glance-api-paste.ini", "wb") as fh:config.write(fh)

    config = ConfigParser.RawConfigParser()config.readfp(open("/etc/glance/glance-registry-paste.ini"))config.set("pipeline:glance-registry",

    "pipeline", "authtoken context apiv1app")config.set("filter:authtoken", "auth_host", "127.0.0.1")config.set("filter:authtoken", "auth_port", "35357")

    config.set("filter:authtoken", "auth_protocol", "http")config.set("filter:authtoken", "admin_tenant_name", "service")config.set("filter:authtoken", "admin_user", "glance")config.set("filter:authtoken", "admin_password", "glance")

    with open("/etc/glance/glance-registry-paste.ini", "wb") as fh:config.write(fh)

    config = ConfigParser.RawConfigParser()config.readfp(open("/etc/glance/glance-scrubber.conf"))config.set("DEFAULT", "filesystem_store_datadir", "/var/lib/glance/images")config.set("DEFAULT", "swift_store_auth_address", "127.0.0.1:5000/v2.0/")config.set("DEFAULT", "swift_store_user", "johndoe:johndoe")config.set("DEFAULT", "swift_store_key", "a86850deb2742ec3cb41518e26aa2d89")config.set("DEFAULT", "s3_store_host", "127.0.0.1:8080/v1.0/")config.set("DEFAULT", "s3_store_access_key", '""')config.set("DEFAULT", "s3_store_secret_key", '""')config.set("DEFAULT", "s3_store_bucket", '""')

    config.set("DEFAULT", "s3_store_create_bucket_on_put", "False")config.set("DEFAULT", "auth_url", "http://127.0.0.1:5000/v2.0/")config.set("DEFAULT", "admin_tenant_name", "service")config.set("DEFAULT", "admin_user", "glance")config.set("DEFAULT", "admin_password", "glance")

    with open("/etc/glance/glance-scrubber.conf", "wb") as fh:config.write(fh)

    def neutron():print "configuring neutron"config = ConfigParser.RawConfigParser()config.readfp(open("/etc/neutron/neutron.conf"))config.set("DEFAULT", "allow_overlapping_ips", "False")

    if not config.has_section("keystone_authtoken"):config.add_section("keystone_authtoken")

    config.set("keystone_authtoken", "auth_host", "127.0.0.1")config.set("keystone_authtoken", "auth_port", "35357")config.set("keystone_authtoken", "auth_protocol", "http")config.set("keystone_authtoken", "admin_tenant_name", "service")config.set("keystone_authtoken", "admin_user", "neutron")config.set("keystone_authtoken", "admin_password", "neutron")config.set("keystone_authtoken", "signing_dir",

    "/var/lib/neutron/keystone-signing")with open("/etc/neutron/neutron.conf", "wb") as fh:

    config.write(fh)

    def nova():print "configuring nova"config = ConfigParser.RawConfigParser()config.readfp(open("/etc/nova/nova.conf"))config.set("DEFAULT", "firewall_driver",

    "nova.virt.firewall.NoopFirewallDriver")

    config.set("DEFAULT", "neutron_url", "http://localhost:9696")config.set("DEFAULT", "neutron_admin_username", "neutron")config.set("DEFAULT", "neutron_admin_password", "neutron")config.set("DEFAULT", "neutron_admin_tenant_name", "service")

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    24/25

    config.set("DEFAULT", "neutron_admin_auth_url","http://localhost:5000/v2.0")

    config.set("DEFAULT", "neutron_auth_strategy", "keystone")with open("/etc/nova/nova.conf", "wb") as fh:

    config.write(fh)

    config = ConfigParser.RawConfigParser()config.readfp(open("/etc/nova/api-paste.ini"))

    config.set("filter:authtoken", "admin_tenant_name", "service")config.set("filter:authtoken", "admin_user", "nova")config.set("filter:authtoken", "admin_password", "nova")

    with open("/etc/nova/api-paste.ini", "wb") as fh:config.write(fh)

    def cinder():print "configuring cinder"config = ConfigParser.RawConfigParser()config.readfp(open("/etc/cinder/cinder.conf"))config.set("DEFAULT", "my_ip", "localhost")config.set("DEFAULT", "scheduler_driver",

    "cinder.scheduler.simple.SimpleScheduler")config.set("DEFAULT", "zfs_volume_base", "rpool/cinder")

    with open("/etc/cinder/cinder.conf", "wb") as fh:config.write(fh)

    config = ConfigParser.RawConfigParser()config.readfp(open("/etc/cinder/api-paste.ini"))config.set("filter:authtoken", "admin_tenant_name", "service")config.set("filter:authtoken", "admin_user", "cinder")config.set("filter:authtoken", "admin_password", "cinder")config.set("filter:authtoken", "signing_dir",

    "/var/lib/cinder/keystone-signing")with open("/etc/cinder/api-paste.ini", "wb") as fh:

    config.write(fh)

    def horizon():print "configuring horizon"# who loves sed?cmd = ["gsed", '-i',

    "-e", "s@SECURE_PROXY_SSL_HEADER@#SECURE_PROXY_SSL_HEADER@","-e", "s@CSRF_COOKIE_SECURE@#CSRF_COOKIE_SECURE@","-e", "s@SESSION_COOKIE_SECURE@#SESSION_COOKIE_SECURE@",

    "-e", "s@from horizon.utils @#from horizon.utils@","-e", "s@SECRET_KEY@#SECRET_KEY@","/etc/openstack_dashboard/local_settings.py"]

    try:check_call(cmd)

    except CalledProcessError:print "text/gnu-sed not installed: skipping horizon configuration."return

    def main(args):if not args:

    print "hol_single_host.py [args]"print "Arguments can be one of: all, keystone, glance, nova, cinder, horizon,

    neutron"

    if "all" in args:args = ["keystone", "glance", "nova", "cinder", "horizon", "swift",

    "neutron"]

    if "keystone" in args:keystone()

    if "glance" in args:glance()

    if "nova" in args:nova()

    if "cinder" in args:cinder()

    if "horizon" in args:

    horizon()if "neutron" in args:

    neutron()

  • 7/25/2019 HOL9821 Foster HOL9821 Enterprise Cloud Part1

    25/25

    if __name__ == "__main__":

    main(sys.argv[1:])