Skip to content
Snippets Groups Projects
Commit 43440815 authored by Guido Trotter's avatar Guido Trotter
Browse files

KVM: parameters for different disk and nic types

- Add a bunch of NICs and DISKs types
- Specify which one are valid disks and nics for KVM (the new ones
  toghether with some of the old ones)
- Add the default values (paravirtual)
- Allow the disk and nic types as parameters and check their validity

Reviewed-by: iustinp
parent d08f6067
No related branches found
No related tags found
No related merge requests found
...@@ -341,11 +341,30 @@ VNC_DEFAULT_BIND_ADDRESS = '0.0.0.0' ...@@ -341,11 +341,30 @@ VNC_DEFAULT_BIND_ADDRESS = '0.0.0.0'
HT_NIC_RTL8139 = "rtl8139" HT_NIC_RTL8139 = "rtl8139"
HT_NIC_NE2K_PCI = "ne2k_pci" HT_NIC_NE2K_PCI = "ne2k_pci"
HT_NIC_NE2K_ISA = "ne2k_isa" HT_NIC_NE2K_ISA = "ne2k_isa"
HT_NIC_I82551 = "i82551"
HT_NIC_I85557B = "i82557b"
HT_NIC_I8259ER = "i82559er"
HT_NIC_PCNET = "pcnet"
HT_NIC_E1000 = "e1000"
HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual" HT_NIC_PARAVIRTUAL = HT_DISK_PARAVIRTUAL = "paravirtual"
HT_DISK_IOEMU = "ioemu" HT_DISK_IOEMU = "ioemu"
HT_DISK_IDE = "ide"
HT_DISK_SCSI = "scsi"
HT_DISK_SD = "sd"
HT_DISK_MTD = "mtd"
HT_DISK_PFLASH = "pflash"
HT_HVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI, HT_HVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
HT_NIC_NE2K_ISA, HT_NIC_PARAVIRTUAL]) HT_NIC_NE2K_ISA, HT_NIC_PARAVIRTUAL])
HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU]) HT_HVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IOEMU])
HT_KVM_VALID_NIC_TYPES = frozenset([HT_NIC_RTL8139, HT_NIC_NE2K_PCI,
HT_NIC_NE2K_ISA, HT_NIC_I82551,
HT_NIC_I85557B, HT_NIC_I8259ER,
HT_NIC_PCNET, HT_NIC_E1000,
HT_NIC_PARAVIRTUAL])
HT_KVM_VALID_DISK_TYPES = frozenset([HT_DISK_PARAVIRTUAL, HT_DISK_IDE,
HT_DISK_SCSI, HT_DISK_SD, HT_DISK_MTD,
HT_DISK_PFLASH])
# Cluster Verify steps # Cluster Verify steps
VERIFY_NPLUSONE_MEM = 'nplusone_mem' VERIFY_NPLUSONE_MEM = 'nplusone_mem'
...@@ -443,7 +462,7 @@ HVC_DEFAULTS = { ...@@ -443,7 +462,7 @@ HVC_DEFAULTS = {
HV_BOOT_ORDER: "cd", HV_BOOT_ORDER: "cd",
HV_CDROM_IMAGE_PATH: None, HV_CDROM_IMAGE_PATH: None,
HV_NIC_TYPE: HT_NIC_RTL8139, HV_NIC_TYPE: HT_NIC_RTL8139,
HV_DISK_TYPE: HT_DEV_PARAVIRTUAL, HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
HV_VNC_BIND_ADDRESS: '0.0.0.0', HV_VNC_BIND_ADDRESS: '0.0.0.0',
HV_ACPI: True, HV_ACPI: True,
HV_PAE: True, HV_PAE: True,
...@@ -460,6 +479,8 @@ HVC_DEFAULTS = { ...@@ -460,6 +479,8 @@ HVC_DEFAULTS = {
HV_VNC_X509_VERIFY: False, HV_VNC_X509_VERIFY: False,
HV_CDROM_IMAGE_PATH: None, HV_CDROM_IMAGE_PATH: None,
HV_BOOT_ORDER: "disk", HV_BOOT_ORDER: "disk",
HV_NIC_TYPE: HT_NIC_PARAVIRTUAL,
HV_DISK_TYPE: HT_DISK_PARAVIRTUAL,
}, },
HT_FAKE: { HT_FAKE: {
}, },
......
...@@ -60,6 +60,8 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -60,6 +60,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
constants.HV_VNC_X509_VERIFY, constants.HV_VNC_X509_VERIFY,
constants.HV_CDROM_IMAGE_PATH, constants.HV_CDROM_IMAGE_PATH,
constants.HV_BOOT_ORDER, constants.HV_BOOT_ORDER,
constants.HV_NIC_TYPE,
constants.HV_DISK_TYPE,
] ]
_MIGRATION_STATUS_RE = re.compile('Migration\s+status:\s+(\w+)', _MIGRATION_STATUS_RE = re.compile('Migration\s+status:\s+(\w+)',
...@@ -749,6 +751,20 @@ class KVMHypervisor(hv_base.BaseHypervisor): ...@@ -749,6 +751,20 @@ class KVMHypervisor(hv_base.BaseHypervisor):
if boot_order == 'cdrom' and not iso_path: if boot_order == 'cdrom' and not iso_path:
raise errors.HypervisorError("Cannot boot from cdrom without an ISO path") raise errors.HypervisorError("Cannot boot from cdrom without an ISO path")
nic_type = hvparams[constants.HV_NIC_TYPE]
if nic_type not in constants.HT_KVM_VALID_NIC_TYPES:
raise errors.HypervisorError("Invalid NIC type %s specified for the KVM"
" hypervisor. Please choose one of: %s" %
(nic_type,
constants.HT_KVM_VALID_NIC_TYPES))
disk_type = hvparams[constants.HV_DISK_TYPE]
if disk_type not in constants.HT_KVM_VALID_DISK_TYPES:
raise errors.HypervisorError("Invalid disk type %s specified for the KVM"
" hypervisor. Please choose one of: %s" %
(disk_type,
constants.HT_KVM_VALID_DISK_TYPES))
def ValidateParameters(self, hvparams): def ValidateParameters(self, hvparams):
"""Check the given parameters for validity. """Check the given parameters for validity.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment