[libvirt] [PATCH 0/4] Add ability to store and display notes and description with domains
by Peter Krempa
This patchset adds ability to store, display and modify comments for domains to help
administrators identify and store metadata to domains to allow easy identification.
A short description "note" was added as an attribute for the <description> element
to hold a shorter description (limited to max 40 characters) to be shown along with
lists of domains.
A new command is being added to virsh to accomodate work with these new options.
Peter Krempa (4):
xml: Add attribute to <description> element to hold a short note
api: Add api to set domain note and description in runtime
qemu: Implement note API in qemu driver
virsh: Add support for modifying domain description and notes
docs/formatdomain.html.in | 7 +-
docs/schemas/domaincommon.rng | 14 ++-
include/libvirt/libvirt.h.in | 15 +++
src/conf/domain_conf.c | 27 ++++-
src/conf/domain_conf.h | 1 +
src/driver.h | 5 +
src/libvirt.c | 47 ++++++++
src/libvirt_public.syms | 5 +
src/qemu/qemu_driver.c | 70 ++++++++++++
src/remote/remote_driver.c | 1 +
src/remote/remote_protocol.x | 9 ++-
tools/virsh.c | 246 +++++++++++++++++++++++++++++++++++++----
tools/virsh.pod | 30 +++++-
13 files changed, 450 insertions(+), 27 deletions(-)
--
1.7.3.4
12 years, 11 months
[libvirt] [PATCH] virsh domiflist: change output
by Taku Izumi
When using "virsh domifstat" command or "virsh domiftune" command,
we pass an interface name as a parameter, so interface name is
important.
"virsh domiflist" output should display interface names
on the first row.
Signed-off-by: Taku Izumi <izumi.taku(a)jp.fujitsu.com>
---
tools/virsh.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: libvirt.capability/tools/virsh.c
===================================================================
--- libvirt.capability.orig/tools/virsh.c
+++ libvirt.capability/tools/virsh.c
@@ -2034,8 +2034,8 @@ cmdDomiflist(vshControl *ctl, const vshC
if (ninterfaces < 0)
goto cleanup;
- vshPrint(ctl, "%-10s %-10s %-10s %-11s %s\n", _("Type"), _("Source"),
- _("Target"), _("Model"), _("MAC"));
+ vshPrint(ctl, "%-10s %-10s %-10s %-11s %s\n", _("Interface"), _("Type"),
+ _("Source"), _("Model"), _("MAC"));
vshPrint(ctl, "-------------------------------------------------------\n");
for (i = 0; i < ninterfaces; i++) {
@@ -2057,9 +2057,10 @@ cmdDomiflist(vshControl *ctl, const vshC
model = virXPathString("string(./model/@type)", ctxt);
mac = virXPathString("string(./mac/@address)", ctxt);
- vshPrint(ctl, "%-10s %-10s %-10s %-11s %-10s\n", type,
- source ? source : "-",
+ vshPrint(ctl, "%-10s %-10s %-10s %-11s %-10s\n",
target ? target : "-",
+ type,
+ source ? source : "-",
model ? model : "-",
mac ? mac : "-");
12 years, 11 months
[libvirt] [PATCH] export virNetDevGetVirtualFunctions as a private symbol
by Paolo Bonzini
This avoids a linking error.
Signed-off-by: Paolo Bonzini <pbonzini(a)redhat.com>
---
src/libvirt_private.syms | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 27a093c..912f1b4 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1196,6 +1196,7 @@ virNetDevSetName;
virNetDevSetNamespace;
virNetDevSetOnline;
virNetDevValidateConfig;
+virNetDevGetVirtualFunctions;
# virnetdevbandwidth.h
--
1.7.7.1
12 years, 11 months
[libvirt] [PATCH] qemu: Introduce inactive PCI device list
by Osier Yang
pciTrySecondaryBusReset checks if there is active device on the
same bus, however, qemu driver doesn't maintain an effective
list for the inactive devices, and it passes meaningless argment
for parameter "inactiveDevs". e.g. (qemuPrepareHostdevPCIDevices)
if (!(pcidevs = qemuGetPciHostDeviceList(hostdevs, nhostdevs)))
return -1;
...skipped...
if (pciResetDevice(dev, driver->activePciHostdevs, pcidevs) < 0)
goto reattachdevs;
NB, the "pcidevs" used above are extracted from domain def, and
thus one won't be able to attach a device of which bus has other
device even detached from host (nodedev-detach). To see more
details of the problem:
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=773667
This patch is to resolve the problem by introduce an inactive
PCI device list (just like qemu_driver->activePciHostdevs), and
the whole logic is:
* Add the device to inactive list when do nodedev-dettach
* Remove the device from inactive list when do nodedev-reattach
* Remove the device from inactive list when do attach-device
(for not managed device)
* Add the device to inactive list after detach-device, only
if the device is not managed
* Don't do any work if the device is managed, as it manages
there is no gap in the whole workflow for another guest
who wants to
With above, we have sufficient inactive PCI device list, and thus
we can use it for pciResetDevice. e.g.(qemuPrepareHostdevPCIDevices)
if (pciResetDevice(dev, driver->activePciHostdevs,
driver->inactivePciHostdevs) < 0)
goto reattachdevs;
---
src/qemu/qemu_conf.h | 5 +++++
src/qemu/qemu_driver.c | 13 ++++++++++---
src/qemu/qemu_hostdev.c | 31 ++++++++++++++++++++++---------
src/qemu/qemu_hotplug.c | 3 ++-
src/util/pci.c | 27 +++++++++++++++++++++++----
src/util/pci.h | 8 ++++++--
src/xen/xen_driver.c | 4 ++--
7 files changed, 70 insertions(+), 21 deletions(-)
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index d8d7915..3f1b668 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -128,6 +128,11 @@ struct qemud_driver {
pciDeviceList *activePciHostdevs;
usbDeviceList *activeUsbHostdevs;
+ /* The device which is not used by both host
+ * and any guest.
+ */
+ pciDeviceList *inactivePciHostdevs;
+
virBitmapPtr reservedVNCPorts;
virSysinfoDefPtr hostsysinfo;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 712f1fc..159911c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -588,6 +588,9 @@ qemudStartup(int privileged) {
if ((qemu_driver->activeUsbHostdevs = usbDeviceListNew()) == NULL)
goto error;
+ if ((qemu_driver->inactivePciHostdevs = pciDeviceListNew()) == NULL)
+ goto error;
+
if (privileged) {
if (chown(qemu_driver->libDir, qemu_driver->user, qemu_driver->group) < 0) {
virReportSystemError(errno,
@@ -778,6 +781,7 @@ qemudShutdown(void) {
qemuDriverLock(qemu_driver);
pciDeviceListFree(qemu_driver->activePciHostdevs);
+ pciDeviceListFree(qemu_driver->inactivePciHostdevs);
usbDeviceListFree(qemu_driver->activeUsbHostdevs);
virCapabilitiesFree(qemu_driver->caps);
@@ -9220,7 +9224,8 @@ qemudNodeDeviceDettach (virNodeDevicePtr dev)
return -1;
qemuDriverLock(driver);
- if (pciDettachDevice(pci, driver->activePciHostdevs) < 0)
+ if (pciDettachDevice(pci, driver->activePciHostdevs,
+ driver->inactivePciHostdevs) < 0)
goto out;
ret = 0;
@@ -9248,7 +9253,8 @@ qemudNodeDeviceReAttach (virNodeDevicePtr dev)
pciDeviceReAttachInit(pci);
qemuDriverLock(driver);
- if (pciReAttachDevice(pci, driver->activePciHostdevs) < 0)
+ if (pciReAttachDevice(pci, driver->activePciHostdevs,
+ driver->inactivePciHostdevs) < 0)
goto out;
ret = 0;
@@ -9275,7 +9281,8 @@ qemudNodeDeviceReset (virNodeDevicePtr dev)
qemuDriverLock(driver);
- if (pciResetDevice(pci, driver->activePciHostdevs, NULL) < 0)
+ if (pciResetDevice(pci, driver->activePciHostdevs,
+ driver->inactivePciHostdevs) < 0)
goto out;
ret = 0;
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index c7adb1d..82ad9de 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -212,7 +212,7 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver,
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
pciDevice *dev = pciDeviceListGet(pcidevs, i);
if (pciDeviceGetManaged(dev) &&
- pciDettachDevice(dev, driver->activePciHostdevs) < 0)
+ pciDettachDevice(dev, driver->activePciHostdevs, NULL) < 0)
goto reattachdevs;
}
@@ -220,7 +220,8 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver,
* can safely reset them */
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
pciDevice *dev = pciDeviceListGet(pcidevs, i);
- if (pciResetDevice(dev, driver->activePciHostdevs, pcidevs) < 0)
+ if (pciResetDevice(dev, driver->activePciHostdevs,
+ driver->inactivePciHostdevs) < 0)
goto reattachdevs;
}
@@ -233,7 +234,13 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver,
}
}
- /* Loop 5: Now set the used_by_domain of the device in
+ /* Loop 5: Now remove the devices from inactive list. */
+ for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
+ pciDevice *dev = pciDeviceListGet(pcidevs, i);
+ pciDeviceListDel(driver->inactivePciHostdevs, dev);
+ }
+
+ /* Loop 6: Now set the used_by_domain of the device in
* driver->activePciHostdevs as domain name.
*/
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
@@ -245,7 +252,7 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver,
pciDeviceSetUsedBy(activeDev, name);
}
- /* Loop 6: Now set the original states for hostdev def */
+ /* Loop 7: Now set the original states for hostdev def */
for (i = 0; i < nhostdevs; i++) {
pciDevice *dev;
pciDevice *pcidev;
@@ -277,7 +284,7 @@ int qemuPrepareHostdevPCIDevices(struct qemud_driver *driver,
pciFreeDevice(dev);
}
- /* Loop 7: Now steal all the devices from pcidevs */
+ /* Loop 8: Now steal all the devices from pcidevs */
while (pciDeviceListCount(pcidevs) > 0) {
pciDevice *dev = pciDeviceListGet(pcidevs, 0);
pciDeviceListSteal(pcidevs, dev);
@@ -298,7 +305,7 @@ inactivedevs:
reattachdevs:
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
pciDevice *dev = pciDeviceListGet(pcidevs, i);
- pciReAttachDevice(dev, driver->activePciHostdevs);
+ pciReAttachDevice(dev, driver->activePciHostdevs, NULL);
}
cleanup:
@@ -445,8 +452,13 @@ void qemuReattachPciDevice(pciDevice *dev, struct qemud_driver *driver)
{
int retries = 100;
- if (!pciDeviceGetManaged(dev))
+ /* If the device is not managed and was attached to guest
+ * successfully, it must had be inactive.
+ */
+ if (!pciDeviceGetManaged(dev)) {
+ pciDeviceListAdd(driver->inactivePciHostdevs, dev);
return;
+ }
while (pciWaitForDeviceCleanup(dev, "kvm_assigned_device")
&& retries) {
@@ -454,7 +466,7 @@ void qemuReattachPciDevice(pciDevice *dev, struct qemud_driver *driver)
retries--;
}
- if (pciReAttachDevice(dev, driver->activePciHostdevs) < 0) {
+ if (pciReAttachDevice(dev, driver->activePciHostdevs, NULL) < 0) {
virErrorPtr err = virGetLastError();
VIR_ERROR(_("Failed to re-attach PCI device: %s"),
err ? err->message : _("unknown error"));
@@ -503,7 +515,8 @@ void qemuDomainReAttachHostdevDevices(struct qemud_driver *driver,
for (i = 0; i < pciDeviceListCount(pcidevs); i++) {
pciDevice *dev = pciDeviceListGet(pcidevs, i);
- if (pciResetDevice(dev, driver->activePciHostdevs, pcidevs) < 0) {
+ if (pciResetDevice(dev, driver->activePciHostdevs,
+ driver->inactivePciHostdevs) < 0) {
virErrorPtr err = virGetLastError();
VIR_ERROR(_("Failed to reset PCI device: %s"),
err ? err->message : _("unknown error"));
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index dc40d2f..6080d38 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2029,7 +2029,8 @@ qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
detach->source.subsys.u.pci.function);
if (pci) {
activePci = pciDeviceListSteal(driver->activePciHostdevs, pci);
- if (pciResetDevice(activePci, driver->activePciHostdevs, NULL))
+ if (pciResetDevice(activePci, driver->activePciHostdevs,
+ driver->inactivePciHostdevs))
qemuReattachPciDevice(activePci, driver);
else
ret = -1;
diff --git a/src/util/pci.c b/src/util/pci.c
index 17cde81..557bd34 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1117,7 +1117,9 @@ cleanup:
}
int
-pciDettachDevice(pciDevice *dev, pciDeviceList *activeDevs)
+pciDettachDevice(pciDevice *dev,
+ pciDeviceList *activeDevs,
+ pciDeviceList *inactiveDevs)
{
const char *driver = pciFindStubDriver();
if (!driver) {
@@ -1132,11 +1134,22 @@ pciDettachDevice(pciDevice *dev, pciDeviceList *activeDevs)
return -1;
}
- return pciBindDeviceToStub(dev, driver);
+ if (pciBindDeviceToStub(dev, driver) < 0)
+ return -1;
+
+ /* Add the dev into list inactiveDevs */
+ if (!pciDeviceListFind(inactiveDevs, dev)) {
+ if (pciDeviceListAdd(inactiveDevs, dev) < 0)
+ return -1;
+ }
+
+ return 0;
}
int
-pciReAttachDevice(pciDevice *dev, pciDeviceList *activeDevs)
+pciReAttachDevice(pciDevice *dev,
+ pciDeviceList *activeDevs,
+ pciDeviceList *inactiveDevs)
{
const char *driver = pciFindStubDriver();
if (!driver) {
@@ -1151,7 +1164,13 @@ pciReAttachDevice(pciDevice *dev, pciDeviceList *activeDevs)
return -1;
}
- return pciUnbindDeviceFromStub(dev, driver);
+ if (pciUnbindDeviceFromStub(dev, driver) < 0)
+ return -1;
+
+ /* Remove the dev from list inactiveDevs */
+ pciDeviceListDel(inactiveDevs, dev);
+
+ return 0;
}
/* Certain hypervisors (like qemu/kvm) map the PCI bar(s) on
diff --git a/src/util/pci.h b/src/util/pci.h
index 5493e0a..25b5b66 100644
--- a/src/util/pci.h
+++ b/src/util/pci.h
@@ -40,8 +40,12 @@ pciDevice *pciGetDevice (unsigned domain,
unsigned function);
void pciFreeDevice (pciDevice *dev);
const char *pciDeviceGetName (pciDevice *dev);
-int pciDettachDevice (pciDevice *dev, pciDeviceList *activeDevs);
-int pciReAttachDevice (pciDevice *dev, pciDeviceList *activeDevs);
+int pciDettachDevice (pciDevice *dev,
+ pciDeviceList *activeDevs,
+ pciDeviceList *inactiveDevs);
+int pciReAttachDevice (pciDevice *dev,
+ pciDeviceList *activeDevs,
+ pciDeviceList *inactiveDevs);
int pciResetDevice (pciDevice *dev,
pciDeviceList *activeDevs,
pciDeviceList *inactiveDevs);
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 20671c0..520ec03 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1985,7 +1985,7 @@ xenUnifiedNodeDeviceDettach (virNodeDevicePtr dev)
if (!pci)
return -1;
- if (pciDettachDevice(pci, NULL) < 0)
+ if (pciDettachDevice(pci, NULL, NULL) < 0)
goto out;
ret = 0;
@@ -2075,7 +2075,7 @@ xenUnifiedNodeDeviceReAttach (virNodeDevicePtr dev)
goto out;
}
- if (pciReAttachDevice(pci, NULL) < 0)
+ if (pciReAttachDevice(pci, NULL, NULL) < 0)
goto out;
ret = 0;
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH v2] virsh: Two new fields for command domblklist
by Osier Yang
Disk "type" and "device" are generally interesting stuffs the
user who wants to known too. To not breaking the scripts which
parses the output field, new options "--details" is introduced
to output the two introduced fields.
---
tools/virsh.c | 32 +++++++++++++++++++++++++++++---
tools/virsh.pod | 19 ++++++++++---------
2 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 734c55d..6f1acf6 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1906,7 +1906,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd)
*/
static const vshCmdInfo info_domblklist[] = {
{"help", N_("list all domain blocks")},
- {"desc", N_("Get the names of block devices for a domain.")},
+ {"desc", N_("Get the summary of block devices for a domain.")},
{NULL, NULL}
};
@@ -1914,6 +1914,8 @@ static const vshCmdOptDef opts_domblklist[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"inactive", VSH_OT_BOOL, 0,
N_("get inactive rather than running configuration")},
+ {"details", VSH_OT_BOOL, 0,
+ N_("additionally display the type and device value")},
{NULL, 0, 0, NULL}
};
@@ -1929,10 +1931,13 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
int ndisks;
xmlNodePtr *disks = NULL;
int i;
+ bool details = false;
if (vshCommandOptBool(cmd, "inactive"))
flags |= VIR_DOMAIN_XML_INACTIVE;
+ details = vshCommandOptBool(cmd, "details");
+
if (!vshConnectionUsability(ctl, ctl->conn))
return false;
@@ -1951,14 +1956,27 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
if (ndisks < 0)
goto cleanup;
- vshPrint(ctl, "%-10s %s\n", _("Target"), _("Source"));
+ if (details)
+ vshPrint(ctl, "%-10s %-10s %-10s %s\n", _("Type"),
+ _("Device"), _("Target"), _("Source"));
+ else
+ vshPrint(ctl, "%-10s %s\n", _("Target"), _("Source"));
+
vshPrint(ctl, "------------------------------------------------\n");
for (i = 0; i < ndisks; i++) {
+ char *type;
+ char *device;
char *target;
char *source;
ctxt->node = disks[i];
+
+ if (details) {
+ type = virXPathString("string(./@type)", ctxt);
+ device = virXPathString("string(./@device)", ctxt);
+ }
+
target = virXPathString("string(./target/@dev)", ctxt);
if (!target) {
vshError(ctl, "unable to query block list");
@@ -1968,7 +1986,15 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd)
"|./source/@dev"
"|./source/@dir"
"|./source/@name)", ctxt);
- vshPrint(ctl, "%-10s %s\n", target, source ? source : "-");
+ if (details) {
+ vshPrint(ctl, "%-10s %-10s %-10s %s\n", type, device,
+ target, source ? source : "-");
+ VIR_FREE(type);
+ VIR_FREE(device);
+ } else {
+ vshPrint(ctl, "%-10s %s\n", target, source ? source : "-");
+ }
+
VIR_FREE(target);
VIR_FREE(source);
}
diff --git a/tools/virsh.pod b/tools/virsh.pod
index d9ca46c..9fd786d 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -512,15 +512,16 @@ to a unique target name (<target dev='name'/>) or source file (<source
file='name'/>) for one of the disk devices attached to I<domain> (see
also B<domblklist> for listing these names).
-=item B<domblklist> I<domain> [I<--inactive>]
-
-Print a table showing the names of all block devices associated with
-I<domain>, as well as the path to the source of each device. If
-I<--inactive> is specified, query the block devices that will be used
-on the next boot, rather than those currently in use by a running
-domain. Other contexts that require a block device name (such as
-I<domblkinfo> or I<snapshot-create> for disk snapshots) will accept
-either target or unique source names printed by this command.
+=item B<domblklist> I<domain> [I<--inactive>] [I<--details>]
+
+Print a table showing the brief information of all block devices
+associated with I<domain>. If I<--inactive> is specified, query the
+block devices that will be used on the next boot, rather than those
+currently in use by a running domain. If I<--details> is specified,
+disk type and device value will be printed additionally. Other
+contexts that require a block device name (such as I<domblkinfo>
+or I<snapshot-create> for disk snapshots) will accept either target
+or unique source names printed by this command.
=item B<domiflist> I<domain> [I<--inactive>]
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH v2] qemu: Support copy on read for disk
by Osier Yang
The new introduced optional attribute "copy_on_read</code> controls
wether to copy read backing file into the image file. The value can
be either "on" or "off". Copy-on-read avoids accessing the same backing
file sectors repeatedly and is useful when the backing file is over a
slow network. By default copy-on-read is off.
---
docs/formatdomain.html.in | 9 ++++
docs/schemas/domaincommon.rng | 11 ++++
src/conf/domain_conf.c | 24 +++++++++-
src/conf/domain_conf.h | 10 ++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_capabilities.c | 3 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 11 ++++
tests/qemuhelptest.c | 3 +-
.../qemuxml2argv-disk-copy_on_read.args | 11 ++++
.../qemuxml2argv-disk-copy_on_read.xml | 50 ++++++++++++++++++++
tests/qemuxml2argvtest.c | 4 ++
12 files changed, 137 insertions(+), 2 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 42e23a1..3a42ebb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1202,6 +1202,15 @@
<b>In general you should leave this option alone, unless you
are very certain you know what you are doing.</b>
</li>
+ <li>
+ The optional <code>copy_on_read</code> attribute controls
+ wether to copy read backing file into the image file. The
+ value can be either "on" or "off".
+ Copy-on-read avoids accessing the same backing file sectors
+ repeatedly and is useful when the backing file is over a slow
+ network. By default copy-on-read is off.
+ <span class='since'>Since 0.9.9 (QEMU and KVM only)</span>
+ </li>
</ul>
</dd>
<dt><code>boot</code></dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e93ae77..fdcbc28 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -958,6 +958,9 @@
<optional>
<ref name="event_idx"/>
</optional>
+ <optional>
+ <ref name="copy_on_read"/>
+ </optional>
<empty/>
</element>
</define>
@@ -1025,6 +1028,14 @@
</choice>
</attribute>
</define>
+ <define name="copy_on_read">
+ <attribute name='copy_on_read'>
+ <choice>
+ <value>on</value>
+ <value>off</value>
+ </choice>
+ </attribute>
+ </define>
<define name="controller">
<element name="controller">
<choice>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 180dd2b..c70faee 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -209,6 +209,11 @@ VIR_ENUM_IMPL(virDomainVirtioEventIdx, VIR_DOMAIN_VIRTIO_EVENT_IDX_LAST,
"on",
"off")
+VIR_ENUM_IMPL(virDomainDiskCopyOnRead, VIR_DOMAIN_DISK_COPY_ON_READ_LAST,
+ "default",
+ "on",
+ "off")
+
VIR_ENUM_IMPL(virDomainDiskSnapshot, VIR_DOMAIN_DISK_SNAPSHOT_LAST,
"default",
"no",
@@ -2783,6 +2788,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
char *iotag = NULL;
char *ioeventfd = NULL;
char *event_idx = NULL;
+ char *copy_on_read = NULL;
char *devaddr = NULL;
virStorageEncryptionPtr encryption = NULL;
char *serial = NULL;
@@ -2911,6 +2917,7 @@ virDomainDiskDefParseXML(virCapsPtr caps,
iotag = virXMLPropString(cur, "io");
ioeventfd = virXMLPropString(cur, "ioeventfd");
event_idx = virXMLPropString(cur, "event_idx");
+ copy_on_read = virXMLPropString(cur, "copy_on_read");
} else if (xmlStrEqual(cur->name, BAD_CAST "auth")) {
authUsername = virXMLPropString(cur, "username");
if (authUsername == NULL) {
@@ -3226,6 +3233,17 @@ virDomainDiskDefParseXML(virCapsPtr caps,
def->event_idx = idx;
}
+ if (copy_on_read) {
+ int cor;
+ if ((cor = virDomainDiskCopyOnReadTypeFromString(copy_on_read)) <= 0) {
+ virDomainReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown disk copy_on_read mode '%s'"),
+ copy_on_read);
+ goto error;
+ }
+ def->copy_on_read = cor;
+ }
+
if (devaddr) {
if (virDomainParseLegacyDeviceAddress(devaddr,
&def->info.addr.pci) < 0) {
@@ -3319,6 +3337,7 @@ cleanup:
VIR_FREE(iotag);
VIR_FREE(ioeventfd);
VIR_FREE(event_idx);
+ VIR_FREE(copy_on_read);
VIR_FREE(devaddr);
VIR_FREE(serial);
virStorageEncryptionFree(encryption);
@@ -9870,6 +9889,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
const char *iomode = virDomainDiskIoTypeToString(def->iomode);
const char *ioeventfd = virDomainIoEventFdTypeToString(def->ioeventfd);
const char *event_idx = virDomainVirtioEventIdxTypeToString(def->event_idx);
+ const char *copy_on_read = virDomainVirtioEventIdxTypeToString(def->copy_on_read);
const char *startupPolicy = virDomainStartupPolicyTypeToString(def->startupPolicy);
char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -9910,7 +9930,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAddLit(buf, ">\n");
if (def->driverName || def->driverType || def->cachemode ||
- def->ioeventfd || def->event_idx) {
+ def->ioeventfd || def->event_idx || def->copy_on_read) {
virBufferAddLit(buf, " <driver");
if (def->driverName)
virBufferAsprintf(buf, " name='%s'", def->driverName);
@@ -9928,6 +9948,8 @@ virDomainDiskDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " ioeventfd='%s'", ioeventfd);
if (def->event_idx)
virBufferAsprintf(buf, " event_idx='%s'", event_idx);
+ if (def->copy_on_read)
+ virBufferAsprintf(buf, " copy_on_read='%s'", copy_on_read);
virBufferAddLit(buf, "/>\n");
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3d5d4f8..bac5a87 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -308,6 +308,14 @@ enum virDomainVirtioEventIdx {
VIR_DOMAIN_VIRTIO_EVENT_IDX_LAST
};
+enum virDomainDiskCopyOnRead {
+ VIR_DOMAIN_DISK_COPY_ON_READ_DEFAULT = 0,
+ VIR_DOMAIN_DISK_COPY_ON_READ_ON,
+ VIR_DOMAIN_DISK_COPY_ON_READ_OFF,
+
+ VIR_DOMAIN_DISK_COPY_ON_READ_LAST
+};
+
enum virDomainDiskSnapshot {
VIR_DOMAIN_DISK_SNAPSHOT_DEFAULT = 0,
VIR_DOMAIN_DISK_SNAPSHOT_NO,
@@ -384,6 +392,7 @@ struct _virDomainDiskDef {
int iomode;
int ioeventfd;
int event_idx;
+ int copy_on_read;
int snapshot; /* enum virDomainDiskSnapshot */
int startupPolicy; /* enum virDomainStartupPolicy */
unsigned int readonly : 1;
@@ -1969,6 +1978,7 @@ VIR_ENUM_DECL(virDomainDiskSecretType)
VIR_ENUM_DECL(virDomainDiskSnapshot)
VIR_ENUM_DECL(virDomainIoEventFd)
VIR_ENUM_DECL(virDomainVirtioEventIdx)
+VIR_ENUM_DECL(virDomainDiskCopyOnRead)
VIR_ENUM_DECL(virDomainController)
VIR_ENUM_DECL(virDomainControllerModelSCSI)
VIR_ENUM_DECL(virDomainControllerModelUSB)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ca4beb1..27a093c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -290,6 +290,8 @@ virDomainDeviceTypeToString;
virDomainDiskBusTypeToString;
virDomainDiskCacheTypeFromString;
virDomainDiskCacheTypeToString;
+virDomainDiskCopyOnReadTypeFromString;
+virDomainDiskCopyOnReadTypeToString;
virDomainDiskDefAssignAddress;
virDomainDiskDefForeachPath;
virDomainDiskDefFree;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6842cfe..530bbb1 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -147,6 +147,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
"virtio-blk-pci.scsi",
"blk-sg-io",
+ "drive-copy-on-read",
);
struct qemu_feature_flags {
@@ -1026,6 +1027,8 @@ qemuCapsComputeCmdFlags(const char *help,
qemuCapsSet(flags, QEMU_CAPS_DRIVE_READONLY);
if (strstr(help, "aio=threads|native"))
qemuCapsSet(flags, QEMU_CAPS_DRIVE_AIO);
+ if (strstr(help, "copy-on-read=on|off"))
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE_COPY_ON_READ);
}
if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
const char *nl = strstr(p, "\n");
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d47177c..ee9d5ab 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -120,6 +120,7 @@ enum qemuCapsFlags {
QEMU_CAPS_VIRTIO_BLK_SCSI = 80, /* virtio-blk-pci.scsi */
QEMU_CAPS_VIRTIO_BLK_SG_IO = 81, /* support for SG_IO commands, reportedly added in 0.11 */
+ QEMU_CAPS_DRIVE_COPY_ON_READ = 82, /* -drive copy-on-read */
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 16ffb4c..ee51965 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1929,6 +1929,17 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
virBufferAddLit(&opt, ",cache=off");
}
+ if (disk->copy_on_read) {
+ if (qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ)) {
+ virBufferAsprintf(&opt, ",copy-on-read=%s",
+ virDomainDiskCopyOnReadTypeToString(disk->copy_on_read));
+ } else {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("copy_on_read is not supported by this QEMU binary"));
+ goto error;
+ }
+ }
+
if (qemuCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
const char *wpolicy = NULL, *rpolicy = NULL;
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 1ef0d9b..2b08af9 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -592,7 +592,8 @@ mymain(void)
QEMU_CAPS_PCI_ROMBAR,
QEMU_CAPS_NO_ACPI,
QEMU_CAPS_VIRTIO_BLK_SCSI,
- QEMU_CAPS_VIRTIO_BLK_SG_IO);
+ QEMU_CAPS_VIRTIO_BLK_SG_IO,
+ QEMU_CAPS_DRIVE_COPY_ON_READ);
DO_TEST("qemu-1.0", 1000000, 0, 0,
QEMU_CAPS_VNC_COLON,
QEMU_CAPS_NO_REBOOT,
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.args
new file mode 100644
index 0000000..2ca586d
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.args
@@ -0,0 +1,11 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc-0.13 -m 1024 -smp 1 -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi \
+-boot dc -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x6 \
+-drive file=/var/lib/libvirt/images/f14.img,if=none,id=drive-virtio-disk0,copy-on-read=on \
+-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0 \
+-drive file=/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso,if=none,media=cdrom,id=drive-ide0-1-0 \
+-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
+-device virtio-net-pci,tx=bh,vlan=0,id=net0,mac=52:54:00:e5:48:58,bus=pci.0,addr=0x3 \
+-net user,vlan=0,name=hostnet0 -serial pty -usb -vnc 127.0.0.1:-809 -std-vga \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
new file mode 100644
index 0000000..433c641
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-copy_on_read.xml
@@ -0,0 +1,50 @@
+<domain type='qemu'>
+ <name>test</name>
+ <memory>1048576</memory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-0.13'>hvm</type>
+ <boot dev='cdrom'/>
+ <boot dev='hd'/>
+ <bootmenu enable='yes'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2' copy_on_read='on'/>
+ <source file='/var/lib/libvirt/images/f14.img'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ <address type='drive' controller='0' bus='1' unit='0'/>
+ </disk>
+ <interface type='user'>
+ <mac address='52:54:00:e5:48:58'/>
+ <model type='virtio'/>
+ <driver name='vhost' txmode='iothread'/>
+ </interface>
+ <controller type='virtio-serial' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </controller>
+ <serial type='pty'>
+ <target port='0'/>
+ </serial>
+ <console type='pty'>
+ <target type='serial' port='0'/>
+ </console>
+ <graphics type='vnc' port='5091' autoport='no' listen='127.0.0.1'/>
+ <video>
+ <model type='vga' vram='9216' heads='1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d87654c..30bea37 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -439,6 +439,10 @@ mymain(void)
QEMU_CAPS_DRIVE, QEMU_CAPS_VIRTIO_IOEVENTFD,
QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE,
QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
+ DO_TEST("disk-copy_on_read", false,
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_COPY_ON_READ,
+ QEMU_CAPS_VIRTIO_TX_ALG, QEMU_CAPS_DEVICE,
+ QEMU_CAPS_VIRTIO_BLK_SCSI, QEMU_CAPS_VIRTIO_BLK_SG_IO);
DO_TEST("disk-snapshot", false,
QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_CACHE_V2, QEMU_CAPS_DRIVE_FORMAT);
DO_TEST("event_idx", false,
--
1.7.7.3
12 years, 11 months
[libvirt] [PATCH] build: silence some compiler warnings from gnulib
by Eric Blake
Gnulib claims that there are some classes of warnings that are
worth enabling during development, but where silencing those
warnings causes code bloat that is not necessary in an optimized
build. The code bloat to silence the warnings is only enabled
by -Dlint. Follow the lead of coreutils in setting up -Dlint
whenever full warnings are requested.
* m4/virt-compile-warnings.m4 (LIBVIRT_COMPILE_WARNINGS): Add
-Dlint, and move _FORTIFY_SOURCE to config.h instead of CFLAGS.
---
In particular, see this gnulib thread, where Dan Berrange complained
about a warning present on a mingw cross-compile:
https://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00184.html
m4/virt-compile-warnings.m4 | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/m4/virt-compile-warnings.m4 b/m4/virt-compile-warnings.m4
index ba388aa..3a428c3 100644
--- a/m4/virt-compile-warnings.m4
+++ b/m4/virt-compile-warnings.m4
@@ -100,8 +100,13 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
gl_WARN_ADD([-Wframe-larger-than=4096])
dnl gl_WARN_ADD([-Wframe-larger-than=256])
+ # Silence certain warnings in gnulib, and use improved glibc headers
+ AC_DEFINE([lint], [1],
+ [Define to 1 if the compiler is checking for lint.])
+ AC_DEFINE([_FORTIFY_SOURCE], [2],
+ [enable compile-time and run-time bounds-checking, and some warnings])
+
# Extra special flags
- gl_WARN_ADD([-Wp,-D_FORTIFY_SOURCE=2])
dnl -fstack-protector stuff passes gl_WARN_ADD with gcc
dnl on Mingw32, but fails when actually used
case $host in
--
1.7.7.5
12 years, 11 months
[libvirt] [PATCH v2 1/1] Added check for maximum number of vcpus exceeding topology limit
by Martin Kletzander
Earlier, when the number of vcpus was greater than the topology allowed,
libvirt didn't raise an error and continued, resulting in running qemu
with parameters making no sense. Even though qemu did not report any
error itself, the number of vcpus was set to maximum allowed by the
topology.
---
v2:
- Added check for topology specification
src/conf/domain_conf.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 180dd2b..5e36270 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -8010,6 +8010,14 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
if (def->cpu == NULL)
goto error;
+ if (def->cpu->sockets &&
+ def->maxvcpus >
+ def->cpu->sockets * def->cpu->cores * def->cpu->threads) {
+ virDomainReportError(VIR_ERR_XML_DETAIL, "%s",
+ _("Maximum CPUs greater than topology limit"));
+ goto error;
+ }
+
if (def->cpu->cells_cpus > def->maxvcpus) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Number of CPUs in <numa> exceeds the"
--
1.7.3.4
12 years, 11 months
[libvirt] [PATCH] build: update to latest gnulib
by Eric Blake
Pick up recent gnulib improvements.
* .gnulib: Update to latest.
* bootstrap: Resync.
* bootstrap.conf (gnulib_tool_option_extras): Adjust to bootstrap
changes.
* gnulib/lib/Makefile.am: Likewise.
---
I'm not sure that we are desparate for any of these patches, so
much as it's nice to re-sync now that 0.9.9 is out.
* .gnulib 6b93d00...8bb68d3 (128):
> strptime: silence gcc warnings
> inet_ntop: silence gcc warning
> getloadavg test: skip the test on GNU/Linux without /proc mounted
> regex: Avoid link error on MSVC 9.
> doc: Mention --with-tests option.
> users.txt: order package names lexicographically.
> maint.mk: fix description in comment
> ignore-value: remove deprecated ignore_ptr function
> test-init.sh: avoid a subshell
> setlocale tests: Avoid test failure on Solaris 11 2011-11.
> posix_spawn_file_actions_addopen: Work around Solaris 11 2011-11 bug.
> posix_spawn_file_actions_adddup2: Work around Solaris 11 2011-11 bug.
> posix_spawn_file_actions_addclose: Work around Solaris 11 2011-11 bug.
> doc: Update for Solaris 11 2011-11.
> mktime: Avoid compilation error on Solaris 11.
> doc: Small fix.
> autoupdate
> Add lgpl-3.0 module.
> select.c: indent with spaces, not TABs
> autoupdate
> Add ChangeLog entries for last 3 commits.
> quotearg: do not use grave accent for left quote
> quotearg: fall back to Unicode single quotes in UTF-8 and GB-18030 locales
> quotearg: fix Wikipedia link
> Fix for mingw with MSVC9.
> Talk about "native Windows API", not "Woe32".
> argp: Avoid crash if translator uses % characters in a translation.
> doc: add ChangeLog entry for previous change
> doc: C11 and C++11 are now official
> uc-is-grapheme-break tests: Tweak.
> test-init.sh: correct the test for diff -u
> doc: fix minor quoting issues, mostly with `
> In commentary, do not use ` to quote.
> Use ', not `, for quoting output.
> strtoimax: Don't force a replacement on systems where intmax_t is int.
> doc: Mention NetBSD bugs.
> strtoumax tests: Enhance tests.
> strtoimax: Work around AIX 5.1 bug.
> inttypes: Modernize.
> init.sh: don't waste a subshell just to redirect stderr
> test-init.sh: avoid failure on HP-UX 11.00
> Tests for module 'strtoull'.
> Tests for module 'strtoll'.
> Tests for module 'strtoul'.
> Tests for module 'strtol'.
> update from texinfo
> autoupdate
> test-init.sh: accommodate Solaris 5.10's different diff -u output
> test-posixtm: don't assume signed integer wraparound
> Spell out "Windows 9x" and "Windows XP".
> test-vc-list-files-cvs.sh: remove obsolete comment
> autoupdate
> update from texinfo
> Talk about "native Windows API", not "Win32".
> isatty: Support for MSVC 9.
> maint.mk: remove temporary transition aid from over 1.5 years ago
> init.sh: do not try to accommodate compare arguments starting with "-"
> Enhance tests for module 'isatty'.
> New module 'isatty'.
> canonicalize: Tweak 2011-12-29 commit.
> gitlog-to-changelog: describe input syntax in --help output
> gitlog-to-changelog: fix typo in --help: show backslash before email @
> gitlog-to-changelog: don't malfunction when name contains %-directive
> gitlog-to-changelog: Copyright-paperwork-exempt: yes == (tiny change)
> test-framework-sh: init.sh: fix "make dist" failure
> autoupdate
> maint: update all copyright year number ranges
> version-etc: update copyright year reported by --version
> canonicalize: only stat() when required
> doc: cover st_ino issues once; add OpenVMS etc.
> same-inode: port to OpenVMS
> canonicalize: fix references to stat() and lstat()
> autoupdate
> gitlog-to-changelog: remove a little duplication
> canonicalize: add support for not resolving symlinks
> autoupdate
> update from texinfo
> gitlog-to-changelog: do not clump multi-paragraph entries
> update from texinfo
> announce-gen: fix `cmd' typo in diagnostic
> update from texinfo
> autoupdate
> test-framework-sh: distribute init.sh
> autoupdate
> maint: remove explicit Files: tests/init.sh; depend on test-framework-sh
> test-framework-sh: add minimal tests of init.sh's compare function
> test-framework-sh: new module
> init.sh: do not emit simulated diff output to stderr
> .gitignore: ignore gnulib.dvi and regex.info
> init.sh: correct previous change
> correct previous ChangeLog entry: s/set -x/set -e/
> init.sh: avoid unwarranted test failure when using "set -x"
> bootstrap: fix it to honor $ACLOCAL_FLAGS once again
> bootstrap: remove some now-unneeded code
> ftoastr: fix typo
> README-release: fix punctuation
> bootstrap: correct the recent buildreq change
> build: let bootstrap resort to wget for downloading .po files
> * m4/stdint.m4 (gl_STDINT_H): Finish up previous change.
> stdint: don't assume C++11 when compiling with g++
> alloca: protect comment from gnulib-tool
> ChangeLog: fix encoding typo
> localcharset: Use an absolute path in TESTS_ENVIRONMENT.
> strftime-tests: also test nanoseconds
> inttypes, stdint: add C++11 support
> Fix ChangeLog typo in previous commit.
> nonblocking tests: Fix test failure on Linux/MIPS.
> argmatch: don't hard-code `' when listing valid option arguments
> autoupdate
> autoupdate
> bootstrap: detect tools required by gnulib-tool
> sethostname: Port to Windows platforms.
> tests: Avoid spurious error message on platforms without mktemp program.
> sethostname: Fix documentation.
> gnulib-tool: Verify that the License field is present and non-empty.
> sethostname tests: Fix link error on mingw.
> sethostname tests: Fix compilation error on mingw.
> sethostname tests: Avoid a gcc warning.
> Tweak last commit.
> Add a test suite for the sethostname module.
> Tweak last commit.
> Integrate the sethostname module into unistd
> Tweak last commit.
> Add a new sethostname module
> Tweak last commit.
> Split the HOST_NAME_MAX detection into a separate m4 macro
> Fix module descriptions syntax.
> stdalign: port to Clang 3.0
.gnulib | 2 +-
bootstrap | 240 +++++++++++++++---------------------------------
bootstrap.conf | 3 +-
gnulib/lib/Makefile.am | 11 ++-
4 files changed, 89 insertions(+), 167 deletions(-)
diff --git a/.gnulib b/.gnulib
index 6b93d00..8bb68d3 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 6b93d00f5410ec183e3a70ebf8e418e3b1bb0191
+Subproject commit 8bb68d37569145a772000ce8db87397529f5b3cf
diff --git a/bootstrap b/bootstrap
index f76db9a..66da981 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,10 +1,10 @@
#! /bin/sh
# Print a version string.
-scriptversion=2011-08-11.17; # UTC
+scriptversion=2012-01-06.07; # UTC
# Bootstrap this package from checked-out sources.
-# Copyright (C) 2003-2011 Free Software Foundation, Inc.
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -38,10 +38,6 @@ export LC_ALL
local_gl_dir=gl
-# Temporary directory names.
-bt='._bootmp'
-bt_regex=`echo "$bt"| sed 's/\./[.]/g'`
-bt2=${bt}2
me=$0
usage() {
@@ -88,6 +84,9 @@ gnulib_modules=
# Any gnulib files needed that are not in modules.
gnulib_files=
+: ${AUTOPOINT=autopoint}
+: ${AUTORECONF=autoreconf}
+
# A function to be called to edit gnulib.mk right after it's created.
# Override it via your own definition in bootstrap.conf.
gnulib_mk_hook() { :; }
@@ -105,6 +104,11 @@ po_download_command_format=\
"rsync --delete --exclude '*.s1' -Lrtvz \
'translationproject.org::tp/latest/%s/' '%s'"
+# Fallback for downloading .po files (if rsync fails).
+po_download_command_format2=\
+"wget --mirror -nd -q -np -A.po -P '%s' \
+ http://translationproject.org/latest/%s/"
+
extract_package_name='
/^AC_INIT(/{
/.*,.*,.*, */{
@@ -312,8 +316,8 @@ insert_vc_ignore() {
pattern="$2"
case $vc_ignore_file in
*.gitignore)
- # A .gitignore entry that does not start with `/' applies
- # recursively to subdirectories, so prepend `/' to every
+ # A .gitignore entry that does not start with '/' applies
+ # recursively to subdirectories, so prepend '/' to every
# .gitignore entry.
pattern=`echo "$pattern" | sed s,^,/,`;;
esac
@@ -473,6 +477,32 @@ if test $use_libtool = 1; then
find_tool LIBTOOLIZE glibtoolize libtoolize
fi
+# gnulib-tool requires at least automake and autoconf.
+# If either is not listed, add it (with minimum version) as a prerequisite.
+case $buildreq in
+ *automake*) ;;
+ *) buildreq="automake 1.9
+$buildreq" ;;
+esac
+case $buildreq in
+ *autoconf*) ;;
+ *) buildreq="autoconf 2.59
+$buildreq" ;;
+esac
+
+# When we can deduce that gnulib-tool will require patch,
+# and when patch is not already listed as a prerequisite, add it, too.
+if test ! -d "$local_gl_dir" \
+ || find "$local_gl_dir" -name '*.diff' -exec false {} +; then
+ :
+else
+ case $buildreq in
+ *patch*) ;;
+ *) buildreq="patch -
+$buildreq" ;;
+ esac
+fi
+
if ! printf "$buildreq" | check_versions; then
echo >&2
if test -f README-prereq; then
@@ -583,6 +613,9 @@ download_po_files() {
domain=$2
echo "$me: getting translations into $subdir for $domain..."
cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
+ eval "$cmd" && return
+ # Fallback to HTTP.
+ cmd=`printf "$po_download_command_format2" "$subdir" "$domain"`
eval "$cmd"
}
@@ -703,56 +736,32 @@ symlink_to_dir()
}
}
-cp_mark_as_generated()
-{
- cp_src=$1
- cp_dst=$2
+# NOTE: we have to be careful to run both autopoint and libtoolize
+# before gnulib-tool, since gnulib-tool is likely to provide newer
+# versions of files "installed" by these two programs.
+# Then, *after* gnulib-tool (see below), we have to be careful to
+# run autoreconf in such a way that it does not run either of these
+# two just-pre-run programs.
- if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
- symlink_to_dir "$GNULIB_SRCDIR" "$cp_dst"
- elif cmp -s "$cp_src" "$local_gl_dir/$cp_dst"; then
- symlink_to_dir $local_gl_dir "$cp_dst"
- else
- case $cp_dst in
- *.[ch]) c1='/* '; c2=' */';;
- *.texi) c1='@c '; c2= ;;
- *.m4|*/Make*|Make*) c1='# ' ; c2= ;;
- *) c1= ; c2= ;;
- esac
+# Import from gettext.
+with_gettext=yes
+grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
+ with_gettext=no
- # If the destination directory doesn't exist, create it.
- # This is required at least for "lib/uniwidth/cjk.h".
- dst_dir=`dirname "$cp_dst"`
- test -d "$dst_dir" || mkdir -p "$dst_dir"
-
- if test -z "$c1"; then
- cmp -s "$cp_src" "$cp_dst" || {
- # Copy the file first to get proper permissions if it
- # doesn't already exist. Then overwrite the copy.
- echo "$me: cp -f $cp_src $cp_dst" &&
- rm -f "$cp_dst" &&
- cp "$cp_src" "$cp_dst-t" &&
- sed "s!$bt_regex/!!g" "$cp_src" > "$cp_dst-t" &&
- mv -f "$cp_dst-t" "$cp_dst"
- }
- else
- # Copy the file first to get proper permissions if it
- # doesn't already exist. Then overwrite the copy.
- cp "$cp_src" "$cp_dst-t" &&
- (
- echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
- echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
- sed "s!$bt_regex/!!g" "$cp_src"
- ) > $cp_dst-t &&
- if cmp -s "$cp_dst-t" "$cp_dst"; then
- rm -f "$cp_dst-t"
- else
- echo "$me: cp $cp_src $cp_dst # with edits" &&
- mv -f "$cp_dst-t" "$cp_dst"
- fi
- fi
- fi
-}
+if test $with_gettext = yes; then
+ # Released autopoint has the tendency to install macros that have been
+ # obsoleted in current gnulib, so run this before gnulib-tool.
+ echo "$0: $AUTOPOINT --force"
+ $AUTOPOINT --force || exit
+fi
+
+# Autoreconf runs aclocal before libtoolize, which causes spurious
+# warnings if the initial aclocal is confused by the libtoolized
+# (or worse out-of-date) macro directory.
+if grep '^[ ]*LT_INIT' configure.ac >/dev/null; then
+ echo "running: $LIBTOOLIZE --copy --install"
+ $LIBTOOLIZE --copy --install
+fi
version_controlled_file() {
dir=$1
@@ -771,83 +780,17 @@ version_controlled_file() {
test $found = yes
}
-slurp() {
- for dir in . `(cd $1 && find * -type d -print)`; do
- copied=
- sep=
- for file in `ls -a $1/$dir`; do
- case $file in
- .|..) continue;;
- # FIXME: should all file names starting with "." be ignored?
- .*) continue;;
- esac
- test -d $1/$dir/$file && continue
- for excluded_file in $excluded_files; do
- test "$dir/$file" = "$excluded_file" && continue 2
- done
- if test $file = Makefile.am && test "X$gnulib_mk" != XMakefile.am; then
- copied=$copied${sep}$gnulib_mk; sep=$nl
- remove_intl='/^[^#].*\/intl/s/^/#/;'"s!$bt_regex/!!g"
- sed "$remove_intl" $1/$dir/$file |
- cmp - $dir/$gnulib_mk > /dev/null || {
- echo "$me: Copying $1/$dir/$file to $dir/$gnulib_mk ..." &&
- rm -f $dir/$gnulib_mk &&
- sed "$remove_intl" $1/$dir/$file >$dir/$gnulib_mk &&
- gnulib_mk_hook $dir/$gnulib_mk
- }
- elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
- version_controlled_file $dir $file; then
- echo "$me: $dir/$file overrides $1/$dir/$file"
- else
- copied=$copied$sep$file; sep=$nl
- cp_mark_as_generated $1/$dir/$file $dir/$file
- fi || exit
- done
-
- for dot_ig in x $vc_ignore; do
- test $dot_ig = x && continue
- ig=$dir/$dot_ig
- if test -n "$copied"; then
- insert_vc_ignore $ig "$copied"
- # If an ignored file name ends with .in.h, then also add
- # the name with just ".h". Many gnulib headers are generated,
- # e.g., stdint.in.h -> stdint.h, dirent.in.h ->..., etc.
- # Likewise for .gperf -> .h, .y -> .c, and .sin -> .sed
- f=`echo "$copied" |
- sed '
- s/\.in\.h$/.h/
- s/\.sin$/.sed/
- s/\.y$/.c/
- s/\.gperf$/.h/
- '
- `
- insert_vc_ignore $ig "$f"
-
- # For files like sys_stat.in.h and sys_time.in.h, record as
- # ignorable the directory we might eventually create: sys/.
- f=`echo "$copied"|sed 's/sys_.*\.in\.h$/sys/'`
- insert_vc_ignore $ig "$f"
- fi
- done
- done
-}
-
-
-# Create boot temporary directories to import from gnulib and gettext.
-rm -fr $bt $bt2 &&
-mkdir $bt $bt2 || exit
-
# Import from gnulib.
gnulib_tool_options="\
--import\
--no-changelog\
- --aux-dir $bt/$build_aux\
- --doc-base $bt/$doc_base\
+ --aux-dir $build_aux\
+ --doc-base $doc_base\
--lib $gnulib_name\
- --m4-base $bt/$m4_base/\
- --source-base $bt/$source_base/\
- --tests-base $bt/$tests_base\
+ --m4-base $m4_base/\
+ --source-base $source_base/\
+ --tests-base $tests_base\
--local-dir $local_gl_dir\
$gnulib_tool_option_extras\
"
@@ -859,26 +802,11 @@ if test $use_libtool = 1; then
fi
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
-slurp $bt || exit
for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file || exit
done
-
-# Import from gettext.
-with_gettext=yes
-grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
- with_gettext=no
-
-if test $with_gettext = yes; then
- echo "$0: (cd $bt2; ${AUTOPOINT-autopoint}) ..."
- cp configure.ac $bt2 &&
- (cd $bt2 && ${AUTOPOINT-autopoint} && rm configure.ac) &&
- slurp $bt2 $bt || exit
-fi
-rm -fr $bt $bt2 || exit
-
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
# The following requires GNU find 4.2.3 or newer. Considering the usual
@@ -891,28 +819,12 @@ find "$m4_base" "$source_base" \
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
-type l -xtype l -delete > /dev/null 2>&1
-# Reconfigure, getting other files.
-
-# Skip autoheader if it's not needed.
-grep -E '^[ ]*AC_CONFIG_HEADERS?\>' configure.ac >/dev/null ||
- AUTOHEADER=true
-
-for command in \
- libtool \
- "${ACLOCAL-aclocal} --force -I '$m4_base' $ACLOCAL_FLAGS" \
- "${AUTOCONF-autoconf} --force" \
- "${AUTOHEADER-autoheader} --force" \
- "${AUTOMAKE-automake} --add-missing --copy --force-missing"
-do
- if test "$command" = libtool; then
- test $use_libtool = 0 \
- && continue
- command="${LIBTOOLIZE-libtoolize} -c -f"
- fi
- echo "$0: $command ..."
- eval "$command" || exit
-done
-
+# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
+echo "running: AUTOPOINT=true LIBTOOLIZE=true " \
+ "$AUTORECONF --verbose --install --no-recursive -I $m4_base $ACLOCAL_FLAGS"
+AUTOPOINT=true LIBTOOLIZE=true \
+ $AUTORECONF --verbose --install --no-recursive -I $m4_base $ACLOCAL_FLAGS \
+ || exit 1
# Get some extra files from gnulib, overriding existing files.
for file in $gnulib_extra_files; do
diff --git a/bootstrap.conf b/bootstrap.conf
index c352718..04c7645 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -1,6 +1,6 @@
# Bootstrap configuration.
-# Copyright (C) 2010-2011 Red Hat, Inc.
+# Copyright (C) 2010-2012 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -171,6 +171,7 @@ tests_base=gnulib/tests
gnulib_tool_option_extras="\
--lgpl=2\
--with-tests\
+ --makefile-name=gnulib.mk\
--avoid=pt_chown\
"
local_gl_dir=gnulib/local
diff --git a/gnulib/lib/Makefile.am b/gnulib/lib/Makefile.am
index 3445c6d..7ec8648 100644
--- a/gnulib/lib/Makefile.am
+++ b/gnulib/lib/Makefile.am
@@ -1,8 +1,17 @@
## Makefile for gnulib/lib -*-Makefile-*-
-## Copyright (C) 2011 Red Hat, Inc.
+## Copyright (C) 2011-2012 Red Hat, Inc.
## See COPYING.LIB for the License of this software
+# Initialize variables, so gnulib.mk can append to them
+BUILT_SOURCES =
+CLEANFILES =
+EXTRA_DIST =
+MOSTLYCLEANDIRS =
+MOSTLYCLEANFILES =
+SUFFIXES =
+noinst_LTLIBRARIES =
+
include gnulib.mk
INCLUDES = $(GETTEXT_CPPFLAGS)
--
1.7.7.5
12 years, 11 months
[libvirt] ANNOUNCE: Release of libvirt-sandbox version 0.0.2
by Daniel P. Berrange
I pleased to announce the first public release of libvirt-sandbox,
version 0.0.2 is now available for download
ftp://libvirt.org/libvirt/sandbox/
The packages are GPG signed with
Key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF (4096R)
The libvirt-sandbox package provides an API layer on top of libvirt-gobject
which facilitates the cration of application sandboxes using virtualization
technology. An application sandbox is a virtual machine or container that
runs a single application binary, directly from the host OS filesystem.
In other words there is no separate guest operating system install to build
or manager.
At this point in time libvirt-sandbox can create sandboxes using either LXC
or KVM, and should in theory be extendable to any libvirt driver. The first
release is able to run simple command line based programs. While there is
some GUI support, this is mostly unreliable / non-functional at this point
in time, future releases will address this properly.
Some examples
$ virt-sandbox -c qemu:///session /bin/date
Thu Jan 12 22:30:03 GMT 2012
$ virt-sandbox -c qemu:///session /bin/cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 2
model name : QEMU Virtual CPU version 1.0
stepping : 3
cpu MHz : 2793.084
cache size : 4096 KB
fpu : yes
fpu_exception : yes
cpuid level : 4
wp : yes
flags : fpu de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pse36 clflush mmx fxsr sse sse2 syscall nx lm up rep_good nopl pni cx16 hypervisor lahf_lm
bogomips : 5586.16
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:
$ ./bin/virt-sandbox -c lxc:/// /bin/sh
sh-4.2$ ps -axuwf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 165436 3756 pts/0 Ss+ 22:31 0:00 libvirt-sandbox-init-lxc
berrange 24 0.0 0.1 167680 4688 pts/0 S+ 22:31 0:00 libvirt-sandbox-init-common
berrange 47 0.0 0.0 13852 1608 pts/1 Ss 22:31 0:00 \_ /bin/sh
berrange 48 0.0 0.0 13124 996 pts/1 R+ 22:31 0:00 \_ ps -axuwf
Watch this space, there is much more interesting functionality in this
space that will be arriving soon...
Feedback / patches / etc should be directed to the main libvirt
development mailing list.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
12 years, 11 months