@@ -120,6 +120,8 @@ class VMWareHandler(SourceBase):
120120 "set_primary_ip" : "when-undefined" ,
121121 "skip_vm_comments" : False ,
122122 "skip_vm_templates" : True ,
123+ "skip_offline_vms" : False ,
124+ "skip_srm_placeholder_vms" : False ,
123125 "strip_host_domain_name" : False ,
124126 "strip_vm_domain_name" : False ,
125127 "sync_tags" : False ,
@@ -450,6 +452,11 @@ def apply(self):
450452 }
451453 }
452454
455+ # skip virtual machines which are reported offline
456+ if self .skip_offline_vms is True :
457+ log .info ("Skipping offline VMs" )
458+ del object_mapping ["offline virtual machine" ]
459+
453460 for view_name , view_details in object_mapping .items ():
454461
455462 if self .session is None :
@@ -1795,6 +1802,11 @@ def add_virtual_machine(self, obj):
17951802 log .debug2 (f"VM '{ name } ' is a template. Skipping" )
17961803 return
17971804
1805+ if bool (self .skip_srm_placeholder_vms ) is True \
1806+ and f"{ grab (obj , 'config.managedBy.extensionKey' )} " .startswith ("com.vmware.vcDr" ):
1807+ log .debug2 (f"VM '{ name } ' is a SRM placeholder VM. Skipping" )
1808+ return
1809+
17981810 # ignore offline VMs during first run
17991811 if self .parsing_vms_the_first_time is True and status == "offline" :
18001812 log .debug2 (f"Ignoring { status } VM '{ name } ' on first run" )
0 commit comments