From f93813bc5846978a541060ec732bf1ebab299237 Mon Sep 17 00:00:00 2001 From: Olivier DRAGHI Date: Sun, 2 Oct 2022 12:44:44 +0200 Subject: [PATCH] Add compute policies in utils.vm_to_dict() If configured, add in the dictionary 'placement-policy' and 'sizing-policy'. Signed-off-by: Olivier DRAGHI --- pyvcloud/vcd/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyvcloud/vcd/utils.py b/pyvcloud/vcd/utils.py index f74dd447a..be08a2881 100644 --- a/pyvcloud/vcd/utils.py +++ b/pyvcloud/vcd/utils.py @@ -500,6 +500,12 @@ def vm_to_dict(vm): setting.AdapterType.text) disk_props['bus'] = setting.BusNumber.text disk_props['unit'] = setting.UnitNumber.text + + if hasattr(vm, 'ComputePolicy'): + if hasattr(vm.ComputePolicy, 'VmPlacementPolicy'): + result['placement-policy'] = vm.ComputePolicy.VmPlacementPolicy.get('name') + if hasattr(vm.ComputePolicy, 'VmSizingPolicy'): + result['sizing-policy'] = vm.ComputePolicy.VmSizingPolicy.get('name') return result