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


Python General.unmount_partition方法代码示例

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


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

示例1: unpartition_disk

# 需要导入模块: from ci.tests.general.general import General [as 别名]
# 或者: from ci.tests.general.general.General import unmount_partition [as 别名]
    def unpartition_disk(disk, partitions=None, wait=True):
        """
        Return disk to RAW state
        :param disk: Disk DAL object
        :param partitions: Partitions DAL object list
        :return: None
        """
        if partitions is None:
            partitions = disk.partitions
        else:
            for partition in partitions:
                if partition not in disk.partitions:
                    raise RuntimeError('Partition {0} does not belong to disk {1}'.format(partition.mountpoint, disk.name))
        if len(disk.partitions) == 0:
            return

        root_client = SSHClient(disk.storagerouter, username='root')
        for partition in partitions:
            General.unmount_partition(root_client, partition)
        root_client.run(['parted', '-s', '/dev/' + disk.name, 'mklabel', 'gpt'])
        GeneralStorageRouter.sync_with_reality(disk.storagerouter)
        counter = 0
        timeout = 60
        while counter < timeout:
            time.sleep(1)
            disk = GeneralDisk.get_disk(guid=disk.guid)
            if len(disk.partitions) == 0:
                break
            counter += 1
        if counter == timeout:
            raise RuntimeError('Removing partitions failed for disk:\n {0} '.format(disk.name))
开发者ID:openvstorage,项目名称:integrationtests,代码行数:33,代码来源:general_disk.py


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