From 84bf04a137bc4dc15d960f4d6380872f67e8a695 Mon Sep 17 00:00:00 2001 From: catborise Date: Thu, 22 Nov 2018 14:45:12 +0300 Subject: [PATCH] add getting list of disk device types. Rename getting disk bus types function --- vrtManager/connection.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/vrtManager/connection.py b/vrtManager/connection.py index 7a9504d..7aa6fbf 100644 --- a/vrtManager/connection.py +++ b/vrtManager/connection.py @@ -436,8 +436,8 @@ class wvmConnect(object): """ Return machine type of emulation""" return util.get_xml_path(self.get_cap_xml(), "/capabilities/guest/arch[@name='{}']/machine".format(arch)) - def get_busses(self): - """Get available busses""" + def get_disk_bus_types(self): + """Get available disk bus types list""" def get_bus_list(ctx): result = [] @@ -449,6 +449,18 @@ class wvmConnect(object): # return [ 'ide', 'scsi', 'usb', 'virtio' ] return util.get_xml_path(self.get_dom_cap_xml(), func=get_bus_list) + def get_disk_device_types(self): + """Get available disk device type list""" + + def get_device_list(ctx): + result = [] + for disk_enum in ctx.xpath('/domainCapabilities/devices/disk/enum'): + if disk_enum.xpath("@name")[0] == "diskDevice": + for values in disk_enum: result.append(values.text) + return result + + # return [ 'disk', 'cdrom', 'floppy', 'lun' ] + return util.get_xml_path(self.get_dom_cap_xml(), func=get_device_list) def get_image_formats(self): """Get available image formats"""