@@ -198,12 +198,39 @@ def _setup_existing_root_volume(self, config: DatasetManagerConfig) -> None:
198198 self ._handle_root_volume_mounting (root_volume_name , root_mountpoint )
199199
200200 def _setup_new_root_volume (self , config : DatasetManagerConfig ) -> None :
201- """Perform operations for new root volume after config is saved."""
201+ """Perform operations for new root volume after config is saved.
202+
203+ Note: This method assumes the base ONTAP configuration has already been
204+ saved to disk before being called, as it needs to access ONTAP APIs.
205+ """
202206 root_volume_name = config .root_volume_name
203207 root_mountpoint = config .root_mountpoint
204208
205209 logger .info (f"\n Setting up new Dataset Manager root volume '{ root_volume_name } '..." )
206210
211+ # Verify we can connect to ONTAP before proceeding
212+ try :
213+ from ..traditional .core import _retrieve_config
214+ from ..traditional .exceptions import InvalidConfigError
215+
216+ # Try to retrieve config to verify it exists and is valid
217+ try :
218+ ontap_config = _retrieve_config (print_output = False )
219+ # Verify we have the minimum required fields
220+ if not all (k in ontap_config for k in ['hostname' , 'svm' , 'dataLif' ]):
221+ raise InvalidConfigError ("Missing required ONTAP configuration fields" )
222+ except (InvalidConfigError , FileNotFoundError , KeyError ) as e :
223+ logger .info (f" Note: Cannot create root volume - ONTAP configuration not available yet." )
224+ logger .info (f" Dataset Manager configuration has been saved." )
225+ logger .info (f" The root volume will be created when you first use Dataset Manager," )
226+ logger .info (f" or you can create it manually: netapp_dataops_cli.py create volume -n { root_volume_name } -s 1GB" )
227+ return
228+ except Exception as e :
229+ logger .info (f" Note: Cannot validate ONTAP connection: { e } " )
230+ logger .info (f" Dataset Manager configuration has been saved." )
231+ logger .info (f" Please create the root volume manually or reconfigure later." )
232+ return
233+
207234 while True : # Loop for retrying with different names if needed
208235 try :
209236 # Check if volume already exists
0 commit comments