Skip to content

Commit

Permalink
Add method to fetch virtual devices attached to VM on VMware
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <gtalreja@redhat.com>
  • Loading branch information
Gauravtalreja1 authored and mshriver committed Jan 28, 2025
1 parent a887f1a commit c9f7fc2
Showing 1 changed file with 15 additions and 0 deletions.
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

0 comments on commit c9f7fc2

Please sign in to comment.