• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python myLib.runCheck函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中myLib.runCheck函数的典型用法代码示例。如果您正苦于以下问题:Python runCheck函数的具体用法?Python runCheck怎么用?Python runCheck使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了runCheck函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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")
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:30,代码来源:fabfile.py


示例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')
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:26,代码来源:fabfile.py


示例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")
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:31,代码来源:fabfile.py


示例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')
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:25,代码来源:fabfile.serverworld.py


示例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)
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:25,代码来源:fabfile.py


示例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)
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:33,代码来源:fabfile.py


示例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")
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:7,代码来源:fabfile.py


示例8: installPackagesCompute

def installPackagesCompute():

    msg = "Install Neutron packages on " + env.host
    runCheck(msg, "yum -y install "
            "openstack-neutron-ml2 "
            "openstack-neutron-openvswitch",
            )
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:7,代码来源:fabfile.py


示例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')
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:27,代码来源:fabfile.py


示例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)
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:8,代码来源:fabfile.opencloudblog.py


示例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)
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:8,代码来源:fabfile.py


示例12: installPackagesController

def installPackagesController():
    msg = "Install Neutron packages on controller"
    runCheck(msg,
            'yum -y install '
            'openstack-neutron '
            'openstack-neutron-ml2 '
            'python-neutronclient '
            'which')
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:8,代码来源:fabfile.py


示例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'])
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:8,代码来源:fabfile.py


示例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)
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:8,代码来源:fabfile.py


示例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))
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:8,代码来源:fabfile.py


示例16: installPackagesNetwork

def installPackagesNetwork():
    msg = "Install Neutron packages on network"
    runCheck(msg,
            "yum -y install "
            "openstack-neutron "
            "openstack-neutron-ml2 "
            "openstack-neutron-openvswitch",
            )
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:8,代码来源:fabfile.py


示例17: make_nfs_directories

def make_nfs_directories():
    runCheck("Make nfs cinder directory", "mkdir %s" % nfs_share)
    runCheck("Make nfs swift directory", "mkdir /home/swift")

    runCheck("Setup exports file", "echo '%s 192.168.1.0/24(rw,sync)'>/etc/exports" % nfs_share)
    runCheck("Continue setting up exports file", "echo '/home/swift 192.168.1.0/24(rw,sync)'>>/etc/exports")

    runCheck("Change cinder NFS file permissions", "chown -R 65534:65534 %s/" % nfs_share)
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:8,代码来源:fabfile.py


示例18: removePort

def removePort(port):
    "Given a port name, remove it using the OVS CLI"

    # Check if the port exists
    if ('Port ' + port) in run('ovs-vsctl show ', quiet=True):
        msg = 'Remove port ' + port
        runCheck(msg, 'ovs-vsctl del-port ' + port)
    else:
        print 'No port named ' + port
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:9,代码来源:fabfile.opencloudblog.py


示例19: mount

def mount():
    runCheck('Make mount point', 'mkdir -p /mnt/gluster')
    if run("mount | grep '{}' | grep /mnt/gluster".format(gluster_volume),
            warn_only=True).return_code:
        runCheck('Mount mount point',
                'mount -t glusterfs {}:/{} /mnt/gluster'.format(
                    env.host, gluster_volume))
        append('/etc/fstab', '%s:/%s /mnt/gluster glusterfs log-file=/root/%s.log,rw,backupvolfile-server=%s 0 0'%(
            env.host, gluster_volume, gluster_volume, backup_volume_file_server))
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:9,代码来源:fabfile.py


示例20: mount

def mount(volume):
    runCheck('Make mount point', 'mkdir -p /mnt/gluster/{}'.format(volume))
    if run("mount | grep '{}' | grep /mnt/gluster/{}".format(volume, volume), 
            warn_only=True).return_code:
        runCheck('Mount mount point', 
                'mount -t glusterfs {}:/{} /mnt/gluster/{}'.format(
                    env.host, volume, volume))
        append('/etc/fstab', '%s:/%s /mnt/gluster/%s glusterfs log-file=/root/%s.log,rw 0 0'%(
            env.host, volume, volume, volume))
开发者ID:BottledTime,项目名称:openstack2015Co-op,代码行数:9,代码来源:glusterLib.py



注:本文中的myLib.runCheck函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python miro_app.MiroApp类代码示例发布时间:2022-05-27
下一篇:
Python test_utils.check_consistency函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap