mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
virDomainMemballoonDef: Change type of model to virDomainMemballoonModel
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
38180f87f5
commit
dcf5d641ec
@ -13532,6 +13532,7 @@ virDomainMemballoonDefParseXML(virDomainXMLOption *xmlopt,
|
||||
g_autofree char *model = NULL;
|
||||
g_autofree char *freepage_reporting = NULL;
|
||||
g_autofree char *deflate = NULL;
|
||||
int model_value;
|
||||
|
||||
def = g_new0(virDomainMemballoonDef, 1);
|
||||
|
||||
@ -13542,11 +13543,12 @@ virDomainMemballoonDefParseXML(virDomainXMLOption *xmlopt,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((def->model = virDomainMemballoonModelTypeFromString(model)) < 0) {
|
||||
if ((model_value = virDomainMemballoonModelTypeFromString(model)) < 0) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unknown memory balloon model '%s'"), model);
|
||||
goto error;
|
||||
}
|
||||
def->model = model_value;
|
||||
|
||||
if ((deflate = virXMLPropString(node, "autodeflate"))) {
|
||||
int value;
|
||||
|
@ -1924,7 +1924,7 @@ typedef enum {
|
||||
} virDomainMemballoonModel;
|
||||
|
||||
struct _virDomainMemballoonDef {
|
||||
int model;
|
||||
virDomainMemballoonModel model;
|
||||
virDomainDeviceInfo info;
|
||||
int period; /* seconds between collections */
|
||||
virTristateSwitch autodeflate;
|
||||
|
@ -740,9 +740,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
|
||||
|
||||
/* only the 'xen' balloon device model is supported */
|
||||
if (def->memballoon) {
|
||||
int model = def->memballoon->model;
|
||||
|
||||
switch ((virDomainMemballoonModel)model) {
|
||||
switch (def->memballoon->model) {
|
||||
case VIR_DOMAIN_MEMBALLOON_MODEL_XEN:
|
||||
break;
|
||||
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
|
||||
@ -750,7 +748,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
|
||||
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_NON_TRANSITIONAL:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("unsupported balloon device model '%s'"),
|
||||
virDomainMemballoonModelTypeToString(model));
|
||||
virDomainMemballoonModelTypeToString(def->memballoon->model));
|
||||
return -1;
|
||||
case VIR_DOMAIN_MEMBALLOON_MODEL_NONE:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
@ -759,7 +757,7 @@ libxlMakeDomBuildInfo(virDomainDef *def,
|
||||
return -1;
|
||||
case VIR_DOMAIN_MEMBALLOON_MODEL_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainMemballoonModel, model);
|
||||
virReportEnumRangeError(virDomainMemballoonModel, def->memballoon->model);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -882,7 +882,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
|
||||
}
|
||||
|
||||
case VIR_DOMAIN_DEVICE_MEMBALLOON:
|
||||
switch ((virDomainMemballoonModel) dev->data.memballoon->model) {
|
||||
switch (dev->data.memballoon->model) {
|
||||
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO_TRANSITIONAL:
|
||||
/* Transitional devices only work in conventional PCI slots */
|
||||
return pciFlags;
|
||||
|
@ -1030,7 +1030,7 @@ qemuMonitorInitBalloonObjectPath(qemuMonitor *mon,
|
||||
|
||||
switch (balloon->info.type) {
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
|
||||
switch ((virDomainMemballoonModel) balloon->model) {
|
||||
switch (balloon->model) {
|
||||
case VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO:
|
||||
name = "virtio-balloon-pci";
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user