当前位置: 首页>>代码示例>>Python>>正文


Python SSHClient.load方法代码示例

本文整理汇总了Python中ovs.extensions.generic.sshclient.SSHClient.load方法的典型用法代码示例。如果您正苦于以下问题:Python SSHClient.load方法的具体用法?Python SSHClient.load怎么用?Python SSHClient.load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ovs.extensions.generic.sshclient.SSHClient的用法示例。


在下文中一共展示了SSHClient.load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: status

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
    def status(cluster_name, ip):
        client = SSHClient.load(ip)
        cmd = """
from ovs.plugin.provider.service import Service
print Service.get_service_status('arakoon-{0}')
""".format(cluster_name)
        System.exec_remote_python(client, cmd)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:9,代码来源:ArakoonInstaller.py

示例2: shrink_cluster

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
 def shrink_cluster(remaining_node_ip, deleted_node_ip, cluster_name):
     ai = ArakoonInstaller()
     ai.load_config_from(cluster_name, remaining_node_ip)
     client = SSHClient.load(deleted_node_ip)
     deleted_node_id = System.get_my_machine_id(client)
     ai.delete_dir_structure(client)
     ai.remove_node_from_config(deleted_node_id)
     ai.upload_config_for(cluster_name)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:10,代码来源:ArakoonInstaller.py

示例3: catchup_cluster_node

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
    def catchup_cluster_node(cluster_name, ip):
        client = SSHClient.load(ip)
        cmd = """
from ovs.extensions.db.arakoon.ArakoonManagement import ArakoonManagementEx
cluster = ArakoonManagementEx().getCluster('{0}')
cluster.catchup_node()
""".format(cluster_name)
        System.exec_remote_python(client, cmd)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:10,代码来源:ArakoonInstaller.py

示例4: mds_checkup

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
 def mds_checkup():
     """
     Validates the current MDS setup/configuration and takes actions where required
     """
     mds_dict = {}
     for vpool in VPoolList.get_vpools():
         for mds_service in vpool.mds_services:
             storagerouter = mds_service.service.storagerouter
             if vpool not in mds_dict:
                 mds_dict[vpool] = {}
             if storagerouter not in mds_dict[vpool]:
                 mds_dict[vpool][storagerouter] = []
             mds_dict[vpool][storagerouter].append(mds_service)
     for vpool in mds_dict:
         # 1. First, make sure there's at least one MDS on every StorageRouter that's not overloaded
         # If not, create an extra MDS for that StorageRouter
         for storagerouter in mds_dict[vpool]:
             mds_services = mds_dict[vpool][storagerouter]
             has_room = False
             for mds_service in mds_services:
                 load, _ = MDSServiceController.get_mds_load(mds_service)
                 if load < Configuration.getInt('ovs.storagedriver.mds.maxload'):
                     has_room = True
                     break
             if has_room is False:
                 client = SSHClient.load(storagerouter.ip)
                 mds_service = MDSServiceController.prepare_mds_service(client, storagerouter, vpool,
                                                                        fresh_only=False, start=True)
                 if mds_service is None:
                     raise RuntimeError('Could not add MDS node')
                 mds_dict[vpool][storagerouter].append(mds_service)
         mds_config_set = MDSServiceController.get_mds_storagedriver_config_set(vpool)
         for storagerouter in mds_dict[vpool]:
             client = SSHClient.load(storagerouter.ip)
             storagedriver_config = StorageDriverConfiguration('storagedriver', vpool.name)
             storagedriver_config.load(client)
             if storagedriver_config.is_new is False:
                 storagedriver_config.clean()  # Clean out obsolete values
                 storagedriver_config.configure_filesystem(
                     fs_metadata_backend_mds_nodes=mds_config_set[storagerouter.guid]
                 )
                 storagedriver_config.save(client)
         # 2. Per VPool, execute a safety check, making sure the master/slave configuration is optimal.
         for vdisk in vpool.vdisks:
             MDSServiceController.ensure_safety(vdisk)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:47,代码来源:mdsservice.py

示例5: get_config_from

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
 def get_config_from(cluster_name, master_ip, master_password=None):
     """
     Gets a config object representation for the cluster on master
     """
     client = SSHClient.load(master_ip, master_password)
     cfg_file = client.file_read(ArakoonInstaller.ARAKOON_CONFIG_FILE.format(cluster_name))
     cfg = RawConfigParser()
     cfg.readfp(StringIO(cfg_file))
     return cfg
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:11,代码来源:ArakoonInstaller.py

示例6: test_single_node

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
 def test_single_node(self):
     base_port = Configuration.getInt('ovs.ports.arakoon')
     cluster = 'one'
     node = sorted(TestArakoonInstaller.nodes.keys())[0]
     ArakoonInstaller.create_cluster(cluster, node, [])
     contents = SSHClient.load(node).file_read(self._get_config_path(cluster))
     expected  = TestArakoonInstaller.expected_global.format(cluster, TestArakoonInstaller.nodes[node])
     expected += TestArakoonInstaller.expected_base.format(TestArakoonInstaller.nodes[node], node, base_port, base_port + 1)
     self.assertEqual(contents.strip(), expected.strip())
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:11,代码来源:test_arakoonInstaller.py

示例7: create_cluster

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
 def create_cluster(cluster_name, ip, exclude_ports, plugins=None):
     ai = ArakoonInstaller()
     ai.clear_config()
     client = SSHClient.load(ip)
     port_range = System.read_remote_config(client, 'ovs.ports.arakoon')
     free_ports = System.get_free_ports(port_range, exclude_ports, 2, client)
     ai.create_config(cluster_name, ip, free_ports[0], free_ports[1], plugins)
     ai.generate_configs(client)
     ai.create_dir_structure(client)
     return {'client_port': free_ports[0],
             'messaging_port': free_ports[1]}
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:13,代码来源:ArakoonInstaller.py

示例8: extend_cluster

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
 def extend_cluster(src_ip, tgt_ip, cluster_name, exclude_ports):
     ai = ArakoonInstaller()
     ai.load_config_from(cluster_name, src_ip)
     client = SSHClient.load(tgt_ip)
     tgt_id = System.get_my_machine_id(client)
     port_range = System.read_remote_config(client, 'ovs.ports.arakoon')
     free_ports = System.get_free_ports(port_range, exclude_ports, 2, client)
     ai.create_dir_structure(client)
     ai.add_node_to_config(tgt_id, tgt_ip, free_ports[0], free_ports[1])
     ai.upload_config_for(cluster_name)
     return {'client_port': free_ports[0],
             'messaging_port': free_ports[1]}
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:14,代码来源:ArakoonInstaller.py

示例9: upload_config_for

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
    def upload_config_for(self, cluster_name):
        if self.config.cluster_name != cluster_name:
            raise RuntimeError('Configuration is not setup for: {0} '.format(cluster_name))

        cluster_ips = list()
        for node in self.config.nodes:
            cluster_ips.append(node.ip)

        for ip in cluster_ips:
            client = SSHClient.load(ip)
            self.generate_config(client)
            self.generate_upstart_config(client)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:14,代码来源:ArakoonInstaller.py

示例10: test_multi_node

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
 def test_multi_node(self):
     base_port = Configuration.getInt('ovs.ports.arakoon')
     cluster = 'one'
     nodes = sorted(TestArakoonInstaller.nodes.keys())
     ArakoonInstaller.create_cluster(cluster, nodes[0], [])
     for node in nodes[1:]:
         ArakoonInstaller.extend_cluster(nodes[0], node, cluster, [])
     expected = TestArakoonInstaller.expected_global.format(cluster, ','.join(TestArakoonInstaller.nodes[node] for node in nodes))
     for node in nodes:
         expected += TestArakoonInstaller.expected_base.format(TestArakoonInstaller.nodes[node], node, base_port, base_port + 1)
     expected = expected.strip()
     for node in nodes:
         contents = SSHClient.load(node).file_read(self._get_config_path(cluster))
         self.assertEqual(contents.strip(), expected.strip())
     node = nodes[0]
     ArakoonInstaller.shrink_cluster(nodes[1], node, cluster)
     expected = TestArakoonInstaller.expected_global.format(cluster, ','.join(TestArakoonInstaller.nodes[node] for node in nodes[1:]))
     for node in nodes[1:]:
         expected += TestArakoonInstaller.expected_base.format(TestArakoonInstaller.nodes[node], node, base_port, base_port + 1)
     expected = expected.strip()
     for node in nodes[1:]:
         contents = SSHClient.load(node).file_read(self._get_config_path(cluster))
         self.assertEqual(contents.strip(), expected.strip())
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:25,代码来源:test_arakoonInstaller.py

示例11: __init__

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
    def __init__(self, cinder_password=None, cinder_user='admin', tenant_name='admin', controller_ip='127.0.0.1'):
        self.client = SSHClient.load('127.0.0.1')
        auth_url = 'http://{}:35357/v2.0'.format(controller_ip)
        self.cinder_client = None

        if cinder_password:
            try:
                from cinderclient.v1 import client as cinder_client
            except ImportError:
                pass
            else:
                self.cinder_client = cinder_client.Client(cinder_user, cinder_password, tenant_name, auth_url)
        self.is_devstack = self._is_devstack()
        self.is_openstack = self._is_openstack()
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:16,代码来源:oscinder.py

示例12: extend_volume

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
    def extend_volume(location, size):
        """
        Extend a volume using filesystem calls
        Calls "truncate" to create sparse raw file
        TODO: use volumedriver API
        TODO: model VDisk() and return guid

        @param location: location, filename
        @param size: size of volume, GB
        @return None
        """
        if not os.path.exists(location):
            raise RuntimeError('Volume not found at %s, use create_volume first.' % location)
        client = SSHClient.load('127.0.0.1')
        client.run_local('truncate -s %sG %s' % (size, location))
开发者ID:mflu,项目名称:openvstorage_centos,代码行数:17,代码来源:vdisk.py

示例13: extend_volume

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
    def extend_volume(location, size):
        """
        Extend a volume using filesystem calls
        Calls "truncate" to create sparse raw file
        TODO: use volumedriver API
        TODO: model VDisk() and return guid

        @param location: location, filename
        @param size: size of volume, GB
        @return None
        """
        if not os.path.exists(location):
            raise RuntimeError("Volume not found at %s, use create_volume first." % location)
        client = SSHClient.load("127.0.0.1")
        print(client.run_local('truncate -s {0}G "{1}"'.format(size, location)))
        VDiskController.own_volume(location)
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:18,代码来源:vdisk.py

示例14: own_volume

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
    def own_volume(location):
        """
        Change permissions and ownership of file
        """
        if not os.path.exists(location):
            raise RuntimeError("Volume not found at %s, use create_volume first." % location)

        client = SSHClient.load("127.0.0.1")
        osc = OpenStackCinder()
        print(client.run_local('chmod 664 "{0}"'.format(location)))
        try:
            if osc.is_devstack:
                print(client.run_local('chgrp stack "{0}"'.format(location)))
            elif osc.is_openstack:
                print(client.run_local('chgrp cinder "{0}"'.format(location)))
        except SystemExit as ex:
            raise RuntimeError(str(ex))
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:19,代码来源:vdisk.py

示例15: create_config

# 需要导入模块: from ovs.extensions.generic.sshclient import SSHClient [as 别名]
# 或者: from ovs.extensions.generic.sshclient.SSHClient import load [as 别名]
    def create_config(self, cluster_name, ip, client_port, messaging_port, plugins=None):
        """
        Creates initial config object causing this host to be master
        :param cluster_name: unique name for this arakoon cluster used in paths
        :param ip: ip on which service should listen
        :param client_port:
        :param messaging_port:
        :param plugins: optional arakoon plugins
        :return:
        """

        client = SSHClient.load(ip)
        node_name = System.get_my_machine_id(client)
        base_dir = System.read_remote_config(client, 'ovs.core.db.arakoon.location')
        self.clear_config()
        self.config = ClusterConfig(base_dir, cluster_name, 'info', plugins)
        self.config.nodes.append(ClusterNode(node_name, ip, client_port, messaging_port))
        self.config.target_ip = ip
开发者ID:BillTheBest,项目名称:openvstorage,代码行数:20,代码来源:ArakoonInstaller.py


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