Create method to get a vm's cd-roms

Create a method to get the drives attached to a vm that have
media type cdrom.
This commit is contained in:
Harmon Herring 2021-05-27 15:02:25 -04:00
parent 2f0b113b05
commit 27a6b2136e

View file

@ -202,6 +202,17 @@ class VM:
disks = sorted(disks, key=lambda x: x[0])
return disks
@lazy_property
def cdroms(self):
cdroms = []
valid_cdrom_types = ['ide', 'sata', 'scsi']
for key, val in self.config.items():
if any(type in key for type in valid_cdrom_types):
if 'scsihw' not in key and 'cdrom' in val:
cdroms.append(key)
cdroms = sorted(cdroms)
return cdroms
@lazy_property
def iso(self):
if self.config.get('ide2'):