From b6325c6ce4fc60099e4a0223cb45b07bb180ab5b Mon Sep 17 00:00:00 2001 From: Kosta Mushkin Date: Fri, 25 Jul 2025 11:49:41 -0400 Subject: [PATCH] added option to specify scratch disk parameters on the vpg level in vpg.py, updated example --- examples/vpg_vms_example.py | 12 ++++++++++-- zvml/vpgs.py | 8 +++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/examples/vpg_vms_example.py b/examples/vpg_vms_example.py index 8792855..4162991 100644 --- a/examples/vpg_vms_example.py +++ b/examples/vpg_vms_example.py @@ -220,11 +220,19 @@ def main(): } } } - + + scratch = { + "Limitation": { + "HardLimitInMB": 407200, + "HardLimitInPercent": 0, + "WarningThresholdInMB": 400000, + "WarningThresholdInPercent": 0 + } + } input("Press Enter to create the first VPG...") vpg_id = client1.vpgs.create_vpg(basic=basic, journal=journal, - recovery=recovery, networks=networks, sync=True) + recovery=recovery, networks=networks, scratch=scratch, sync=True) logging.info(f"VPG ID: {vpg_id} created successfully.") # Add VMs to the first VPG diff --git a/zvml/vpgs.py b/zvml/vpgs.py index 081a6ab..acf0b25 100644 --- a/zvml/vpgs.py +++ b/zvml/vpgs.py @@ -175,10 +175,10 @@ class VPGs: logging.error(f"Unexpected error: {e}") raise - def create_vpg(self, basic, journal, recovery, networks, sync=True, status: ZertoVPGStatus = ZertoVPGStatus.Initializing, timeout=30, interval=5): + def create_vpg(self, basic, journal, recovery, networks, scratch = None, sync=True, status: ZertoVPGStatus = ZertoVPGStatus.Initializing, timeout=30, interval=5): vpg_name = basic.get("Name") logging.info(f'VPGs.create_vpg(zvm_address={self.client.zvm_address}, vpg_name={vpg_name}, sync={sync})') - vpg_settings_id = self.create_vpg_settings(basic, journal, recovery, networks, vpg_identifier=None) + vpg_settings_id = self.create_vpg_settings(basic, journal, recovery, networks, scratch, vpg_identifier=None) return self.commit_vpg(vpg_settings_id, vpg_name, sync, expected_status=status, timeout=timeout, interval=interval) def wait_for_vpg_ready(self, vpg_name, timeout=180, interval=5, expected_status=ZertoVPGStatus.Initializing): @@ -624,7 +624,7 @@ class VPGs: logging.error("HTTPError occurred with no response attached.") raise - def create_vpg_settings(self, basic=None, journal=None, recovery=None, networks=None, vpg_identifier=None): + def create_vpg_settings(self, basic=None, journal=None, recovery=None, networks=None, scratch=None, vpg_identifier=None): logging.info(f'VPGs.create_vpg_settings(zvm_address={self.client.zvm_address}, vpg_identifier={vpg_identifier})') vpg_settings_uri = f"https://{self.client.zvm_address}/v1/vpgSettings" headers = { @@ -643,6 +643,8 @@ class VPGs: payload["Recovery"] = recovery if networks: payload["Networks"] = networks + if scratch: + payload["Scratch"] = scratch logging.debug(f"VPGs.create_vpg_settings: Payload: {json.dumps(payload, indent=4)}") try: