Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to fetch virtual devices attached to VM on VMware #501

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions wrapanapi/systems/virtualcenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,21 @@ def add_disk(self, capacity_in_kb, provision_type=None, unit=None):
result = (None, None)
return result

def get_virtual_device_type_names(self):
"""
Retrieves the names of all subclasses of vim.vm.device.VirtualDevice.

Returns:
list: A list of class names (as strings) representing the types of virtual devices.
"""
# Get all subclasses of vim.vm.device.VirtualDevice
subclasses = vim.vm.device.VirtualDevice.__subclasses__()

# Extract only the class names (not fully qualified names) and return
class_names = [cls.__name__.split(".")[-1] for cls in subclasses]

return class_names


class VMWareVirtualMachine(VMWareVMOrTemplate, Vm):
state_map = {
Expand Down
Loading