當前位置: 首頁>>代碼示例>>Python>>正文


Python blockdevicemapping.BlockDeviceMapping方法代碼示例

本文整理匯總了Python中boto.ec2.blockdevicemapping.BlockDeviceMapping方法的典型用法代碼示例。如果您正苦於以下問題:Python blockdevicemapping.BlockDeviceMapping方法的具體用法?Python blockdevicemapping.BlockDeviceMapping怎麽用?Python blockdevicemapping.BlockDeviceMapping使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在boto.ec2.blockdevicemapping的用法示例。


在下文中一共展示了blockdevicemapping.BlockDeviceMapping方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _getBlockDeviceMapping

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def _getBlockDeviceMapping(cls, instanceType, rootVolSize=50):
        # determine number of ephemeral drives via cgcloud-lib (actually this is moved into toil's lib
        bdtKeys = [''] + ['/dev/xvd{}'.format(c) for c in string.ascii_lowercase[1:]]
        bdm = BlockDeviceMapping()
        # Change root volume size to allow for bigger Docker instances
        root_vol = BlockDeviceType(delete_on_termination=True)
        root_vol.size = rootVolSize
        bdm["/dev/xvda"] = root_vol
        # The first disk is already attached for us so start with 2nd.
        # Disk count is weirdly a float in our instance database, so make it an int here.
        for disk in range(1, int(instanceType.disks) + 1):
            bdm[bdtKeys[disk]] = BlockDeviceType(
                ephemeral_name='ephemeral{}'.format(disk - 1))  # ephemeral counts start at 0

        logger.debug('Device mapping: %s', bdm)
        return bdm 
開發者ID:DataBiosphere,項目名稱:toil,代碼行數:18,代碼來源:awsProvisioner.py

示例2: startElement

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def startElement(self, name, attrs, connection):
        retval = TaggedEC2Object.startElement(self, name, attrs, connection)
        if retval is not None:
            return retval
        if name == 'monitoring':
            self._in_monitoring_element = True
        elif name == 'blockDeviceMapping':
            self.block_device_mapping = BlockDeviceMapping()
            return self.block_device_mapping
        elif name == 'productCodes':
            return self.product_codes
        elif name == 'stateReason':
            self.state_reason = StateReason()
            return self.state_reason
        elif name == 'groupSet':
            self.groups = ResultSet([('item', Group)])
            return self.groups
        return None 
開發者ID:canvasnetworks,項目名稱:canvas,代碼行數:20,代碼來源:instance.py

示例3: startElement

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def startElement(self, name, attrs, connection):
        retval = super(Image, self).startElement(name, attrs, connection)
        if retval is not None:
            return retval
        if name == 'blockDeviceMapping':
            self.block_device_mapping = BlockDeviceMapping()
            return self.block_device_mapping
        elif name == 'productCodes':
            return self.product_codes
        elif name == 'billingProducts':
            return self.billing_products
        else:
            return None 
開發者ID:VirtueSecurity,項目名稱:aws-extender,代碼行數:15,代碼來源:image.py

示例4: startElement

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def startElement(self, name, attrs, connection):
        if name == 'groupSet':
            self.groups = ResultSet([('item', Group)])
            return self.groups
        elif name == 'monitoring':
            self._in_monitoring_element = True
        elif name == 'blockDeviceMapping':
            self.block_device_mapping = BlockDeviceMapping()
            return self.block_device_mapping
        elif name == 'iamInstanceProfile':
            self.instance_profile = SubParse('iamInstanceProfile')
            return self.instance_profile
        else:
            return None 
開發者ID:VirtueSecurity,項目名稱:aws-extender,代碼行數:16,代碼來源:launchspecification.py

示例5: startElement

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def startElement(self, name, attrs, connection):
        retval = super(Instance, self).startElement(name, attrs, connection)
        if retval is not None:
            return retval
        if name == 'monitoring':
            self._in_monitoring_element = True
        elif name == 'blockDeviceMapping':
            self.block_device_mapping = BlockDeviceMapping()
            return self.block_device_mapping
        elif name == 'productCodes':
            return self.product_codes
        elif name == 'stateReason':
            self.state_reason = SubParse('stateReason')
            return self.state_reason
        elif name == 'groupSet':
            self.groups = ResultSet([('item', Group)])
            return self.groups
        elif name == "eventsSet":
            self.eventsSet = SubParse('eventsSet')
            return self.eventsSet
        elif name == 'networkInterfaceSet':
            self.interfaces = ResultSet([('item', NetworkInterface)])
            return self.interfaces
        elif name == 'iamInstanceProfile':
            self.instance_profile = SubParse('iamInstanceProfile')
            return self.instance_profile
        elif name == 'currentState':
            return self._state
        elif name == 'previousState':
            self._previous_state = InstanceState()
            return self._previous_state
        elif name == 'instanceState':
            return self._state
        elif name == 'placement':
            return self._placement
        return None 
開發者ID:VirtueSecurity,項目名稱:aws-extender,代碼行數:38,代碼來源:instance.py

示例6: startElement

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def startElement(self, name, attrs, connection):
        if name == 'SecurityGroups':
            return self.security_groups
        elif name == 'ClassicLinkVPCSecurityGroups':
            return self.classic_link_vpc_security_groups
        elif name == 'BlockDeviceMappings':
            if self.use_block_device_types:
                self.block_device_mappings = BDM()
            else:
                self.block_device_mappings = ResultSet([('member', BlockDeviceMapping)])
            return self.block_device_mappings
        elif name == 'InstanceMonitoring':
            self.instance_monitoring = InstanceMonitoring(self)
            return self.instance_monitoring 
開發者ID:VirtueSecurity,項目名稱:aws-extender,代碼行數:16,代碼來源:launchconfig.py

示例7: startElement

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def startElement(self, name, attrs, connection):
        retval = TaggedEC2Object.startElement(self, name, attrs, connection)
        if retval is not None:
            return retval
        if name == 'blockDeviceMapping':
            self.block_device_mapping = BlockDeviceMapping()
            return self.block_device_mapping
        elif name == 'productCodes':
            return self.product_codes
        else:
            return None 
開發者ID:canvasnetworks,項目名稱:canvas,代碼行數:13,代碼來源:image.py

示例8: startElement

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def startElement(self, name, attrs, connection):
        if name == 'groupSet':
            self.groups = ResultSet([('item', Group)])
            return self.groups
        elif name == 'monitoring':
            self._in_monitoring_element = True
        elif name == 'blockDeviceMapping':
            self.block_device_mapping = BlockDeviceMapping()
            return self.block_device_mapping
        else:
            return None 
開發者ID:canvasnetworks,項目名稱:canvas,代碼行數:13,代碼來源:launchspecification.py

示例9: create_image

# 需要導入模塊: from boto.ec2 import blockdevicemapping [as 別名]
# 或者: from boto.ec2.blockdevicemapping import BlockDeviceMapping [as 別名]
def create_image(self, instance_id, name,
                     description=None, no_reboot=False,
                     block_device_mapping=None, dry_run=False):
        """
        Will create an AMI from the instance in the running or stopped
        state.

        :type instance_id: string
        :param instance_id: the ID of the instance to image.

        :type name: string
        :param name: The name of the new image

        :type description: string
        :param description: An optional human-readable string describing
            the contents and purpose of the AMI.

        :type no_reboot: bool
        :param no_reboot: An optional flag indicating that the
            bundling process should not attempt to shutdown the
            instance before bundling.  If this flag is True, the
            responsibility of maintaining file system integrity is
            left to the owner of the instance.

        :type block_device_mapping: :class:`boto.ec2.blockdevicemapping.BlockDeviceMapping`
        :param block_device_mapping: A BlockDeviceMapping data structure
            describing the EBS volumes associated with the Image.

        :type dry_run: bool
        :param dry_run: Set to True if the operation should not actually run.

        :rtype: string
        :return: The new image id
        """
        params = {'InstanceId': instance_id,
                  'Name': name}
        if description:
            params['Description'] = description
        if no_reboot:
            params['NoReboot'] = 'true'
        if block_device_mapping:
            block_device_mapping.ec2_build_list_params(params)
        if dry_run:
            params['DryRun'] = 'true'
        img = self.get_object('CreateImage', params, Image, verb='POST')
        return img.id

    # ImageAttribute methods 
開發者ID:VirtueSecurity,項目名稱:aws-extender,代碼行數:50,代碼來源:connection.py


注:本文中的boto.ec2.blockdevicemapping.BlockDeviceMapping方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。