- vol_lim = self.cinder.limits.get()._info['absolute']
- if ("storage" in vimacc_resources) and\
- ((vimacc_resources["storage"]["volumes"]["total"] != vol_lim['maxTotalVolumes'])
- or (vimacc_resources["storage"]["snapshots"]["total"] != vol_lim['maxTotalSnapshots'])
- or (vimacc_resources["storage"]["volumes"]["used"] != vol_lim['totalVolumesUsed'])
- or (vimacc_resources["storage"]["snapshots"]["used"] != vol_lim['totalSnapshotsUsed'])
- or (vimacc_resources["storage"]["storage"]["total"] != vol_lim['maxTotalVolumeGigabytes'])
- or (vimacc_resources["storage"]["storage"]["used"] != vol_lim['totalGigabytesUsed'])):
- update_dict = {"resources.storage": {"volumes": {"total": vol_lim['maxTotalVolumes'],
- "used": vol_lim['totalVolumesUsed']},
- "snapshots": {"total": vol_lim['maxTotalSnapshots'],
- "used": vol_lim['totalSnapshotsUsed']},
- "storage": {"total": vol_lim['maxTotalVolumeGigabytes'],
- "used": vol_lim['totalGigabytesUsed']}}}
- suc_value = self.common_db.set_vim_account(str(self.vim_account['_id']), update_dict)
+ vol_lim = self.cinder.limits.get()._info["absolute"]
+ if ("storage" in vimacc_resources) and (
+ (
+ vimacc_resources["storage"]["volumes"]["total"]
+ != vol_lim["maxTotalVolumes"]
+ )
+ or (
+ vimacc_resources["storage"]["snapshots"]["total"]
+ != vol_lim["maxTotalSnapshots"]
+ )
+ or (
+ vimacc_resources["storage"]["volumes"]["used"]
+ != vol_lim["totalVolumesUsed"]
+ )
+ or (
+ vimacc_resources["storage"]["snapshots"]["used"]
+ != vol_lim["totalSnapshotsUsed"]
+ )
+ or (
+ vimacc_resources["storage"]["storage"]["total"]
+ != vol_lim["maxTotalVolumeGigabytes"]
+ )
+ or (
+ vimacc_resources["storage"]["storage"]["used"]
+ != vol_lim["totalGigabytesUsed"]
+ )
+ ):
+ update_dict = {
+ "resources.storage": {
+ "volumes": {
+ "total": vol_lim["maxTotalVolumes"],
+ "used": vol_lim["totalVolumesUsed"],
+ },
+ "snapshots": {
+ "total": vol_lim["maxTotalSnapshots"],
+ "used": vol_lim["totalSnapshotsUsed"],
+ },
+ "storage": {
+ "total": vol_lim["maxTotalVolumeGigabytes"],
+ "used": vol_lim["totalGigabytesUsed"],
+ },
+ }
+ }
+ suc_value = self.common_db.set_vim_account(
+ str(self.vim_account["_id"]), update_dict
+ )