本文整理汇总了Python中myLib.runCheck函数的典型用法代码示例。如果您正苦于以下问题:Python runCheck函数的具体用法?Python runCheck怎么用?Python runCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了runCheck函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_cinder_config_files_on_storage
def setup_cinder_config_files_on_storage():
CINDER_DBPASS = passwd["CINDER_DBPASS"]
CINDER_PASS = passwd["CINDER_PASS"]
RABBIT_PASS = passwd["RABBIT_PASS"]
STORAGE_MANAGEMENT_IP = env_config.nicDictionary["storage1"]["mgtIPADDR"]
install_command = "yum install -y openstack-cinder targetcli python-oslo-db MySQL-python"
runCheck("Install packages on storage node", install_command)
set_parameter(
etc_cinder_config_file, "database", "connection", "mysql://cinder:{}@controller/cinder".format(CINDER_DBPASS)
)
set_parameter(etc_cinder_config_file, "DEFAULT", "rpc_backend", "rabbit")
set_parameter(etc_cinder_config_file, "DEFAULT", "rabbit_host", "controller")
set_parameter(etc_cinder_config_file, "DEFAULT", "rabbit_password", RABBIT_PASS)
set_parameter(etc_cinder_config_file, "DEFAULT", "auth_strategy", "keystone")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "auth_uri", "http://controller:5000/v2.0")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "identity_uri", "http://controller:35357")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "admin_tenant_name", "service")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "admin_user", "cinder")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "admin_password", CINDER_PASS)
set_parameter(etc_cinder_config_file, "DEFAULT", "my_ip", STORAGE_MANAGEMENT_IP)
set_parameter(etc_cinder_config_file, "DEFAULT", "iscsi_helper", "lioadm")
set_parameter(etc_cinder_config_file, "DEFAULT", "glance_host", "controller")
set_parameter(etc_cinder_config_file, "DEFAULT", "verbose", "True")
示例2: tdd
def tdd():
"""
Create some test instances
"""
with prefix(env_config.admin_openrc):
for tag in vlans:
netid = run("neutron net-list | grep vlan | awk '/%d/ {print $2}'" % tag)
if not netid:
print align_n("No vlan network found for tag %d" % tag)
sys.exit(1)
instanceName = 'test-vlan-%d' % tag
msg = 'Launch instance for vlan %d' % tag
runCheck(msg,
"nova boot "
"--flavor m1.tiny "
"--image cirros-test "
"--nic net-id=%s "
"--security-group default "
" %s"
% (netid, instanceName))
# restart all services
# execute(restartServices)
time.sleep(20)
run('nova list')
示例3: setup_cinder_config_files_on_controller
def setup_cinder_config_files_on_controller():
installation_command = "yum install -y openstack-cinder python-oslo-db MySQL-python"
# installation_command = "yum install -y openstack-cinder python-cinderclient python-oslo-db"
runCheck("Install the packages", installation_command)
set_parameter(
etc_cinder_config_file,
"database",
"connection",
"mysql://cinder:%[email protected]/cinder" % passwd["CINDER_DBPASS"],
)
set_parameter(etc_cinder_config_file, "DEFAULT", "rpc_backend", "rabbit")
set_parameter(etc_cinder_config_file, "DEFAULT", "rabbit_host", "controller")
set_parameter(etc_cinder_config_file, "DEFAULT", "rabbit_password", passwd["RABBIT_PASS"])
set_parameter(etc_cinder_config_file, "DEFAULT", "auth_strategy", "keystone")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "auth_uri", "http://controller:5000/v2.0")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "identity_uri", "http://controller:35357")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "admin_tenant_name", "service")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "admin_user", "cinder")
set_parameter(etc_cinder_config_file, "keystone_authtoken", "admin_password", passwd["CINDER_PASS"])
set_parameter(etc_cinder_config_file, "DEFAULT", "my_ip", env_config.nicDictionary["controller"]["mgtIPADDR"])
set_parameter(etc_cinder_config_file, "DEFAULT", "glance_host", "controller") # new line
set_parameter(etc_cinder_config_file, "DEFAULT", "verbose", "True")
示例4: test
def test():
with prefix(env_config.admin_openrc):
for tag in vlans:
try:
netid = run("neutron net-list | grep vlan | awk '/%d/ {print $2}'" % tag)
except:
print align_n("No vlan network found for tag %d" % tag)
raise ValueError
instanceName = 'test-vlan-%d' % tag
msg = 'Launch instance for vlan %d' % tag
try:
runCheck(msg,
"nova boot "
"--flavor m1.tiny "
"--image cirros-test "
"--nic net-id=%s "
"--security-group default "
" %s"
% (netid, instanceName))
except:
run('source neutron_log')
time.sleep(15)
run('nova list')
示例5: createInitialRings
def createInitialRings():
"""
Create 3 initial rings as a test
"""
managementIP = env_config.nicDictionary['compute1']['mgtIPADDR']
deviceLocation = swiftGlusterDir
deviceName = "rings"
deviceWeight = '100'
# deviceName = "/dev/sdd"
msg = 'create new directory for the rings'
runCheck(msg, 'mkdir -p %s/%s' % (deviceLocation, deviceName))
# create account ring
createRing('account',6002,managementIP,deviceName,deviceWeight)
# create container ring
createRing('container',6001,managementIP,deviceName,deviceWeight)
# create object ring
createRing('object',6000,managementIP,deviceName,deviceWeight)
execute(grabGZfiles)
execute(saveGZfiles)
示例6: controller_deploy
def controller_deploy():
execute(create_neutron_database)
execute(setup_keystone_controller)
execute(installPackagesController)
execute(configure_networking_server_component)
configure_ML2_plugin_general()
execute(configure_nova_to_use_neutron)
# The Networking service initialization scripts expect a symbolic link /etc/neutron/plugin.ini
# pointing to the ML2 plug-in configuration file, /etc/neutron/plugins/ml2/ml2_conf.ini.
# If this symbolic link does not exist, create it
if 'plugin.ini' not in run('ls /etc/neutron'):
msg = "Create symbolic link to ml2 conf file"
runCheck(msg, 'ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini')
msg = "Populate the database for neutron"
runCheck(msg, 'su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf ' + \
'--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade juno" neutron')
# Restart nova
msg = "Restart Nova services"
runCheck(msg, 'systemctl restart openstack-nova-api.service openstack-nova-scheduler.service' + \
' openstack-nova-conductor.service')
msg = "Enable Neutron service"
runCheck(msg, 'systemctl enable neutron-server.service')
msg = "Enable Neutron service"
runCheck(msg, 'systemctl start neutron-server.service')
execute(restart_nova_controller)
示例7: start_glance_services
def start_glance_services():
msg = "Enable glance services"
runCheck(msg, "systemctl enable openstack-glance-api.service "
"openstack-glance-registry.service")
msg = "Start glance services"
runCheck(msg, "systemctl start openstack-glance-api.service "
"openstack-glance-registry.service")
示例8: installPackagesCompute
def installPackagesCompute():
msg = "Install Neutron packages on " + env.host
runCheck(msg, "yum -y install "
"openstack-neutron-ml2 "
"openstack-neutron-openvswitch",
)
示例9: createRing
def createRing(typeRing,port,IP,deviceName,deviceWeight):
# ASSUMES A SINGLE DEVICE ON STORAGE NODE
port = str(port)
with cd('/etc/swift/'):
# verify if ring is already there
out = run("swift-ring-builder %s.builder" % (typeRing),quiet=True)
if 'does not exist' in out:
# ring is not created yet
# Create the base *.builder file
run("swift-ring-builder %s.builder create 10 3 1" % (typeRing))
# Add node to the ring
run("swift-ring-builder %s.builder add r1z1-%s:%s/%s %s" %
(typeRing,IP,port,deviceName,deviceWeight))
# rebalance ring
run("swift-ring-builder %s.builder rebalance" % (typeRing))
else:
print blue("Ring {} already exists. Nothing done".format(typeRing))
run("ls")
msg = 'Restart proxy server service'
runCheck(msg, 'systemctl restart openstack-swift-proxy.service')
示例10: createRouter
def createRouter():
"Create a virtual router for the VLANs"
router = 'router01'
if router in run('neutron router-list'):
print blue('Router %s already created' % router)
else:
msg = 'Create virtual router'
runCheck(msg, 'neutron router-create ' + router)
示例11: removeBridges
def removeBridges():
delete = ['br-ex']
for br in delete:
if br in run("ovs-vsctl list-br"):
msg = 'Delete bridge ' + br
runCheck(msg, "ovs-vsctl del-br " + br)
else:
print blue('No bridge called ' + br)
示例12: installPackagesController
def installPackagesController():
msg = "Install Neutron packages on controller"
runCheck(msg,
'yum -y install '
'openstack-neutron '
'openstack-neutron-ml2 '
'python-neutronclient '
'which')
示例13: setup_nova_database_on_controller
def setup_nova_database_on_controller():
NOVA_DBPASS = passwd['NOVA_DBPASS']
mysql_commands = createDatabaseScript('nova',NOVA_DBPASS)
msg = "Create database for Nova"
runCheck(msg, 'echo "' + mysql_commands + '" | mysql -u root -p' + env_config.passwd['ROOT_SECRET'])
示例14: start_cinder_services_on_controller
def start_cinder_services_on_controller():
services = ["openstack-cinder-api", "openstack-cinder-scheduler", "openstack-cinder-volume", "target"]
for service in services:
msg = "Enable %s service" % service
runCheck(msg, "systemctl enable %s.service" % service)
msg = "Start %s service" % service
runCheck(msg, "systemctl start %s.service" % service)
示例15: connectBridgeAndInterface
def connectBridgeAndInterface(tag):
"""
Given a VLAN tag, connect the corresponding bridge and virtual interface
"""
br = bridge[tag]
interface = virtualInterfaces[tag]
msg = 'Connect %s and %s' % (br, interface)
runCheck(msg, "ovs-vsctl add-port %s %s" % (br, interface))