snapshot.wait_until_completed既不显示进度也不显示进度 [英] snapshot.wait_until_completed doesn't show progress nor when it has completed
本文介绍了snapshot.wait_until_completed既不显示进度也不显示进度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个小的功能,负责创建快照,它可以正常工作;但是我也想获得进度,但是以下功能对我没有帮助:
I have a small function which is responsible for creating the snapshots , it works fine; but i want to get the progress as well , but the following function doesn't help me:
def call_creater():
regions = ['eu-central-1']
for region in regions:
ec2 = boto3.resource('ec2', region, aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY, )
snapshot = ec2.create_snapshot(VolumeId='vol-f9e7d220', Description='fra01-he-trial-ansible01')
print snapshot.id
get_all_snapshots = ec2.snapshots.filter(snap_id=['SnapshotIds'])
print get_all_snapshots
#snapshot.wait_until_completed()
print "STARTING TO CREATE :"
time.sleep(10)
snapshot.wait_until_completed(
Filters=[
{
'Name': 'progress'
}
]
)
print "snapshot ready"
抛出:
'Name': 'progress'
File "C:\Python27\lib\site-packages\boto3\resources\factory.py", line 368, in do_waiter
waiter(self, *args, **kwargs)
File "C:\Python27\lib\site-packages\boto3\resources\action.py", line 201, in __call__
response = waiter.wait(**params)
File "C:\Python27\lib\site-packages\botocore\waiter.py", line 53, in wait
Waiter.wait(self, **kwargs)
File "C:\Python27\lib\site-packages\botocore\waiter.py", line 321, in wait
reason='Max attempts exceeded')
botocore.exceptions.WaiterError: Waiter SnapshotCompleted failed: Max attempts exceeded
尽管创建了快照,但我无法获取状态
Though the snapshot gets created , i am not able to get the status
推荐答案
wait_until_completed
最多应等待约10分钟,对于大型快照而言,这还远远不够,并且
wait_until_completed
should wait for a maximum of about 10 minutes, which is nowhere near enough for a big snapshot, and reportedly it's returning faster even than that. Since this functionality seems to be broken I'd suggest writing your own waiter.
这篇关于snapshot.wait_until_completed既不显示进度也不显示进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文