devices: disk: Use uppercase naming for mode lists

This commit is contained in:
Cole Robinson 2018-09-06 16:45:44 -04:00
parent 63287c83fb
commit a754718889
2 changed files with 12 additions and 16 deletions

View File

@ -438,28 +438,28 @@ class vmmAddHardware(vmmGObjectUI):
@staticmethod @staticmethod
def build_disk_cache_combo(_vm, combo): def build_disk_cache_combo(_vm, combo):
values = [[None, _("Hypervisor default")]] values = [[None, _("Hypervisor default")]]
for m in DeviceDisk.cache_types: for m in DeviceDisk.CACHE_MODES:
values.append([m, m]) values.append([m, m])
_build_combo(combo, values, sort=False) _build_combo(combo, values, sort=False)
@staticmethod @staticmethod
def build_disk_io_combo(_vm, combo): def build_disk_io_combo(_vm, combo):
values = [[None, _("Hypervisor default")]] values = [[None, _("Hypervisor default")]]
for m in DeviceDisk.io_modes: for m in DeviceDisk.IO_MODES:
values.append([m, m]) values.append([m, m])
_build_combo(combo, values, sort=False) _build_combo(combo, values, sort=False)
@staticmethod @staticmethod
def build_disk_discard_combo(_vm, combo): def build_disk_discard_combo(_vm, combo):
values = [[None, _("Hypervisor default")]] values = [[None, _("Hypervisor default")]]
for m in DeviceDisk.discard_types: for m in DeviceDisk.DISCARD_MODES:
values.append([m, m]) values.append([m, m])
_build_combo(combo, values, sort=False) _build_combo(combo, values, sort=False)
@staticmethod @staticmethod
def build_disk_detect_zeroes_combo(_vm, combo): def build_disk_detect_zeroes_combo(_vm, combo):
values = [[None, _("Hypervisor default")]] values = [[None, _("Hypervisor default")]]
for m in DeviceDisk.detect_zeroes_types: for m in DeviceDisk.DETECT_ZEROES_MODES:
values.append([m, m]) values.append([m, m])
_build_combo(combo, values, sort=False) _build_combo(combo, values, sort=False)

View File

@ -110,37 +110,33 @@ class DeviceDisk(Device):
CACHE_MODE_WRITEBACK = "writeback" CACHE_MODE_WRITEBACK = "writeback"
CACHE_MODE_DIRECTSYNC = "directsync" CACHE_MODE_DIRECTSYNC = "directsync"
CACHE_MODE_UNSAFE = "unsafe" CACHE_MODE_UNSAFE = "unsafe"
cache_types = [CACHE_MODE_NONE, CACHE_MODE_WRITETHROUGH, CACHE_MODES = [CACHE_MODE_NONE, CACHE_MODE_WRITETHROUGH,
CACHE_MODE_WRITEBACK, CACHE_MODE_DIRECTSYNC, CACHE_MODE_UNSAFE] CACHE_MODE_WRITEBACK, CACHE_MODE_DIRECTSYNC, CACHE_MODE_UNSAFE]
DISCARD_MODE_IGNORE = "ignore" DISCARD_MODE_IGNORE = "ignore"
DISCARD_MODE_UNMAP = "unmap" DISCARD_MODE_UNMAP = "unmap"
discard_types = [DISCARD_MODE_IGNORE, DISCARD_MODE_UNMAP] DISCARD_MODES = [DISCARD_MODE_IGNORE, DISCARD_MODE_UNMAP]
DETECT_ZEROES_OFF = "off" DETECT_ZEROES_MODE_OFF = "off"
DETECT_ZEROES_ON = "on" DETECT_ZEROES_MODE_ON = "on"
DETECT_ZEROES_UNMAP = "unmap" DETECT_ZEROES_MODE_UNMAP = "unmap"
detect_zeroes_types = [DETECT_ZEROES_OFF, DETECT_ZEROES_ON, DETECT_ZEROES_MODES = [DETECT_ZEROES_MODE_OFF, DETECT_ZEROES_MODE_ON,
DETECT_ZEROES_UNMAP] DETECT_ZEROES_MODE_UNMAP]
DEVICE_DISK = "disk" DEVICE_DISK = "disk"
DEVICE_LUN = "lun" DEVICE_LUN = "lun"
DEVICE_CDROM = "cdrom" DEVICE_CDROM = "cdrom"
DEVICE_FLOPPY = "floppy" DEVICE_FLOPPY = "floppy"
devices = [DEVICE_DISK, DEVICE_LUN, DEVICE_CDROM, DEVICE_FLOPPY]
TYPE_FILE = "file" TYPE_FILE = "file"
TYPE_BLOCK = "block" TYPE_BLOCK = "block"
TYPE_DIR = "dir" TYPE_DIR = "dir"
TYPE_VOLUME = "volume" TYPE_VOLUME = "volume"
TYPE_NETWORK = "network" TYPE_NETWORK = "network"
types = [TYPE_FILE, TYPE_BLOCK, TYPE_DIR, TYPE_NETWORK]
IO_MODE_NATIVE = "native" IO_MODE_NATIVE = "native"
IO_MODE_THREADS = "threads" IO_MODE_THREADS = "threads"
io_modes = [IO_MODE_NATIVE, IO_MODE_THREADS] IO_MODES = [IO_MODE_NATIVE, IO_MODE_THREADS]
error_policies = ["ignore", "stop", "enospace", "report"]
@staticmethod @staticmethod
def get_old_recommended_buses(guest): def get_old_recommended_buses(guest):