I found the flavor, and have returned, but why the function still raise Exception? and strange is I can not catch it .
I finded the flavor, and have returned, but why the function still raise Exception? and strange is I can not catch it .
I have a retrieveFlavor
function.
try:
vcpus_id = data["vcpus"]
vcpus = CPUType.objects.get(id=vcpus_id).name[:-1]
flavor = retrieveFlavor(vcpu=str(vcpus),
ram=str(data["ram"]),
disk=str(data["disk_os"]["disk_size"]),
rxtx_factor=str(data["bandwidth"]))
except Exception as e:
raise Exception("创建Flavor失败,请联系运营商")
this is the retrieveFlavor
function details:
In it, I find_flavor = super_conn.conn.compute.find_flavor(name_or_id=flavor_name)
and it have found the flavor, you can see in the red arrow, but when I step over it get out to the outter:
You can see it comes to the retrieveFlavor invoke place, and the exception is:
'NoneType' object has no attribute '_body'
The strange is
1) the compute.find_flavor()
have get the flavor, why still raise Exception?
2) the compute.find_flavor()
did not except the Exception, , direct raise to the outter(retrieveFlavor()
invoke there).
How to do with that?