mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
S390: Enhance memballoon handling for virtio-s390
The way in that memory balloon suppression was handled for S390 is flawed for a number or reasons. 1. Just preventing the default balloon to be created in the case of VIR_ARCH_S390[X] is not sufficient. An explicit memballoon element in the guest definition will still be honored, resulting both in a -balloon option and the allocation of a PCI bus address, neither being supported. 2. Prohibiting balloon for S390 altogether at a domain_conf level is no good solution either as there's work in progress on the QEMU side to implement a virtio-balloon device, although in conjunction with a new machine type. Suppressing the balloon should therefore be done at the QEMU driver level depending on the present capabilities. Therefore we remove the conditional suppression of the default balloon in domain_conf.c. Further, we are claiming the memballoon device for virtio-s390 during device address assignment to prevent it from being considered as a PCI device. Finally, we suppress the generation of the balloon command line option if this is a virtio-s390 machine. Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
7b3a9f754e
commit
053e813a30
@ -10296,9 +10296,7 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
|
||||
|
||||
def->memballoon = memballoon;
|
||||
VIR_FREE(nodes);
|
||||
} else if (def->os.arch != VIR_ARCH_S390 &&
|
||||
def->os.arch != VIR_ARCH_S390X) {
|
||||
/* TODO: currently no balloon support on s390 -> no default balloon */
|
||||
} else {
|
||||
if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
|
||||
def->virtType == VIR_DOMAIN_VIRT_QEMU ||
|
||||
def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* qemu_command.c: QEMU command generation
|
||||
*
|
||||
* Copyright (C) 2006-2012 Red Hat, Inc.
|
||||
* Copyright (C) 2006-2013 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -795,7 +795,7 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def,
|
||||
{
|
||||
/*
|
||||
declare address-less virtio devices to be of address type 'type'
|
||||
only disks, networks, consoles and controllers for now
|
||||
only disks, networks, consoles, controllers and memballoon for now
|
||||
*/
|
||||
int i;
|
||||
|
||||
@ -825,6 +825,10 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def,
|
||||
def->controllers[i]->info.type = type;
|
||||
}
|
||||
|
||||
if (def->memballoon &&
|
||||
def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO &&
|
||||
def->memballoon->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE)
|
||||
def->memballoon->info.type = type;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -6977,8 +6981,11 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
* NB: Earlier we declared that VirtIO balloon will always be in
|
||||
* slot 0x3 on bus 0x0
|
||||
*/
|
||||
if ((def->memballoon) &&
|
||||
(def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) {
|
||||
if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_S390) && def->memballoon)
|
||||
def->memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_NONE;
|
||||
|
||||
if (def->memballoon &&
|
||||
def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) {
|
||||
if (def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Memory balloon device type '%s' is not supported by this version of qemu"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user