Rebase ot upstream 1.1.3
This commit is contained in:
parent
b884323c03
commit
a2951dccb5
File diff suppressed because it is too large
Load Diff
@ -1,77 +0,0 @@
|
||||
From 1bab38008dbfb16329e73b419fd9871e6f15990c Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri, 30 Aug 2013 12:41:30 -0400
|
||||
Subject: [PATCH] domain_conf: Add default memballoon in PostParse callbacks
|
||||
|
||||
This should be a no-op change for now.
|
||||
---
|
||||
src/conf/domain_conf.c | 13 -------------
|
||||
src/qemu/qemu_domain.c | 10 ++++++++++
|
||||
src/xen/xen_driver.c | 9 +++++++++
|
||||
3 files changed, 19 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index f8fbf79..fafbb89 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -12184,19 +12184,6 @@ virDomainDefParseXML(xmlDocPtr xml,
|
||||
|
||||
def->memballoon = memballoon;
|
||||
VIR_FREE(nodes);
|
||||
- } else {
|
||||
- if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
|
||||
- def->virtType == VIR_DOMAIN_VIRT_QEMU ||
|
||||
- def->virtType == VIR_DOMAIN_VIRT_KQEMU ||
|
||||
- def->virtType == VIR_DOMAIN_VIRT_KVM) {
|
||||
- virDomainMemballoonDefPtr memballoon;
|
||||
- if (VIR_ALLOC(memballoon) < 0)
|
||||
- goto error;
|
||||
- memballoon->model = def->virtType == VIR_DOMAIN_VIRT_XEN ?
|
||||
- VIR_DOMAIN_MEMBALLOON_MODEL_XEN :
|
||||
- VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
|
||||
- def->memballoon = memballoon;
|
||||
- }
|
||||
}
|
||||
|
||||
/* Parse the RNG device */
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 7f4d17d..9260301 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -784,6 +784,16 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if (!def->memballoon) {
|
||||
+ virDomainMemballoonDefPtr memballoon;
|
||||
+ if (VIR_ALLOC(memballoon) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO;
|
||||
+ def->memballoon = memballoon;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
|
||||
index cb64de6..6cb4f4f 100644
|
||||
--- a/src/xen/xen_driver.c
|
||||
+++ b/src/xen/xen_driver.c
|
||||
@@ -340,6 +340,15 @@ xenDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
STRNEQ(def->os.type, "hvm"))
|
||||
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
|
||||
|
||||
+ if (!def->memballoon) {
|
||||
+ virDomainMemballoonDefPtr memballoon;
|
||||
+ if (VIR_ALLOC(memballoon) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ memballoon->model = VIR_DOMAIN_MEMBALLOON_MODEL_XEN;
|
||||
+ def->memballoon = memballoon;
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,191 +0,0 @@
|
||||
From d85bc1315cc00800ed6d4a1baeda9a91c34e52c4 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri, 30 Aug 2013 12:41:31 -0400
|
||||
Subject: [PATCH] qemu: Don't add default memballoon device on ARM
|
||||
|
||||
And add test cases for a basic working ARM guest.
|
||||
---
|
||||
docs/schemas/domaincommon.rng | 19 +++++++++++++
|
||||
src/qemu/qemu_domain.c | 4 ++-
|
||||
.../qemuxml2argv-arm-vexpressa9-nodevs.args | 5 ++++
|
||||
.../qemuxml2argv-arm-vexpressa9-nodevs.xml | 26 +++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 3 ++
|
||||
tests/testutilsqemu.c | 33 ++++++++++++++++++++++
|
||||
6 files changed, 89 insertions(+), 1 deletion(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.xml
|
||||
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 6978dc7..68c3e4d 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -304,6 +304,7 @@
|
||||
<ref name="hvmppc"/>
|
||||
<ref name="hvmppc64"/>
|
||||
<ref name="hvms390"/>
|
||||
+ <ref name="hvmarm"/>
|
||||
</choice>
|
||||
</optional>
|
||||
<value>hvm</value>
|
||||
@@ -413,6 +414,24 @@
|
||||
</optional>
|
||||
</group>
|
||||
</define>
|
||||
+ <define name="hvmarm">
|
||||
+ <group>
|
||||
+ <optional>
|
||||
+ <attribute name="arch">
|
||||
+ <choice>
|
||||
+ <value>armv7l</value>
|
||||
+ </choice>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ <optional>
|
||||
+ <attribute name="machine">
|
||||
+ <data type="string">
|
||||
+ <param name="pattern">[a-zA-Z0-9_\.\-]+</param>
|
||||
+ </data>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
+ </group>
|
||||
+ </define>
|
||||
<define name="osexe">
|
||||
<element name="os">
|
||||
<element name="type">
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index 9260301..cff6d70 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -703,6 +703,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
bool addImplicitSATA = false;
|
||||
bool addPCIRoot = false;
|
||||
bool addPCIeRoot = false;
|
||||
+ bool addDefaultMemballoon = true;
|
||||
|
||||
/* check for emulator and create a default one if needed */
|
||||
if (!def->emulator &&
|
||||
@@ -737,6 +738,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
|
||||
case VIR_ARCH_ARMV7L:
|
||||
addDefaultUSB = false;
|
||||
+ addDefaultMemballoon = false;
|
||||
break;
|
||||
|
||||
case VIR_ARCH_ALPHA:
|
||||
@@ -785,7 +787,7 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
}
|
||||
}
|
||||
|
||||
- if (!def->memballoon) {
|
||||
+ if (addDefaultMemballoon && !def->memballoon) {
|
||||
virDomainMemballoonDefPtr memballoon;
|
||||
if (VIR_ALLOC(memballoon) < 0)
|
||||
return -1;
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.args
|
||||
new file mode 100644
|
||||
index 0000000..794dba2
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.args
|
||||
@@ -0,0 +1,5 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-arm -S -M vexpress-a9 -m 1024 -smp 1 -nographic \
|
||||
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
+-boot c -kernel /arm.kernel -initrd /arm.initrd \
|
||||
+-append console=ttyAMA0,115200n8 -dtb /arm.dtb -usb
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.xml b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.xml
|
||||
new file mode 100644
|
||||
index 0000000..3f318c8
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-nodevs.xml
|
||||
@@ -0,0 +1,26 @@
|
||||
+<domain type="qemu">
|
||||
+ <name>armtest</name>
|
||||
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e6a</uuid>
|
||||
+ <memory>1048576</memory>
|
||||
+ <currentMemory>1048576</currentMemory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch="armv7l" machine="vexpress-a9">hvm</type>
|
||||
+ <kernel>/arm.kernel</kernel>
|
||||
+ <initrd>/arm.initrd</initrd>
|
||||
+ <dtb>/arm.dtb</dtb>
|
||||
+ <cmdline>console=ttyAMA0,115200n8</cmdline>
|
||||
+ </os>
|
||||
+ <features>
|
||||
+ <acpi/>
|
||||
+ <apic/>
|
||||
+ <pae/>
|
||||
+ </features>
|
||||
+ <clock offset="utc"/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>restart</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-arm</emulator>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 4e3508b..cb6106f 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1057,6 +1057,9 @@ mymain(void)
|
||||
QEMU_CAPS_VGA_QXL, QEMU_CAPS_DEVICE_QXL,
|
||||
QEMU_CAPS_Q35_PCI_HOLE64_SIZE);
|
||||
|
||||
+ DO_TEST("arm-vexpressa9-nodevs",
|
||||
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
|
||||
+
|
||||
virObjectUnref(driver.config);
|
||||
virObjectUnref(driver.caps);
|
||||
virObjectUnref(driver.xmlopt);
|
||||
diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
|
||||
index fac83b2..92433ef 100644
|
||||
--- a/tests/testutilsqemu.c
|
||||
+++ b/tests/testutilsqemu.c
|
||||
@@ -145,6 +145,36 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
+static int testQemuAddArmGuest(virCapsPtr caps)
|
||||
+{
|
||||
+ static const char *machines[] = { "vexpress-a9",
|
||||
+ "vexpress-a15",
|
||||
+ "versatilepb" };
|
||||
+ virCapsGuestMachinePtr *capsmachines = NULL;
|
||||
+ virCapsGuestPtr guest;
|
||||
+
|
||||
+ capsmachines = virCapabilitiesAllocMachines(machines,
|
||||
+ ARRAY_CARDINALITY(machines));
|
||||
+ if (!capsmachines)
|
||||
+ goto error;
|
||||
+
|
||||
+ guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_ARMV7L,
|
||||
+ "/usr/bin/qemu-system-arm", NULL,
|
||||
+ ARRAY_CARDINALITY(machines),
|
||||
+ capsmachines);
|
||||
+ if (!guest)
|
||||
+ goto error;
|
||||
+
|
||||
+ if (!virCapabilitiesAddGuestDomain(guest, "qemu", NULL, NULL, 0, NULL))
|
||||
+ goto error;
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+error:
|
||||
+ virCapabilitiesFreeMachines(capsmachines, ARRAY_CARDINALITY(machines));
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
|
||||
virCapsPtr testQemuCapsInit(void) {
|
||||
virCapsPtr caps;
|
||||
@@ -270,6 +300,9 @@ virCapsPtr testQemuCapsInit(void) {
|
||||
if (testQemuAddS390Guest(caps))
|
||||
goto cleanup;
|
||||
|
||||
+ if (testQemuAddArmGuest(caps))
|
||||
+ goto cleanup;
|
||||
+
|
||||
if (virTestGetDebug()) {
|
||||
char *caps_str;
|
||||
|
@ -1,156 +0,0 @@
|
||||
From c72361536b151a2b9bd839bd528671bafbd5dee2 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri, 30 Aug 2013 12:41:32 -0400
|
||||
Subject: [PATCH] qemu: Fix specifying char devs for ARM
|
||||
|
||||
QEMU ARM boards don't give us any way to explicitly wire in
|
||||
a -chardev, so use the old style -serial options.
|
||||
|
||||
Unfortunately this isn't as simple as just turning off the CHARDEV flag
|
||||
for qemu-system-arm, as upcoming virtio support _will_ use device/chardev.
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 18 ++++++++++++++++++
|
||||
src/qemu/qemu_capabilities.h | 4 ++++
|
||||
src/qemu/qemu_command.c | 3 +--
|
||||
src/qemu/qemu_process.c | 37 ++++++++++++++++++++++---------------
|
||||
4 files changed, 45 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 7888e2d..72df793 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -2827,3 +2827,21 @@ virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps)
|
||||
{
|
||||
return qemuCaps->usedQMP;
|
||||
}
|
||||
+
|
||||
+bool
|
||||
+virQEMUCapsSupportsChardev(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainChrDefPtr chr ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
|
||||
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
+ return false;
|
||||
+
|
||||
+ /* This may not be true for all ARM machine types, but at least
|
||||
+ * the only supported serial devices of vexpress and versatile
|
||||
+ * don't have the -chardev property wired up. */
|
||||
+ if (def->os.arch != VIR_ARCH_ARMV7L)
|
||||
+ return false;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index 69f3395..5180ee9 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -275,4 +275,8 @@ int virQEMUCapsParseDeviceStr(virQEMUCapsPtr qemuCaps, const char *str);
|
||||
VIR_ENUM_DECL(virQEMUCaps);
|
||||
|
||||
bool virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps);
|
||||
+bool virQEMUCapsSupportsChardev(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainChrDefPtr chr);
|
||||
+
|
||||
#endif /* __QEMU_CAPABILITIES_H__*/
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 9dfdb73..a8e532c 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -8493,8 +8493,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
char *devstr;
|
||||
|
||||
/* Use -chardev with -device if they are available */
|
||||
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
+ if (virQEMUCapsSupportsChardev(def, qemuCaps, serial)) {
|
||||
virCommandAddArg(cmd, "-chardev");
|
||||
if (!(devstr = qemuBuildChrChardevStr(&serial->source,
|
||||
serial->info.alias,
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index dfe8142..abe0060 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -1604,22 +1604,25 @@ qemuProcessExtractTTYPath(const char *haystack,
|
||||
}
|
||||
|
||||
static int
|
||||
-qemuProcessLookupPTYs(virDomainChrDefPtr *devices,
|
||||
+qemuProcessLookupPTYs(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainChrDefPtr *devices,
|
||||
int count,
|
||||
- virHashTablePtr paths,
|
||||
- bool chardevfmt)
|
||||
+ virHashTablePtr paths)
|
||||
{
|
||||
size_t i;
|
||||
- const char *prefix = chardevfmt ? "char" : "";
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
virDomainChrDefPtr chr = devices[i];
|
||||
+ bool chardevfmt = virQEMUCapsSupportsChardev(def, qemuCaps, chr);
|
||||
+
|
||||
if (chr->source.type == VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
char id[32];
|
||||
const char *path;
|
||||
|
||||
if (snprintf(id, sizeof(id), "%s%s",
|
||||
- prefix, chr->info.alias) >= sizeof(id))
|
||||
+ chardevfmt ? "char" : "",
|
||||
+ chr->info.alias) >= sizeof(id))
|
||||
return -1;
|
||||
|
||||
path = (const char *) virHashLookup(paths, id);
|
||||
@@ -1653,19 +1656,21 @@ qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
virHashTablePtr paths)
|
||||
{
|
||||
- bool chardevfmt = virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV);
|
||||
size_t i = 0;
|
||||
|
||||
- if (qemuProcessLookupPTYs(vm->def->serials, vm->def->nserials,
|
||||
- paths, chardevfmt) < 0)
|
||||
+ if (qemuProcessLookupPTYs(vm->def, qemuCaps,
|
||||
+ vm->def->serials, vm->def->nserials,
|
||||
+ paths) < 0)
|
||||
return -1;
|
||||
|
||||
- if (qemuProcessLookupPTYs(vm->def->parallels, vm->def->nparallels,
|
||||
- paths, chardevfmt) < 0)
|
||||
+ if (qemuProcessLookupPTYs(vm->def, qemuCaps,
|
||||
+ vm->def->parallels, vm->def->nparallels,
|
||||
+ paths) < 0)
|
||||
return -1;
|
||||
|
||||
- if (qemuProcessLookupPTYs(vm->def->channels, vm->def->nchannels,
|
||||
- paths, chardevfmt) < 0)
|
||||
+ if (qemuProcessLookupPTYs(vm->def, qemuCaps,
|
||||
+ vm->def->channels, vm->def->nchannels,
|
||||
+ paths) < 0)
|
||||
return -1;
|
||||
/* For historical reasons, console[0] can be just an alias
|
||||
* for serial[0]. That's why we need to update it as well. */
|
||||
@@ -1683,8 +1688,9 @@ qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
|
||||
}
|
||||
}
|
||||
|
||||
- if (qemuProcessLookupPTYs(vm->def->consoles + i, vm->def->nconsoles - i,
|
||||
- paths, chardevfmt) < 0)
|
||||
+ if (qemuProcessLookupPTYs(vm->def, qemuCaps,
|
||||
+ vm->def->consoles + i, vm->def->nconsoles - i,
|
||||
+ paths) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@@ -1774,7 +1780,8 @@ qemuProcessWaitForMonitor(virQEMUDriverPtr driver,
|
||||
virHashTablePtr paths = NULL;
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
|
||||
- if (!virQEMUCapsUsedQMP(qemuCaps) && pos != -1) {
|
||||
+ if (!virQEMUCapsUsedQMP(qemuCaps)
|
||||
+ && pos != -1) {
|
||||
if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0)
|
||||
return -1;
|
||||
|
@ -1,43 +0,0 @@
|
||||
From c8e47add2fe77905523f6112ceb6b844337f6d3f Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri, 30 Aug 2013 12:41:33 -0400
|
||||
Subject: [PATCH] qemu: Don't try to allocate PCI addresses for ARM
|
||||
|
||||
---
|
||||
src/qemu/qemu_command.c | 16 ++++++++++++++--
|
||||
1 file changed, 14 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index a8e532c..87345c7 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -1773,6 +1773,16 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static bool
|
||||
+qemuDomainSupportsPCI(virDomainDefPtr def) {
|
||||
+ if (def->os.arch != VIR_ARCH_ARMV7L)
|
||||
+ return true;
|
||||
+
|
||||
+ if (STREQ(def->os.machine, "versatilepb"))
|
||||
+ return true;
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
|
||||
int
|
||||
qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
@@ -1838,8 +1848,10 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
|
||||
if (!(addrs = qemuDomainPCIAddressSetCreate(def, nbuses, false)))
|
||||
goto cleanup;
|
||||
|
||||
- if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
|
||||
- goto cleanup;
|
||||
+ if (qemuDomainSupportsPCI(def)) {
|
||||
+ if (qemuAssignDevicePCISlots(def, qemuCaps, addrs) < 0)
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
}
|
||||
|
||||
if (obj && obj->privateData) {
|
@ -1,146 +0,0 @@
|
||||
From e534a73a71655d45a0b0af98b4b9b9176d701fb3 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri, 30 Aug 2013 12:41:34 -0400
|
||||
Subject: [PATCH] domain_conf: Add disk bus=sd, wire it up for qemu
|
||||
|
||||
This corresponds to '-sd' and '-drive if=sd' on the qemu command line.
|
||||
Needed for many ARM boards which don't provide any other way to
|
||||
pass in storage.
|
||||
---
|
||||
docs/formatdomain.html.in | 3 ++-
|
||||
docs/schemas/domaincommon.rng | 1 +
|
||||
src/conf/domain_conf.c | 4 +++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_command.c | 20 +++++++++++++++-----
|
||||
5 files changed, 22 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
||||
index cce179d..af9b4ae 100644
|
||||
--- a/docs/formatdomain.html.in
|
||||
+++ b/docs/formatdomain.html.in
|
||||
@@ -1785,7 +1785,8 @@
|
||||
as a device ordering hint. The optional <code>bus</code>
|
||||
attribute specifies the type of disk device to emulate;
|
||||
possible values are driver specific, with typical values being
|
||||
- "ide", "scsi", "virtio", "xen", "usb" or "sata". If omitted, the bus
|
||||
+ "ide", "scsi", "virtio", "xen", "usb", "sata", or
|
||||
+ "sd" <span class="since">"sd" since 1.1.2</span>. If omitted, the bus
|
||||
type is inferred from the style of the device name (e.g. a device named
|
||||
'sda' will typically be exported using a SCSI bus). The optional
|
||||
attribute <code>tray</code> indicates the tray status of the
|
||||
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
||||
index 68c3e4d..79ea746 100644
|
||||
--- a/docs/schemas/domaincommon.rng
|
||||
+++ b/docs/schemas/domaincommon.rng
|
||||
@@ -1295,6 +1295,7 @@
|
||||
<value>usb</value>
|
||||
<value>uml</value>
|
||||
<value>sata</value>
|
||||
+ <value>sd</value>
|
||||
</choice>
|
||||
</attribute>
|
||||
</optional>
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index fafbb89..2c62a2d 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -239,7 +239,8 @@ VIR_ENUM_IMPL(virDomainDiskBus, VIR_DOMAIN_DISK_BUS_LAST,
|
||||
"xen",
|
||||
"usb",
|
||||
"uml",
|
||||
- "sata")
|
||||
+ "sata",
|
||||
+ "sd")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainDiskCache, VIR_DOMAIN_DISK_CACHE_LAST,
|
||||
"default",
|
||||
@@ -17308,6 +17309,7 @@ virDiskNameToBusDeviceIndex(const virDomainDiskDefPtr disk,
|
||||
case VIR_DOMAIN_DISK_BUS_USB:
|
||||
case VIR_DOMAIN_DISK_BUS_VIRTIO:
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
+ case VIR_DOMAIN_DISK_BUS_SD:
|
||||
default:
|
||||
*busIdx = 0;
|
||||
*devIdx = idx;
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 56739b7..380e2bb 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -509,6 +509,7 @@ enum virDomainDiskBus {
|
||||
VIR_DOMAIN_DISK_BUS_USB,
|
||||
VIR_DOMAIN_DISK_BUS_UML,
|
||||
VIR_DOMAIN_DISK_BUS_SATA,
|
||||
+ VIR_DOMAIN_DISK_BUS_SD,
|
||||
|
||||
VIR_DOMAIN_DISK_BUS_LAST
|
||||
};
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 87345c7..6733709 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -73,7 +73,8 @@ VIR_ENUM_IMPL(virDomainDiskQEMUBus, VIR_DOMAIN_DISK_BUS_LAST,
|
||||
"xen",
|
||||
"usb",
|
||||
"uml",
|
||||
- "sata")
|
||||
+ "sata",
|
||||
+ "sd")
|
||||
|
||||
|
||||
VIR_ENUM_DECL(qemuDiskCacheV1)
|
||||
@@ -646,6 +647,9 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
ret = virAsprintf(&dev_name, "xenblk%d", devid);
|
||||
break;
|
||||
+ case VIR_DOMAIN_DISK_BUS_SD:
|
||||
+ ret = virAsprintf(&dev_name, "sd%d", devid);
|
||||
+ break;
|
||||
default:
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Unsupported disk name mapping for bus '%s'"),
|
||||
@@ -3786,7 +3790,9 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
- /* Xen has no address type currently, so assign based on index */
|
||||
+ case VIR_DOMAIN_DISK_BUS_SD:
|
||||
+ /* Xen and SD have no address type currently, so assign
|
||||
+ * based on index */
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8190,12 +8196,13 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
virCommandAddArg(cmd, "-drive");
|
||||
|
||||
/* Unfortunately it is not possible to use
|
||||
- -device for floppies, or Xen paravirt
|
||||
+ -device for floppies, xen PV, or SD
|
||||
devices. Fortunately, those don't need
|
||||
static PCI addresses, so we don't really
|
||||
care that we can't use -device */
|
||||
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
- if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) {
|
||||
+ if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN &&
|
||||
+ disk->bus != VIR_DOMAIN_DISK_BUS_SD) {
|
||||
withDeviceArg = true;
|
||||
} else {
|
||||
virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
|
||||
@@ -9892,6 +9899,8 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
||||
def->bus = VIR_DOMAIN_DISK_BUS_VIRTIO;
|
||||
else if (STREQ(values[i], "xen"))
|
||||
def->bus = VIR_DOMAIN_DISK_BUS_XEN;
|
||||
+ else if (STREQ(values[i], "sd"))
|
||||
+ def->bus = VIR_DOMAIN_DISK_BUS_SD;
|
||||
} else if (STREQ(keywords[i], "media")) {
|
||||
if (STREQ(values[i], "cdrom")) {
|
||||
def->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||
@@ -10041,7 +10050,8 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
|
||||
|
||||
if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) {
|
||||
ignore_value(VIR_STRDUP(def->dst, "hda"));
|
||||
- } else if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
|
||||
+ } else if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI ||
|
||||
+ def->bus == VIR_DOMAIN_DISK_BUS_SD) {
|
||||
ignore_value(VIR_STRDUP(def->dst, "sda"));
|
||||
} else if (def->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
|
||||
ignore_value(VIR_STRDUP(def->dst, "vda"));
|
@ -1,206 +0,0 @@
|
||||
From b09ab6961b8dd60691839f0b1a5f259925819425 Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri, 30 Aug 2013 12:41:35 -0400
|
||||
Subject: [PATCH] qemu: Fix networking for ARM guests
|
||||
|
||||
Similar to the chardev bit, ARM boards depend on the old style '-net nic'
|
||||
for actually instantiating net devices. But we can't block out
|
||||
-netdev altogether since it's needed for upcoming virtio support.
|
||||
|
||||
And add tests for working ARM XML with console, disk, and networking.
|
||||
---
|
||||
src/qemu/qemu_command.c | 34 ++++++++++++++++------
|
||||
src/qemu/qemu_domain.c | 20 +++++++++++--
|
||||
.../qemuxml2argv-arm-vexpressa9-basic.args | 8 +++++
|
||||
.../qemuxml2argv-arm-vexpressa9-basic.xml | 34 ++++++++++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 3 ++
|
||||
5 files changed, 88 insertions(+), 11 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.xml
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 6733709..787381b 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -417,6 +417,26 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static bool
|
||||
+qemuDomainSupportsNicdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
+ return false;
|
||||
+
|
||||
+ /* arm boards require legacy -net nic */
|
||||
+ if (def->os.arch == VIR_ARCH_ARMV7L)
|
||||
+ return false;
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static bool
|
||||
+qemuDomainSupportsNetdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ if (!qemuDomainSupportsNicdev(def, qemuCaps))
|
||||
+ return false;
|
||||
+ return virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV);
|
||||
+}
|
||||
|
||||
/**
|
||||
* qemuOpenVhostNet:
|
||||
@@ -454,8 +474,7 @@ qemuOpenVhostNet(virDomainDefPtr def,
|
||||
* option), don't try to open the device.
|
||||
*/
|
||||
if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
|
||||
+ qemuDomainSupportsNetdev(def, qemuCaps))) {
|
||||
if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("vhost-net is not supported with "
|
||||
@@ -7312,8 +7331,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
*
|
||||
* NB, no support for -netdev without use of -device
|
||||
*/
|
||||
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
+ if (qemuDomainSupportsNetdev(def, qemuCaps)) {
|
||||
if (!(host = qemuBuildHostNetStr(net, driver,
|
||||
',', vlan,
|
||||
tapfdName, tapfdSize,
|
||||
@@ -7321,7 +7339,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-netdev", host, NULL);
|
||||
}
|
||||
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
|
||||
+ if (qemuDomainSupportsNicdev(def, qemuCaps)) {
|
||||
bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
|
||||
|
||||
if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
|
||||
@@ -7333,8 +7351,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-net", nic, NULL);
|
||||
}
|
||||
- if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
|
||||
+ if (!qemuDomainSupportsNetdev(def, qemuCaps)) {
|
||||
if (!(host = qemuBuildHostNetStr(net, driver,
|
||||
',', vlan,
|
||||
tapfdName, tapfdSize,
|
||||
@@ -8385,8 +8402,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
int vlan;
|
||||
|
||||
/* VLANs are not used with -netdev, so don't record them */
|
||||
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
|
||||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
+ if (qemuDomainSupportsNetdev(def, qemuCaps))
|
||||
vlan = -1;
|
||||
else
|
||||
vlan = i;
|
||||
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
|
||||
index cff6d70..30588fb 100644
|
||||
--- a/src/qemu/qemu_domain.c
|
||||
+++ b/src/qemu/qemu_domain.c
|
||||
@@ -799,6 +799,23 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static const char *
|
||||
+qemuDomainDefaultNetModel(virDomainDefPtr def) {
|
||||
+ if (def->os.arch == VIR_ARCH_S390 ||
|
||||
+ def->os.arch == VIR_ARCH_S390X)
|
||||
+ return "virtio";
|
||||
+
|
||||
+ if (def->os.arch == VIR_ARCH_ARMV7L) {
|
||||
+ if (STREQ(def->os.machine, "versatilepb"))
|
||||
+ return "smc91c111";
|
||||
+
|
||||
+ /* Incomplete. vexpress (and a few others) use this, but not all
|
||||
+ * arm boards */
|
||||
+ return "lan9118";
|
||||
+ }
|
||||
+
|
||||
+ return "rtl8139";
|
||||
+}
|
||||
|
||||
static int
|
||||
qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
@@ -814,8 +831,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
|
||||
dev->data.net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV &&
|
||||
!dev->data.net->model) {
|
||||
if (VIR_STRDUP(dev->data.net->model,
|
||||
- def->os.arch == VIR_ARCH_S390 ||
|
||||
- def->os.arch == VIR_ARCH_S390X ? "virtio" : "rtl8139") < 0)
|
||||
+ qemuDomainDefaultNetModel(def)) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.args
|
||||
new file mode 100644
|
||||
index 0000000..a23fde4
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.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-arm -S -M vexpress-a9 -m 1024 -smp 1 -nographic \
|
||||
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
+-boot c -kernel /arm.kernel -initrd /arm.initrd -append \
|
||||
+'console=ttyAMA0,115200n8 rw root=/dev/mmcblk0p3 rootwait physmap.enabled=0' \
|
||||
+-dtb /arm.dtb -usb -drive file=/arm.raw,if=sd,index=0 \
|
||||
+-net nic,macaddr=52:54:00:09:a4:37,vlan=0,model=lan9118,name=net0 \
|
||||
+-net user,vlan=0,name=hostnet0 -serial pty
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.xml b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.xml
|
||||
new file mode 100644
|
||||
index 0000000..ec9374f
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-basic.xml
|
||||
@@ -0,0 +1,34 @@
|
||||
+<domain type="qemu">
|
||||
+ <name>armtest</name>
|
||||
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e6a</uuid>
|
||||
+ <memory>1048576</memory>
|
||||
+ <currentMemory>1048576</currentMemory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch="armv7l" machine="vexpress-a9">hvm</type>
|
||||
+ <kernel>/arm.kernel</kernel>
|
||||
+ <initrd>/arm.initrd</initrd>
|
||||
+ <dtb>/arm.dtb</dtb>
|
||||
+ <cmdline>console=ttyAMA0,115200n8 rw root=/dev/mmcblk0p3 rootwait physmap.enabled=0</cmdline>
|
||||
+ </os>
|
||||
+ <features>
|
||||
+ <acpi/>
|
||||
+ <apic/>
|
||||
+ <pae/>
|
||||
+ </features>
|
||||
+ <clock offset="utc"/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>restart</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-arm</emulator>
|
||||
+ <disk type='file' device='disk'>
|
||||
+ <source file='/arm.raw'/>
|
||||
+ <target dev='sda' bus='sd'/>
|
||||
+ </disk>
|
||||
+ <interface type='user'>
|
||||
+ <mac address='52:54:00:09:a4:37'/>
|
||||
+ </interface>
|
||||
+ <console type='pty'/>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index cb6106f..6ecabbf 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1059,6 +1059,9 @@ mymain(void)
|
||||
|
||||
DO_TEST("arm-vexpressa9-nodevs",
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB);
|
||||
+ DO_TEST("arm-vexpressa9-basic",
|
||||
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
|
||||
+ QEMU_CAPS_DRIVE);
|
||||
|
||||
virObjectUnref(driver.config);
|
||||
virObjectUnref(driver.caps);
|
@ -1,448 +0,0 @@
|
||||
From cddd76962c2a0fcbb8c80240d234b7d0d657324d Mon Sep 17 00:00:00 2001
|
||||
From: Cole Robinson <crobinso@redhat.com>
|
||||
Date: Fri, 30 Aug 2013 12:41:36 -0400
|
||||
Subject: [PATCH] qemu: Support virtio-mmio transport for virtio on ARM
|
||||
|
||||
Starting with qemu 1.6, the qemu-system-arm vexpress-a9 model has a
|
||||
hardcoded virtio-mmio transport which enables attaching all virtio
|
||||
devices.
|
||||
|
||||
On the command line, we have to use virtio-XXX-device rather than
|
||||
virtio-XXX-pci, thankfully s390 already set the precedent here so
|
||||
it's fairly straight forward.
|
||||
|
||||
At the XML level, this adds a new device address type virtio-mmio.
|
||||
The controller and addressing don't have any subelements at the
|
||||
moment because we they aren't needed for this usecase, but could
|
||||
be added later if needed.
|
||||
|
||||
Add a test case for an ARM guest with one of every virtio device
|
||||
enabled.
|
||||
---
|
||||
src/conf/domain_conf.c | 12 +++-
|
||||
src/conf/domain_conf.h | 1 +
|
||||
src/qemu/qemu_capabilities.c | 17 ++++--
|
||||
src/qemu/qemu_capabilities.h | 2 +
|
||||
src/qemu/qemu_command.c | 65 +++++++++++++++++-----
|
||||
.../qemuxml2argv-arm-vexpressa9-virtio.args | 14 +++++
|
||||
.../qemuxml2argv-arm-vexpressa9-virtio.xml | 45 +++++++++++++++
|
||||
tests/qemuxml2argvtest.c | 4 ++
|
||||
8 files changed, 139 insertions(+), 21 deletions(-)
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args
|
||||
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.xml
|
||||
|
||||
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
||||
index 2c62a2d..3b51ae8 100644
|
||||
--- a/src/conf/domain_conf.c
|
||||
+++ b/src/conf/domain_conf.c
|
||||
@@ -210,7 +210,8 @@ VIR_ENUM_IMPL(virDomainDeviceAddress, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST,
|
||||
"usb",
|
||||
"spapr-vio",
|
||||
"virtio-s390",
|
||||
- "ccw")
|
||||
+ "ccw",
|
||||
+ "virtio-mmio")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainDisk, VIR_DOMAIN_DISK_TYPE_LAST,
|
||||
"block",
|
||||
@@ -2390,6 +2391,7 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
|
||||
return 1;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
|
||||
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||
return 1;
|
||||
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
|
||||
@@ -3031,6 +3033,9 @@ virDomainDeviceInfoFormat(virBufferPtr buf,
|
||||
info->addr.ccw.devno);
|
||||
break;
|
||||
|
||||
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown address type '%d'"), info->type);
|
||||
@@ -3495,6 +3500,9 @@ virDomainDeviceInfoParseXML(xmlNodePtr node,
|
||||
goto cleanup;
|
||||
break;
|
||||
|
||||
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||
+ break;
|
||||
+
|
||||
default:
|
||||
/* Should not happen */
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@@ -5827,6 +5835,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 &&
|
||||
+ def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Controllers must use the 'pci' address type"));
|
||||
@@ -6387,6 +6396,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390 &&
|
||||
+ def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO &&
|
||||
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Network interfaces must use 'pci' address type"));
|
||||
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
||||
index 380e2bb..1d70eba 100644
|
||||
--- a/src/conf/domain_conf.h
|
||||
+++ b/src/conf/domain_conf.h
|
||||
@@ -207,6 +207,7 @@ enum virDomainDeviceAddressType {
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO,
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390,
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW,
|
||||
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO,
|
||||
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_LAST
|
||||
};
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 72df793..a0f7773 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -237,6 +237,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
|
||||
"dmi-to-pci-bridge",
|
||||
"i440fx-pci-hole64-size",
|
||||
"q35-pci-hole64-size",
|
||||
+
|
||||
+ "virtio-mmio", /* 155 */
|
||||
);
|
||||
|
||||
struct _virQEMUCaps {
|
||||
@@ -1385,6 +1387,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
|
||||
{ "vfio-pci", QEMU_CAPS_DEVICE_VFIO_PCI },
|
||||
{ "scsi-generic", QEMU_CAPS_DEVICE_SCSI_GENERIC },
|
||||
{ "i82801b11-bridge", QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE },
|
||||
+ { "virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO },
|
||||
};
|
||||
|
||||
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
|
||||
@@ -2831,17 +2834,19 @@ virQEMUCapsUsedQMP(virQEMUCapsPtr qemuCaps)
|
||||
bool
|
||||
virQEMUCapsSupportsChardev(virDomainDefPtr def,
|
||||
virQEMUCapsPtr qemuCaps,
|
||||
- virDomainChrDefPtr chr ATTRIBUTE_UNUSED)
|
||||
+ virDomainChrDefPtr chr)
|
||||
{
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
return false;
|
||||
|
||||
- /* This may not be true for all ARM machine types, but at least
|
||||
- * the only supported serial devices of vexpress and versatile
|
||||
- * don't have the -chardev property wired up. */
|
||||
if (def->os.arch != VIR_ARCH_ARMV7L)
|
||||
- return false;
|
||||
+ return true;
|
||||
|
||||
- return true;
|
||||
+ /* This may not be true for all ARM machine types, but at least
|
||||
+ * the only supported non-virtio serial devices of vexpress and versatile
|
||||
+ * don't have the -chardev property wired up. */
|
||||
+ return (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO ||
|
||||
+ (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE &&
|
||||
+ chr->targetType == VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO));
|
||||
}
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index 5180ee9..e000ce5 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -194,6 +194,8 @@ enum virQEMUCapsFlags {
|
||||
QEMU_CAPS_I440FX_PCI_HOLE64_SIZE = 153, /* i440FX-pcihost.pci-hole64-size */
|
||||
QEMU_CAPS_Q35_PCI_HOLE64_SIZE = 154, /* q35-pcihost.pci-hole64-size */
|
||||
|
||||
+ QEMU_CAPS_DEVICE_VIRTIO_MMIO = 155, /* -device virtio-mmio */
|
||||
+
|
||||
QEMU_CAPS_LAST, /* this must always be the last item */
|
||||
};
|
||||
|
||||
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
||||
index 787381b..efbfc97 100644
|
||||
--- a/src/qemu/qemu_command.c
|
||||
+++ b/src/qemu/qemu_command.c
|
||||
@@ -418,22 +418,27 @@ cleanup:
|
||||
}
|
||||
|
||||
static bool
|
||||
-qemuDomainSupportsNicdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
+qemuDomainSupportsNicdev(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainNetDefPtr net)
|
||||
{
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
|
||||
return false;
|
||||
|
||||
- /* arm boards require legacy -net nic */
|
||||
- if (def->os.arch == VIR_ARCH_ARMV7L)
|
||||
+ /* non-virtio ARM nics require legacy -net nic */
|
||||
+ if (def->os.arch == VIR_ARCH_ARMV7L &&
|
||||
+ net->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
-qemuDomainSupportsNetdev(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
|
||||
+qemuDomainSupportsNetdev(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps,
|
||||
+ virDomainNetDefPtr net)
|
||||
{
|
||||
- if (!qemuDomainSupportsNicdev(def, qemuCaps))
|
||||
+ if (!qemuDomainSupportsNicdev(def, qemuCaps, net))
|
||||
return false;
|
||||
return virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV);
|
||||
}
|
||||
@@ -474,7 +479,7 @@ qemuOpenVhostNet(virDomainDefPtr def,
|
||||
* option), don't try to open the device.
|
||||
*/
|
||||
if (!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) &&
|
||||
- qemuDomainSupportsNetdev(def, qemuCaps))) {
|
||||
+ qemuDomainSupportsNetdev(def, qemuCaps, net))) {
|
||||
if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
"%s", _("vhost-net is not supported with "
|
||||
@@ -1154,8 +1159,8 @@ cleanup:
|
||||
}
|
||||
|
||||
static void
|
||||
-qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def,
|
||||
- enum virDomainDeviceAddressType type)
|
||||
+qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr def,
|
||||
+ enum virDomainDeviceAddressType type)
|
||||
{
|
||||
/*
|
||||
declare address-less virtio devices to be of address type 'type'
|
||||
@@ -1289,7 +1294,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
|
||||
|
||||
if (STREQLEN(def->os.machine, "s390-ccw", 8) &&
|
||||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_CCW)) {
|
||||
- qemuDomainPrimeS390VirtioDevices(
|
||||
+ qemuDomainPrimeVirtioDeviceAddresses(
|
||||
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW);
|
||||
|
||||
if (!(addrs = qemuDomainCCWAddressSetCreate()))
|
||||
@@ -1304,7 +1309,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def,
|
||||
goto cleanup;
|
||||
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
|
||||
/* deal with legacy virtio-s390 */
|
||||
- qemuDomainPrimeS390VirtioDevices(
|
||||
+ qemuDomainPrimeVirtioDeviceAddresses(
|
||||
def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390);
|
||||
}
|
||||
|
||||
@@ -1327,6 +1332,18 @@ cleanup:
|
||||
|
||||
return ret;
|
||||
}
|
||||
+static int
|
||||
+qemuDomainAssignARMVirtioMMIOAddresses(virDomainDefPtr def,
|
||||
+ virQEMUCapsPtr qemuCaps)
|
||||
+{
|
||||
+ if (def->os.arch == VIR_ARCH_ARMV7L &&
|
||||
+ STRPREFIX(def->os.machine, "vexpress-") &&
|
||||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_MMIO)) {
|
||||
+ qemuDomainPrimeVirtioDeviceAddresses(
|
||||
+ def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
|
||||
static int
|
||||
qemuSpaprVIOFindByReg(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
@@ -1912,6 +1929,10 @@ int qemuDomainAssignAddresses(virDomainDefPtr def,
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
+ rc = qemuDomainAssignARMVirtioMMIOAddresses(def, qemuCaps);
|
||||
+ if (rc)
|
||||
+ return rc;
|
||||
+
|
||||
return qemuDomainAssignPCIAddresses(def, qemuCaps, obj);
|
||||
}
|
||||
|
||||
@@ -4367,6 +4388,9 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
|
||||
} else if (disk->info.type ==
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
|
||||
virBufferAddLit(&opt, "virtio-blk-s390");
|
||||
+ } else if (disk->info.type ==
|
||||
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) {
|
||||
+ virBufferAddLit(&opt, "virtio-blk-device");
|
||||
} else {
|
||||
virBufferAddLit(&opt, "virtio-blk-pci");
|
||||
}
|
||||
@@ -4645,6 +4669,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
|
||||
else if (def->info.type ==
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
||||
virBufferAddLit(&buf, "virtio-scsi-s390");
|
||||
+ else if (def->info.type ==
|
||||
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
||||
+ virBufferAddLit(&buf, "virtio-scsi-device");
|
||||
else
|
||||
virBufferAddLit(&buf, "virtio-scsi-pci");
|
||||
break;
|
||||
@@ -4674,6 +4701,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
|
||||
} else if (def->info.type ==
|
||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
|
||||
virBufferAddLit(&buf, "virtio-serial-s390");
|
||||
+ } else if (def->info.type ==
|
||||
+ VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) {
|
||||
+ virBufferAddLit(&buf, "virtio-serial-device");
|
||||
} else {
|
||||
virBufferAddLit(&buf, "virtio-serial");
|
||||
}
|
||||
@@ -4806,6 +4836,8 @@ qemuBuildNicDevStr(virDomainDefPtr def,
|
||||
nic = "virtio-net-ccw";
|
||||
else if (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
||||
nic = "virtio-net-s390";
|
||||
+ else if (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
||||
+ nic = "virtio-net-device";
|
||||
else
|
||||
nic = "virtio-net-pci";
|
||||
|
||||
@@ -5054,6 +5086,9 @@ qemuBuildMemballoonDevStr(virDomainDefPtr def,
|
||||
case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
|
||||
virBufferAddLit(&buf, "virtio-balloon-ccw");
|
||||
break;
|
||||
+ case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
|
||||
+ virBufferAddLit(&buf, "virtio-balloon-device");
|
||||
+ break;
|
||||
default:
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("memballoon unsupported with address type '%s'"),
|
||||
@@ -6055,6 +6090,8 @@ qemuBuildRNGDeviceArgs(virCommandPtr cmd,
|
||||
virBufferAsprintf(&buf, "virtio-rng-ccw,rng=%s", dev->info.alias);
|
||||
else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
||||
virBufferAsprintf(&buf, "virtio-rng-s390,rng=%s", dev->info.alias);
|
||||
+ else if (dev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
||||
+ virBufferAsprintf(&buf, "virtio-rng-device,rng=%s", dev->info.alias);
|
||||
else
|
||||
virBufferAsprintf(&buf, "virtio-rng-pci,rng=%s", dev->info.alias);
|
||||
|
||||
@@ -7331,7 +7368,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
*
|
||||
* NB, no support for -netdev without use of -device
|
||||
*/
|
||||
- if (qemuDomainSupportsNetdev(def, qemuCaps)) {
|
||||
+ if (qemuDomainSupportsNetdev(def, qemuCaps, net)) {
|
||||
if (!(host = qemuBuildHostNetStr(net, driver,
|
||||
',', vlan,
|
||||
tapfdName, tapfdSize,
|
||||
@@ -7339,7 +7376,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-netdev", host, NULL);
|
||||
}
|
||||
- if (qemuDomainSupportsNicdev(def, qemuCaps)) {
|
||||
+ if (qemuDomainSupportsNicdev(def, qemuCaps, net)) {
|
||||
bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
|
||||
|
||||
if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
|
||||
@@ -7351,7 +7388,7 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
|
||||
goto cleanup;
|
||||
virCommandAddArgList(cmd, "-net", nic, NULL);
|
||||
}
|
||||
- if (!qemuDomainSupportsNetdev(def, qemuCaps)) {
|
||||
+ if (!qemuDomainSupportsNetdev(def, qemuCaps, net)) {
|
||||
if (!(host = qemuBuildHostNetStr(net, driver,
|
||||
',', vlan,
|
||||
tapfdName, tapfdSize,
|
||||
@@ -8402,7 +8439,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
int vlan;
|
||||
|
||||
/* VLANs are not used with -netdev, so don't record them */
|
||||
- if (qemuDomainSupportsNetdev(def, qemuCaps))
|
||||
+ if (qemuDomainSupportsNetdev(def, qemuCaps, net))
|
||||
vlan = -1;
|
||||
else
|
||||
vlan = i;
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args
|
||||
new file mode 100644
|
||||
index 0000000..62de9d3
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.args
|
||||
@@ -0,0 +1,14 @@
|
||||
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
|
||||
+/usr/bin/qemu-system-arm -S -M vexpress-a9 -m 1024 -smp 1 -nographic \
|
||||
+-nodefconfig -nodefaults -monitor unix:/tmp/test-monitor,server,nowait \
|
||||
+-boot c -kernel /arm.kernel -initrd /arm.initrd -append \
|
||||
+'console=ttyAMA0,115200n8 rw root=/dev/vda3 rootwait physmap.enabled=0' \
|
||||
+-dtb /arm.dtb -device virtio-serial-device,id=virtio-serial0 -usb \
|
||||
+-drive file=/arm.raw,if=none,id=drive-virtio-disk0 \
|
||||
+-device virtio-blk-device,drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||
+-device virtio-net-device,vlan=0,id=net0,mac=52:54:00:09:a4:37 \
|
||||
+-net user,vlan=0,name=hostnet0 -serial pty -chardev pty,id=charconsole1 \
|
||||
+-device virtconsole,chardev=charconsole1,id=console1 \
|
||||
+-device virtio-balloon-device,id=balloon0 \
|
||||
+-object rng-random,id=rng0,filename=/dev/random \
|
||||
+-device virtio-rng-device,rng=rng0
|
||||
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.xml b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.xml
|
||||
new file mode 100644
|
||||
index 0000000..2acf3c9
|
||||
--- /dev/null
|
||||
+++ b/tests/qemuxml2argvdata/qemuxml2argv-arm-vexpressa9-virtio.xml
|
||||
@@ -0,0 +1,45 @@
|
||||
+<domain type="qemu">
|
||||
+ <name>armtest</name>
|
||||
+ <uuid>496d7ea8-9739-544b-4ebd-ef08be936e6a</uuid>
|
||||
+ <memory>1048576</memory>
|
||||
+ <currentMemory>1048576</currentMemory>
|
||||
+ <vcpu>1</vcpu>
|
||||
+ <os>
|
||||
+ <type arch="armv7l" machine="vexpress-a9">hvm</type>
|
||||
+ <kernel>/arm.kernel</kernel>
|
||||
+ <initrd>/arm.initrd</initrd>
|
||||
+ <dtb>/arm.dtb</dtb>
|
||||
+ <cmdline>console=ttyAMA0,115200n8 rw root=/dev/vda3 rootwait physmap.enabled=0</cmdline>
|
||||
+ </os>
|
||||
+ <features>
|
||||
+ <acpi/>
|
||||
+ <apic/>
|
||||
+ <pae/>
|
||||
+ </features>
|
||||
+ <clock offset="utc"/>
|
||||
+ <on_poweroff>destroy</on_poweroff>
|
||||
+ <on_reboot>restart</on_reboot>
|
||||
+ <on_crash>restart</on_crash>
|
||||
+ <devices>
|
||||
+ <emulator>/usr/bin/qemu-system-arm</emulator>
|
||||
+ <disk type='file' device='disk'>
|
||||
+ <source file='/arm.raw'/>
|
||||
+ <target dev='vda' bus='virtio'/>
|
||||
+ </disk>
|
||||
+ <interface type='user'>
|
||||
+ <mac address='52:54:00:09:a4:37'/>
|
||||
+ <model type='virtio'/>
|
||||
+ </interface>
|
||||
+ <console type='pty'/>
|
||||
+ <console type='pty'>
|
||||
+ <target type='virtio' port='0'/>
|
||||
+ </console>
|
||||
+ <memballoon model='virtio'/>
|
||||
+ <!--
|
||||
+ This actually doesn't work in practice because vexpress only has
|
||||
+ 4 virtio slots available, rng makes 5 -->
|
||||
+ <rng model='virtio'>
|
||||
+ <backend model='random'>/dev/random</backend>
|
||||
+ </rng>
|
||||
+ </devices>
|
||||
+</domain>
|
||||
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
|
||||
index 6ecabbf..ae8cc3b 100644
|
||||
--- a/tests/qemuxml2argvtest.c
|
||||
+++ b/tests/qemuxml2argvtest.c
|
||||
@@ -1062,6 +1062,10 @@ mymain(void)
|
||||
DO_TEST("arm-vexpressa9-basic",
|
||||
QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
|
||||
QEMU_CAPS_DRIVE);
|
||||
+ DO_TEST("arm-vexpressa9-virtio",
|
||||
+ QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DTB,
|
||||
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE_VIRTIO_MMIO,
|
||||
+ QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM);
|
||||
|
||||
virObjectUnref(driver.config);
|
||||
virObjectUnref(driver.caps);
|
@ -1,26 +0,0 @@
|
||||
From 580025d7a58ee4c07312d33aa78186dbe7e0d9ee Mon Sep 17 00:00:00 2001
|
||||
From: Michal Privoznik <mprivozn@redhat.com>
|
||||
Date: Tue, 3 Sep 2013 18:56:06 +0200
|
||||
Subject: [PATCH] virFileNBDDeviceAssociate: Avoid use of uninitialized
|
||||
variable
|
||||
|
||||
The @qemunbd variable can be used uninitialized.
|
||||
|
||||
(cherry picked from commit 2dba0323ff0cec31bdcea9dd3b2428af297401f2)
|
||||
---
|
||||
src/util/virfile.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/util/virfile.c b/src/util/virfile.c
|
||||
index 2b07ac9..7af0843 100644
|
||||
--- a/src/util/virfile.c
|
||||
+++ b/src/util/virfile.c
|
||||
@@ -732,7 +732,7 @@ int virFileNBDDeviceAssociate(const char *file,
|
||||
char **dev)
|
||||
{
|
||||
char *nbddev;
|
||||
- char *qemunbd;
|
||||
+ char *qemunbd = NULL;
|
||||
virCommandPtr cmd = NULL;
|
||||
int ret = -1;
|
||||
const char *fmtstr = NULL;
|
@ -1,23 +0,0 @@
|
||||
From a0ed55a9ab7c90723490363febabd27fa59877c8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
|
||||
Date: Sun, 1 Sep 2013 09:53:03 +0200
|
||||
Subject: [PATCH] Fix AM_LDFLAGS typo (cherry picked from commit
|
||||
fe502de3bcdd76a0d256206111945ca7e4f4388a)
|
||||
|
||||
---
|
||||
src/Makefile.am | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 636bcbc..19dfb81 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -1455,7 +1455,7 @@ libvirt_driver_nwfilter_la_CFLAGS = \
|
||||
-I$(top_srcdir)/src/access \
|
||||
-I$(top_srcdir)/src/conf \
|
||||
$(AM_CFLAGS)
|
||||
-libvirt_driver_nwfilter_la_LDFLAGS = $(LD_AMFLAGS)
|
||||
+libvirt_driver_nwfilter_la_LDFLAGS = $(AM_LDFLAGS)
|
||||
libvirt_driver_nwfilter_la_LIBADD = $(LIBPCAP_LIBS) $(LIBNL_LIBS) $(DBUS_LIBS)
|
||||
if WITH_DRIVER_MODULES
|
||||
libvirt_driver_nwfilter_la_LIBADD += ../gnulib/lib/libgnu.la
|
@ -1,88 +0,0 @@
|
||||
From bd4e7f927fcc2edcba29e441973389ad845d648c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
|
||||
Date: Sun, 1 Sep 2013 08:50:58 +0200
|
||||
Subject: [PATCH] Pass AM_LDFLAGS to driver modules too
|
||||
|
||||
This gives us a RO got, otherwise Debian's lintian complains:
|
||||
|
||||
W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_qemu.so
|
||||
W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_storage.so
|
||||
W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_uml.so
|
||||
W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_vbox.so
|
||||
W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_xen.so
|
||||
W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_nwfilter.so
|
||||
W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_storage.so
|
||||
W: libvirt-bin: hardening-no-relro usr/lib/libvirt/connection-driver/libvirt_driver_uml.so
|
||||
W: libvirt-sanlock: hardening-no-relro usr/lib/libvirt/lock-driver/sanlock.so
|
||||
(cherry picked from commit f1f0e53b0814aab3c093f1219da95c0f836cdf4a)
|
||||
---
|
||||
src/Makefile.am | 14 +++++++-------
|
||||
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/Makefile.am b/src/Makefile.am
|
||||
index 19dfb81..097682c 100644
|
||||
--- a/src/Makefile.am
|
||||
+++ b/src/Makefile.am
|
||||
@@ -1000,7 +1000,7 @@ libvirt_driver_xen_la_LIBADD = libvirt_driver_xen_impl.la
|
||||
if WITH_DRIVER_MODULES
|
||||
mod_LTLIBRARIES += libvirt_driver_xen.la
|
||||
libvirt_driver_xen_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||
-libvirt_driver_xen_la_LDFLAGS = -module -avoid-version
|
||||
+libvirt_driver_xen_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||
else
|
||||
noinst_LTLIBRARIES += libvirt_driver_xen.la
|
||||
# Stateful, so linked to daemon instead
|
||||
@@ -1050,7 +1050,7 @@ libvirt_driver_vbox_la_LIBADD = libvirt_driver_vbox_impl.la
|
||||
if WITH_DRIVER_MODULES
|
||||
mod_LTLIBRARIES += libvirt_driver_vbox.la
|
||||
libvirt_driver_vbox_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||
-libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version
|
||||
+libvirt_driver_vbox_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||
else
|
||||
noinst_LTLIBRARIES += libvirt_driver_vbox.la
|
||||
# GPLv2-only license requries that it be linked into
|
||||
@@ -1083,7 +1083,7 @@ libvirt_driver_libxl_la_LIBADD = libvirt_driver_libxl_impl.la
|
||||
if WITH_DRIVER_MODULES
|
||||
mod_LTLIBRARIES += libvirt_driver_libxl.la
|
||||
libvirt_driver_libxl_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||
-libvirt_driver_libxl_la_LDFLAGS = -module -avoid-version
|
||||
+libvirt_driver_libxl_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||
else
|
||||
noinst_LTLIBRARIES += libvirt_driver_libxl.la
|
||||
# Stateful, so linked to daemon instead
|
||||
@@ -1108,7 +1108,7 @@ libvirt_driver_qemu_la_LIBADD = libvirt_driver_qemu_impl.la
|
||||
if WITH_DRIVER_MODULES
|
||||
mod_LTLIBRARIES += libvirt_driver_qemu.la
|
||||
libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||
-libvirt_driver_qemu_la_LDFLAGS = -module -avoid-version
|
||||
+libvirt_driver_qemu_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||
else
|
||||
noinst_LTLIBRARIES += libvirt_driver_qemu.la
|
||||
# Stateful, so linked to daemon instead
|
||||
@@ -1184,7 +1184,7 @@ libvirt_driver_uml_la_LIBADD = libvirt_driver_uml_impl.la
|
||||
if WITH_DRIVER_MODULES
|
||||
mod_LTLIBRARIES += libvirt_driver_uml.la
|
||||
libvirt_driver_uml_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||
-libvirt_driver_uml_la_LDFLAGS = -module -avoid-version
|
||||
+libvirt_driver_uml_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||
else
|
||||
noinst_LTLIBRARIES += libvirt_driver_uml.la
|
||||
# Stateful, so linked to daemon instead
|
||||
@@ -1361,7 +1361,7 @@ libvirt_driver_storage_la_LIBADD = libvirt_driver_storage_impl.la
|
||||
if WITH_DRIVER_MODULES
|
||||
mod_LTLIBRARIES += libvirt_driver_storage.la
|
||||
libvirt_driver_storage_la_LIBADD += ../gnulib/lib/libgnu.la
|
||||
-libvirt_driver_storage_la_LDFLAGS = -module -avoid-version
|
||||
+libvirt_driver_storage_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||
else
|
||||
noinst_LTLIBRARIES += libvirt_driver_storage.la
|
||||
# Stateful, so linked to daemon instead
|
||||
@@ -2114,7 +2114,7 @@ if WITH_SANLOCK
|
||||
lockdriver_LTLIBRARIES += sanlock.la
|
||||
sanlock_la_SOURCES = $(LOCK_DRIVER_SANLOCK_SOURCES)
|
||||
sanlock_la_CFLAGS = -I$(top_srcdir)/src/conf $(AM_CFLAGS)
|
||||
-sanlock_la_LDFLAGS = -module -avoid-version
|
||||
+sanlock_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
|
||||
sanlock_la_LIBADD = -lsanlock_client \
|
||||
../gnulib/lib/libgnu.la
|
||||
|
@ -1,125 +0,0 @@
|
||||
From bcba68498f698dedfdc83687c72e0e6dd7dc0e96 Mon Sep 17 00:00:00 2001
|
||||
From: Eric Blake <eblake@redhat.com>
|
||||
Date: Fri, 13 Sep 2013 10:11:26 -0600
|
||||
Subject: [PATCH] build: fix build with latest rawhide kernel headers
|
||||
|
||||
Bother those kernel developers. In the latest rawhide, kernel
|
||||
and glibc have now been unified so that <netinet/in.h> and
|
||||
<linux/in6.h> no longer clash; but <linux/if_bridge.h> is still
|
||||
not self-contained. Because of the latest header change, the
|
||||
build is failing with:
|
||||
|
||||
checking for linux/param.h... no
|
||||
configure: error: You must install kernel-headers in order to compile libvirt with QEMU or LXC support
|
||||
|
||||
with details:
|
||||
|
||||
In file included from conftest.c:561:0:
|
||||
/usr/include/linux/in6.h:71:18: error: field 'flr_dst' has incomplete type
|
||||
struct in6_addr flr_dst;
|
||||
|
||||
We need a workaround to avoid our workaround :)
|
||||
|
||||
* configure.ac (NETINET_LINUX_WORKAROUND): New test.
|
||||
* src/util/virnetdevbridge.c (includes): Use it.
|
||||
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
(cherry picked from commit e62e0094dcd0ca1484491a9cc62919473b647f11)
|
||||
---
|
||||
configure.ac | 39 +++++++++++++++++++++++++++++----------
|
||||
src/util/virnetdevbridge.c | 24 ++++++++++++++----------
|
||||
2 files changed, 43 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index f853e03..1956717 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1003,18 +1003,37 @@ dnl check for kernel headers required by src/bridge.c
|
||||
dnl
|
||||
if test "$with_linux" = "yes"; then
|
||||
if test "$with_qemu" = "yes" || test "$with_lxc" = "yes" ; then
|
||||
+ # Various kernel versions have headers that are not self-standing, but
|
||||
+ # yet are incompatible with the corresponding glibc headers. In order
|
||||
+ # to guarantee compilation across a wide range of versions (from RHEL 5
|
||||
+ # to rawhide), we first have to probe whether glibc and kernel can be
|
||||
+ # used in tandem; and if not, provide workarounds that ensure that
|
||||
+ # ABI-compatible IPv6 types are present for use by the kernel headers.
|
||||
+ # These probes mirror the usage in virnetdevbridge.c
|
||||
+ AC_CACHE_CHECK(
|
||||
+ [whether <linux/*.h> and <netinet/*.h> headers are compatible],
|
||||
+ [lv_cv_netinet_linux_compatible],
|
||||
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||
+ #include <netinet/in.h>
|
||||
+ #include <linux/in6.h>
|
||||
+ ]])],
|
||||
+ [lv_cv_netinet_linux_compatible=yes],
|
||||
+ [lv_cv_netinet_linux_compatible=no])])
|
||||
+ if test "x$lv_cv_netinet_linux_compatible" != xyes; then
|
||||
+ AC_DEFINE([NETINET_LINUX_WORKAROUND], [1],
|
||||
+ [define to 1 if Linux kernel headers require a workaround to avoid
|
||||
+ compilation errors when mixed with glibc netinet headers])
|
||||
+ fi
|
||||
AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linux/if_tun.h],,
|
||||
[AC_MSG_ERROR([You must install kernel-headers in order to compile libvirt with QEMU or LXC support])],
|
||||
- [[/* The kernel folks broke their headers when used with particular
|
||||
- * glibc versions; although the structs are ABI compatible, the
|
||||
- * C type system doesn't like struct redefinitions. We work around
|
||||
- * the problem here in the same manner as in virnetdevbridge.c. */
|
||||
- #include <netinet/in.h>
|
||||
- #define in6_addr in6_addr_
|
||||
- #define sockaddr_in6 sockaddr_in6_
|
||||
- #define ipv6_mreq ipv6_mreq_
|
||||
- #define in6addr_any in6addr_any_
|
||||
- #define in6addr_loopback in6addr_loopback_
|
||||
+ [[#include <netinet/in.h>
|
||||
+ #if NETINET_LINUX_WORKAROUND
|
||||
+ # define in6_addr in6_addr_
|
||||
+ # define sockaddr_in6 sockaddr_in6_
|
||||
+ # define ipv6_mreq ipv6_mreq_
|
||||
+ # define in6addr_any in6addr_any_
|
||||
+ # define in6addr_loopback in6addr_loopback_
|
||||
+ #endif
|
||||
#include <linux/in6.h>
|
||||
]])
|
||||
fi
|
||||
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
|
||||
index e4daa27..1a3740a 100644
|
||||
--- a/src/util/virnetdevbridge.c
|
||||
+++ b/src/util/virnetdevbridge.c
|
||||
@@ -39,22 +39,26 @@
|
||||
#ifdef __linux__
|
||||
# include <linux/sockios.h>
|
||||
# include <linux/param.h> /* HZ */
|
||||
+# if NETINET_LINUX_WORKAROUND
|
||||
/* Depending on the version of kernel vs. glibc, there may be a collision
|
||||
* between <net/in.h> and kernel IPv6 structures. The different types
|
||||
* are ABI compatible, but choke the C type system; work around it by
|
||||
* using temporary redefinitions. */
|
||||
-# define in6_addr in6_addr_
|
||||
-# define sockaddr_in6 sockaddr_in6_
|
||||
-# define ipv6_mreq ipv6_mreq_
|
||||
-# define in6addr_any in6addr_any_
|
||||
-# define in6addr_loopback in6addr_loopback_
|
||||
+# define in6_addr in6_addr_
|
||||
+# define sockaddr_in6 sockaddr_in6_
|
||||
+# define ipv6_mreq ipv6_mreq_
|
||||
+# define in6addr_any in6addr_any_
|
||||
+# define in6addr_loopback in6addr_loopback_
|
||||
+# endif
|
||||
# include <linux/in6.h>
|
||||
# include <linux/if_bridge.h> /* SYSFS_BRIDGE_ATTR */
|
||||
-# undef in6_addr
|
||||
-# undef sockaddr_in6
|
||||
-# undef ipv6_mreq
|
||||
-# undef in6addr_any
|
||||
-# undef in6addr_loopback
|
||||
+# if NETINET_LINUX_WORKAROUND
|
||||
+# undef in6_addr
|
||||
+# undef sockaddr_in6
|
||||
+# undef ipv6_mreq
|
||||
+# undef in6addr_any
|
||||
+# undef in6addr_loopback
|
||||
+# endif
|
||||
|
||||
# define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
|
||||
# define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
|
@ -1,154 +0,0 @@
|
||||
From 2fb7c4d202da975a1498fd205cc3e1bc49595d3c Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Thu, 22 Aug 2013 16:00:01 +0100
|
||||
Subject: [PATCH] Also store user & group ID values in virIdentity
|
||||
|
||||
Future improvements to the polkit code will require access to
|
||||
the numeric user ID, not merely user name.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit db7a5688c05f3fd60d9d2b74c72427eb9ee9c176)
|
||||
---
|
||||
src/rpc/virnetserverclient.c | 18 ++++++++++++++++++
|
||||
src/util/viridentity.c | 23 +++++++++++++++++++----
|
||||
src/util/viridentity.h | 2 ++
|
||||
3 files changed, 39 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
|
||||
index 83d5cf1..19c4100 100644
|
||||
--- a/src/rpc/virnetserverclient.c
|
||||
+++ b/src/rpc/virnetserverclient.c
|
||||
@@ -652,7 +652,9 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
|
||||
char *processid = NULL;
|
||||
char *processtime = NULL;
|
||||
char *username = NULL;
|
||||
+ char *userid = NULL;
|
||||
char *groupname = NULL;
|
||||
+ char *groupid = NULL;
|
||||
#if WITH_SASL
|
||||
char *saslname = NULL;
|
||||
#endif
|
||||
@@ -672,8 +674,12 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
|
||||
|
||||
if (!(username = virGetUserName(uid)))
|
||||
goto cleanup;
|
||||
+ if (virAsprintf(&userid, "%d", (int)uid) < 0)
|
||||
+ goto cleanup;
|
||||
if (!(groupname = virGetGroupName(gid)))
|
||||
goto cleanup;
|
||||
+ if (virAsprintf(&userid, "%d", (int)gid) < 0)
|
||||
+ goto cleanup;
|
||||
if (virAsprintf(&processid, "%llu",
|
||||
(unsigned long long)pid) < 0)
|
||||
goto cleanup;
|
||||
@@ -710,11 +716,21 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
|
||||
VIR_IDENTITY_ATTR_UNIX_USER_NAME,
|
||||
username) < 0)
|
||||
goto error;
|
||||
+ if (userid &&
|
||||
+ virIdentitySetAttr(ret,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_USER_ID,
|
||||
+ userid) < 0)
|
||||
+ goto error;
|
||||
if (groupname &&
|
||||
virIdentitySetAttr(ret,
|
||||
VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
|
||||
groupname) < 0)
|
||||
goto error;
|
||||
+ if (groupid &&
|
||||
+ virIdentitySetAttr(ret,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
|
||||
+ groupid) < 0)
|
||||
+ goto error;
|
||||
if (processid &&
|
||||
virIdentitySetAttr(ret,
|
||||
VIR_IDENTITY_ATTR_UNIX_PROCESS_ID,
|
||||
@@ -745,7 +761,9 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(username);
|
||||
+ VIR_FREE(userid);
|
||||
VIR_FREE(groupname);
|
||||
+ VIR_FREE(groupid);
|
||||
VIR_FREE(processid);
|
||||
VIR_FREE(processtime);
|
||||
VIR_FREE(seccontext);
|
||||
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
|
||||
index 781f660..03c375b 100644
|
||||
--- a/src/util/viridentity.c
|
||||
+++ b/src/util/viridentity.c
|
||||
@@ -133,7 +133,9 @@ int virIdentitySetCurrent(virIdentityPtr ident)
|
||||
virIdentityPtr virIdentityGetSystem(void)
|
||||
{
|
||||
char *username = NULL;
|
||||
+ char *userid = NULL;
|
||||
char *groupname = NULL;
|
||||
+ char *groupid = NULL;
|
||||
char *seccontext = NULL;
|
||||
virIdentityPtr ret = NULL;
|
||||
#if WITH_SELINUX
|
||||
@@ -147,8 +149,13 @@ virIdentityPtr virIdentityGetSystem(void)
|
||||
|
||||
if (!(username = virGetUserName(getuid())))
|
||||
goto cleanup;
|
||||
+ if (virAsprintf(&userid, "%d", (int)getuid()) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
if (!(groupname = virGetGroupName(getgid())))
|
||||
goto cleanup;
|
||||
+ if (virAsprintf(&groupid, "%d", (int)getgid()) < 0)
|
||||
+ goto cleanup;
|
||||
|
||||
#if WITH_SELINUX
|
||||
if (getcon(&con) < 0) {
|
||||
@@ -166,16 +173,22 @@ virIdentityPtr virIdentityGetSystem(void)
|
||||
if (!(ret = virIdentityNew()))
|
||||
goto cleanup;
|
||||
|
||||
- if (username &&
|
||||
- virIdentitySetAttr(ret,
|
||||
+ if (virIdentitySetAttr(ret,
|
||||
VIR_IDENTITY_ATTR_UNIX_USER_NAME,
|
||||
username) < 0)
|
||||
goto error;
|
||||
- if (groupname &&
|
||||
- virIdentitySetAttr(ret,
|
||||
+ if (virIdentitySetAttr(ret,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_USER_ID,
|
||||
+ userid) < 0)
|
||||
+ goto error;
|
||||
+ if (virIdentitySetAttr(ret,
|
||||
VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
|
||||
groupname) < 0)
|
||||
goto error;
|
||||
+ if (virIdentitySetAttr(ret,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
|
||||
+ groupid) < 0)
|
||||
+ goto error;
|
||||
if (seccontext &&
|
||||
virIdentitySetAttr(ret,
|
||||
VIR_IDENTITY_ATTR_SELINUX_CONTEXT,
|
||||
@@ -188,7 +201,9 @@ virIdentityPtr virIdentityGetSystem(void)
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(username);
|
||||
+ VIR_FREE(userid);
|
||||
VIR_FREE(groupname);
|
||||
+ VIR_FREE(groupid);
|
||||
VIR_FREE(seccontext);
|
||||
VIR_FREE(processid);
|
||||
return ret;
|
||||
diff --git a/src/util/viridentity.h b/src/util/viridentity.h
|
||||
index 4bae8d6..a240c2d 100644
|
||||
--- a/src/util/viridentity.h
|
||||
+++ b/src/util/viridentity.h
|
||||
@@ -29,7 +29,9 @@ typedef virIdentity *virIdentityPtr;
|
||||
|
||||
typedef enum {
|
||||
VIR_IDENTITY_ATTR_UNIX_USER_NAME,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_USER_ID,
|
||||
VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
|
||||
VIR_IDENTITY_ATTR_UNIX_PROCESS_ID,
|
||||
VIR_IDENTITY_ATTR_UNIX_PROCESS_TIME,
|
||||
VIR_IDENTITY_ATTR_SASL_USER_NAME,
|
@ -1,68 +0,0 @@
|
||||
From fe544fd4c18d6982e652a1d5cd016816c609b72c Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Wed, 28 Aug 2013 15:22:05 +0100
|
||||
Subject: [PATCH] Ensure system identity includes process start time
|
||||
|
||||
The polkit access driver will want to use the process start
|
||||
time field. This was already set for network identities, but
|
||||
not for the system identity.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit e65667c0c6e016d42abea077e31628ae43f57b74)
|
||||
---
|
||||
src/util/viridentity.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/src/util/viridentity.c b/src/util/viridentity.c
|
||||
index 03c375b..f681f85 100644
|
||||
--- a/src/util/viridentity.c
|
||||
+++ b/src/util/viridentity.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "virthread.h"
|
||||
#include "virutil.h"
|
||||
#include "virstring.h"
|
||||
+#include "virprocess.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_IDENTITY
|
||||
|
||||
@@ -142,11 +143,20 @@ virIdentityPtr virIdentityGetSystem(void)
|
||||
security_context_t con;
|
||||
#endif
|
||||
char *processid = NULL;
|
||||
+ unsigned long long timestamp;
|
||||
+ char *processtime = NULL;
|
||||
|
||||
if (virAsprintf(&processid, "%llu",
|
||||
(unsigned long long)getpid()) < 0)
|
||||
goto cleanup;
|
||||
|
||||
+ if (virProcessGetStartTime(getpid(), ×tamp) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (timestamp != 0 &&
|
||||
+ virAsprintf(&processtime, "%llu", timestamp) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
if (!(username = virGetUserName(getuid())))
|
||||
goto cleanup;
|
||||
if (virAsprintf(&userid, "%d", (int)getuid()) < 0)
|
||||
@@ -198,6 +208,11 @@ virIdentityPtr virIdentityGetSystem(void)
|
||||
VIR_IDENTITY_ATTR_UNIX_PROCESS_ID,
|
||||
processid) < 0)
|
||||
goto error;
|
||||
+ if (processtime &&
|
||||
+ virIdentitySetAttr(ret,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_PROCESS_TIME,
|
||||
+ processtime) < 0)
|
||||
+ goto error;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(username);
|
||||
@@ -206,6 +221,7 @@ cleanup:
|
||||
VIR_FREE(groupid);
|
||||
VIR_FREE(seccontext);
|
||||
VIR_FREE(processid);
|
||||
+ VIR_FREE(processtime);
|
||||
return ret;
|
||||
|
||||
error:
|
@ -1,178 +0,0 @@
|
||||
From dcba8ce65b0ee9f18dca6ac4bdbb57f5cbcc75c6 Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Wed, 28 Aug 2013 15:25:40 +0100
|
||||
Subject: [PATCH] Add support for using 3-arg pkcheck syntax for process
|
||||
(CVE-2013-4311)
|
||||
|
||||
With the existing pkcheck (pid, start time) tuple for identifying
|
||||
the process, there is a race condition, where a process can make
|
||||
a libvirt RPC call and in another thread exec a setuid application,
|
||||
causing it to change to effective UID 0. This in turn causes polkit
|
||||
to do its permission check based on the wrong UID.
|
||||
|
||||
To address this, libvirt must get the UID the caller had at time
|
||||
of connect() (from SO_PEERCRED) and pass a (pid, start time, uid)
|
||||
triple to the pkcheck program.
|
||||
|
||||
This fix requires that libvirt is re-built against a version of
|
||||
polkit that has the fix for its CVE-2013-4288, so that libvirt
|
||||
can see 'pkg-config --variable pkcheck_supports_uid polkit-gobject-1'
|
||||
|
||||
Signed-off-by: Colin Walters <walters@redhat.com>
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit 922b7fda77b094dbf022d625238262ea05335666)
|
||||
---
|
||||
configure.ac | 8 ++++++++
|
||||
daemon/remote.c | 22 ++++++++++++++++++---
|
||||
libvirt.spec.in | 3 +--
|
||||
src/access/viraccessdriverpolkit.c | 40 +++++++++++++++++++++++++++++++++-----
|
||||
4 files changed, 63 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 1956717..8baf6fa 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -1203,6 +1203,14 @@ if test "x$with_polkit" = "xyes" || test "x$with_polkit" = "xcheck"; then
|
||||
AC_PATH_PROG([PKCHECK_PATH],[pkcheck], [], [/usr/sbin:$PATH])
|
||||
if test "x$PKCHECK_PATH" != "x" ; then
|
||||
AC_DEFINE_UNQUOTED([PKCHECK_PATH],["$PKCHECK_PATH"],[Location of pkcheck program])
|
||||
+ AC_MSG_CHECKING([whether pkcheck supports uid value])
|
||||
+ pkcheck_supports_uid=`$PKG_CONFIG --variable pkcheck_supports_uid polkit-gobject-1`
|
||||
+ if test "x$pkcheck_supports_uid" = "xtrue"; then
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ AC_DEFINE_UNQUOTED([PKCHECK_SUPPORTS_UID], 1, [Pass uid to pkcheck])
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
AC_DEFINE_UNQUOTED([WITH_POLKIT], 1,
|
||||
[use PolicyKit for UNIX socket access checks])
|
||||
AC_DEFINE_UNQUOTED([WITH_POLKIT1], 1,
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index 6ace7af..b5395dd 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -2738,10 +2738,12 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
int status = -1;
|
||||
char *ident = NULL;
|
||||
bool authdismissed = 0;
|
||||
+ bool supportsuid = false;
|
||||
char *pkout = NULL;
|
||||
struct daemonClientPrivate *priv =
|
||||
virNetServerClientGetPrivateData(client);
|
||||
virCommandPtr cmd = NULL;
|
||||
+ static bool polkitInsecureWarned;
|
||||
|
||||
virMutexLock(&priv->lock);
|
||||
action = virNetServerClientGetReadonly(client) ?
|
||||
@@ -2763,14 +2765,28 @@ remoteDispatchAuthPolkit(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
goto authfail;
|
||||
}
|
||||
|
||||
+ if (timestamp == 0) {
|
||||
+ VIR_WARN("Failing polkit auth due to missing client (pid=%lld) start time",
|
||||
+ (long long)callerPid);
|
||||
+ goto authfail;
|
||||
+ }
|
||||
+
|
||||
VIR_INFO("Checking PID %lld running as %d",
|
||||
(long long) callerPid, callerUid);
|
||||
|
||||
virCommandAddArg(cmd, "--process");
|
||||
- if (timestamp != 0) {
|
||||
- virCommandAddArgFormat(cmd, "%lld,%llu", (long long) callerPid, timestamp);
|
||||
+# ifdef PKCHECK_SUPPORTS_UID
|
||||
+ supportsuid = true;
|
||||
+# endif
|
||||
+ if (supportsuid) {
|
||||
+ virCommandAddArgFormat(cmd, "%lld,%llu,%lu",
|
||||
+ (long long) callerPid, timestamp, (unsigned long) callerUid);
|
||||
} else {
|
||||
- virCommandAddArgFormat(cmd, "%lld", (long long) callerPid);
|
||||
+ if (!polkitInsecureWarned) {
|
||||
+ VIR_WARN("No support for caller UID with pkcheck. This deployment is known to be insecure.");
|
||||
+ polkitInsecureWarned = true;
|
||||
+ }
|
||||
+ virCommandAddArgFormat(cmd, "%lld,%llu", (long long) callerPid, timestamp);
|
||||
}
|
||||
virCommandAddArg(cmd, "--allow-user-interaction");
|
||||
|
||||
diff --git a/libvirt.spec.in b/libvirt.spec.in
|
||||
index e94901a..b9c8c91 100644
|
||||
--- a/libvirt.spec.in
|
||||
+++ b/libvirt.spec.in
|
||||
@@ -508,8 +508,7 @@ BuildRequires: cyrus-sasl-devel
|
||||
%endif
|
||||
%if %{with_polkit}
|
||||
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
|
||||
-# Only need the binary, not -devel
|
||||
-BuildRequires: polkit >= 0.93
|
||||
+BuildRequires: polkit-devel >= 0.93
|
||||
%else
|
||||
BuildRequires: PolicyKit-devel >= 0.6
|
||||
%endif
|
||||
diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdriverpolkit.c
|
||||
index 4c76e64..bb170b5 100644
|
||||
--- a/src/access/viraccessdriverpolkit.c
|
||||
+++ b/src/access/viraccessdriverpolkit.c
|
||||
@@ -72,8 +72,12 @@ static char *
|
||||
virAccessDriverPolkitFormatProcess(const char *actionid)
|
||||
{
|
||||
virIdentityPtr identity = virIdentityGetCurrent();
|
||||
- const char *process = NULL;
|
||||
+ const char *callerPid = NULL;
|
||||
+ const char *callerTime = NULL;
|
||||
+ const char *callerUid = NULL;
|
||||
char *ret = NULL;
|
||||
+ bool supportsuid = false;
|
||||
+ static bool polkitInsecureWarned;
|
||||
|
||||
if (!identity) {
|
||||
virAccessError(VIR_ERR_ACCESS_DENIED,
|
||||
@@ -81,17 +85,43 @@ virAccessDriverPolkitFormatProcess(const char *actionid)
|
||||
actionid);
|
||||
return NULL;
|
||||
}
|
||||
- if (virIdentityGetAttr(identity, VIR_IDENTITY_ATTR_UNIX_PROCESS_ID, &process) < 0)
|
||||
+ if (virIdentityGetAttr(identity, VIR_IDENTITY_ATTR_UNIX_PROCESS_ID, &callerPid) < 0)
|
||||
+ goto cleanup;
|
||||
+ if (virIdentityGetAttr(identity, VIR_IDENTITY_ATTR_UNIX_PROCESS_TIME, &callerTime) < 0)
|
||||
+ goto cleanup;
|
||||
+ if (virIdentityGetAttr(identity, VIR_IDENTITY_ATTR_UNIX_USER_ID, &callerUid) < 0)
|
||||
goto cleanup;
|
||||
|
||||
- if (!process) {
|
||||
+ if (!callerPid) {
|
||||
virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("No UNIX process ID available"));
|
||||
goto cleanup;
|
||||
}
|
||||
-
|
||||
- if (VIR_STRDUP(ret, process) < 0)
|
||||
+ if (!callerTime) {
|
||||
+ virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("No UNIX process start time available"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (!callerUid) {
|
||||
+ virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("No UNIX caller UID available"));
|
||||
goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+#ifdef PKCHECK_SUPPORTS_UID
|
||||
+ supportsuid = true;
|
||||
+#endif
|
||||
+ if (supportsuid) {
|
||||
+ if (virAsprintf(&ret, "%s,%s,%s", callerPid, callerTime, callerUid) < 0)
|
||||
+ goto cleanup;
|
||||
+ } else {
|
||||
+ if (!polkitInsecureWarned) {
|
||||
+ VIR_WARN("No support for caller UID with pkcheck. This deployment is known to be insecure.");
|
||||
+ polkitInsecureWarned = true;
|
||||
+ }
|
||||
+ if (virAsprintf(&ret, "%s,%s", callerPid, callerTime) < 0)
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
|
||||
cleanup:
|
||||
virObjectUnref(identity);
|
@ -1,38 +0,0 @@
|
||||
From 3bee40f9bd3b3c11d782b79eb90f46087d3ab9be Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Tue, 3 Sep 2013 16:52:06 +0100
|
||||
Subject: [PATCH] Fix crash in remoteDispatchDomainMemoryStats (CVE-2013-4296)
|
||||
|
||||
The 'stats' variable was not initialized to NULL, so if some
|
||||
early validation of the RPC call fails, it is possible to jump
|
||||
to the 'cleanup' label and VIR_FREE an uninitialized pointer.
|
||||
This is a security flaw, since the API can be called from a
|
||||
readonly connection which can trigger the validation checks.
|
||||
|
||||
This was introduced in release v0.9.1 onwards by
|
||||
|
||||
commit 158ba8730e44b7dd07a21ab90499996c5dec080a
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Wed Apr 13 16:21:35 2011 +0100
|
||||
|
||||
Merge all returns paths from dispatcher into single path
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
(cherry picked from commit e7f400a110e2e3673b96518170bfea0855dd82c0)
|
||||
---
|
||||
daemon/remote.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/daemon/remote.c b/daemon/remote.c
|
||||
index b5395dd..afd9fb5 100644
|
||||
--- a/daemon/remote.c
|
||||
+++ b/daemon/remote.c
|
||||
@@ -1146,7 +1146,7 @@ remoteDispatchDomainMemoryStats(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||
remote_domain_memory_stats_ret *ret)
|
||||
{
|
||||
virDomainPtr dom = NULL;
|
||||
- struct _virDomainMemoryStat *stats;
|
||||
+ struct _virDomainMemoryStat *stats = NULL;
|
||||
int nr_stats;
|
||||
size_t i;
|
||||
int rv = -1;
|
@ -1,59 +0,0 @@
|
||||
From f19543baee399bf6b3d91da38fa0b7025f233dee Mon Sep 17 00:00:00 2001
|
||||
From: Simone Gotti <simone.gotti@gmail.com>
|
||||
Date: Thu, 19 Sep 2013 15:08:29 +0200
|
||||
Subject: [PATCH] virsh: add missing "async" option in opts_block_commit
|
||||
|
||||
After commit 8aecd351266a66efa59b7f7be77bf66693d99ce0 it'll detect
|
||||
that a required option is not defined and it will assert and exit with:
|
||||
|
||||
virsh.c:1364: vshCommandOpt: Assertion `valid->name' failed.
|
||||
|
||||
Problem has been latent since commit ed23b106.
|
||||
|
||||
Signed-off-by: Eric Blake <eblake@redhat.com>
|
||||
(cherry picked from commit fe64499dd14315b2d9d62cdf421bd3c97a46b7ac)
|
||||
---
|
||||
tools/virsh-domain.c | 4 ++++
|
||||
tools/virsh.pod | 7 +++++--
|
||||
2 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
|
||||
index 568d61d..da6ab87 100644
|
||||
--- a/tools/virsh-domain.c
|
||||
+++ b/tools/virsh-domain.c
|
||||
@@ -1544,6 +1544,10 @@ static const vshCmdOptDef opts_block_commit[] = {
|
||||
.type = VSH_OT_INT,
|
||||
.help = N_("with --wait, abort if copy exceeds timeout (in seconds)")
|
||||
},
|
||||
+ {.name = "async",
|
||||
+ .type = VSH_OT_BOOL,
|
||||
+ .help = N_("with --wait, don't wait for cancel to finish")
|
||||
+ },
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
diff --git a/tools/virsh.pod b/tools/virsh.pod
|
||||
index 0ae5178..2864f3d 100644
|
||||
--- a/tools/virsh.pod
|
||||
+++ b/tools/virsh.pod
|
||||
@@ -737,7 +737,7 @@ I<domif-setlink>) will accept the MAC address printed by this command.
|
||||
|
||||
=item B<blockcommit> I<domain> I<path> [I<bandwidth>]
|
||||
{[I<base>] | [I<--shallow>]} [I<top>] [I<--delete>]
|
||||
-[I<--wait> [I<--verbose>] [I<--timeout> B<seconds>]]
|
||||
+[I<--wait> [I<--verbose>] [I<--timeout> B<seconds>] [I<--async>]]
|
||||
|
||||
Reduce the length of a backing image chain, by committing changes at the
|
||||
top of the chain (snapshot or delta files) into backing images. By
|
||||
@@ -756,7 +756,10 @@ operation can be checked with B<blockjob>. However, if I<--wait> is
|
||||
specified, then this command will block until the operation completes,
|
||||
or cancel the operation if the optional I<timeout> in seconds elapses
|
||||
or SIGINT is sent (usually with C<Ctrl-C>). Using I<--verbose> along
|
||||
-with I<--wait> will produce periodic status updates.
|
||||
+with I<--wait> will produce periodic status updates. If job cancellation
|
||||
+is triggered, I<--async> will return control to the user as fast as
|
||||
+possible, otherwise the command may continue to block a little while
|
||||
+longer until the job is done cleaning up.
|
||||
|
||||
I<path> specifies fully-qualified path of the disk; it corresponds
|
||||
to a unique target name (<target dev='name'/>) or source file (<source
|
@ -1,38 +0,0 @@
|
||||
From b4e1fb2febb00173b1489634262169554e8f6a1d Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Mon, 23 Sep 2013 12:46:25 +0100
|
||||
Subject: [PATCH] Fix typo in identity code which is pre-requisite for
|
||||
CVE-2013-4311
|
||||
|
||||
The fix for CVE-2013-4311 had a pre-requisite enhancement
|
||||
to the identity code
|
||||
|
||||
commit db7a5688c05f3fd60d9d2b74c72427eb9ee9c176
|
||||
Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
Date: Thu Aug 22 16:00:01 2013 +0100
|
||||
|
||||
Also store user & group ID values in virIdentity
|
||||
|
||||
This had a typo which caused the group ID to overwrite the
|
||||
user ID string. This meant any checks using this would have
|
||||
the wrong ID value. This only affected the ACL code, not the
|
||||
initial polkit auth. It also leaked memory.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
---
|
||||
src/rpc/virnetserverclient.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
|
||||
index 19c4100..0b9ab52 100644
|
||||
--- a/src/rpc/virnetserverclient.c
|
||||
+++ b/src/rpc/virnetserverclient.c
|
||||
@@ -678,7 +678,7 @@ virNetServerClientCreateIdentity(virNetServerClientPtr client)
|
||||
goto cleanup;
|
||||
if (!(groupname = virGetGroupName(gid)))
|
||||
goto cleanup;
|
||||
- if (virAsprintf(&userid, "%d", (int)gid) < 0)
|
||||
+ if (virAsprintf(&groupid, "%d", (int)gid) < 0)
|
||||
goto cleanup;
|
||||
if (virAsprintf(&processid, "%llu",
|
||||
(unsigned long long)pid) < 0)
|
@ -1,69 +0,0 @@
|
||||
From 9e7cec4d755341cfb4c27c16aa59b22135612f0e Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Mon, 23 Sep 2013 12:46:26 +0100
|
||||
Subject: [PATCH] Add a virNetSocketNewConnectSockFD method
|
||||
|
||||
To allow creation of a virNetSocketPtr instance from a pre-opened
|
||||
socketpair FD, add a virNetSocketNewConnectSockFD method.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
---
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/rpc/virnetsocket.c | 18 ++++++++++++++++++
|
||||
src/rpc/virnetsocket.h | 2 ++
|
||||
3 files changed, 21 insertions(+)
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 35f0f1b..873d93d 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -1008,6 +1008,7 @@ virNetSocketLocalAddrString;
|
||||
virNetSocketNewConnectCommand;
|
||||
virNetSocketNewConnectExternal;
|
||||
virNetSocketNewConnectLibSSH2;
|
||||
+virNetSocketNewConnectSockFD;
|
||||
virNetSocketNewConnectSSH;
|
||||
virNetSocketNewConnectTCP;
|
||||
virNetSocketNewConnectUNIX;
|
||||
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
|
||||
index ae81512..b311aae 100644
|
||||
--- a/src/rpc/virnetsocket.c
|
||||
+++ b/src/rpc/virnetsocket.c
|
||||
@@ -884,6 +884,24 @@ int virNetSocketNewConnectExternal(const char **cmdargv,
|
||||
}
|
||||
|
||||
|
||||
+int virNetSocketNewConnectSockFD(int sockfd,
|
||||
+ virNetSocketPtr *retsock)
|
||||
+{
|
||||
+ virSocketAddr localAddr;
|
||||
+
|
||||
+ localAddr.len = sizeof(localAddr.data);
|
||||
+ if (getsockname(sockfd, &localAddr.data.sa, &localAddr.len) < 0) {
|
||||
+ virReportSystemError(errno, "%s", _("Unable to get local socket name"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (!(*retsock = virNetSocketNew(&localAddr, NULL, true, sockfd, -1, -1)))
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
virNetSocketPtr virNetSocketNewPostExecRestart(virJSONValuePtr object)
|
||||
{
|
||||
virSocketAddr localAddr;
|
||||
diff --git a/src/rpc/virnetsocket.h b/src/rpc/virnetsocket.h
|
||||
index ca9ae91..86bc2f6 100644
|
||||
--- a/src/rpc/virnetsocket.h
|
||||
+++ b/src/rpc/virnetsocket.h
|
||||
@@ -97,6 +97,8 @@ int virNetSocketNewConnectLibSSH2(const char *host,
|
||||
int virNetSocketNewConnectExternal(const char **cmdargv,
|
||||
virNetSocketPtr *addr);
|
||||
|
||||
+int virNetSocketNewConnectSockFD(int sockfd,
|
||||
+ virNetSocketPtr *retsock);
|
||||
|
||||
virNetSocketPtr virNetSocketNewPostExecRestart(virJSONValuePtr object);
|
||||
|
@ -1,305 +0,0 @@
|
||||
From 7e1b75ca5d4127a86ff1eaa0dfe37b485eeb0a7a Mon Sep 17 00:00:00 2001
|
||||
From: "Daniel P. Berrange" <berrange@redhat.com>
|
||||
Date: Mon, 23 Sep 2013 12:46:27 +0100
|
||||
Subject: [PATCH] Add test case for virNetServerClient object identity code
|
||||
|
||||
Start a test case for the virNetServerClient object, which
|
||||
initially checks the creation of a virIdentityPtr object.
|
||||
|
||||
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
||||
---
|
||||
cfg.mk | 2 +-
|
||||
tests/Makefile.am | 14 +++-
|
||||
tests/virnetserverclientmock.c | 64 +++++++++++++++++
|
||||
tests/virnetserverclienttest.c | 159 +++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 237 insertions(+), 2 deletions(-)
|
||||
create mode 100644 tests/virnetserverclientmock.c
|
||||
create mode 100644 tests/virnetserverclienttest.c
|
||||
|
||||
diff --git a/cfg.mk b/cfg.mk
|
||||
index 9a9616c..7f817ef 100644
|
||||
--- a/cfg.mk
|
||||
+++ b/cfg.mk
|
||||
@@ -939,7 +939,7 @@ exclude_file_name_regexp--sc_prohibit_asprintf = \
|
||||
^(bootstrap.conf$$|src/util/virstring\.[ch]$$|examples/domain-events/events-c/event-test\.c$$|tests/vircgroupmock\.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_strdup = \
|
||||
- ^(docs/|examples/|python/|src/util/virstring\.c$$)
|
||||
+ ^(docs/|examples/|python/|src/util/virstring\.c|tests/virnetserverclientmock.c$$)
|
||||
|
||||
exclude_file_name_regexp--sc_prohibit_close = \
|
||||
(\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c|tests/vircgroupmock\.c)$$)
|
||||
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
||||
index c800179..ae99b38 100644
|
||||
--- a/tests/Makefile.am
|
||||
+++ b/tests/Makefile.am
|
||||
@@ -114,7 +114,7 @@ test_programs = virshtest sockettest \
|
||||
nodeinfotest virbuftest \
|
||||
commandtest seclabeltest \
|
||||
virhashtest virnetmessagetest virnetsockettest \
|
||||
- viratomictest \
|
||||
+ viratomictest virnetserverclienttest \
|
||||
utiltest shunloadtest \
|
||||
virtimetest viruritest virkeyfiletest \
|
||||
virauthconfigtest \
|
||||
@@ -281,6 +281,7 @@ EXTRA_DIST += $(test_scripts)
|
||||
|
||||
test_libraries = libshunload.la \
|
||||
libvirportallocatormock.la \
|
||||
+ virnetserverclientmock.la \
|
||||
vircgroupmock.la \
|
||||
$(NULL)
|
||||
if WITH_QEMU
|
||||
@@ -611,6 +612,17 @@ virnetsockettest_SOURCES = \
|
||||
virnetsockettest.c testutils.h testutils.c
|
||||
virnetsockettest_LDADD = $(LDADDS)
|
||||
|
||||
+virnetserverclienttest_SOURCES = \
|
||||
+ virnetserverclienttest.c \
|
||||
+ testutils.h testutils.c
|
||||
+virnetserverclienttest_LDADD = $(LDADDS)
|
||||
+
|
||||
+virnetserverclientmock_la_SOURCES = \
|
||||
+ virnetserverclientmock.c
|
||||
+virnetserverclientmock_la_CFLAGS = $(AM_CFLAGS)
|
||||
+virnetserverclientmock_la_LDFLAGS = -module -avoid-version \
|
||||
+ -rpath /evil/libtool/hack/to/force/shared/lib/creation
|
||||
+
|
||||
if WITH_GNUTLS
|
||||
virnettlscontexttest_SOURCES = \
|
||||
virnettlscontexttest.c \
|
||||
diff --git a/tests/virnetserverclientmock.c b/tests/virnetserverclientmock.c
|
||||
new file mode 100644
|
||||
index 0000000..caef1e3
|
||||
--- /dev/null
|
||||
+++ b/tests/virnetserverclientmock.c
|
||||
@@ -0,0 +1,64 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2013 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
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library. If not, see
|
||||
+ * <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+ * Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
+ */
|
||||
+
|
||||
+#include <config.h>
|
||||
+
|
||||
+#include "rpc/virnetsocket.h"
|
||||
+#include "virutil.h"
|
||||
+#include "internal.h"
|
||||
+
|
||||
+int virEventAddTimeout(int frequency ATTRIBUTE_UNUSED,
|
||||
+ virEventTimeoutCallback cb ATTRIBUTE_UNUSED,
|
||||
+ void *opaque ATTRIBUTE_UNUSED,
|
||||
+ virFreeCallback ff ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int virNetSocketGetUNIXIdentity(virNetSocketPtr sock ATTRIBUTE_UNUSED,
|
||||
+ uid_t *uid,
|
||||
+ gid_t *gid,
|
||||
+ pid_t *pid,
|
||||
+ unsigned long long *timestamp)
|
||||
+{
|
||||
+ *uid = 666;
|
||||
+ *gid = 7337;
|
||||
+ *pid = 42;
|
||||
+ *timestamp = 12345678;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+char *virGetUserName(uid_t uid ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ return strdup("astrochicken");
|
||||
+}
|
||||
+
|
||||
+char *virGetGroupName(gid_t gid ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ return strdup("fictionalusers");
|
||||
+}
|
||||
+
|
||||
+int virNetSocketGetSELinuxContext(virNetSocketPtr sock ATTRIBUTE_UNUSED,
|
||||
+ char **context)
|
||||
+{
|
||||
+ if (!(*context = strdup("foo_u:bar_r:wizz_t:s0-s0:c0.c1023")))
|
||||
+ return -1;
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/tests/virnetserverclienttest.c b/tests/virnetserverclienttest.c
|
||||
new file mode 100644
|
||||
index 0000000..1ddff3e
|
||||
--- /dev/null
|
||||
+++ b/tests/virnetserverclienttest.c
|
||||
@@ -0,0 +1,159 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2013 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
|
||||
+ * License as published by the Free Software Foundation; either
|
||||
+ * version 2.1 of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This library is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+ * Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public
|
||||
+ * License along with this library. If not, see
|
||||
+ * <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+ * Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
+ */
|
||||
+
|
||||
+#include <config.h>
|
||||
+
|
||||
+#include "testutils.h"
|
||||
+#include "virerror.h"
|
||||
+#include "rpc/virnetserverclient.h"
|
||||
+
|
||||
+#define VIR_FROM_THIS VIR_FROM_RPC
|
||||
+
|
||||
+#ifdef HAVE_SOCKETPAIR
|
||||
+static int testIdentity(const void *opaque ATTRIBUTE_UNUSED)
|
||||
+{
|
||||
+ int sv[2];
|
||||
+ int ret = -1;
|
||||
+ virNetSocketPtr sock = NULL;
|
||||
+ virNetServerClientPtr client = NULL;
|
||||
+ virIdentityPtr ident = NULL;
|
||||
+ const char *gotUsername = NULL;
|
||||
+ const char *gotUserID = NULL;
|
||||
+ const char *gotGroupname = NULL;
|
||||
+ const char *gotGroupID = NULL;
|
||||
+ const char *gotSELinuxContext = NULL;
|
||||
+
|
||||
+ if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) < 0) {
|
||||
+ virReportSystemError(errno, "%s",
|
||||
+ "Cannot create socket pair");
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (virNetSocketNewConnectSockFD(sv[0], &sock) < 0) {
|
||||
+ virDispatchError(NULL);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ sv[0] = -1;
|
||||
+
|
||||
+ if (!(client = virNetServerClientNew(sock, 0, false, 1,
|
||||
+# ifdef WITH_GNUTLS
|
||||
+ NULL,
|
||||
+# endif
|
||||
+ NULL, NULL, NULL, NULL))) {
|
||||
+ virDispatchError(NULL);
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (!(ident = virNetServerClientGetIdentity(client))) {
|
||||
+ fprintf(stderr, "Failed to create identity\n");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (virIdentityGetAttr(ident,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_USER_NAME,
|
||||
+ &gotUsername) < 0) {
|
||||
+ fprintf(stderr, "Missing username in identity\n");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (STRNEQ_NULLABLE("astrochicken", gotUsername)) {
|
||||
+ fprintf(stderr, "Want username 'astrochicken' got '%s'\n",
|
||||
+ NULLSTR(gotUsername));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (virIdentityGetAttr(ident,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_USER_ID,
|
||||
+ &gotUserID) < 0) {
|
||||
+ fprintf(stderr, "Missing user ID in identity\n");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (STRNEQ_NULLABLE("666", gotUserID)) {
|
||||
+ fprintf(stderr, "Want username '666' got '%s'\n",
|
||||
+ NULLSTR(gotUserID));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (virIdentityGetAttr(ident,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_GROUP_NAME,
|
||||
+ &gotGroupname) < 0) {
|
||||
+ fprintf(stderr, "Missing groupname in identity\n");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (STRNEQ_NULLABLE("fictionalusers", gotGroupname)) {
|
||||
+ fprintf(stderr, "Want groupname 'fictionalusers' got '%s'\n",
|
||||
+ NULLSTR(gotGroupname));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (virIdentityGetAttr(ident,
|
||||
+ VIR_IDENTITY_ATTR_UNIX_GROUP_ID,
|
||||
+ &gotGroupID) < 0) {
|
||||
+ fprintf(stderr, "Missing group ID in identity\n");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (STRNEQ_NULLABLE("7337", gotGroupID)) {
|
||||
+ fprintf(stderr, "Want groupname '7337' got '%s'\n",
|
||||
+ NULLSTR(gotGroupID));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ if (virIdentityGetAttr(ident,
|
||||
+ VIR_IDENTITY_ATTR_SELINUX_CONTEXT,
|
||||
+ &gotSELinuxContext) < 0) {
|
||||
+ fprintf(stderr, "Missing SELinux context in identity\n");
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+ if (STRNEQ_NULLABLE("foo_u:bar_r:wizz_t:s0-s0:c0.c1023", gotSELinuxContext)) {
|
||||
+ fprintf(stderr, "Want groupname 'foo_u:bar_r:wizz_t:s0-s0:c0.c1023' got '%s'\n",
|
||||
+ NULLSTR(gotGroupID));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ ret = 0;
|
||||
+ cleanup:
|
||||
+ virObjectUnref(sock);
|
||||
+ virObjectUnref(client);
|
||||
+ virObjectUnref(ident);
|
||||
+ VIR_FORCE_CLOSE(sv[0]);
|
||||
+ VIR_FORCE_CLOSE(sv[1]);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+mymain(void)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+
|
||||
+
|
||||
+ if (virtTestRun("Identity", 1,
|
||||
+ testIdentity, NULL) < 0)
|
||||
+ ret = -1;
|
||||
+
|
||||
+ return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
+}
|
||||
+#else
|
||||
+static int
|
||||
+mymain(void)
|
||||
+{
|
||||
+ return AM_TEST_SKIP;
|
||||
+}
|
||||
+#endif
|
||||
+VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virnetserverclientmock.so")
|
@ -1,62 +0,0 @@
|
||||
From 08a0e5d5ab9a0254045e6b6304bfdb7061f5e249 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Mon, 16 Sep 2013 13:37:34 +0200
|
||||
Subject: [PATCH] qemu: Fix checking of ABI stability when restoring external
|
||||
checkpoints
|
||||
|
||||
External checkpoints have a bug in the implementation where they use the
|
||||
normal definition instead of the "migratable" one. This causes errors
|
||||
when the snapshot is being reverted using the workaround method via
|
||||
qemuDomainRestoreFlags() with a custom XML. This issue was introduced
|
||||
when commit 07966f6a8b5ccb5bb4c716b25deb8ba2e572cc67 changed the code to
|
||||
compare "migratable" XMLs from the user as we should have used
|
||||
migratable in the image too.
|
||||
|
||||
This patch adds a compatibility layer, so that fixing the snapshot code
|
||||
won't make existing snapshots fail to load.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340
|
||||
(cherry picked from commit 59898a88ce8431bd3ea249b8789edc2ef9985827)
|
||||
---
|
||||
src/qemu/qemu_driver.c | 23 ++++++++++++++++++++---
|
||||
1 file changed, 20 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index ed29373..3a7c9d0 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -5251,14 +5251,31 @@ qemuDomainSaveImageOpen(virQEMUDriverPtr driver,
|
||||
goto error;
|
||||
|
||||
newdef = qemuDomainDefCopy(driver, def2, VIR_DOMAIN_XML_MIGRATABLE);
|
||||
- virDomainDefFree(def2);
|
||||
- if (!newdef)
|
||||
+ if (!newdef) {
|
||||
+ virDomainDefFree(def2);
|
||||
goto error;
|
||||
+ }
|
||||
|
||||
if (!virDomainDefCheckABIStability(def, newdef)) {
|
||||
virDomainDefFree(newdef);
|
||||
- goto error;
|
||||
+ virResetLastError();
|
||||
+
|
||||
+ /* Due to a bug in older version of external snapshot creation
|
||||
+ * code, the XML saved in the save image was not a migratable
|
||||
+ * XML. To ensure backwards compatibility with the change of the
|
||||
+ * saved XML type, we need to check the ABI compatibility against
|
||||
+ * the user provided XML if the check against the migratable XML
|
||||
+ * fails. Snapshots created prior to v1.1.3 have this issue. */
|
||||
+ if (!virDomainDefCheckABIStability(def, def2)) {
|
||||
+ virDomainDefFree(def2);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ /* use the user provided XML */
|
||||
+ newdef = def2;
|
||||
+ def2 = NULL;
|
||||
}
|
||||
+
|
||||
virDomainDefFree(def);
|
||||
def = newdef;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
From 438dc5b4e161f675575c6febb07d75fbf6022d6e Mon Sep 17 00:00:00 2001
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Mon, 16 Sep 2013 13:40:42 +0200
|
||||
Subject: [PATCH] qemu: Use "migratable" XML definition when doing external
|
||||
checkpoints
|
||||
|
||||
In the original implementation of external checkpoints I've mistakenly
|
||||
used the live definition to be stored in the save image. The normal
|
||||
approach is to use the "migratable" definition. This was discovered when
|
||||
commit 07966f6a8b5ccb5bb4c716b25deb8ba2e572cc67 changed the behavior to
|
||||
use a converted XML from the user to do the compatibility check to fix
|
||||
problem when using the regular machine saving.
|
||||
|
||||
As the previous patch added a compatibility layer, we can now change the
|
||||
type of the XML in the image.
|
||||
|
||||
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1008340
|
||||
(cherry picked from commit 1b7bfa65e36996fc3a204452d2a844ab9f4b52b3)
|
||||
---
|
||||
src/qemu/qemu_driver.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index 3a7c9d0..c500728 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -12186,7 +12186,7 @@ qemuDomainSnapshotCreateActiveExternal(virConnectPtr conn,
|
||||
JOB_MASK(QEMU_JOB_SUSPEND) |
|
||||
JOB_MASK(QEMU_JOB_MIGRATION_OP));
|
||||
|
||||
- if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, false)))
|
||||
+ if (!(xml = qemuDomainDefFormatLive(driver, vm->def, true, true)))
|
||||
goto endjob;
|
||||
|
||||
if ((ret = qemuDomainSaveMemory(driver, vm, snap->def->file,
|
94
libvirt.spec
94
libvirt.spec
@ -13,13 +13,11 @@
|
||||
# touch configure.ac or Makefile.am.
|
||||
%{!?enable_autotools:%define enable_autotools 0}
|
||||
|
||||
# Drop after libvirt-1.1.3 is rebased
|
||||
%define enable_autotools 1
|
||||
|
||||
# A client only build will create a libvirt.so only containing
|
||||
# the generic RPC driver, and test driver and no libvirtd
|
||||
# Default to a full server + client build
|
||||
%define client_only 0
|
||||
# Default to a full server + client build, but with the possibility
|
||||
# of a command-line or ~/.rpmmacros override for client-only.
|
||||
%{!?client_only:%define client_only 0}
|
||||
|
||||
# Now turn off server build in certain cases
|
||||
|
||||
@ -53,6 +51,7 @@
|
||||
%define with_lxc 0%{!?_without_lxc:%{server_drivers}}
|
||||
%define with_uml 0%{!?_without_uml:%{server_drivers}}
|
||||
%define with_libxl 0%{!?_without_libxl:%{server_drivers}}
|
||||
%define with_vbox 0%{!?_without_vbox:%{server_drivers}}
|
||||
|
||||
%define with_qemu_tcg %{with_qemu}
|
||||
# Change if we ever provide qemu-kvm binaries on non-x86 hosts
|
||||
@ -74,7 +73,6 @@
|
||||
|
||||
# Then the hypervisor drivers that run outside libvirtd, in libvirt.so
|
||||
%define with_openvz 0%{!?_without_openvz:1}
|
||||
%define with_vbox 0%{!?_without_vbox:1}
|
||||
%define with_vmware 0%{!?_without_vmware:1}
|
||||
%define with_phyp 0%{!?_without_phyp:1}
|
||||
%define with_esx 0%{!?_without_esx:1}
|
||||
@ -368,8 +366,8 @@
|
||||
|
||||
Summary: Library providing a simple virtualization API
|
||||
Name: libvirt
|
||||
Version: 1.1.2
|
||||
Release: 4%{?dist}%{?extra_release}
|
||||
Version: 1.1.3
|
||||
Release: 1%{?dist}%{?extra_release}
|
||||
License: LGPLv2+
|
||||
Group: Development/Libraries
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
@ -380,34 +378,6 @@ URL: http://libvirt.org/
|
||||
%endif
|
||||
Source: http://libvirt.org/sources/%{?mainturl}libvirt-%{version}.tar.gz
|
||||
|
||||
# Fix launching ARM guests on x86 (patches posted upstream, F20 feature)
|
||||
Patch0001: 0001-qemu-Set-QEMU_AUDIO_DRV-none-with-nographic.patch
|
||||
Patch0002: 0002-domain_conf-Add-default-memballoon-in-PostParse-call.patch
|
||||
Patch0003: 0003-qemu-Don-t-add-default-memballoon-device-on-ARM.patch
|
||||
Patch0004: 0004-qemu-Fix-specifying-char-devs-for-ARM.patch
|
||||
Patch0005: 0005-qemu-Don-t-try-to-allocate-PCI-addresses-for-ARM.patch
|
||||
Patch0006: 0006-domain_conf-Add-disk-bus-sd-wire-it-up-for-qemu.patch
|
||||
Patch0007: 0007-qemu-Fix-networking-for-ARM-guests.patch
|
||||
Patch0008: 0008-qemu-Support-virtio-mmio-transport-for-virtio-on-ARM.patch
|
||||
|
||||
# Sync with v1.1.2-maint
|
||||
Patch0101: 0101-virFileNBDDeviceAssociate-Avoid-use-of-uninitialized.patch
|
||||
Patch0102: 0102-Fix-AM_LDFLAGS-typo.patch
|
||||
Patch0103: 0103-Pass-AM_LDFLAGS-to-driver-modules-too.patch
|
||||
Patch0104: 0104-build-fix-build-with-latest-rawhide-kernel-headers.patch
|
||||
Patch0105: 0105-Also-store-user-group-ID-values-in-virIdentity.patch
|
||||
Patch0106: 0106-Ensure-system-identity-includes-process-start-time.patch
|
||||
Patch0107: 0107-Add-support-for-using-3-arg-pkcheck-syntax-for-proce.patch
|
||||
Patch0108: 0108-Fix-crash-in-remoteDispatchDomainMemoryStats-CVE-201.patch
|
||||
Patch0109: 0109-virsh-add-missing-async-option-in-opts_block_commit.patch
|
||||
Patch0110: 0110-Fix-typo-in-identity-code-which-is-pre-requisite-for.patch
|
||||
Patch0111: 0111-Add-a-virNetSocketNewConnectSockFD-method.patch
|
||||
Patch0112: 0112-Add-test-case-for-virNetServerClient-object-identity.patch
|
||||
|
||||
# Fix snapshot restore when VM has disabled usb support (bz #1011520)
|
||||
Patch0201: 0201-qemu-Fix-checking-of-ABI-stability-when-restoring-ex.patch
|
||||
Patch0202: 0202-qemu-Use-migratable-XML-definition-when-doing-extern.patch
|
||||
|
||||
%if %{with_libvirtd}
|
||||
Requires: libvirt-daemon = %{version}-%{release}
|
||||
%if %{with_network}
|
||||
@ -539,8 +509,7 @@ BuildRequires: cyrus-sasl-devel
|
||||
%endif
|
||||
%if %{with_polkit}
|
||||
%if 0%{?fedora} >= 12 || 0%{?rhel} >= 6
|
||||
# Only need the binary, not -devel
|
||||
BuildRequires: polkit >= 0.93
|
||||
BuildRequires: polkit-devel >= 0.93
|
||||
%else
|
||||
BuildRequires: PolicyKit-devel >= 0.6
|
||||
%endif
|
||||
@ -629,7 +598,6 @@ BuildRequires: audit-libs-devel
|
||||
BuildRequires: systemtap-sdt-devel
|
||||
%endif
|
||||
|
||||
|
||||
%if %{with_storage_fs}
|
||||
# For mount/umount in FS driver
|
||||
BuildRequires: util-linux
|
||||
@ -1184,34 +1152,6 @@ of recent versions of Linux (and other OSes).
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
# Fix launching ARM guests on x86 (patches posted upstream, F20 feature)
|
||||
%patch0001 -p1
|
||||
%patch0002 -p1
|
||||
%patch0003 -p1
|
||||
%patch0004 -p1
|
||||
%patch0005 -p1
|
||||
%patch0006 -p1
|
||||
%patch0007 -p1
|
||||
%patch0008 -p1
|
||||
|
||||
# Sync with v1.1.2-maint
|
||||
%patch0101 -p1
|
||||
%patch0102 -p1
|
||||
%patch0103 -p1
|
||||
%patch0104 -p1
|
||||
%patch0105 -p1
|
||||
%patch0106 -p1
|
||||
%patch0107 -p1
|
||||
%patch0108 -p1
|
||||
%patch0109 -p1
|
||||
%patch0110 -p1
|
||||
%patch0111 -p1
|
||||
%patch0112 -p1
|
||||
|
||||
# Fix snapshot restore when VM has disabled usb support (bz #1011520)
|
||||
%patch0201 -p1
|
||||
%patch0202 -p1
|
||||
|
||||
%build
|
||||
%if ! %{with_xen}
|
||||
%define _without_xen --without-xen
|
||||
@ -1783,6 +1723,8 @@ fi
|
||||
|
||||
%files docs
|
||||
%defattr(-, root, root)
|
||||
%doc AUTHORS ChangeLog.gz NEWS README TODO
|
||||
|
||||
# Website
|
||||
%dir %{_datadir}/doc/libvirt-docs-%{version}
|
||||
%dir %{_datadir}/doc/libvirt-docs-%{version}/html
|
||||
@ -1799,7 +1741,6 @@ fi
|
||||
%files daemon
|
||||
%defattr(-, root, root)
|
||||
|
||||
%doc AUTHORS ChangeLog.gz NEWS README COPYING COPYING.LESSER TODO
|
||||
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
|
||||
|
||||
%if %{with_network}
|
||||
@ -2071,20 +2012,26 @@ fi
|
||||
|
||||
%files client -f %{name}.lang
|
||||
%defattr(-, root, root)
|
||||
%doc AUTHORS ChangeLog.gz NEWS README COPYING COPYING.LESSER TODO
|
||||
%doc COPYING COPYING.LESSER
|
||||
|
||||
%config(noreplace) %{_sysconfdir}/libvirt/libvirt.conf
|
||||
%if %{with_lxc}
|
||||
%config(noreplace) %{_sysconfdir}/libvirt/virt-login-shell.conf
|
||||
%endif
|
||||
%{_mandir}/man1/virsh.1*
|
||||
%{_mandir}/man1/virt-xml-validate.1*
|
||||
%{_mandir}/man1/virt-pki-validate.1*
|
||||
%{_mandir}/man1/virt-host-validate.1*
|
||||
%if %{with_lxc}
|
||||
%{_mandir}/man1/virt-login-shell.1*
|
||||
%endif
|
||||
%{_bindir}/virsh
|
||||
%{_bindir}/virt-xml-validate
|
||||
%{_bindir}/virt-pki-validate
|
||||
%{_bindir}/virt-host-validate
|
||||
%if %{with_lxc}
|
||||
%attr(4755, root, root) %{_bindir}/virt-login-shell
|
||||
%endif
|
||||
%{_libdir}/lib*.so.*
|
||||
|
||||
%if %{with_dtrace}
|
||||
@ -2155,7 +2102,6 @@ fi
|
||||
%files python
|
||||
%defattr(-, root, root)
|
||||
|
||||
%doc AUTHORS NEWS README COPYING COPYING.LESSER
|
||||
%{_libdir}/python*/site-packages/libvirt.py*
|
||||
%{_libdir}/python*/site-packages/libvirt_qemu.py*
|
||||
%{_libdir}/python*/site-packages/libvirt_lxc.py*
|
||||
@ -2165,6 +2111,14 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Oct 1 2013 Daniel Veillard <veillard@redhat.com> - 1.1.3-1
|
||||
- VMware: Initial VMware Fusion support and various improvements
|
||||
- libvirt: add new public API virConnectGetCPUModelNames
|
||||
- various libxl driver improvements
|
||||
- LXC many container driver improvement
|
||||
- ARM cpu improvements
|
||||
- a lot of bug and leak fixes and various improvements
|
||||
|
||||
* Tue Sep 24 2013 Cole Robinson <crobinso@redhat.com> - 1.1.2-4
|
||||
- Fix snapshot restore when VM has disabled usb support (bz #1011520)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user