1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-04-01 06:50:25 +03:00

F #6303: Add SCSI controller and update names

- Always add a virtio-scsi controller to allow hotplug of scsi disks
- Change DISK/QUEUES to DISK/VIRTIO_BLK_QUEUES
- Default for all disk in the VM can be set in FEATURES/VIRTIO_BLK_QUEUES
- Defaults for all domains can be set in vmm_exec.conf
This commit is contained in:
Ruben S. Montero 2023-09-04 11:52:57 +02:00
parent 159275c833
commit f5de29658f
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 89 additions and 60 deletions

View File

@ -658,7 +658,6 @@ int LibVirtDriver::deployment_description_kvm(
bool localtime = false;
bool guest_agent = false;
int scsi_targets_num = 0;
int iothreads = 0;
int iothread_actual = 1;
@ -1053,7 +1052,6 @@ int LibVirtDriver::deployment_description_kvm(
get_attribute(nullptr, host, cluster, "DISK", "IO", default_driver_disk_io);
get_attribute(nullptr, host, cluster, "DISK", "DISCARD", default_driver_discard);
get_attribute(nullptr, host, cluster, "DISK", "QUEUES", default_blk_queues);
get_attribute(nullptr, host, cluster, "DISK", "TOTAL_BYTES_SEC", default_total_bytes_sec);
get_attribute(nullptr, host, cluster, "DISK", "TOTAL_BYTES_SEC_MAX", default_total_bytes_sec_max);
@ -1081,7 +1079,9 @@ int LibVirtDriver::deployment_description_kvm(
get_attribute(nullptr, host, cluster, "DISK", "SIZE_IOPS_SEC", default_size_iops_sec);
// ------------------------------------------------------------------------
get_attribute(vm, host, cluster, "FEATURES", "VIRTIO_BLK_QUEUES", default_blk_queues);
// -------------------------------------------------------------------------
num = vm->get_template_attribute("DISK", disk);
@ -1097,7 +1097,7 @@ int LibVirtDriver::deployment_description_kvm(
discard = disk[i]->vector_value("DISCARD");
source = disk[i]->vector_value("SOURCE");
clone = disk[i]->vector_value("CLONE");
blk_queues= disk[i]->vector_value("QUEUES");
blk_queues= disk[i]->vector_value("VIRTIO_BLK_QUEUES");
shareable = disk[i]->vector_value("SHAREABLE");
ceph_host = disk[i]->vector_value("CEPH_HOST");
@ -1569,7 +1569,6 @@ int LibVirtDriver::deployment_description_kvm(
{
file << "\t\t\t<address type='drive' controller='0' bus='0' " <<
"target='" << target_number << "' unit='0'/>" << endl;
scsi_targets_num++;
}
}
@ -1639,6 +1638,34 @@ int LibVirtDriver::deployment_description_kvm(
}
}
// -------------------------------------------------------------------------
// Controllers:
// - virtio-scsi, for non SCSI disk domains allows hotplug of new disks
// -------------------------------------------------------------------------
get_attribute(vm, host, cluster, "FEATURES", "VIRTIO_SCSI_QUEUES", virtio_scsi_queues);
set_queues(virtio_scsi_queues, vcpu);
file << "\t\t<controller type='scsi' index='0' model='virtio-scsi'>" << endl
<< "\t\t\t<driver";
if ( !virtio_scsi_queues.empty() )
{
file << " queues=" << one_util::escape_xml_attr(virtio_scsi_queues);
}
else
{
file << " queues='1'";
}
if ( iothreads > 0 )
{
file << " iothread=" << one_util::escape_xml_attr(iothread_actual);
}
file << "/>" << endl
<< "\t\t</controller>" << endl;
// ------------------------------------------------------------------------
// Network interfaces
// ------------------------------------------------------------------------
@ -2047,7 +2074,6 @@ int LibVirtDriver::deployment_description_kvm(
get_attribute(vm, host, cluster, "FEATURES", "HYPERV", hyperv);
get_attribute(vm, host, cluster, "FEATURES", "LOCALTIME", localtime);
get_attribute(vm, host, cluster, "FEATURES", "GUEST_AGENT", guest_agent);
get_attribute(vm, host, cluster, "FEATURES", "VIRTIO_SCSI_QUEUES", virtio_scsi_queues);
if ( acpi || pae || apic || hyperv || boot_secure)
{
@ -2100,36 +2126,6 @@ int LibVirtDriver::deployment_description_kvm(
<< "\t</devices>" << endl;
}
set_queues(virtio_scsi_queues, vcpu);
if ( scsi_targets_num > 0 )
{
file << "\t<devices>" << endl
<< "\t\t<controller type='scsi' index='0' model='virtio-scsi'>"
<< endl;
file << "\t\t\t<driver";
if ( !virtio_scsi_queues.empty() )
{
file << " queues=" << one_util::escape_xml_attr(virtio_scsi_queues);
}
else
{
file << " queues='1'";
}
if ( iothreads > 0 )
{
file << " iothread=" << one_util::escape_xml_attr(iothread_actual);
}
file << "/>" << endl;
file << "\t\t</controller>" << endl
<< "\t</devices>" << endl;
}
// ------------------------------------------------------------------------
// Raw KVM attributes
// ------------------------------------------------------------------------

View File

@ -1,21 +1,59 @@
# -----------------------------------------------------------------------------
# Default configuration attributes for the KVM driver
# -----------------------------------------------------------------------------
# (all domains will use these values as defaults). These values can
# be overridden in each VM template. Valid atributes are:
# - emulator
# - os [kernel,initrd,boot,root,kernel_cmd,arch,machine,sd_disk_bus]
# - vcpu
# - memory_slots: number of memory slots for hotplug memory
# - graphics [type, listen, passwd, keymap, random_passwd]
# - features [acpi, pae, apic, hyperv, localtime, guest_agent,
# virtio_scsi_queues, iothreads, virtio_scsi_queues]
# - cpu_model [model]
# - disk [driver, cache, io, queues, discard, total_bytes_sec, total_iops_sec,
# read_bytes_sec, write_bytes_sec, read_iops_sec, write_iops_sec,
# size_iops_sec]
# - nic [filter, model]
# - raw
# - hyperv_options: options used for FEATURES = [ HYPERV = yes ]
# NOTE: raw attribute value is appended to that on the VM template
# * EMULATOR
# * OS:
# - KERNEL
# - INITRD
# - BOOT
# - ROOT
# - KERNEL_CMD
# - ARCH
# - MACHINE
# - SD_DISK_BUS
# * vCPU
# * MEMORY_SLOTS: number of memory slots for hotplug memory
# * gRAPHICS:
# - TYPE
# - LISTEN
# - PASSWD
# - KEYMAP
# - RANDOM_PASSWD
# * featURES:
# - ACPI
# - PAE
# - APIC
# - HYPERV
# - LOCALTIME
# - GUEST_AGENT,
# - IOTHREADS
# - VIRTIO_SCSI_QUEUES
# - VIRTIO_BLK_QUEUES
# * cpu_MODEL:
# - MODEL
# * DISK:
# - DRIVER
# - CACHE
# - IO
# - DISCARD
# - TOTAL_BYTES_SEC
# - TOTAL_IOPS_SEC
# - READ_BYTES_SEC
# - WRITE_BYTES_SEC
# - READ_IOPS_SEC
# - WRITE_IOPS_SEC
# - SIZE_IOPS_SEC
# * NIC:
# - FILTER
# - MODEL
# * RAW: raw attribute value is appended to that on the VM template
# * HYPERV_OPTIONS: options used for FEATURES = [ HYPERV = yes ]
# * SPICE_OPTIONS
# * Q35_ROOT_PORTS: Number of PCI ports allocated for VMs of type q35.
# * OVMF_UEFIS: List of firmware available to users (full path in the hosts)
# -----------------------------------------------------------------------------
#EMULATOR = /usr/libexec/qemu-kvm
@ -34,6 +72,7 @@ FEATURES = [
HYPERV = "no",
GUEST_AGENT = "yes",
VIRTIO_SCSI_QUEUES = "auto",
# VIRTIO_BLK_QUEUES = "auto",
IOTHREADS = "0"
]
@ -42,8 +81,7 @@ FEATURES = [
DISK = [
DRIVER = "raw",
CACHE = "none",
DISCARD = "unmap",
QUEUES = "auto"
DISCARD = "unmap"
]
NIC = [
@ -75,14 +113,9 @@ SPICE_OPTIONS = "
<redirdev bus='usb' type='spicevmc'/>
<redirdev bus='usb' type='spicevmc'/>"
#
Q35_ROOT_PORTS = 16
# Open Virtual Machine Firware (UEFI Firmware)
# List of valid firmware available to users (full path in the hosts)
OVMF_UEFIS = "/usr/share/OVMF/OVMF_CODE.fd /usr/share/OVMF/OVMF_CODE.secboot.fd /usr/share/AAVMF/AAVMF_CODE.fd"
# Q35 PCI root ports
# Amount of PCI ports allocated for VMs of type q35.
# In order to hotplug NICs it must be increased.
# If it is not defined, its default will be 16
Q35_ROOT_PORTS = 16