コード例 #1
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def stopNetworkManager():
     stopCmd = "service NetworkManager stop"
     chkconfigOffCmd = "chkconfig NetworkManager off"
     
     ShellCmdExecutor.execCmd(stopCmd)
     ShellCmdExecutor.execCmd(chkconfigOffCmd)
     pass
コード例 #2
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def install():
     yumCmd = "yum install openstack-utils -y"
     ShellCmdExecutor.execCmd(yumCmd)
     
     yumCmd = "yum install openstack-selinux -y"
     ShellCmdExecutor.execCmd(yumCmd)
     pass
コード例 #3
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def install():
     print 'RabbitMQ.install start====='
     yumCmd = "yum install -y rabbitmq-server.noarch"
     ShellCmdExecutor.execCmd(yumCmd)
     
     RabbitMQ.initRabbitMQ(RabbitMQ.INIT_USER_NAME, RabbitMQ.INIT_PASSWORD)
     print 'RabbitMQ.install done####'
     pass
コード例 #4
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def install():
     print 'MySQL.install start====='
     yumCmd = 'yum install mysql mysql-server MySQL-python -y'
     ShellCmdExecutor.execCmd(yumCmd)
     
     MySQL.initMySQL(MySQL.USERNAME, MySQL.INIT_PASSWORD)
     print 'MySQL.install done====='
     pass
コード例 #5
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def createAdminUser():
     ## create admin user
     ShellCmdExecutor.execCmd("keystone user-create --name=admin --pass=123456 [email protected]")
     ShellCmdExecutor.execCmd("keystone role-create --name=admin")
     ShellCmdExecutor.execCmd("keystone tenant-create --name=admin --description=\"Admin Tenant\"")
     ShellCmdExecutor.execCmd("keystone user-role-add --user=admin --tenant=admin --role=admin")
     ShellCmdExecutor.execCmd("keystone user-role-add --user=admin --role=_member_ --tenant=admin")
     pass
コード例 #6
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def install():
     print 'NTP.install start====='
     yumCmd = "yum install -y ntp"
     ShellCmdExecutor.execCmd(yumCmd)
     
     NTP.initNTP()
     print 'NTP.install done####'
     pass
コード例 #7
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def createDb(user, passwd, db_name):
     listDbCmd = 'mysql -u%s -p%s -e "show databases" | grep %s' % (user, passwd, db_name)
     output, exitcde = ShellCmdExecutor.execCmd(listDbCmd)
     if (db_name not in output) or output == '' or output == None :
         createDbCmd = 'mysql -u%s -p%s -e "create database %s"' % (user, passwd, db_name)
         output, exitcode = ShellCmdExecutor.execCmd(createDbCmd)
         print "output=%s--" % output
     else :
         print "The DB:%s already exists!" % db_name
         pass
     pass
コード例 #8
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def install():
     print 'Dashboard.install start===='
     yumCmd = "yum install memcached python-memcached mod_wsgi openstack-dashboard"
     ShellCmdExecutor.execCmd(yumCmd)
     Dashboard.configConfFile()
     
     #assign network connect
     ShellCmdExecutor.execCmd("setsebool -P httpd_can_network_connect on")
     Dashboard.start()
     print 'Dashboard.install done####'
     pass
コード例 #9
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def configMyConfFile():
     print 'start to config my.conf file====='
     curDir = os.getcwd()
     print "curDir=%s" % curDir
     curFileName = os.path.basename(curDir)
     mysqlConfDir = os.path.join(curDir.rstrip(curFileName), 'configfile.template', 'controller')
     mysqlConfFilePath = os.path.join(mysqlConfDir, 'my.cnf')
     print 'mysqlConfFilePath=%s' % mysqlConfFilePath
     cpMyCnfCmd = "sudo cp -rf %s /etc/" % mysqlConfFilePath
     ShellCmdExecutor.execCmd(cpMyCnfCmd)
     print 'config done####'
     pass
コード例 #10
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def configDB():
     createDbCmd = "CREATE DATABASE nova"
     MySQL.execMySQLCmd(MySQL.USERNAME, MySQL.INIT_PASSWORD, createDbCmd)
     
     grantCmd = "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY '123456'"
     MySQL.execMySQLCmd(MySQL.USERNAME, MySQL.INIT_PASSWORD, grantCmd)
     
     grantCmd = "GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY '123456'"
     MySQL.execMySQLCmd(MySQL.USERNAME, MySQL.INIT_PASSWORD, grantCmd)
     
     #Import db schema to Nova db
     importDBCmd = "su -s /bin/sh -c \"nova-manage db_sync\" nova"
     ShellCmdExecutor.execCmd(importDBCmd)
     pass
コード例 #11
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
    def createUserRole():
        '''
$ keystone endpoint-create --service-id $(keystone service-list | awk '/ network / {print $2}') --publicurl http://controller:9696 --adminurl http://controller:9696 --internalurl http://controller:9696

        '''
        ShellCmdExecutor.execCmd("keystone user-create --name neutron --pass 123456 --email [email protected]")
        ShellCmdExecutor.execCmd("keystone user-role-add --user neutron --tenant service --role admin")
        ShellCmdExecutor.execCmd("keystone service-create --name neutron --type network --description \"OpenStack Networking\"")
        ShellCmdExecutor.execCmd("keystone endpoint-create --service-id $(keystone service-list | awk '/ network / {print $2}') --publicurl http://controller:9696 --adminurl http://controller:9696 --internalurl http://controller:9696")
        pass
コード例 #12
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
    def install():
        '''
        1)    on Controller, Network node: modify neutron.conf
#### service_plugins add fwaas
service_plugins= router,firewall,lbaas

2)    modify fwaas.ini conf file: /etc/neutron/fwaas_driver.ini

[fwaas]
driver = neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver
enabled = True

3)    on Neutron-Controller, Network: lbaas.ini
[DEFAULT]
interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver
ovs_use_veth = True
device_driver = neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver

        '''
        
        #Install haproxy @network node, controller node
        ShellCmdExecutor.execCmd("yum intsall haproxy -y")
        
        #create nogroup , nobody @network, controller node
        ShellCmdExecutor.execCmd("groupadd nogroup")
        ShellCmdExecutor.execCmd("useradd -g nogroup nobody")

        '''
        4)    moidfy dashboard configuration to support use FWaaS
###on Controller Node,/etc/openstack-dashboard/local_settings

OPENSTACK_NEUTRON_NETWORK = {
    'enable_firewall': True,
}

OPENSTACK_NEUTRON_NETWORK = {
    'enable_lbaas': True,
}
        '''
        # restart  neutron server @ controller node
        ShellCmdExecutor.execCmd("/etc/init.d/neutron-server restart")
        
        #restart dashboard
        ShellCmdExecutor.execCmd("/etc/init.d/httpd restart")
        pass
コード例 #13
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
    def install():
        print 'Nova.install start===='
        yumCmd = "yum install -y openstack-nova-api openstack-nova-cert openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler python-novaclient"
        ShellCmdExecutor.execCmd(yumCmd)
        Nova.configConfFile()
        Nova.configDB()
        Nova.createUserRole()
        
#         ShellCmdExecutor.execCmd("keystone service-create --name=nova --type=compute --description=\"OpenStack Compute\"")
#         ShellCmdExecutor.execCmd("keystone endpoint-create --service-id=$(keystone service-list | awk '/ compute / {print $2}') --publicurl=http://192.168.122.80:8774/v2/%\(tenant_id\)s  --internalurl=http://192.168.122.80:8774/v2/%\(tenant_id\)s --adminurl=http://192.168.122.80:8774/v2/%\(tenant_id\)s")
#         
        Nova.start()
        
        #After Network node configuration done
        Nova.configAfterNetworkNodeConfiguration()
        Nova.restart()
        print 'Nova.install done####'
        pass
コード例 #14
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
    def install():
        Neutron.configDB()
        Neutron.createUserRole()
        
        #Install Neutron package,use ml2 as the second layer core_plugin
        yumCmd = "yum install openstack-neutron openstack-neutron-ml2 python-neutronclient -y"
        ShellCmdExecutor.execCmd(yumCmd)
        
        Neutron.configConfFile()
        
        #execute command to configure nova_admin_tenant_id
        ShellCmdExecutor.execCmd("openstack-config --set /etc/neutron/neutron.conf DEFAULT nova_admin_tenant_id $(keystone tenant-list | awk '/ service / { print $2 }')")

        #create soft link: from ml2_conf.ini to plugin.ini
        ShellCmdExecutor.execCmd("ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini")
        
        #start
        ShellCmdExecutor.execCmd("service neutron-server start")
        ShellCmdExecutor.execCmd("chkconfig neutron-server on")
        pass
コード例 #15
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def configKeyStone():
     #configure KeyStone to support PKI token
     cmd = "keystone-manage pki_setup --keystone-user keystone --keystone-group keystone"
     ShellCmdExecutor.execCmd(cmd)
     ShellCmdExecutor.execCmd("chown -R keystone:keystone /etc/keystone/ssl")
     ShellCmdExecutor.execCmd("chmod -R o-rwx /etc/keystone/ssl")
     
     pass
コード例 #16
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def initRabbitMQ(username, password):
     startCmd = "/etc/init.d/rabbitmq-server restart"
     ShellCmdExecutor.execCmd(startCmd)
     
     chkconfigCmd = "chkconfig rabbitmq-server on"
     ShellCmdExecutor.execCmd(chkconfigCmd)
     
     initPasswordCmd = "rabbitmqctl change_password %s %s" % (username, password)
     ShellCmdExecutor.execCmd(initPasswordCmd)
     pass
コード例 #17
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def install():
     yumCmd = "yum install yum-plugin-priorities -y"
     ShellCmdExecutor.execCmd(yumCmd)
     
     yumCmd = "yum install http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/rdo-release-icehouse-3.noarch.rpm -y"
     ShellCmdExecutor.execCmd(yumCmd)
     
     yumCmd = "yum install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm -y"
     ShellCmdExecutor.execCmd(yumCmd)
     pass
コード例 #18
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def initMySQL(user, initPasswd):
     #when mysql is installed,config file and the root password is None, init the db.
     MySQL.configMyConfFile()
     
     #start
     startCmd = "service mysql start"
     ShellCmdExecutor.execCmd(startCmd)
     
     #chkcofnig
     chkconfigCmd = "chkconfig mysql on"
     ShellCmdExecutor.execCmd(chkconfigCmd)
     
     initPasswdCmd = 'mysqladmin -u%s password %s' % (user, initPasswd)
     ShellCmdExecutor.execCmd(initPasswdCmd)
     pass
コード例 #19
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def configToEtcHosts(ip, domain):
     output, exitcode = ShellCmdExecutor.execCmd("cat /etc/hosts")
     if domain not in output :
         ShellCmdExecutor.execCmd("echo '%s  %s' >> /etc/hosts" % (ip, domain))
         pass
     pass
コード例 #20
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def start():
     ShellCmdExecutor.execCmd("service httpd restart")
     ShellCmdExecutor.execCmd("service memcached restart")
     ShellCmdExecutor.execCmd("chkconfig httpd on")
     ShellCmdExecutor.execCmd("chkconfig memcached on")
     pass
コード例 #21
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def createUserRole():
     #create nova user & role
     ShellCmdExecutor.execCmd("keystone user-create --name=nova --pass=123456 [email protected]")
     ShellCmdExecutor.execCmd("keystone user-role-add --user=nova --tenant=service --role=admin")
     pass
コード例 #22
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def stopIPTables():
     stopCmd = "service iptables stop"
     ShellCmdExecutor.execCmd(stopCmd)
     pass
コード例 #23
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
    def install():
        print "KeyStone.install start======="
        yumCmd = "yum install -y openstack-keystone python-keystoneclient"
        ShellCmdExecutor.execCmd(yumCmd)
        
        KeyStone.configConfFile()
        KeyStone.configDB()
        KeyStone.configKeyStone()
        #start
        ShellCmdExecutor.execCmd("service openstack-keystone start")
        ShellCmdExecutor.execCmd("chkconfig openstack-keystone on")
        #create user/tenant/role
        KeyStone.configEnvVar()
        ## create an admin user
        KeyStone.createAdminUser()
        ## create a normal user -- demo
        KeyStone.createDemoUser()
        #create service tenant
        ShellCmdExecutor.execCmd("keystone tenant-create --name=service --description=\"Service Tenant\"")
        #create keystone users,services & endpoint
        ShellCmdExecutor.execCmd("keystone service-create --name=keystone --type=identity --description=\"OpenStack Identity\"")

        cmd = "keystone endpoint-create \
        --service-id=$(keystone service-list | awk '/ identity / {print $2}') \
        --publicurl=http://controller:5000/v2.0 \
        --internalurl=http://controller:5000/v2.0 \
        --adminurl=http://controller:35357/v2.0"
        ShellCmdExecutor.execCmd(cmd)
        
        AdminOpenrc.sourceAdminOpenrc()        
        print "KeyStone.install done####"
        pass
コード例 #24
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def restart():
     #restart Controller nova-api service
     restartCmd = "service openstack-nova-api restart"
     ShellCmdExecutor.execCmd(restartCmd)
     pass
コード例 #25
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def configEnvVar():
     ## configure env var
     ShellCmdExecutor.execCmd("export OS_SERVICE_TOKEN=123456")
     ShellCmdExecutor.execCmd("export OS_SERVICE_ENDPOINT=http://controller:35357/v2.0")
     pass
コード例 #26
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def start():
     ShellCmdExecutor.execCmd("service openstack-nova-api start")
     ShellCmdExecutor.execCmd("service openstack-nova-cert start")
     ShellCmdExecutor.execCmd("service openstack-nova-consoleauth start")
     ShellCmdExecutor.execCmd("service openstack-nova-scheduler start")
     ShellCmdExecutor.execCmd("service openstack-nova-conductor start")
     ShellCmdExecutor.execCmd("service openstack-nova-novncproxy start")
     
     ShellCmdExecutor.execCmd("chkconfig openstack-nova-api on")
     ShellCmdExecutor.execCmd("chkconfig openstack-nova-cert on")
     ShellCmdExecutor.execCmd("chkconfig openstack-nova-consoleauth on ")
     ShellCmdExecutor.execCmd("chkconfig openstack-nova-scheduler on")
     ShellCmdExecutor.execCmd("chkconfig openstack-nova-conductor on")
     ShellCmdExecutor.execCmd("chkconfig openstack-nova-novncproxy on")
     pass
コード例 #27
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
    def install():
        print 'Glance.install start====='
        yumCmd = "yum install openstack-glance python-glanceclient"
        ShellCmdExecutor.execCmd(yumCmd)
        
        Glance.configConfFile()
        Glance.configDB()
        
        Glance.createGlanceUser()

        ShellCmdExecutor.execCmd("keystone service-create --name=glance --type=image --description=\"OpenStack Image Service\"")
        ShellCmdExecutor.execCmd("keystone endpoint-create --service-id=$(keystone service-list | awk '/ image / {print $2}') --publicurl=http://controller:9292 --internalurl=http://controller:9292 --adminurl=http://controller:9292")
        
        ShellCmdExecutor.execCmd("service openstack-glance-api start")
        ShellCmdExecutor.execCmd("service openstack-glance-registry start")
        ShellCmdExecutor.execCmd("chkconfig openstack-glance-api on")
        ShellCmdExecutor.execCmd("chkconfig openstack-glance-registry on")
        
        Glance.validation()
        
        print 'Glance.install done####'
        pass
コード例 #28
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def createDemoUser():
     ShellCmdExecutor.execCmd("keystone user-create --name=demo --pass=123456 [email protected]")
     ShellCmdExecutor.execCmd("keystone tenant-create --name=demo --description=\"Demo Tenant\"")
     ShellCmdExecutor.execCmd("keystone user-role-add --user=demo --role=_member_ --tenant=demo")
     pass
コード例 #29
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def initNTP():
     NTP.configNTPFile()
     
     restartNTPCmd = "service ntpd restart"
     ShellCmdExecutor.execCmd(restartNTPCmd)
     pass
コード例 #30
0
ファイル: controller.py プロジェクト: zbwzy/fuel-python
 def createGlanceUser():
     #prepare env var
     AdminOpenrc.sourceAdminOpenrc()
     ShellCmdExecutor.execCmd("keystone user-create --name=glance --pass=123456  [email protected]")
     ShellCmdExecutor.execCmd("keystone user-role-add --user=glance --tenant=service --role=admin")
     pass