本文整理汇总了Python中profitbricks.client.ProfitBricksService.update_volume方法的典型用法代码示例。如果您正苦于以下问题:Python ProfitBricksService.update_volume方法的具体用法?Python ProfitBricksService.update_volume怎么用?Python ProfitBricksService.update_volume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profitbricks.client.ProfitBricksService
的用法示例。
在下文中一共展示了ProfitBricksService.update_volume方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ProfitBricksService
# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import update_volume [as 别名]
datacenter_id = '700e1cab-99b2-4c30-ba8c-1d273ddba022'
volume_id = '700e1cab-99b2-4c30-ba8c-1d273ddba025'
snapshot_id = '7df81087-5835-41c6-a10b-3e098593bba4'
client = ProfitBricksService(
username='username', password='password')
response = client.restore_snapshot(
datacenter_id=datacenter_id,
volume_id=volume_id,
snapshot_id=snapshot_id)
"""Update Volume
"""
from profitbricks.client import ProfitBricksService
datacenter_id = '700e1cab-99b2-4c30-ba8c-1d273ddba022'
volume_id = '700e1cab-99b2-4c30-ba8c-1d273ddba025'
client = ProfitBricksService(
username='username', password='password')
volume = client.update_volume(
datacenter_id=datacenter_id,
volume_id=volume_id,
size=100,
name='Resized storage to 100 GB')
示例2: TestVolume
# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import update_volume [as 别名]
#.........这里部分代码省略.........
datacenter_id=self.datacenter['id'],
volume_id=self.volume['id'])
self.assertEqual(volume['id'], self.volume['id'])
self.assertEqual(volume['type'], 'volume')
self.assertEqual(volume['properties']['name'], self.resource['volume']['name'])
self.assertEqual(volume['properties']['size'], self.resource['volume']['size'])
self.assertEqual(volume['properties']['licenceType'], self.resource['volume']['licence_type'])
self.assertEqual(volume['properties']['type'], self.resource['volume']['type'])
self.assertFalse(volume['properties']['cpuHotPlug'])
self.assertFalse(volume['properties']['cpuHotUnplug'])
self.assertFalse(volume['properties']['ramHotPlug'])
self.assertFalse(volume['properties']['ramHotUnplug'])
self.assertFalse(volume['properties']['nicHotPlug'])
self.assertFalse(volume['properties']['nicHotUnplug'])
self.assertFalse(volume['properties']['discVirtioHotPlug'])
self.assertFalse(volume['properties']['discVirtioHotUnplug'])
self.assertFalse(volume['properties']['discScsiHotPlug'])
self.assertFalse(volume['properties']['discScsiHotUnplug'])
self.assertIsNone(volume['properties']['bus'])
def test_delete_volume(self):
volume = self.client.create_volume(
datacenter_id=self.datacenter['id'],
volume=Volume(**self.resource['volume']))
wait_for_completion(self.client, volume, 'create_volume')
volume = self.client.delete_volume(
datacenter_id=self.datacenter['id'],
volume_id=volume['id'])
self.assertTrue(volume)
def test_update_volume(self):
volume = self.client.update_volume(
datacenter_id=self.datacenter['id'],
volume_id=self.volume['id'],
size=6,
name=self.resource['volume']['name'] + ' RENAME')
wait_for_completion(self.client, volume, 'update_volume')
volume = self.client.get_volume(
datacenter_id=self.datacenter['id'],
volume_id=self.volume['id'])
self.assertEqual(volume['id'], self.volume['id'])
self.assertEqual(volume['properties']['name'], self.resource['volume']['name'] + ' RENAME')
self.assertEqual(volume['properties']['size'], 6)
def test_create_volume(self):
# Use volume created during volume test setup.
self.assertEqual(self.volume['properties']['name'], self.resource['volume']['name'])
self.assertEqual(self.volume['properties']['bus'], self.resource['volume']['bus'])
self.assertEqual(self.volume['properties']['type'], self.resource['volume']['type'])
self.assertEqual(self.volume['properties']['size'], self.resource['volume']['size'])
self.assertEqual(self.volume['properties']['licenceType'], self.resource['volume']['licence_type'])
self.assertFalse(self.volume['properties']['cpuHotPlug'])
self.assertFalse(self.volume['properties']['cpuHotUnplug'])
self.assertFalse(self.volume['properties']['ramHotPlug'])
self.assertFalse(self.volume['properties']['ramHotUnplug'])
self.assertFalse(self.volume['properties']['nicHotPlug'])
self.assertFalse(self.volume['properties']['nicHotUnplug'])
self.assertFalse(self.volume['properties']['discVirtioHotPlug'])
self.assertFalse(self.volume['properties']['discVirtioHotUnplug'])
self.assertFalse(self.volume['properties']['discScsiHotPlug'])
self.assertFalse(self.volume['properties']['discScsiHotUnplug'])
示例3: TestVolume
# 需要导入模块: from profitbricks.client import ProfitBricksService [as 别名]
# 或者: from profitbricks.client.ProfitBricksService import update_volume [as 别名]
class TestVolume(unittest.TestCase):
def setUp(self):
self.volume = ProfitBricksService(
username='username', password='password')
def test_list_volumes(self):
volumes = self.volume.list_volumes(
datacenter_id=datacenter_id)
self.assertEqual(len(volumes), 4)
self.assertEqual(volumes['items'][0]['id'], volume_id)
self.assertEqual(volumes['items'][0]['properties']['name'], 'my boot volume for server 1')
self.assertEqual(volumes['items'][0]['properties']['size'], 80)
self.assertEqual(volumes['items'][0]['properties']['licenceType'], 'WINDOWS')
self.assertFalse(volumes['items'][0]['properties']['cpuHotPlug'])
self.assertFalse(volumes['items'][0]['properties']['cpuHotUnplug'])
self.assertFalse(volumes['items'][0]['properties']['ramHotPlug'])
self.assertFalse(volumes['items'][0]['properties']['ramHotUnplug'])
self.assertFalse(volumes['items'][0]['properties']['nicHotPlug'])
self.assertFalse(volumes['items'][0]['properties']['nicHotUnplug'])
self.assertFalse(volumes['items'][0]['properties']['discVirtioHotPlug'])
self.assertFalse(volumes['items'][0]['properties']['discVirtioHotUnplug'])
self.assertFalse(volumes['items'][0]['properties']['discScsiHotPlug'])
self.assertFalse(volumes['items'][0]['properties']['discScsiHotUnplug'])
self.assertEqual(volumes['items'][0]['properties']['bus'], 'VIRTIO')
self.assertEqual(volumes['items'][0]['properties']['type'], 'HDD')
def test_get_volume(self):
volume = self.volume.get_volume(
datacenter_id=datacenter_id,
volume_id=volume_id)
self.assertEqual(volume['properties']['name'], 'my boot volume for server 1')
self.assertEqual(volume['properties']['size'], 80)
self.assertEqual(volume['properties']['licenceType'], 'WINDOWS')
self.assertFalse(volume['properties']['cpuHotPlug'])
self.assertFalse(volume['properties']['cpuHotUnplug'])
self.assertFalse(volume['properties']['ramHotPlug'])
self.assertFalse(volume['properties']['ramHotUnplug'])
self.assertFalse(volume['properties']['nicHotPlug'])
self.assertFalse(volume['properties']['nicHotUnplug'])
self.assertFalse(volume['properties']['discVirtioHotPlug'])
self.assertFalse(volume['properties']['discVirtioHotUnplug'])
self.assertFalse(volume['properties']['discScsiHotPlug'])
self.assertFalse(volume['properties']['discScsiHotUnplug'])
self.assertEqual(volume['properties']['bus'], 'VIRTIO')
self.assertEqual(volume['properties']['type'], 'HDD')
def test_delete_volume(self):
volume = self.volume.delete_volume(
datacenter_id=datacenter_id,
volume_id=volume_id)
self.assertTrue(volume)
def test_update_volume(self):
volume = self.volume.update_volume(
datacenter_id=datacenter_id,
volume_id=volume_id,
size=100,
name='Resized storage to 100 GB',
cpu_hot_unplug=True)
self.assertEqual(
volume['properties']['name'], 'Resized storage to 100 GB')
self.assertEqual(volume['properties']['size'], 100)
def test_create_volume(self):
i = Volume(
name='Explicitly created volume',
size=56,
image='<IMAGE/SNAPSHOT-ID>',
bus='VIRTIO')
response = self.volume.create_volume(
datacenter_id=datacenter_id, volume=i)
self.assertEqual(
response['properties']['name'], 'my boot volume for server 1')
self.assertEqual(response['properties']['size'], 80)
self.assertEqual(response['properties']['licenceType'], 'WINDOWS')
self.assertFalse(response['properties']['cpuHotPlug'])
self.assertFalse(response['properties']['cpuHotUnplug'])
self.assertFalse(response['properties']['ramHotPlug'])
self.assertFalse(response['properties']['ramHotUnplug'])
self.assertFalse(response['properties']['nicHotPlug'])
self.assertFalse(response['properties']['nicHotUnplug'])
self.assertFalse(response['properties']['discVirtioHotPlug'])
self.assertFalse(response['properties']['discVirtioHotUnplug'])
self.assertFalse(response['properties']['discScsiHotPlug'])
self.assertFalse(response['properties']['discScsiHotUnplug'])
self.assertEqual(response['properties']['bus'], 'VIRTIO')
self.assertEqual(response['properties']['type'], 'HDD')
def test_create_optional_value(self):
i = Volume(
name='Explicitly created volume',
size=56,
image='<IMAGE/SNAPSHOT-ID>',
bus='VIRTIO',
#.........这里部分代码省略.........