-def create_vim_res(data, do_notify, do_rollback):
- try:
- for vol in ignore_case_get(data, "volume_storages"):
- create_volume(vol, do_notify, OPT_CREATE_VOLUME)
- for network in ignore_case_get(data, "vls"):
- create_network(network, do_notify, OPT_CREATE_NETWORK)
- for subnet in ignore_case_get(data, "vls"):
- create_subnet(subnet, do_notify, OPT_CREATE_SUBNET)
- for port in ignore_case_get(data, "cps"):
- create_port(port, do_notify, OPT_CREATE_PORT)
- for flavor in ignore_case_get(data, "vdus"):
- create_flavor(flavor, do_notify, OPT_CREATE_FLAVOR)
- for vm in ignore_case_get(data, "vdus"):
- create_vm(vm, do_notify, OPT_CREATE_VM)
- except VimException as e:
- logger.error(e.message)
- do_rollback(e.message)
- except:
- logger.error(traceback.format_exc())
- do_rollback(str(sys.exc_info()))
+def create_vim_res(data, do_notify):
+ vim_cache = {}
+ for vol in ignore_case_get(data, "volume_storages"):
+ create_volume(vim_cache, vol, do_notify, OPT_CREATE_VOLUME)
+ for network in ignore_case_get(data, "vls"):
+ create_network(vim_cache, network, do_notify, OPT_CREATE_NETWORK)
+ for subnet in ignore_case_get(data, "vls"):
+ create_subnet(vim_cache, subnet, do_notify, OPT_CREATE_SUBNET)
+ for port in ignore_case_get(data, "cps"):
+ create_port(vim_cache, port, do_notify, OPT_CREATE_PORT)
+ for flavor in ignore_case_get(data, "vdus"):
+ create_flavor(vim_cache, flavor, do_notify, OPT_CREATE_FLAVOR)
+ for vm in ignore_case_get(data, "vdus"):
+ create_vm(vim_cache, vm, do_notify, OPT_CREATE_VM)