Compare commits
121 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0831c388ec | |||
| b59373e03c | |||
| d617f580c5 | |||
| 7415198273 | |||
| 0ceadbef50 | |||
| 82f2674fae | |||
| 91063332d7 | |||
| 503330ba5d | |||
| 0a64085f47 | |||
| 1073e2447a | |||
| 5b1a906ace | |||
| aff97e0146 | |||
| a4b41a378b | |||
| 3ec523d168 | |||
| 622cf0d642 | |||
| a540751e83 | |||
| 11b596669a | |||
| fefbae879b | |||
| 695b281409 | |||
| 9f9eae34c1 | |||
| ae37ed3500 | |||
| f7f509999b | |||
| 419bcc4b2f | |||
| 7b59d4f7eb | |||
| 03326e9c04 | |||
| f40b464d1e | |||
| 810ca6c207 | |||
| 8df3aef6aa | |||
| 0223d5a656 | |||
| aad810a204 | |||
| 1b8b7567b1 | |||
| 442040caac | |||
| 65efaafca2 | |||
| e87c8ab0c7 | |||
| be6bda45b4 | |||
| 8c9e40d383 | |||
| 0f6f9b973a | |||
| 3db6039b2b | |||
| 4051217c8b | |||
| c5c28baba1 | |||
| 43618df1d4 | |||
| a2951dccb5 | |||
| b884323c03 | |||
| adeaf839fd | |||
| 40d99010e1 | |||
| 11755d8663 | |||
| 2daa92daf9 | |||
| db2858c661 | |||
| 53adb9aaba | |||
| 168df8b606 | |||
| f9085f2538 | |||
| b159bbdc98 | |||
| a5af3cf105 | |||
| 27ca069db7 | |||
| 000a3274d2 | |||
| 19c7799c31 | |||
| 198ff818c6 | |||
| e80c83ad06 | |||
| 660e0112c6 | |||
| 45c1cabef6 | |||
| 56be2c5e38 | |||
| 4aa9c4f1a3 | |||
| 7be420ad22 | |||
| 40b00623a4 | |||
| ce09ec66c7 | |||
| 97d7c80e2e | |||
| b856ae03bf | |||
| 803b3b891a | |||
| 350081d1a9 | |||
| 1b71b68bb9 | |||
| 4084288dd5 | |||
| d1cd1b7ceb | |||
| 5ed69704b9 | |||
| be6e136cb1 | |||
| d3109abfa4 | |||
| f5ff4a2393 | |||
| 8cc50838dc | |||
| 2c2e71c0ce | |||
| 96b1b18b42 | |||
| f7763bfd17 | |||
| 404e58cb18 | |||
| cd3767e3b9 | |||
| f1867a5ecc | |||
| b5548f62cb | |||
| 52f3bedee7 | |||
| f87237919c | |||
| e8969fb913 | |||
| 74d46bc7dd | |||
| 4b6ea94306 | |||
| 963754bc8c | |||
| 7b5483236c | |||
| 438006407c | |||
| 76c8282ee2 | |||
| f463598b24 | |||
| f4e752a385 | |||
| c37cb21dea | |||
| e0bfc1f8aa | |||
| 544ad4a787 | |||
| 8f163760ed | |||
| 565427cf89 | |||
| e10da2f6d4 | |||
| aa386576d5 | |||
| c73c129b48 | |||
| afe729ac3c | |||
| b6038bae4f | |||
| e6d9787587 | |||
| 44699dc495 | |||
| 991d719dde | |||
| 96a520b555 | |||
| e31df5e9de | |||
| 6763b267b9 | |||
| 24e91208a4 | |||
| 15dec999e7 | |||
| d6b0635d3d | |||
| 336a93264e | |||
| 6398d1cff5 | |||
| 6926ed26ea | |||
| 6253f97a2d | |||
| 37ddbd0eac | |||
| 95fe7c8df2 | |||
| 79ae809020 |
@@ -0,0 +1,206 @@
|
||||
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Date: Tue, 4 Nov 2014 22:51:26 +0530
|
||||
Subject: [PATCH] Cpu: Add support for Power LE Architecture.
|
||||
|
||||
This adds support for PowerPC Little Endian architecture.,
|
||||
and allows libvirt to spawn VMs based on 'ppc64le' architecture.
|
||||
|
||||
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
|
||||
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit da636d83dc6b1d070a705786b4daef8644eaca13)
|
||||
---
|
||||
src/conf/domain_conf.c | 2 +-
|
||||
src/cpu/cpu_powerpc.c | 2 +-
|
||||
src/qemu/qemu_capabilities.c | 6 +++---
|
||||
src/qemu/qemu_command.c | 22 +++++++++++-----------
|
||||
src/qemu/qemu_domain.c | 1 +
|
||||
src/util/virarch.h | 3 +++
|
||||
6 files changed, 20 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index cfdf66c..8aca289 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -9867,7 +9867,7 @@ virDomainVideoDefaultType(const virDomainDef *def)
|
||||
(STREQ(def->os.type, "xen") ||
|
||||
STREQ(def->os.type, "linux")))
|
||||
return VIR_DOMAIN_VIDEO_TYPE_XEN;
|
||||
- else if (def->os.arch == VIR_ARCH_PPC64)
|
||||
+ else if ARCH_IS_PPC64(def->os.arch)
|
||||
return VIR_DOMAIN_VIDEO_TYPE_VGA;
|
||||
else
|
||||
return VIR_DOMAIN_VIDEO_TYPE_CIRRUS;
|
||||
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
|
||||
index 67cb9ff..d591c18 100644
|
||||
--- a/src/cpu/cpu_powerpc.c
|
||||
+++ b/src/cpu/cpu_powerpc.c
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
VIR_LOG_INIT("cpu.cpu_powerpc");
|
||||
|
||||
-static const virArch archs[] = { VIR_ARCH_PPC64 };
|
||||
+static const virArch archs[] = { VIR_ARCH_PPC64, VIR_ARCH_PPC64LE };
|
||||
|
||||
struct ppc_vendor {
|
||||
char *name;
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index be4d01f..34d753c 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -632,7 +632,7 @@ virQEMUCapsProbeCPUModels(virQEMUCapsPtr qemuCaps, uid_t runUid, gid_t runGid)
|
||||
if (qemuCaps->arch == VIR_ARCH_I686 ||
|
||||
qemuCaps->arch == VIR_ARCH_X86_64) {
|
||||
parse = virQEMUCapsParseX86Models;
|
||||
- } else if (qemuCaps->arch == VIR_ARCH_PPC64) {
|
||||
+ } else if ARCH_IS_PPC64(qemuCaps->arch) {
|
||||
parse = virQEMUCapsParsePPCModels;
|
||||
} else {
|
||||
VIR_DEBUG("don't know how to parse %s CPU models",
|
||||
@@ -2018,7 +2018,7 @@ bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
|
||||
return true;
|
||||
|
||||
if (def->os.arch == VIR_ARCH_PPC ||
|
||||
- def->os.arch == VIR_ARCH_PPC64) {
|
||||
+ ARCH_IS_PPC64(def->os.arch)) {
|
||||
/*
|
||||
* Usage of pci.0 naming:
|
||||
*
|
||||
@@ -3600,7 +3600,7 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
return false;
|
||||
|
||||
- if ((def->os.arch == VIR_ARCH_PPC) || (def->os.arch == VIR_ARCH_PPC64)) {
|
||||
+ if ((def->os.arch == VIR_ARCH_PPC) || ARCH_IS_PPC64(def->os.arch)) {
|
||||
/* only pseries need -device spapr-vty with -chardev */
|
||||
return (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
||||
chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO);
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index aeb4eec..c5c48bf 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -713,7 +713,7 @@ qemuSetSCSIControllerModel(virDomainDefPtr def,
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
- if ((def->os.arch == VIR_ARCH_PPC64) &&
|
||||
+ if (ARCH_IS_PPC64(def->os.arch) &&
|
||||
STRPREFIX(def->os.machine, "pseries")) {
|
||||
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
|
||||
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
|
||||
@@ -1260,7 +1260,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
|
||||
|
||||
for (i = 0; i < def->nserials; i++) {
|
||||
if (def->serials[i]->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
||||
- (def->os.arch == VIR_ARCH_PPC64) &&
|
||||
+ ARCH_IS_PPC64(def->os.arch) &&
|
||||
STRPREFIX(def->os.machine, "pseries"))
|
||||
def->serials[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
||||
if (qemuAssignSpaprVIOAddress(def, &def->serials[i]->info,
|
||||
@@ -1269,7 +1269,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
|
||||
}
|
||||
|
||||
if (def->nvram) {
|
||||
- if (def->os.arch == VIR_ARCH_PPC64 &&
|
||||
+ if (ARCH_IS_PPC64(def->os.arch) &&
|
||||
STRPREFIX(def->os.machine, "pseries"))
|
||||
def->nvram->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
|
||||
if (qemuAssignSpaprVIOAddress(def, &def->nvram->info,
|
||||
@@ -4191,7 +4191,7 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef,
|
||||
model = def->model;
|
||||
|
||||
if (model == -1) {
|
||||
- if (domainDef->os.arch == VIR_ARCH_PPC64)
|
||||
+ if ARCH_IS_PPC64(domainDef->os.arch)
|
||||
model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PCI_OHCI;
|
||||
else
|
||||
model = VIR_DOMAIN_CONTROLLER_MODEL_USB_PIIX3_UHCI;
|
||||
@@ -8445,7 +8445,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
!qemuDomainMachineIsQ35(def) &&
|
||||
(!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI) ||
|
||||
(!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_OHCI) &&
|
||||
- def->os.arch == VIR_ARCH_PPC64))) {
|
||||
+ ARCH_IS_PPC64(def->os.arch)))) {
|
||||
if (usblegacy) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Multiple legacy USB controllers are "
|
||||
@@ -9643,7 +9643,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (def->nvram) {
|
||||
- if (def->os.arch == VIR_ARCH_PPC64 &&
|
||||
+ if (ARCH_IS_PPC64(def->os.arch) &&
|
||||
STRPREFIX(def->os.machine, "pseries")) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVRAM)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
@@ -9761,7 +9761,7 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
|
||||
{
|
||||
virBuffer cmd = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
- if ((arch == VIR_ARCH_PPC64) && STRPREFIX(machine, "pseries")) {
|
||||
+ if (ARCH_IS_PPC64(arch) && STRPREFIX(machine, "pseries")) {
|
||||
if (serial->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL &&
|
||||
serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
|
||||
virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
|
||||
@@ -10183,7 +10183,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
||||
if (VIR_ALLOC(def->src) < 0)
|
||||
goto error;
|
||||
|
||||
- if (((dom->os.arch == VIR_ARCH_PPC64) &&
|
||||
+ if ((ARCH_IS_PPC64(dom->os.arch) &&
|
||||
dom->os.machine && STRPREFIX(dom->os.machine, "pseries")))
|
||||
def->bus = VIR_DOMAIN_DISK_BUS_SCSI;
|
||||
else
|
||||
@@ -10276,7 +10276,7 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
||||
} else if (STREQ(keywords[i], "if")) {
|
||||
if (STREQ(values[i], "ide")) {
|
||||
def->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
||||
- if (((dom->os.arch == VIR_ARCH_PPC64) &&
|
||||
+ if ((ARCH_IS_PPC64(dom->os.arch) &&
|
||||
dom->os.machine && STRPREFIX(dom->os.machine, "pseries"))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("pseries systems do not support ide devices '%s'"), val);
|
||||
@@ -11521,7 +11521,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
|
||||
}
|
||||
if (STREQ(arg, "-cdrom")) {
|
||||
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||
- if (((def->os.arch == VIR_ARCH_PPC64) &&
|
||||
+ if ((ARCH_IS_PPC64(def->os.arch) &&
|
||||
def->os.machine && STRPREFIX(def->os.machine, "pseries")))
|
||||
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
|
||||
if (VIR_STRDUP(disk->dst, "hdc") < 0)
|
||||
@@ -11537,7 +11537,7 @@ qemuParseCommandLine(virCapsPtr qemuCaps,
|
||||
disk->bus = VIR_DOMAIN_DISK_BUS_IDE;
|
||||
else
|
||||
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
|
||||
- if (((def->os.arch == VIR_ARCH_PPC64) &&
|
||||
+ if ((ARCH_IS_PPC64(def->os.arch) &&
|
||||
def->os.machine && STRPREFIX(def->os.machine, "pseries")))
|
||||
disk->bus = VIR_DOMAIN_DISK_BUS_SCSI;
|
||||
}
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index bec7cf2..48e8acf 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -980,6 +980,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
break;
|
||||
|
||||
case VIR_ARCH_PPC64:
|
||||
+ case VIR_ARCH_PPC64LE:
|
||||
addPCIRoot = true;
|
||||
addDefaultUSBKBD = true;
|
||||
addDefaultUSBMouse = true;
|
||||
diff --git a/src/util/virarch.h b/src/util/virarch.h
|
||||
index d395e58..3206ce2 100644
|
||||
--- a/src/util/virarch.h
|
||||
+++ b/src/util/virarch.h
|
||||
@@ -79,6 +79,9 @@ typedef enum {
|
||||
(arch) == VIR_ARCH_PPC64LE ||\
|
||||
(arch) == VIR_ARCH_PPCEMB)
|
||||
|
||||
+# define ARCH_IS_PPC64(arch) ((arch) == VIR_ARCH_PPC64 ||\
|
||||
+ (arch) == VIR_ARCH_PPC64LE)
|
||||
+
|
||||
# define ARCH_IS_ARM(arch) ((arch) == VIR_ARCH_ARMV6L ||\
|
||||
(arch) == VIR_ARCH_ARMV7L ||\
|
||||
(arch) == VIR_ARCH_ARMV7B ||\
|
||||
@@ -0,0 +1,99 @@
|
||||
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Date: Tue, 4 Nov 2014 22:52:44 +0530
|
||||
Subject: [PATCH] PowerPC : Add support for launching VM in 'compat' mode.
|
||||
|
||||
PowerISA allows processors to run VMs in binary compatibility ("compat")
|
||||
mode supporting an older version of ISA. QEMU has recently added support to
|
||||
explicitly denote a VM running in compatibility mode through commit 6d9412ea
|
||||
& 8dfa3a5e85. Now, a "compat" mode VM can be run by invoking this qemu
|
||||
commandline on a POWER8 host: -cpu host,compat=power7.
|
||||
|
||||
This patch allows libvirt to exploit cpu mode 'host-model' to describe this
|
||||
new mode for PowerKVM guests. For example, when a user wants to request a
|
||||
power7 vm to run in compatibility mode on a Power8 host, this can be
|
||||
described in XML as follows :
|
||||
|
||||
<cpu mode='host-model'>
|
||||
<model>power7</model>
|
||||
</cpu>
|
||||
|
||||
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
|
||||
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
|
||||
Acked-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit addce06c9221f948072cd222b56ea9c3f70ec066)
|
||||
---
|
||||
src/conf/cpu_conf.c | 1 +
|
||||
src/cpu/cpu_powerpc.c | 11 ++---------
|
||||
src/qemu/qemu_command.c | 10 +++++++++-
|
||||
3 files changed, 12 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
||||
index c09c352..74f0b16 100644
|
||||
--- a/src/conf/cpu_conf.c
|
||||
+++ b/src/conf/cpu_conf.c
|
||||
@@ -624,6 +624,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
||||
return 0;
|
||||
|
||||
formatModel = (def->mode == VIR_CPU_MODE_CUSTOM ||
|
||||
+ def->mode == VIR_CPU_MODE_HOST_MODEL ||
|
||||
(flags & VIR_DOMAIN_XML_UPDATE_CPU));
|
||||
formatFallback = (def->type == VIR_CPU_TYPE_GUEST &&
|
||||
(def->mode == VIR_CPU_MODE_HOST_MODEL ||
|
||||
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
|
||||
index d591c18..4ea1835 100644
|
||||
--- a/src/cpu/cpu_powerpc.c
|
||||
+++ b/src/cpu/cpu_powerpc.c
|
||||
@@ -562,8 +562,8 @@ ppcUpdate(virCPUDefPtr guest,
|
||||
static virCPUDefPtr
|
||||
ppcBaseline(virCPUDefPtr *cpus,
|
||||
unsigned int ncpus,
|
||||
- const char **models,
|
||||
- unsigned int nmodels,
|
||||
+ const char **models ATTRIBUTE_UNUSED,
|
||||
+ unsigned int nmodels ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct ppc_map *map = NULL;
|
||||
@@ -583,13 +583,6 @@ ppcBaseline(virCPUDefPtr *cpus,
|
||||
goto error;
|
||||
}
|
||||
|
||||
- if (!cpuModelIsAllowed(model->name, models, nmodels)) {
|
||||
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
- _("CPU model %s is not supported by hypervisor"),
|
||||
- model->name);
|
||||
- goto error;
|
||||
- }
|
||||
-
|
||||
for (i = 0; i < ncpus; i++) {
|
||||
const struct ppc_vendor *vnd;
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index c5c48bf..423692e 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -6217,7 +6217,9 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
||||
*hasHwVirt = hasSVM > 0 ? true : false;
|
||||
}
|
||||
|
||||
- if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
|
||||
+ if ((cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) ||
|
||||
+ ((cpu->mode == VIR_CPU_MODE_HOST_MODEL) &&
|
||||
+ ARCH_IS_PPC64(def->os.arch))) {
|
||||
const char *mode = virCPUModeTypeToString(cpu->mode);
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_HOST)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
@@ -6232,6 +6234,12 @@ qemuBuildCpuModelArgStr(virQEMUDriverPtr driver,
|
||||
goto cleanup;
|
||||
}
|
||||
virBufferAddLit(buf, "host");
|
||||
+
|
||||
+ if (ARCH_IS_PPC64(def->os.arch) &&
|
||||
+ cpu->mode == VIR_CPU_MODE_HOST_MODEL) {
|
||||
+ virBufferAsprintf(buf, ",compat=%s", def->cpu->model);
|
||||
+ }
|
||||
+
|
||||
} else {
|
||||
if (VIR_ALLOC(guest) < 0)
|
||||
goto cleanup;
|
||||
@@ -0,0 +1,92 @@
|
||||
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Date: Tue, 4 Nov 2014 22:58:33 +0530
|
||||
Subject: [PATCH] PowerPC:Improve PVR handling to fall back to cpu generation.
|
||||
|
||||
IBM Power processors differ uniquely across generations (such as power6,
|
||||
power7, power8). Each generation signifies a new PowerISA version
|
||||
that exhibits features unique to that generation.
|
||||
The higher 16 bits of PVR for IBM Power processors encode the CPU
|
||||
generation, while the CPU chip (sub)version is encoded in lower 16 bits.
|
||||
|
||||
For all practical purposes of launching a VM, we care about the
|
||||
generation which the vCPU will belong to, and not specifically the chip
|
||||
version. This patch updates the libvirt PVR check to reflect this
|
||||
relationship. It allows libvirt to select the right CPU generation
|
||||
in case the exact match for a a specific CPU is not found.
|
||||
Hence, there will no longer be a need to add each PowerPC CPU model to
|
||||
cpu_map.xml; just adding entry for the matching ISA generation will
|
||||
suffice.
|
||||
|
||||
It also contains changes to cpu_map.xml since processor generations
|
||||
as understood by QEMU compat mode go as "power6", "power7" or "power8"
|
||||
[Reference : QEMU commit 8dfa3a5e85 ]
|
||||
|
||||
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Signed-off-by: Pradipta Kr. Banerjee <bpradip@in.ibm.com>
|
||||
Signed-off-by: Anton Blanchard <anton@samba.org>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 1e911742287d964055f33ab76d53e673a9b4477f)
|
||||
---
|
||||
src/cpu/cpu_map.xml | 30 ++++++++++++++++++++++++++++++
|
||||
src/cpu/cpu_powerpc.c | 8 ++++++++
|
||||
2 files changed, 38 insertions(+)
|
||||
|
||||
diff --git a/src/cpu/cpu_map.xml b/src/cpu/cpu_map.xml
|
||||
index d181cd5..4ec49ca 100644
|
||||
--- a/src/cpu/cpu_map.xml
|
||||
+++ b/src/cpu/cpu_map.xml
|
||||
@@ -637,5 +637,35 @@
|
||||
<pvr value='0x004b0100'/>
|
||||
</model>
|
||||
|
||||
+ <model name='power6'>
|
||||
+ <vendor name='IBM'/>
|
||||
+ <compat isa='2.05'/>
|
||||
+ <pvr value='0x003e0000'/>
|
||||
+ </model>
|
||||
+
|
||||
+ <model name='power7'>
|
||||
+ <vendor name='IBM'/>
|
||||
+ <compat isa='2.06'/>
|
||||
+ <pvr value='0x003f0000'/>
|
||||
+ </model>
|
||||
+
|
||||
+ <model name='power7+'>
|
||||
+ <vendor name='IBM'/>
|
||||
+ <compat isa='2.06B'/>
|
||||
+ <pvr value='0x004a0000'/>
|
||||
+ </model>
|
||||
+
|
||||
+ <model name='power8e'>
|
||||
+ <vendor name='IBM'/>
|
||||
+ <compat isa='2.07'/>
|
||||
+ <pvr value='0x004b0000'/>
|
||||
+ </model>
|
||||
+
|
||||
+ <model name='power8'>
|
||||
+ <vendor name='IBM'/>
|
||||
+ <compat isa='2.07'/>
|
||||
+ <pvr value='0x004d0000'/>
|
||||
+ </model>
|
||||
+
|
||||
</arch>
|
||||
</cpus>
|
||||
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
|
||||
index 4ea1835..531868c 100644
|
||||
--- a/src/cpu/cpu_powerpc.c
|
||||
+++ b/src/cpu/cpu_powerpc.c
|
||||
@@ -99,6 +99,14 @@ ppcModelFindPVR(const struct ppc_map *map,
|
||||
model = model->next;
|
||||
}
|
||||
|
||||
+ /* PowerPC Processor Version Register is interpreted as follows :
|
||||
+ * Higher order 16 bits : Power ISA generation.
|
||||
+ * Lower order 16 bits : CPU chip version number.
|
||||
+ * If the exact CPU isnt found, return the nearest matching CPU generation
|
||||
+ */
|
||||
+ if (pvr & 0x0000FFFFul)
|
||||
+ return ppcModelFindPVR(map, (pvr & 0xFFFF0000ul));
|
||||
+
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Date: Tue, 4 Nov 2014 23:00:36 +0530
|
||||
Subject: [PATCH] docs: Add documentation for compat mode.
|
||||
|
||||
Add documentation to explain how compat-mode can be invoked with libvirt
|
||||
running on PowerPC architecture.
|
||||
It also mentions that this change is available libvirt 1.2.11 onwards.
|
||||
|
||||
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 9265fd19b68d787e478f5e490524da794965a5f1)
|
||||
---
|
||||
docs/formatdomain.html.in | 15 ++++++++++++++-
|
||||
1 file changed, 14 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 12172a4..6c64230 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -1047,7 +1047,20 @@
|
||||
(such as CPUID level) that don't work. Until these issues are fixed,
|
||||
it's a good idea to avoid using <code>host-model</code> and use
|
||||
<code>custom</code> mode with just the CPU model from host
|
||||
- capabilities XML.</dd>
|
||||
+ capabilities XML.
|
||||
+ <span class="since">(Since 1.2.11)</span>. PowerISA allows
|
||||
+ processors to run VMs in binary compatibility mode supporting an
|
||||
+ older version of ISA. Libvirt on PowerPC architecture uses the
|
||||
+ <code>host-model</code> to signify a guest mode CPU running in
|
||||
+ binary compatibility mode. Example:
|
||||
+ When a user needs a power7 VM to run in compatibility mode
|
||||
+ on a Power8 host, this can be described in XML as follows :
|
||||
+<pre>
|
||||
+ <cpu mode='host-model'>
|
||||
+ <model>power7</model>
|
||||
+ </cpu>
|
||||
+ ...</pre>
|
||||
+ </dd>
|
||||
<dt><code>host-passthrough</code></dt>
|
||||
<dd>With this mode, the CPU visible to the guest should be exactly
|
||||
the same as the host CPU even in the aspects that libvirt does not
|
||||
@@ -0,0 +1,71 @@
|
||||
From: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Date: Tue, 4 Nov 2014 23:02:15 +0530
|
||||
Subject: [PATCH] Test: Add a testcase for PowerPC compat mode cpu
|
||||
specification.
|
||||
|
||||
This introduces a testcase for PowerPC compat mode cpu specification.
|
||||
|
||||
Signed-off-by: Prerna Saxena <prerna@linux.vnet.ibm.com>
|
||||
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
||||
(cherry picked from commit 12c381114ce362e49cadb730b5faabbc150a8878)
|
||||
---
|
||||
.../qemuxml2argv-pseries-cpu-compat.args | 8 ++++++++
|
||||
.../qemuxml2argv-pseries-cpu-compat.xml | 20 ++++++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 2 ++
|
||||
3 files changed, 30 insertions(+)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
|
||||
new file mode 100644
|
||||
index 0000000..64df406
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.args
|
||||
@@ -0,0 +1,8 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test \
|
||||
+QEMU_AUDIO_DRV=none /usr/bin/qemu-system-ppc64 -S -M pseries \
|
||||
+-cpu host,compat=power7 \
|
||||
+-m 214 -smp 4 -nographic -nodefconfig -nodefaults \
|
||||
+-chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait \
|
||||
+-mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c -usb \
|
||||
+-chardev pty,id=charserial0 \
|
||||
+-device spapr-vty,chardev=charserial0,reg=0x30000000
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml
|
||||
new file mode 100644
|
||||
index 0000000..e34a8ad
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pseries-cpu-compat.xml
|
||||
@@ -0,0 +1,20 @@
|
||||
+<domain type='kvm'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <memory unit='KiB'>219100</memory>
|
||||
+ <currentMemory unit='KiB'>219100</currentMemory>
|
||||
+ <vcpu placement='static'>4</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='ppc64' machine='pseries'>hvm</type>
|
||||
+ </os>
|
||||
+ <cpu mode='host-model'>
|
||||
+ <model>power7</model>
|
||||
+ </cpu>
|
||||
+ <clock offset='utc'/>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||
+ <console type='pty'>
|
||||
+ <address type="spapr-vio"/>
|
||||
+ </console>
|
||||
+ <memballoon model="none"/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 5539a84..e24d17f 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1314,6 +1314,8 @@ mymain(void)
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
|
||||
DO_TEST("pseries-cpu-exact", QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE,
|
||||
QEMU_CAPS_NODEFCONFIG);
|
||||
+ DO_TEST("pseries-cpu-compat", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST,
|
||||
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
|
||||
DO_TEST("disk-ide-drive-split",
|
||||
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
|
||||
QEMU_CAPS_IDE_CD);
|
||||
@@ -0,0 +1,126 @@
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Tue, 28 Apr 2015 17:38:00 -0400
|
||||
Subject: [PATCH] polkit: Allow password-less access for 'libvirt' group
|
||||
|
||||
Many users, who admin their own machines, want to be able to access
|
||||
system libvirtd via tools like virt-manager without having to enter
|
||||
a root password. Just google 'virt-manager without password' and
|
||||
you'll find many hits. I've read at least 5 blog posts over the years
|
||||
describing slightly different ways of achieving this goal.
|
||||
|
||||
Let's finally add official support for this.
|
||||
|
||||
Install a polkit-1 rules file granting password-less auth for any user
|
||||
in the new 'libvirt' group. Create the group on RPM install
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=957300
|
||||
(cherry picked from commit e94979e901517af9fdde358d7b7c92cc055dd50c)
|
||||
---
|
||||
daemon/Makefile.am | 13 +++++++++++++
|
||||
daemon/libvirt.rules | 9 +++++++++
|
||||
libvirt.spec.in | 15 +++++++++++++--
|
||||
3 files changed, 35 insertions(+), 2 deletions(-)
|
||||
create mode 100644 daemon/libvirt.rules
|
||||
|
||||
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
|
||||
index b95a79d..9c5ea37 100644
|
||||
--- a/daemon/Makefile.am
|
||||
+++ b/daemon/Makefile.am
|
||||
@@ -53,6 +53,7 @@ EXTRA_DIST = \
|
||||
libvirtd.init.in \
|
||||
libvirtd.upstart \
|
||||
libvirtd.policy.in \
|
||||
+ libvirt.rules \
|
||||
libvirtd.sasl \
|
||||
libvirtd.service.in \
|
||||
libvirtd.socket.in \
|
||||
@@ -233,6 +234,8 @@ policyauth = auth_admin_keep_session
|
||||
else ! WITH_POLKIT0
|
||||
policydir = $(datadir)/polkit-1/actions
|
||||
policyauth = auth_admin_keep
|
||||
+rulesdir = $(datadir)/polkit-1/rules.d
|
||||
+rulesfile = libvirt.rules
|
||||
endif ! WITH_POLKIT0
|
||||
endif WITH_POLKIT
|
||||
|
||||
@@ -263,9 +266,19 @@ if WITH_POLKIT
|
||||
install-data-polkit::
|
||||
$(MKDIR_P) $(DESTDIR)$(policydir)
|
||||
$(INSTALL_DATA) libvirtd.policy $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||
+if ! WITH_POLKIT0
|
||||
+ $(MKDIR_P) $(DESTDIR)$(rulesdir)
|
||||
+ $(INSTALL_DATA) $(srcdir)/$(rulesfile) $(DESTDIR)$(rulesdir)/50-libvirt.rules
|
||||
+endif ! WITH_POLKIT0
|
||||
+
|
||||
uninstall-data-polkit::
|
||||
rm -f $(DESTDIR)$(policydir)/org.libvirt.unix.policy
|
||||
rmdir $(DESTDIR)$(policydir) || :
|
||||
+if ! WITH_POLKIT0
|
||||
+ rm -f $(DESTDIR)$(rulesdir)/50-libvirt.rules
|
||||
+ rmdir $(DESTDIR)$(rulesdir) || :
|
||||
+endif ! WITH_POLKIT0
|
||||
+
|
||||
else ! WITH_POLKIT
|
||||
install-data-polkit::
|
||||
uninstall-data-polkit::
|
||||
diff --git a/daemon/libvirt.rules b/daemon/libvirt.rules
|
||||
new file mode 100644
|
||||
index 0000000..01a15fa
|
||||
--- /dev/null
|
||||
+++ b/daemon/libvirt.rules
|
||||
@@ -0,0 +1,9 @@
|
||||
+// Allow any user in the 'libvirt' group to connect to system libvirtd
|
||||
+// without entering a password.
|
||||
+
|
||||
+polkit.addRule(function(action, subject) {
|
||||
+ if (action.id == "org.libvirt.unix.manage" &&
|
||||
+ subject.isInGroup("libvirt")) {
|
||||
+ return polkit.Result.YES;
|
||||
+ }
|
||||
+});
|
||||
diff --git a/libvirt.spec.in b/libvirt.spec.in
|
||||
index a84b19d..5de085b 100644
|
||||
--- a/libvirt.spec.in
|
||||
+++ b/libvirt.spec.in
|
||||
@@ -1583,9 +1583,9 @@ then
|
||||
fi
|
||||
|
||||
%if %{with_libvirtd}
|
||||
+%pre daemon
|
||||
%if ! %{with_driver_modules}
|
||||
%if %{with_qemu}
|
||||
-%pre daemon
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6
|
||||
# We want soft static allocation of well-known ids, as disk images
|
||||
# are commonly shared across NFS mounts by id rather than name; see
|
||||
@@ -1599,11 +1599,21 @@ if ! getent passwd qemu >/dev/null; then
|
||||
useradd -r -g qemu -G kvm -d / -s /sbin/nologin -c "qemu user" qemu
|
||||
fi
|
||||
fi
|
||||
-exit 0
|
||||
%endif
|
||||
%endif
|
||||
%endif
|
||||
|
||||
+ %if %{with_polkit}
|
||||
+ %if 0%{?fedora} || 0%{?rhel} >= 6
|
||||
+# 'libvirt' group is just to allow password-less polkit access to
|
||||
+# libvirtd. The uid number is irrelevant, so we use dynamic allocation
|
||||
+# described at the above link.
|
||||
+getent group libvirt >/dev/null || groupadd -r libvirt
|
||||
+ %endif
|
||||
+ %endif
|
||||
+
|
||||
+exit 0
|
||||
+
|
||||
%post daemon
|
||||
|
||||
%if %{with_network}
|
||||
@@ -1919,6 +1929,7 @@ exit 0
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 6
|
||||
%{_datadir}/polkit-1/actions/org.libvirt.unix.policy
|
||||
%{_datadir}/polkit-1/actions/org.libvirt.api.policy
|
||||
+%{_datadir}/polkit-1/rules.d/50-libvirt.rules
|
||||
%else
|
||||
%{_datadir}/PolicyKit/policy/org.libvirt.unix.policy
|
||||
%endif
|
||||
@@ -1,180 +0,0 @@
|
||||
From f3997733f0bca081d71848e66ca7d728b4c0a864 Mon Sep 17 00:00:00 2001
|
||||
From: Alon Levy <alevy@redhat.com>
|
||||
Date: Tue, 8 May 2012 20:42:44 +0300
|
||||
Subject: [PATCH] domain_conf: add "default" to list of valid spice channels
|
||||
|
||||
qemu's behavior in this case is to change the spice server behavior to
|
||||
require secure connection to any channel not otherwise specified as
|
||||
being in plaintext mode. libvirt doesn't currently allow requesting this
|
||||
(via plaintext-channel=<channel name>).
|
||||
|
||||
RHBZ: 819499
|
||||
|
||||
Signed-off-by: Alon Levy <alevy@redhat.com>
|
||||
(cherry picked from commit ba97e4edc6aa439a4f1e70855cf4503181efdb7f)
|
||||
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 7 +++++++
|
||||
docs/schemas/domaincommon.rng | 9 +++++++++
|
||||
src/conf/domain_conf.c | 20 ++++++++++++++++++++
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_command.c | 13 +++++++++++++
|
||||
.../qemuxml2argv-graphics-spice.args | 2 +-
|
||||
.../qemuxml2argv-graphics-spice.xml | 2 +-
|
||||
7 files changed, 52 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index e33913f..4a70b0f 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -2913,6 +2913,13 @@ qemu-kvm -net nic,model=? /dev/null
|
||||
<span class="since">Since 0.9.3</span>
|
||||
NB, this may not be supported by all hypervisors.
|
||||
<span class="since">"spice" since 0.8.6</span>.
|
||||
+ The <code>defaultMode</code> attribute sets the default channel
|
||||
+ security policy, valid values are <code>secure</code>,
|
||||
+ <code>insecure</code> and the default <code>any</code>
|
||||
+ (which is secure if possible, but falls back to insecure
|
||||
+ rather than erroring out if no secure path is
|
||||
+ available). <span class="since">"defaultMode" since
|
||||
+ 0.9.12</span>.
|
||||
</p>
|
||||
<p>
|
||||
When SPICE has both a normal and TLS secured TCP port
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 5bcf1b9..30ab4c6 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1779,6 +1779,15 @@
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <attribute name="defaultMode">
|
||||
+ <choice>
|
||||
+ <value>any</value>
|
||||
+ <value>secure</value>
|
||||
+ <value>insecure</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
<interleave>
|
||||
<ref name="listenElements"/>
|
||||
<zeroOrMore>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index d017ea4..2b21b11 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -6069,6 +6069,8 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
||||
char *port = virXMLPropString(node, "port");
|
||||
char *tlsPort;
|
||||
char *autoport;
|
||||
+ char *defaultMode;
|
||||
+ int defaultModeVal;
|
||||
|
||||
if (port) {
|
||||
if (virStrToLong_i(port, NULL, 10, &def->data.spice.port) < 0) {
|
||||
@@ -6101,6 +6103,20 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
|
||||
VIR_FREE(autoport);
|
||||
}
|
||||
|
||||
+ def->data.spice.defaultMode = VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY;
|
||||
+
|
||||
+ if ((defaultMode = virXMLPropString(node, "defaultMode")) != NULL) {
|
||||
+ if ((defaultModeVal = virDomainGraphicsSpiceChannelModeTypeFromString(defaultMode)) < 0) {
|
||||
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
+ _("unknown default spice channel mode %s"),
|
||||
+ defaultMode);
|
||||
+ VIR_FREE(defaultMode);
|
||||
+ goto error;
|
||||
+ }
|
||||
+ def->data.spice.defaultMode = defaultModeVal;
|
||||
+ VIR_FREE(defaultMode);
|
||||
+ }
|
||||
+
|
||||
if (def->data.spice.port == -1 && def->data.spice.tlsPort == -1) {
|
||||
/* Legacy compat syntax, used -1 for auto-port */
|
||||
def->data.spice.autoport = 1;
|
||||
@@ -12111,6 +12127,10 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
|
||||
virBufferEscapeString(buf, " keymap='%s'",
|
||||
def->data.spice.keymap);
|
||||
|
||||
+ if (def->data.spice.defaultMode != VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY)
|
||||
+ virBufferAsprintf(buf, " defaultMode='%s'",
|
||||
+ virDomainGraphicsSpiceChannelModeTypeToString(def->data.spice.defaultMode));
|
||||
+
|
||||
virDomainGraphicsAuthDefFormatAttr(buf, &def->data.spice.auth, flags);
|
||||
break;
|
||||
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index a2fea00..62eaafb 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1233,6 +1233,7 @@ struct _virDomainGraphicsDef {
|
||||
virDomainGraphicsAuthDef auth;
|
||||
unsigned int autoport :1;
|
||||
int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
|
||||
+ int defaultMode; /* enum virDomainGraphicsSpiceChannelMode */
|
||||
int image;
|
||||
int jpeg;
|
||||
int zlib;
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 55e772f..f411712 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -5499,6 +5499,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
const char *listenAddr = NULL;
|
||||
char *netAddr = NULL;
|
||||
int ret;
|
||||
+ int defaultMode = def->graphics[0]->data.spice.defaultMode;
|
||||
|
||||
if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SPICE)) {
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
@@ -5582,6 +5583,18 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
virBufferAsprintf(&opt, ",x509-dir=%s",
|
||||
driver->spiceTLSx509certdir);
|
||||
|
||||
+ switch (defaultMode) {
|
||||
+ case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE:
|
||||
+ virBufferAsprintf(&opt, ",tls-channel=default");
|
||||
+ break;
|
||||
+ case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_INSECURE:
|
||||
+ virBufferAsprintf(&opt, ",plaintext-channel=default");
|
||||
+ break;
|
||||
+ case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_ANY:
|
||||
+ /* nothing */
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
for (i = 0 ; i < VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST ; i++) {
|
||||
int mode = def->graphics[0]->data.spice.channels[i];
|
||||
switch (mode) {
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
|
||||
index c9fdb99..698e39c 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
|
||||
@@ -2,7 +2,7 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
|
||||
/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor \
|
||||
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
|
||||
/dev/HostVG/QEMUGuest1 -spice port=5903,tls-port=5904,addr=127.0.0.1,\
|
||||
-x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs,\
|
||||
+x509-dir=/etc/pki/libvirt-spice,tls-channel=default,tls-channel=main,plaintext-channel=inputs,\
|
||||
image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
|
||||
playback-compression=on,streaming-video=filter,disable-copy-paste -vga \
|
||||
qxl -global qxl.vram_size=18874368 -device qxl,id=video1,vram_size=33554432,bus=pci.0,addr=0x4 \
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
|
||||
index 8930b60..a3789f2 100644
|
||||
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
|
||||
@@ -22,7 +22,7 @@
|
||||
<controller type='usb' index='0'/>
|
||||
<controller type='ide' index='0'/>
|
||||
<input type='mouse' bus='ps2'/>
|
||||
- <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
|
||||
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1' defaultMode='secure'>
|
||||
<listen type='address' address='127.0.0.1'/>
|
||||
<channel name='main' mode='secure'/>
|
||||
<channel name='inputs' mode='insecure'/>
|
||||
--
|
||||
1.7.7.6
|
||||
|
||||
@@ -1,182 +0,0 @@
|
||||
From 3c3816ed226e766aa76624de7d159cdd1ee67913 Mon Sep 17 00:00:00 2001
|
||||
From: Alon Levy <alevy@redhat.com>
|
||||
Date: Tue, 8 May 2012 16:00:28 +0300
|
||||
Subject: [PATCH] domain_conf: add "usbredir" to list of valid spice channels
|
||||
|
||||
Add "usbredir" channel to list of recognized spice channels.
|
||||
|
||||
RHBZ: 819498
|
||||
|
||||
Signed-off-by: Alon Levy <alevy@redhat.com>
|
||||
(cherry picked from commit 4e78ffb63489071c4100678ed88d3111284555e8)
|
||||
Signed-off-by: Cole Robinson <crobinso@redhat.com>
|
||||
---
|
||||
docs/formatdomain.html.in | 8 ++-
|
||||
docs/schemas/domaincommon.rng | 1 +
|
||||
src/conf/domain_conf.c | 3 +-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
.../qemuxml2argv-graphics-spice-usb-redir.args | 16 ++++++
|
||||
.../qemuxml2argv-graphics-spice-usb-redir.xml | 53 ++++++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 6 ++
|
||||
7 files changed, 84 insertions(+), 4 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index 801e1ec..e33913f 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -2922,9 +2922,11 @@ qemu-kvm -net nic,model=? /dev/null
|
||||
main <graphics> element. Valid channel names
|
||||
include <code>main</code>, <code>display</code>,
|
||||
<code>inputs</code>, <code>cursor</code>,
|
||||
- <code>playback</code>, <code>record</code>;
|
||||
- and <span class="since">since
|
||||
- 0.8.8</span>: <code>smartcard</code>.
|
||||
+ <code>playback</code>, <code>record</code>
|
||||
+ (all <span class="since"> since 0.8.6</span>);
|
||||
+ <code>smartcard</code> (<span class="since">since
|
||||
+ 0.8.8</span>); and <code>usbredir</code>
|
||||
+ (<span class="since">since 0.9.12</span>).
|
||||
</p>
|
||||
<pre>
|
||||
<graphics type='spice' port='-1' tlsPort='-1' autoport='yes'>
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 0cc04af..5bcf1b9 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1792,6 +1792,7 @@
|
||||
<value>playback</value>
|
||||
<value>record</value>
|
||||
<value>smartcard</value>
|
||||
+ <value>usbredir</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
<attribute name="mode">
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index d886b60..d017ea4 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -428,7 +428,8 @@ VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelName,
|
||||
"cursor",
|
||||
"playback",
|
||||
"record",
|
||||
- "smartcard");
|
||||
+ "smartcard",
|
||||
+ "usbredir");
|
||||
|
||||
VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelMode,
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_LAST,
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 1b8741e..a2fea00 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -1097,6 +1097,7 @@ enum virDomainGraphicsSpiceChannelName {
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_PLAYBACK,
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_RECORD,
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_SMARTCARD,
|
||||
+ VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_USBREDIR,
|
||||
|
||||
VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST
|
||||
};
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args
|
||||
new file mode 100644
|
||||
index 0000000..35e51a7
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.args
|
||||
@@ -0,0 +1,16 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice /usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=readline -no-acpi -boot c \
|
||||
+-device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 \
|
||||
+-device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4 \
|
||||
+-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1 \
|
||||
+-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2 \
|
||||
+-spice port=5903,tls-port=5904,addr=127.0.0.1,\
|
||||
+x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs,\
|
||||
+tls-channel=usbredir,\
|
||||
+image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
|
||||
+playback-compression=on,streaming-video=filter,disable-copy-paste \
|
||||
+-vga cirrus \
|
||||
+-chardev socket,id=charredir0,host=localhost,port=4000 \
|
||||
+-device usb-redir,chardev=charredir0,id=redir0 \
|
||||
+-chardev spicevmc,id=charredir1,name=usbredir \
|
||||
+-device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 \
|
||||
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml
|
||||
new file mode 100644
|
||||
index 0000000..1dc23bd
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-usb-redir.xml
|
||||
@@ -0,0 +1,53 @@
|
||||
+<domain type='qemu'>
|
||||
+ <name>QEMUGuest1</name>
|
||||
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
+ <memory unit='KiB'>219136</memory>
|
||||
+ <currentMemory unit='KiB'>219136</currentMemory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch='i686' machine='pc'>hvm</type>
|
||||
+ <boot dev='hd'/>
|
||||
+ </os>
|
||||
+ <clock offset='utc'/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>destroy</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu</emulator>
|
||||
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
|
||||
+ <listen type='address' address='127.0.0.1'/>
|
||||
+ <channel name='main' mode='secure'/>
|
||||
+ <channel name='inputs' mode='insecure'/>
|
||||
+ <channel name='usbredir' mode='secure'/>
|
||||
+ <image compression='auto_glz'/>
|
||||
+ <jpeg compression='auto'/>
|
||||
+ <zlib compression='auto'/>
|
||||
+ <playback compression='on'/>
|
||||
+ <streaming mode='filter'/>
|
||||
+ <clipboard copypaste='no'/>
|
||||
+ </graphics>
|
||||
+ <controller type='usb' index='0' model='ich9-ehci1'>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
|
||||
+ </controller>
|
||||
+ <controller type='usb' index='0' model='ich9-uhci1'>
|
||||
+ <master startport='0'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
|
||||
+ </controller>
|
||||
+ <controller type='usb' index='0' model='ich9-uhci2'>
|
||||
+ <master startport='2'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
|
||||
+ </controller>
|
||||
+ <controller type='usb' index='0' model='ich9-uhci3'>
|
||||
+ <master startport='4'/>
|
||||
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
|
||||
+ </controller>
|
||||
+ <redirdev bus='usb' type='tcp'>
|
||||
+ <source mode='connect' host='localhost' service='4000'/>
|
||||
+ <protocol type='raw'/>
|
||||
+ </redirdev>
|
||||
+ <redirdev bus='usb' type='spicevmc'>
|
||||
+ <address type='usb' bus='0' port='4'/>
|
||||
+ </redirdev>
|
||||
+ <memballoon model='virtio'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index a32d4f8..b128c07 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -540,6 +540,12 @@ mymain(void)
|
||||
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
|
||||
QEMU_CAPS_DEVICE_QXL_VGA);
|
||||
+ DO_TEST("graphics-spice-usb-redir", false,
|
||||
+ QEMU_CAPS_VGA, QEMU_CAPS_SPICE,
|
||||
+ QEMU_CAPS_CHARDEV, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
|
||||
+ QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_USB_HUB,
|
||||
+ QEMU_CAPS_ICH9_USB_EHCI1, QEMU_CAPS_USB_REDIR,
|
||||
+ QEMU_CAPS_CHARDEV_SPICEVMC);
|
||||
|
||||
DO_TEST("input-usbmouse", false, NONE);
|
||||
DO_TEST("input-usbtablet", false, NONE);
|
||||
--
|
||||
1.7.7.6
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
--- libvirt-0.9.11.5.orig/src/lxc/lxc_container.c 2012-08-12 18:03:58.000000000 -0500
|
||||
+++ libvirt-0.9.11.5.orig/src/lxc/lxc_container.c 2012-09-21 07:38:19.000000000 -0500
|
||||
@@ -506,7 +506,7 @@
|
||||
if (pivotRoot) {
|
||||
#if HAVE_SELINUX
|
||||
if (getfilecon("/", &con) < 0 &&
|
||||
- errno != ENOTSUP) {
|
||||
+ errno != ENOTSUP && errno != ENODATA) {
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Failed to query file context on /"));
|
||||
goto cleanup;
|
||||
--- libvirt-0.9.11.5.orig/src/lxc/lxc_controller.c 2012-08-12 18:03:58.000000000 -0500
|
||||
+++ libvirt-0.9.11.5.orig/src/lxc/lxc_controller.c 2012-09-21 07:20:41.000000000 -0500
|
||||
@@ -1480,7 +1480,7 @@
|
||||
|
||||
#if HAVE_SELINUX
|
||||
if (getfilecon(root->src, &con) < 0 &&
|
||||
- errno != ENOTSUP) {
|
||||
+ errno != ENOTSUP && errno != ENODATA) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to query file context on %s"),
|
||||
root->src);
|
||||
@@ -1,155 +0,0 @@
|
||||
From 7c96ce960b84ba19b9cc8e090615f54206e44ff0 Mon Sep 17 00:00:00 2001
|
||||
From: Laine Stump <laine@laine.org>
|
||||
Date: Tue, 6 Dec 2011 12:47:28 -0500
|
||||
Subject: [PATCH] qemu: replace deprecated fedora-13 machine type with pc-0.14
|
||||
|
||||
This addresses https://bugzilla.redhat.com/show_bug.cgi?id=754772 .
|
||||
It should only be applied to Fedora builds of libvirt, F15 and
|
||||
later, so there is no upstream equivalent patch.
|
||||
|
||||
Background:
|
||||
|
||||
During the lifetime of Fedora 13, some features were backported into
|
||||
the F13 build of qemu-kvm from upstream. These features were part of
|
||||
the functionality of machine type "pc-0.13" in upstream qemu-kvm, so a
|
||||
special "fedora-13" machine type was created for the F13 qemu-kvm.
|
||||
Since "fedora-13" became the new "canonical machine type", all new
|
||||
domains created with F13 libvirt tools by default contained that
|
||||
machine type in their configuration file.
|
||||
|
||||
In Fedora 14, a patch was made to qemu to treat the fedora-13 machine
|
||||
type as equivalent to "pc-0.13". When Fedora 15 was released, this was
|
||||
inadvertently changed to make it equivalent to "pc-0.14".
|
||||
|
||||
With the release of Fedora 16, qemu-kvm initially removed support for
|
||||
this machine type, which caused failure of many guest configurations
|
||||
to start. qemu-kvm subsequently re-added the patch to support
|
||||
fedora-13 (as equivalent to pc-0.14), but with the promise that they
|
||||
could remove it with the release of Fedora 17. (see
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=748218 ).
|
||||
|
||||
Solution:
|
||||
|
||||
In order to create a repeat of the recent problems, prior to F17
|
||||
existing guest configurations need to be updated to change fedora-13
|
||||
to pc-0.14 (which has been determined to be equivalent for all
|
||||
practical purposes in both F15 and F16). That's what this patch does:
|
||||
|
||||
1) Each time libvirtd is started, it calls virDomainLoadAllConfigs()
|
||||
which calls virDomainLoadConfig(); this function has been modified to
|
||||
check for os.machine == "fedora-13", and change it to "pc-0.14" then
|
||||
write the updated config back to disk.
|
||||
|
||||
2) Also, any other time a domain definition is parsed, the parsed
|
||||
version in memory is changed to turn "fedora-13" into "pc-0.14". This
|
||||
handles domains that had been saved to disk prior to the upgrade, and
|
||||
are subsequently restarted.
|
||||
|
||||
3) Finally, whenever a domain definition is formatted into a string,
|
||||
any occurrence of fedora-13 is replaced with pc-0.14 *directly in the
|
||||
virDomainDef* (to avoid multiple warning messages for the same object
|
||||
when it's formatted multiple times). This should deal with those cases
|
||||
where a domain was running at the time of upgrade, and is later
|
||||
saved/snapshotted.
|
||||
|
||||
I had considered doing this with some sed commands in the specfile,
|
||||
but that wouldn't do anything to help the xml saved in image files.
|
||||
|
||||
(Also, one of the xml tests was using the machine type "fedora-13",
|
||||
and since that machine type is treated specially by the rest of this
|
||||
patch, it was failing. That has been changed in a separate patch,
|
||||
which must be applied with this patch, and which *is* also upstream).
|
||||
---
|
||||
src/conf/domain_conf.c | 62 +++++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 files changed, 59 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index f8d0a4c..c79014b 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -8394,7 +8394,25 @@ virDomainDefPtr virDomainDefParseString(virCapsPtr caps,
|
||||
unsigned int expectedVirtTypes,
|
||||
unsigned int flags)
|
||||
{
|
||||
- return virDomainDefParse(xmlStr, NULL, caps, expectedVirtTypes, flags);
|
||||
+ virDomainDefPtr def
|
||||
+ = virDomainDefParse(xmlStr, NULL, caps, expectedVirtTypes, flags);
|
||||
+
|
||||
+ /* Fedora-specific HACK - treat fedora-13 and pc-0.14 as equivalent.
|
||||
+ * This handles the case of domains that had been saved to an image file
|
||||
+ * prior to upgrade (save or snapshot), then restarted/reverted.
|
||||
+ */
|
||||
+ if (def && STREQ_NULLABLE(def->os.machine, "fedora-13")) {
|
||||
+ VIR_FREE(def->os.machine);
|
||||
+ if (!(def->os.machine = strdup("pc-0.14"))) {
|
||||
+ virReportOOMError();
|
||||
+ virDomainDefFree(def);
|
||||
+ def = NULL;
|
||||
+ } else {
|
||||
+ VIR_WARN("Replacing deprecated 'fedora-13' machine type "
|
||||
+ "with equivalent 'pc-0.14' in domain %s xml", def->name);
|
||||
+ }
|
||||
+ }
|
||||
+ return def;
|
||||
}
|
||||
|
||||
virDomainDefPtr virDomainDefParseFile(virCapsPtr caps,
|
||||
@@ -11737,8 +11755,30 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
||||
virBufferAddLit(buf, " <type");
|
||||
if (def->os.arch)
|
||||
virBufferAsprintf(buf, " arch='%s'", def->os.arch);
|
||||
- if (def->os.machine)
|
||||
- virBufferAsprintf(buf, " machine='%s'", def->os.machine);
|
||||
+ if (def->os.machine) {
|
||||
+ /* Fedora-specific HACK - replace "fedora-13" with "pc-0.14"
|
||||
+ * (in the original DomainDef as well as in the xml output).
|
||||
+ * This will catch XML being written to save/migration images
|
||||
+ * of domains that were running when libvirtd was restarted at
|
||||
+ * the time of upgrade.
|
||||
+ */
|
||||
+ if (STREQ_NULLABLE(def->os.machine, "fedora-13")) {
|
||||
+ virBufferAddLit(buf, " machine='pc-0.14'");
|
||||
+ VIR_WARN("substituting machine type 'fedora-13' with 'pc-0.14' "
|
||||
+ "in domain %s", def->name);
|
||||
+ /* It's not exactly nice to modify the source object,
|
||||
+ * but sometimes virDomainFormat is called > 100 times for the
|
||||
+ * same object, which would result in far too many warning logs.
|
||||
+ */
|
||||
+ VIR_FREE(def->os.machine);
|
||||
+ if (!(def->os.machine = strdup("pc-0.14"))) {
|
||||
+ virReportOOMError();
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ } else {
|
||||
+ virBufferAsprintf(buf, " machine='%s'", def->os.machine);
|
||||
+ }
|
||||
+ }
|
||||
/*
|
||||
* HACK: For xen driver we previously used bogus 'linux' as the
|
||||
* os type for paravirt, whereas capabilities declare it to
|
||||
@@ -12149,6 +12189,22 @@ static virDomainObjPtr virDomainLoadConfig(virCapsPtr caps,
|
||||
VIR_DOMAIN_XML_INACTIVE)))
|
||||
goto error;
|
||||
|
||||
+ /* Fedora-specific HACK - replace "fedora-13" with "pc-0.14".
|
||||
+ * This updates all config files at the first restart of libvirt
|
||||
+ * after upgrade.
|
||||
+ */
|
||||
+ if (STREQ_NULLABLE(def->os.machine, "fedora-13")) {
|
||||
+ VIR_FREE(def->os.machine);
|
||||
+ if (!(def->os.machine = strdup("pc-0.14"))) {
|
||||
+ virReportOOMError();
|
||||
+ goto error;
|
||||
+ }
|
||||
+ VIR_WARN("Replacing deprecated 'fedora-13' machine type "
|
||||
+ "with equivalent 'pc-0.14' in domain %s configuration file", name);
|
||||
+ if (virDomainSaveConfig(configDir, def) < 0)
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
if ((autostartLink = virDomainConfigFile(autostartDir, name)) == NULL)
|
||||
goto error;
|
||||
|
||||
--
|
||||
1.7.7.6
|
||||
|
||||
@@ -1,218 +0,0 @@
|
||||
commit b8012ce9312f00947c5ca7250a7a96534c85835f
|
||||
Author: David Weber <wb@munzinger.de>
|
||||
Date: Mon May 14 09:53:02 2012 +0000
|
||||
|
||||
sanlock: fix locking for readonly devices
|
||||
|
||||
Add ignore param for readonly and shared disk in sanlock
|
||||
|
||||
diff --git a/src/locking/libvirt_sanlock.aug b/src/locking/libvirt_sanlock.aug
|
||||
index 5f5f8a1..d65b002 100644
|
||||
--- a/src/locking/libvirt_sanlock.aug
|
||||
+++ b/src/locking/libvirt_sanlock.aug
|
||||
@@ -21,6 +21,7 @@ module Libvirt_sanlock =
|
||||
| bool_entry "auto_disk_leases"
|
||||
| int_entry "host_id"
|
||||
| bool_entry "require_lease_for_disks"
|
||||
+ | bool_entry "ignore_readonly_and_shared_disks"
|
||||
let comment = [ label "#comment" . del /#[ \t]*/ "# " . store /([^ \t\n][^\n]*)?/ . del /\n/ "\n" ]
|
||||
let empty = [ label "#empty" . eol ]
|
||||
|
||||
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
|
||||
index d344d6a..146aefd 100644
|
||||
--- a/src/locking/lock_driver_sanlock.c
|
||||
+++ b/src/locking/lock_driver_sanlock.c
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* lock_driver_sanlock.c: A lock driver for Sanlock
|
||||
*
|
||||
- * Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
+ * Copyright (C) 2010-2012 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -65,6 +65,7 @@ struct _virLockManagerSanlockDriver {
|
||||
bool requireLeaseForDisks;
|
||||
int hostID;
|
||||
bool autoDiskLease;
|
||||
+ bool ignoreReadonlyShared;
|
||||
char *autoDiskLeasePath;
|
||||
};
|
||||
|
||||
@@ -114,6 +115,10 @@ static int virLockManagerSanlockLoadConfig(const char *configFile)
|
||||
CHECK_TYPE("auto_disk_leases", VIR_CONF_LONG);
|
||||
if (p) driver->autoDiskLease = p->l;
|
||||
|
||||
+ p = virConfGetValue(conf, "ignore_readonly_and_shared_disks");
|
||||
+ CHECK_TYPE("ignore_readonly_and_shared_disks", VIR_CONF_LONG);
|
||||
+ if (p) driver->ignoreReadonlyShared = p->l;
|
||||
+
|
||||
p = virConfGetValue(conf, "disk_lease_dir");
|
||||
CHECK_TYPE("disk_lease_dir", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
@@ -625,6 +630,12 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if ((flags & (VIR_LOCK_MANAGER_RESOURCE_READONLY |
|
||||
+ VIR_LOCK_MANAGER_RESOURCE_SHARED)) &&
|
||||
+ driver->ignoreReadonlyShared) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
if (flags & VIR_LOCK_MANAGER_RESOURCE_READONLY) {
|
||||
virLockError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Readonly leases are not supported"));
|
||||
diff --git a/src/locking/sanlock.conf b/src/locking/sanlock.conf
|
||||
index efc35ee..19ab2b3 100644
|
||||
--- a/src/locking/sanlock.conf
|
||||
+++ b/src/locking/sanlock.conf
|
||||
@@ -52,3 +52,10 @@
|
||||
# to enabled, otherwise it defaults to disabled.
|
||||
#
|
||||
#require_lease_for_disks = 1
|
||||
+
|
||||
+#
|
||||
+# Enable this flag to have sanlock ignore readonly and shared disks.
|
||||
+# If disabled, then this rejects attempts to share resources until
|
||||
+# sanlock gains support for shared locks.
|
||||
+#
|
||||
+#ignore_readonly_and_shared_disks = 1
|
||||
commit acbd4965c44c4dbc676dfe89aff970052e376073
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Thu Jun 21 15:34:46 2012 +0100
|
||||
|
||||
Add support for shared sanlock leases
|
||||
|
||||
A sanlock lease can be marked as shared (rather
|
||||
than exclusive) using SANLK_RES_SHARED flag. This
|
||||
adds support for that flag and ensures that in auto
|
||||
disk mode, any shared disks use shared leases. This
|
||||
also makes any read-only disks be completely
|
||||
ignored.
|
||||
|
||||
These changes remove the need for the option
|
||||
|
||||
ignore_readonly_and_shared_disks
|
||||
|
||||
so that is removed
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
|
||||
index 146aefd..16941c9 100644
|
||||
--- a/src/locking/lock_driver_sanlock.c
|
||||
+++ b/src/locking/lock_driver_sanlock.c
|
||||
@@ -65,7 +65,6 @@ struct _virLockManagerSanlockDriver {
|
||||
bool requireLeaseForDisks;
|
||||
int hostID;
|
||||
bool autoDiskLease;
|
||||
- bool ignoreReadonlyShared;
|
||||
char *autoDiskLeasePath;
|
||||
};
|
||||
|
||||
@@ -115,10 +114,6 @@ static int virLockManagerSanlockLoadConfig(const char *configFile)
|
||||
CHECK_TYPE("auto_disk_leases", VIR_CONF_LONG);
|
||||
if (p) driver->autoDiskLease = p->l;
|
||||
|
||||
- p = virConfGetValue(conf, "ignore_readonly_and_shared_disks");
|
||||
- CHECK_TYPE("ignore_readonly_and_shared_disks", VIR_CONF_LONG);
|
||||
- if (p) driver->ignoreReadonlyShared = p->l;
|
||||
-
|
||||
p = virConfGetValue(conf, "disk_lease_dir");
|
||||
CHECK_TYPE("disk_lease_dir", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
@@ -428,7 +423,8 @@ static int virLockManagerSanlockDiskLeaseName(const char *path,
|
||||
static int virLockManagerSanlockAddLease(virLockManagerPtr lock,
|
||||
const char *name,
|
||||
size_t nparams,
|
||||
- virLockManagerParamPtr params)
|
||||
+ virLockManagerParamPtr params,
|
||||
+ bool shared)
|
||||
{
|
||||
virLockManagerSanlockPrivatePtr priv = lock->privateData;
|
||||
int ret = -1;
|
||||
@@ -440,6 +436,7 @@ static int virLockManagerSanlockAddLease(virLockManagerPtr lock,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ res->flags = shared ? SANLK_RES_SHARED : 0;
|
||||
res->num_disks = 1;
|
||||
if (!virStrcpy(res->name, name, SANLK_NAME_LEN)) {
|
||||
virLockError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -485,7 +482,8 @@ cleanup:
|
||||
static int virLockManagerSanlockAddDisk(virLockManagerPtr lock,
|
||||
const char *name,
|
||||
size_t nparams,
|
||||
- virLockManagerParamPtr params ATTRIBUTE_UNUSED)
|
||||
+ virLockManagerParamPtr params ATTRIBUTE_UNUSED,
|
||||
+ bool shared)
|
||||
{
|
||||
virLockManagerSanlockPrivatePtr priv = lock->privateData;
|
||||
int ret = -1;
|
||||
@@ -503,6 +501,7 @@ static int virLockManagerSanlockAddDisk(virLockManagerPtr lock,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
+ res->flags = shared ? SANLK_RES_SHARED : 0;
|
||||
res->num_disks = 1;
|
||||
if (virLockManagerSanlockDiskLeaseName(name, res->name, SANLK_NAME_LEN) < 0)
|
||||
goto cleanup;
|
||||
@@ -630,27 +629,15 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
|
||||
return -1;
|
||||
}
|
||||
|
||||
- if ((flags & (VIR_LOCK_MANAGER_RESOURCE_READONLY |
|
||||
- VIR_LOCK_MANAGER_RESOURCE_SHARED)) &&
|
||||
- driver->ignoreReadonlyShared) {
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- if (flags & VIR_LOCK_MANAGER_RESOURCE_READONLY) {
|
||||
- virLockError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("Readonly leases are not supported"));
|
||||
- return -1;
|
||||
- }
|
||||
- if (flags & VIR_LOCK_MANAGER_RESOURCE_SHARED) {
|
||||
- virLockError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
- _("Shareable leases are not supported"));
|
||||
- return -1;
|
||||
- }
|
||||
+ /* Treat R/O resources as a no-op lock request */
|
||||
+ if (flags & VIR_LOCK_MANAGER_RESOURCE_READONLY)
|
||||
+ return 0;
|
||||
|
||||
switch (type) {
|
||||
case VIR_LOCK_MANAGER_RESOURCE_TYPE_DISK:
|
||||
if (driver->autoDiskLease) {
|
||||
- if (virLockManagerSanlockAddDisk(lock, name, nparams, params) < 0)
|
||||
+ if (virLockManagerSanlockAddDisk(lock, name, nparams, params,
|
||||
+ !!(flags & VIR_LOCK_MANAGER_RESOURCE_SHARED)) < 0)
|
||||
return -1;
|
||||
|
||||
if (virLockManagerSanlockCreateLease(priv->res_args[priv->res_count-1]) < 0)
|
||||
@@ -664,7 +651,8 @@ static int virLockManagerSanlockAddResource(virLockManagerPtr lock,
|
||||
break;
|
||||
|
||||
case VIR_LOCK_MANAGER_RESOURCE_TYPE_LEASE:
|
||||
- if (virLockManagerSanlockAddLease(lock, name, nparams, params) < 0)
|
||||
+ if (virLockManagerSanlockAddLease(lock, name, nparams, params,
|
||||
+ !!(flags & VIR_LOCK_MANAGER_RESOURCE_SHARED)) < 0)
|
||||
return -1;
|
||||
break;
|
||||
|
||||
diff --git a/src/locking/sanlock.conf b/src/locking/sanlock.conf
|
||||
index 19ab2b3..efc35ee 100644
|
||||
--- a/src/locking/sanlock.conf
|
||||
+++ b/src/locking/sanlock.conf
|
||||
@@ -52,10 +52,3 @@
|
||||
# to enabled, otherwise it defaults to disabled.
|
||||
#
|
||||
#require_lease_for_disks = 1
|
||||
-
|
||||
-#
|
||||
-# Enable this flag to have sanlock ignore readonly and shared disks.
|
||||
-# If disabled, then this rejects attempts to share resources until
|
||||
-# sanlock gains support for shared locks.
|
||||
-#
|
||||
-#ignore_readonly_and_shared_disks = 1
|
||||
+1668
-589
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user