summaryrefslogtreecommitdiffstats
path: root/share/starlingx_base/resource
diff options
context:
space:
mode:
Diffstat (limited to 'share/starlingx_base/resource')
-rw-r--r--share/starlingx_base/resource/capacity.py24
-rw-r--r--share/starlingx_base/resource/infra_workload.py1
2 files changed, 14 insertions, 11 deletions
diff --git a/share/starlingx_base/resource/capacity.py b/share/starlingx_base/resource/capacity.py
index 46e5eba5..cbdedaa3 100644
--- a/share/starlingx_base/resource/capacity.py
+++ b/share/starlingx_base/resource/capacity.py
@@ -41,7 +41,10 @@ class CapacityCheck(newton_capacity.CapacityCheck):
self._logger.debug("META> %s" % request.META)
try:
- hasEnoughResource = self.get_tenant_cap_info(vimid, request.data)
+
+ # Get the specified tenant id
+ specified_project_idorname = request.META.get("Project", None)
+ hasEnoughResource = self.get_tenant_cap_info(vimid, request.data, specified_project_idorname)
azCapInfo = self.get_az_cap_info(vimid)
self._logger.info("RESP with data> result:%s" % hasEnoughResource)
return Response(data={'result': hasEnoughResource, 'AZs': azCapInfo}, status=status.HTTP_200_OK)
@@ -52,15 +55,14 @@ class CapacityCheck(newton_capacity.CapacityCheck):
def get_az_cap_info(self, vimid):
azCapInfo = []
- viminfo = VimDriverUtils.get_vim_info(vimid)
- if not viminfo:
- self._logger.warn("azcap_audit no valid vimid: %s" % vimid)
- return
-
- session = VimDriverUtils.get_session(
- viminfo,
- tenant_name=viminfo['tenant']
- )
+ # viminfo = VimDriverUtils.get_vim_info(vimid)
+ # if not viminfo:
+ # self._logger.warn("azcap_audit no valid vimid: %s" % vimid)
+ # return
+ # session = VimDriverUtils.get_session(
+ # viminfo,
+ # tenant_name=viminfo.get('tenant', None)
+ # )
try:
# get list of AZ
vimAzCacheKey = "cap_azlist_" + vimid
@@ -87,7 +89,7 @@ class CapacityCheck(newton_capacity.CapacityCheck):
return azCapInfoList
except Exception as e:
return azCapInfo
- pass
+
class APIv1CapacityCheck(CapacityCheck):
def __init__(self):
diff --git a/share/starlingx_base/resource/infra_workload.py b/share/starlingx_base/resource/infra_workload.py
index 745e9f03..6b064856 100644
--- a/share/starlingx_base/resource/infra_workload.py
+++ b/share/starlingx_base/resource/infra_workload.py
@@ -468,6 +468,7 @@ class InfraWorkloadHelper(infra_workload_helper.InfraWorkloadHelper):
The template for workload will be fetched from sdc client
:param vimid:
:param workload_data:
+ :param project_idorname: tenant id or name
:return: result code, status enum, status reason
result code: 0-ok, otherwise error
status enum: "CREATE_IN_PROGRESS", "CREATE_FAILED"