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


Python Volume.status方法代码示例

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


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

示例1: _create_template_ebs_volume

# 需要导入模块: from boto.ec2.volume import Volume [as 别名]
# 或者: from boto.ec2.volume.Volume import status [as 别名]
    def _create_template_ebs_volume(self, operation):
        """
        Helper function to create template EBS volume to work on.

        :param NamedConstant operation: Intended use of created template.
            A value from ``VolumeOperations``.

        :returns: Suitable volume in the right start state for input operation.
        :rtype: boto.ec2.volume.Volume
        """
        volume = EbsVolume()

        # Irrelevant volume attributes.
        volume.id = u'vol-9c48a689'
        volume.create_time = u'2015-07-14T22:46:00.447Z'
        volume.size = 1
        volume.snapshot_id = ''
        volume.zone = u'us-west-2b'
        volume.type = u'standard'

        volume_state_table = VolumeStateTable()
        state_flow = volume_state_table.table[operation]
        start_state = state_flow.start_state.value

        # Interesting volume attribute.
        volume.status = start_state

        return volume
开发者ID:hackday-profilers,项目名称:flocker,代码行数:30,代码来源:test_ebs.py

示例2: create_volume

# 需要导入模块: from boto.ec2.volume import Volume [as 别名]
# 或者: from boto.ec2.volume.Volume import status [as 别名]
 def create_volume(self, size, zone, **kwargs):
     volume = Volume()
     volume.id = 'vol-' + new_id()
     volume.size = size
     volume.zone = zone
     volume.status = 'available'
     self.volumes[volume.id] = volume
     return volume
开发者ID:patlachance,项目名称:brkt-cli,代码行数:10,代码来源:test_aws_service.py

示例3: test_wait_for_volume

# 需要导入模块: from boto.ec2.volume import Volume [as 别名]
# 或者: from boto.ec2.volume.Volume import status [as 别名]
    def test_wait_for_volume(self):
        aws_svc, encryptor_image, guest_image = build_aws_service()

        # Create a dummy volume.
        volume = Volume()
        volume.size = 8
        volume.id = new_id()
        volume.status = 'detaching'
        aws_svc.volumes[volume.id] = volume

        def transition_to_available(callback_volume):
            self.num_calls += 1
            self.assertEqual(volume, callback_volume)
            self.assertFalse(self.num_calls > 5)

            if self.num_calls == 5:
                volume.status = 'available'

        aws_svc.get_volume_callback = transition_to_available
        result = aws_service.wait_for_volume(aws_svc, volume.id)
        self.assertEqual(volume, result)
开发者ID:patlachance,项目名称:brkt-cli,代码行数:23,代码来源:test_aws_service.py


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