-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from jyejare/vmware_alignment
[Develop] VMWare cleanup alignment with Develop branch
- Loading branch information
Showing
8 changed files
with
111 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
aws_data = ['VMS', 'NICS', 'DISCS', 'PIPS', 'RESOURCES', 'STACKS'] | ||
azure_data = ['VMS', 'NICS', 'DISCS', 'IMAGES', 'PIPS', 'RESOURCES'] | ||
gce_data = ['VMS', 'NICS', 'DISCS'] | ||
vmware_data = ['VMS', 'NICS', 'DISCS'] | ||
container_data = ['CONTAINERS'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""VMWare CR Cleanup Utilities""" | ||
from cloudwash.client import compute_client | ||
from cloudwash.constants import vmware_data as data | ||
from cloudwash.entities.providers import VMWareCleanup | ||
from cloudwash.logger import logger | ||
from cloudwash.utils import dry_data | ||
from cloudwash.utils import echo_dry | ||
|
||
|
||
def cleanup(**kwargs): | ||
is_dry_run = kwargs.get("dry_run", False) | ||
dry_data['PROVIDER'] = "VMWARE" | ||
if kwargs["nics"] or kwargs["_all"]: | ||
logger.warning("Cloudwash does not supports NICs operation for VMWare yet!") | ||
if kwargs["discs"] or kwargs["_all"]: | ||
logger.warning("Cloudwash does not supports DISCs operation for VMWare yet!") | ||
|
||
with compute_client("vmware") as vmware_client: | ||
for items in data: | ||
dry_data[items]['delete'] = [] | ||
vmware_cleanup = VMWareCleanup(client=vmware_client) | ||
if kwargs["vms"] or kwargs["_all"]: | ||
vmware_cleanup.vms.cleanup() | ||
if is_dry_run: | ||
echo_dry(dry_data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
VMWARE: | ||
AUTH: | ||
VCENTER: | ||
USERNAME: | ||
PASSWORD: | ||
CRITERIA: | ||
VM: | ||
# The VM to be deleted with prepend string, e.g VM name that starts with 'test' | ||
DELETE_VM: 'test' | ||
# Number of minutes the deletable VM should be allowed to live, e.g 120 minutes = 2 Hours | ||
SLA_MINUTES: 120 | ||
EXCEPTIONS: | ||
VM: | ||
# VM names that would be skipped from cleanup | ||
VM_LIST: [] | ||
# VMs that would be stopped from current running state | ||
STOP_LIST: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters