|
124 | 124 | fetch_compute_hosts:
|
125 | 125 | description: When set, the compute nodes are fetched. Default value set to True.
|
126 | 126 | type: bool
|
| 127 | + fetch_all_compute_hosts: |
| 128 | + description: When set along with fetch_compute_hosts, compute nodes in any lifecycle state are fetched. Default value set to False. |
| 129 | + type: bool |
127 | 130 | primary_vnic_only:
|
128 | 131 | description: The default behavior of the plugin is to process all VNIC's attached to a compute instance.
|
129 | 132 | This might result in instance having multiple entries. When this parameter is set to True,
|
|
354 | 357 |
|
355 | 358 | # Compute Hosts (bool type)
|
356 | 359 | fetch_compute_hosts: True
|
| 360 | +fetch_all_compute_hosts: False |
357 | 361 |
|
358 | 362 | # Process only the primary vnic of a compute instance
|
359 | 363 | primary_vnic_only: True
|
@@ -1845,16 +1849,28 @@ def get_filtered_instances(self, compartment_ocid, region):
|
1845 | 1849 | )
|
1846 | 1850 | try:
|
1847 | 1851 | compute_client = self.get_compute_client_for_region(region)
|
| 1852 | + limit = 2000 |
| 1853 | + |
| 1854 | + if self.get_option("fetch_all_compute_hosts"): |
| 1855 | + instances = self.get_filtered_resources( |
| 1856 | + oci_common_utils.list_all_resources( |
| 1857 | + target_fn=compute_client.list_instances, |
| 1858 | + compartment_id=compartment_ocid, |
| 1859 | + limit=limit, |
| 1860 | + ), |
| 1861 | + compartment_ocid, |
| 1862 | + ) |
| 1863 | + else: |
| 1864 | + instances = self.get_filtered_resources( |
| 1865 | + oci_common_utils.list_all_resources( |
| 1866 | + target_fn=compute_client.list_instances, |
| 1867 | + compartment_id=compartment_ocid, |
| 1868 | + lifecycle_state="RUNNING", |
| 1869 | + limit=limit, |
| 1870 | + ), |
| 1871 | + compartment_ocid, |
| 1872 | + ) |
1848 | 1873 |
|
1849 |
| - instances = self.get_filtered_resources( |
1850 |
| - oci_common_utils.list_all_resources( |
1851 |
| - target_fn=compute_client.list_instances, |
1852 |
| - compartment_id=compartment_ocid, |
1853 |
| - lifecycle_state="RUNNING", |
1854 |
| - limit=2000, |
1855 |
| - ), |
1856 |
| - compartment_ocid, |
1857 |
| - ) |
1858 | 1874 | return instances
|
1859 | 1875 | except ServiceError as ex:
|
1860 | 1876 | self.debug(
|
|
0 commit comments