[libvirt] ANNOUNCE: libvirt 1.1.3.5 maintenance release
by Cole Robinson
libvirt 1.1.3.5 maintenance release is now available. This is
libvirt 1.1.3 with additional bugfixes that have accumulated
upstream since the initial release.
This release can be downloaded at:
http://libvirt.org/sources/stable_updates/libvirt-1.1.3.5.tar.gz
Changes in this version:
* qemu: Introduce qemuDomainDefCheckABIStability
* interface: dump inactive xml when interface isn't active
* interface: Introduce netcfInterfaceObjIsActive
* Ignore additional fields in iscsiadm output
* qemu: fix crash when removing <filterref> from interface with update-
device
* Only set QEMU_CAPS_NO_HPET on x86
* Fix journald PRIORITY values
* qemu: make sure agent returns error when required data are missing
* qemu: remove unneeded forward declaration
* qemu: cleanup error checking on agent replies
* Ignore char devices in storage pools by default
* Ignore missing files on pool refresh
* storage: reduce number of stat calls
* Fix explicit usage of default video PCI slots
* virNetClientSetTLSSession: Restore original signal mask
* storage: use valid XML for awkward volume names
* maint: fix comma style issues: conf
* virNetServerRun: Notify systemd that we're accepting clients
* libvirt-guests: Wait for libvirtd to initialize
* virSystemdCreateMachine: Set dependencies for slices
* Add Documentation fields to systemd service files
* Add a mutex to serialize updates to firewall
* virt-login-shell: also build virAtomic.h
* Fix conflicting types of virInitctlSetRunLevel
For info about past maintenance releases, see:
http://wiki.libvirt.org/page/Maintenance_Releases
Thanks,
Cole
10 years, 6 months
[libvirt] [PATCH 1/3] tests: Don't crash when creating the config object fails
by Guido Günther
As observed when building in a chroot and QEMU_USER doesn't exist
---
tests/qemuargv2xmltest.c | 3 +++
tests/qemuxml2argvtest.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 6d7e23e..4cc3749 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -128,6 +128,9 @@ mymain(void)
int ret = 0;
driver.config = virQEMUDriverConfigNew(false);
+ if (driver.config == NULL)
+ return EXIT_FAILURE;
+
if ((driver.caps = testQemuCapsInit()) == NULL)
return EXIT_FAILURE;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 56854dc..13ed4f6 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -501,6 +501,9 @@ mymain(void)
}
driver.config = virQEMUDriverConfigNew(true);
+ if (driver.config == NULL)
+ return EXIT_FAILURE;
+
VIR_FREE(driver.config->spiceListen);
VIR_FREE(driver.config->vncListen);
--
1.9.1
10 years, 6 months
[libvirt] [PATCH] Explicitly link virfirewalltest and virsystemdtest against dbus
by Guido Günther
This fixes link failures like:
CCLD virfirewalltest
/usr/bin/ld: virfirewalltest-virfirewalltest.o: undefined reference to
symbol 'dbus_message_iter_init_append'
---
tests/Makefile.am | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7ffb44e..5ef8940 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -963,7 +963,7 @@ virmockdbus_la_LDFLAGS = -module -avoid-version \
virsystemdtest_SOURCES = \
virsystemdtest.c testutils.h testutils.c
virsystemdtest_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
-virsystemdtest_LDADD = $(LDADDS)
+virsystemdtest_LDADD = $(LDADDS) $(DBUS_LIBS)
else ! WITH_DBUS
EXTRA_DIST += virdbustest.c virmockdbus.c virsystemdtest.c
@@ -1047,7 +1047,7 @@ virfiletest_LDADD = $(LDADDS)
virfirewalltest_SOURCES = \
virfirewalltest.c testutils.h testutils.c
-virfirewalltest_LDADD = $(LDADDS)
+virfirewalltest_LDADD = $(LDADDS) $(DBUS_LIBS)
virfirewalltest_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
jsontest_SOURCES = \
--
1.9.2
10 years, 6 months
[libvirt] CPU type/flags when converting a physical machine to run on libvirt
by Richard W.M. Jones
I'm in the process of rewriting virt-p2v which is our program for
converting physical machines to become virtual machines, running on
top of libvirt + KVM.
The physical machine has certain characteristics -- eg:
- number of physical cores
- amount of RAM
- CPU type (eg. AMD Opteron, Intel Core i7)
- CPU flags (eg. ACPI, SSE4)
which it might make sense to reflect in the libvirt XML of the virtual
machine we create.
The old version of virt-p2v is pretty simplistic about this. It
generates *only* an i386 or x86-64 VM, and the only flags it considers
are 'apic', 'acpi', 'pae' and 'lm' [the latter to distinguish between
32 and 64 bit x86].
What should the new version do?
Particular questions:
- Should we try to reflect the CPU type of the physical machine in
the virtual machine? eg. If it's an Opteron, we generate an
Opteron target machine. (I believe the answer is *no*, because
this is not live migration, and most guests can boot on any
compatible CPU).
- How can I ask libvirt to give me the best possible CPU, and not
some baseline? Normally I use host-model, but I think that
prevents migration.
- What CPU flags should be reflected in the target libvirt XML?
- Is it worth modelling CPU thread layout? (I suspect this will be a
lot of work with the potential to break things rather than provide
any measurable benefits.)
- Is there anything else I haven't thought about?
However the overriding rule is:
- We *must not* end up with a target virtual machine which doesn't work!
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
10 years, 6 months
[libvirt] Reg : failing to attach iscsi disk from virsh to running VM on xen
by Prapulla Kumar
Hi ,
For attaching iSCSI disk I have tried like this
*iscsi target side :*
* 1 created an iqn number*
#tgtadm --lld iscsi --op new --mode target --tid 1 -T
iqn.2009-06.com.eucalyptus.cluster1:store1
* 2. added one lun to it*
#tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1
-b /fs.iscsi.disk
* 3.To enable the target to accept any initiators, enter:*
#tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
* 4.To view the current configuration, enter:*
#tgtadm --lld iscsi --op show --mode target
*iscsi initaitor side (where libvirt and xen is running)*
* 1. to** scan for the newly created target*
* #*iscsiadm -m discovery -t sendtargets -p 192.168.53.14
* 2. created pool file *
<pool type="iscsi">
<name>sample3</name>
<source>
<host name="192.168.53.14"/>
<device
path="iqn.2009-06.com.eucalyptus.cluster1:store1"/>
</source>
<target>
<path>/dev/disk/by-path</path>
</target>
</pool>
* 3.*#virsh pool-define sample_pool.xml
#virsh pool-start sample3
then it created one link like this at */dev/disk/by-path/*
*ip-192.168.53.14:3260-iscsi-iqn.2009-06.com.eucalyptus.cluster1:store1-lun-1
-> ../../sdb*
4. I have attached using virsh attach-disk
#virsh attach-disk 1 /dev/sdb xvdb
It is attached successfully , I console in vm I have checked .
But while using with eucalyptus,It is not attching.
I'm using eucalyptus 3.4.2 , libvirt 1.2.3 with xen4.3.1 to attach volume
to vm .
eucalyptus attaching volume is done through iscsi disk , intermediate files
are created while attaching volume in xml format as below.
*File 1:*
<?xml version="1.0" encoding="UTF-8"?>
<disk type="block">
<driver cache="none" name="phy"/>
<source
dev="/dev/disk/by-id/scsi-1IET_00230001"/>
<target dev="sdf" bus="scsi"/>
<serial>vol-759A3CDB-dev-sdf</serial>
</disk>
*File 2:*
<?xml version="1.0" encoding="UTF-8"?>
<volume>
<hypervisor type="xen" capability="xen+hw"
bitness="64"/>
<id>vol-759A3CDB</id>
<user>AIDOMCCNSP7YNR7IEZEUX</user>
<instancePath>/usr/local/eucalyptus/work/AIDOMCCNSP7YNR7IEZEUX/i-ED153F84</instancePath>
<os platform="linux" virtioRoot="false"
virtioDisk="false" virtioNetwork="false"/>
<backing>
<root type="image"/>
</backing>
<diskPath targetDeviceType="disk"
targetDeviceName="sdf" targetDeviceBus="scsi" sourceType="block"
serial="vol-759A3CDB-dev-sdf">/dev/disk/by-id/scsi-1IET_00230001</diskPath>
</volume>
*in libvirtd.log i'm getting*
*error : libxlDomainAttachDeviceDiskLive:2567 : unsupported configuration:
disk bus 'scsi' cannot be hotplugged.*
Can u suggest how to enable or patch to scsi hotplug from libvirt which
support for xen.
Can u say the meaning of PATCH 11/12 what is 11/12 means.
eg ; [libvirt] [PATCH 11/12] Properly support SCSI drive hotplug
With Regards
Prapulla Kumar R
10 years, 6 months
[libvirt] qemu: managedsave vs. save
by Richard Weinberger
Hi!
My KVM hosts share the same filesystem and I'm facing an issue using
managedsave.
If I save vmX using managedsave on hostA and restore it later using
"virsh restore" in hostB
the qemu process consumes 100% CPU and makes no progress.
On the other hand, if I save vmX using save the restore works fine on hostB.
Why can't I restore vms saved by managedsave using restore?
Or is this a known issue on libvirt-0.10.X (CentOS 6)?
--
Thanks,
//richard
10 years, 6 months
[libvirt] [PATCHv2] storageVolCreateXMLFrom: Allow multiple accesses to origvol
by Michal Privoznik
When creating a new volume, it is possible to copy data into it from
another already existing volume (referred to as @origvol). Obviously,
the read-only access to @origvol is required, which is thread safe
(probably not performance-wise though). However, with current code
both @newvol and @origvol are marked as building for the time of
copying data from the @origvol to @newvol. The rationale behind
is to disallow some operations on both @origvol and @newvol, e.g.
vol-wipe, vol-delete, vol-download. While it makes sense to not allow
such operations on partly copied mirror, but it doesn't make sense to
disallow the operations on the source (@origvol).
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Diff to v1:
-introduced a counter in addition to not marking origvol as building
src/conf/storage_conf.h | 1 +
src/storage/storage_driver.c | 14 +++++++-------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 9ad38e1..eae959c 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -64,6 +64,7 @@ struct _virStorageVolDef {
int type; /* enum virStorageVolType */
unsigned int building;
+ unsigned int in_use;
virStorageVolSource source;
virStorageSource target;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 2cb8347..a953dfd 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1640,7 +1640,7 @@ storageVolDelete(virStorageVolPtr obj,
if (virStorageVolDeleteEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
- if (vol->building) {
+ if (vol->building || vol->in_use) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
vol->name);
@@ -1912,8 +1912,8 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
/* Drop the pool lock during volume allocation */
pool->asyncjobs++;
- origvol->building = 1;
newvol->building = 1;
+ origvol->in_use++;
virStoragePoolObjUnlock(pool);
if (origpool) {
@@ -1929,7 +1929,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
virStoragePoolObjLock(origpool);
storageDriverUnlock(driver);
- origvol->building = 0;
+ origvol->in_use--;
newvol->building = 0;
allocation = newvol->target.allocation;
pool->asyncjobs--;
@@ -2010,7 +2010,7 @@ storageVolDownload(virStorageVolPtr obj,
if (virStorageVolDownloadEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
- if (vol->building) {
+ if (vol->building || vol->in_use) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
vol->name);
@@ -2076,7 +2076,7 @@ storageVolUpload(virStorageVolPtr obj,
if (virStorageVolUploadEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
- if (vol->building) {
+ if (vol->building || vol->in_use) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
vol->name);
@@ -2167,7 +2167,7 @@ storageVolResize(virStorageVolPtr obj,
if (virStorageVolResizeEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
- if (vol->building) {
+ if (vol->building || vol->in_use) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
vol->name);
@@ -2474,7 +2474,7 @@ storageVolWipePattern(virStorageVolPtr obj,
if (virStorageVolWipePatternEnsureACL(obj->conn, pool->def, vol) < 0)
goto cleanup;
- if (vol->building) {
+ if (vol->building || vol->in_use) {
virReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
vol->name);
--
1.9.0
10 years, 6 months
[libvirt] [PATCH] tests: skip virfirewalltest on non-Linux systems
by Roman Bogorodskiy
Currently firewalling is supported on Linux only, so skip the
virfirewalltest on other platforms.
---
tests/virfirewalltest.c | 58 +++++++++++++++++++++++++++++--------------------
1 file changed, 35 insertions(+), 23 deletions(-)
diff --git a/tests/virfirewalltest.c b/tests/virfirewalltest.c
index 805fa44..af74d57 100644
--- a/tests/virfirewalltest.c
+++ b/tests/virfirewalltest.c
@@ -24,23 +24,26 @@
#define __VIR_COMMAND_PRIV_H_ALLOW__
#include "testutils.h"
-#include "virbuffer.h"
-#include "vircommandpriv.h"
-#include "virfirewallpriv.h"
-#include "virmock.h"
-#include "virdbuspriv.h"
-#define VIR_FROM_THIS VIR_FROM_FIREWALL
+#if defined(__linux__)
-#if WITH_DBUS
-# include <dbus/dbus.h>
-#endif
+# include "virbuffer.h"
+# include "vircommandpriv.h"
+# include "virfirewallpriv.h"
+# include "virmock.h"
+# include "virdbuspriv.h"
+
+# define VIR_FROM_THIS VIR_FROM_FIREWALL
+
+# if WITH_DBUS
+# include <dbus/dbus.h>
+# endif
static bool fwDisabled = true;
static virBufferPtr fwBuf;
static bool fwError;
-#define TEST_FILTER_TABLE_LIST \
+# define TEST_FILTER_TABLE_LIST \
"Chain INPUT (policy ACCEPT)\n" \
"target prot opt source destination\n" \
"\n" \
@@ -50,7 +53,7 @@ static bool fwError;
"Chain OUTPUT (policy ACCEPT)\n" \
"target prot opt source destination\n"
-#define TEST_NAT_TABLE_LIST \
+# define TEST_NAT_TABLE_LIST \
"Chain PREROUTING (policy ACCEPT)\n" \
"target prot opt source destination\n" \
"\n" \
@@ -63,7 +66,7 @@ static bool fwError;
"Chain POSTROUTING (policy ACCEPT)\n" \
"target prot opt source destination\n"
-#if WITH_DBUS
+# if WITH_DBUS
VIR_MOCK_IMPL_RET_ARGS(dbus_connection_send_with_reply_and_block,
DBusMessage *,
DBusConnection *, connection,
@@ -186,7 +189,7 @@ VIR_MOCK_IMPL_RET_ARGS(dbus_connection_send_with_reply_and_block,
goto cleanup;
}
-#endif
+# endif
struct testFirewallData {
virFirewallBackend tryBackend;
@@ -1126,7 +1129,7 @@ mymain(void)
{
int ret = 0;
-#define RUN_TEST_DIRECT(name, method) \
+# define RUN_TEST_DIRECT(name, method) \
do { \
struct testFirewallData data; \
data.tryBackend = VIR_FIREWALL_BACKEND_AUTOMATIC; \
@@ -1141,8 +1144,8 @@ mymain(void)
ret = -1; \
} while (0)
-#if WITH_DBUS
-# define RUN_TEST_FIREWALLD(name, method) \
+# if WITH_DBUS
+# define RUN_TEST_FIREWALLD(name, method) \
do { \
struct testFirewallData data; \
data.tryBackend = VIR_FIREWALL_BACKEND_AUTOMATIC; \
@@ -1157,13 +1160,13 @@ mymain(void)
ret = -1; \
} while (0)
-# define RUN_TEST(name, method) \
+# define RUN_TEST(name, method) \
RUN_TEST_DIRECT(name, method); \
RUN_TEST_FIREWALLD(name, method)
-#else /* ! WITH_DBUS */
-# define RUN_TEST(name, method) \
+# else /* ! WITH_DBUS */
+# define RUN_TEST(name, method) \
RUN_TEST_DIRECT(name, method)
-#endif /* ! WITH_DBUS */
+# endif /* ! WITH_DBUS */
RUN_TEST("single group", testFirewallSingleGroup);
RUN_TEST("remove rule", testFirewallRemoveRule);
@@ -1179,8 +1182,17 @@ mymain(void)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-#if WITH_DBUS
+# if WITH_DBUS
VIRT_TEST_MAIN_PRELOAD(mymain, abs_builddir "/.libs/virmockdbus.so")
-#else
+# else
VIRT_TEST_MAIN(mymain)
-#endif
+# endif
+
+#else /* ! defined (__linux__) */
+
+int main(void)
+{
+ return EXIT_AM_SKIP;
+}
+
+#endif /* ! defined(__linux__) */
--
1.9.0
10 years, 6 months
[libvirt] [PATCH] Restore skipping of setting capacity
by John Ferlan
Commit id 'ac9a0963' refactored out the 'withCapacity' for the
virStorageBackendUpdateVolInfo() API. See:
http://www.redhat.com/archives/libvir-list/2014-April/msg00043.html
This resulted in a difference in how 'virsh vol-info --pool <poolName>
<volume>' or 'virsh vol-list vol-list --pool <poolName> --details' outputs
the capacity information for a directory pool with a qcow2 sparse file.
For example, using the following XML
mkdir /home/TestPool
cat testpool.xml
<pool type='dir'>
<name>TestPool</name>
<uuid>6bf80895-10b6-75a6-6059-89fdea2aefb7</uuid>
<source>
</source>
<target>
<path>/home/TestPool</path>
<permissions>
<mode>0755</mode>
<owner>0</owner>
<group>0</group>
</permissions>
</target>
</pool>
virsh pool-create testpool.xml
virsh vol-create-as --pool TestPool temp_vol_1 \
--capacity 1048576 --allocation 1048576 --format qcow2
virsh vol-info --pool TestPool temp_vol_1
Results in listing a Capacity value. Prior to the commit, the value would
be '1.0 MiB' (1048576 bytes). However, after the commit the output would be
(for example) '192.50 KiB', which for my system was the size of the volume
in my file system (eg 'ls -l TestPool/temp_vol_1' results in '197120' bytes
or 192.50 KiB). While perhaps technically correct, it's not necessarily
what the user expected (certainly virt-test didn't expect it).
This patch restores the code to not update the target capacity for this path
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/storage/storage_backend.c | 22 +++++++++++++++-------
src/storage/storage_backend.h | 5 ++++-
src/storage/storage_backend_disk.c | 2 +-
src/storage/storage_backend_fs.c | 11 +++++++----
src/storage/storage_backend_gluster.c | 2 +-
src/storage/storage_backend_logical.c | 2 +-
src/storage/storage_backend_mpath.c | 2 +-
src/storage/storage_backend_scsi.c | 2 +-
8 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 946196b..afedbf5 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1403,6 +1403,7 @@ virStorageBackendVolOpen(const char *path, struct stat *sb,
int
virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target,
+ bool updateCapacity,
bool withBlockVolFormat,
unsigned int openflags)
{
@@ -1413,7 +1414,8 @@ virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target,
goto cleanup;
fd = ret;
- if ((ret = virStorageBackendUpdateVolTargetInfoFD(target, fd, &sb)) < 0)
+ if ((ret = virStorageBackendUpdateVolTargetInfoFD(target, fd, &sb,
+ updateCapacity)) < 0)
goto cleanup;
if (withBlockVolFormat) {
@@ -1429,18 +1431,21 @@ virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target,
int
virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
+ bool updateCapacity,
bool withBlockVolFormat,
unsigned int openflags)
{
int ret;
if ((ret = virStorageBackendUpdateVolTargetInfo(&vol->target,
+ updateCapacity,
withBlockVolFormat,
openflags)) < 0)
return ret;
if (vol->backingStore.path &&
(ret = virStorageBackendUpdateVolTargetInfo(&vol->backingStore,
+ updateCapacity,
withBlockVolFormat,
VIR_STORAGE_VOL_OPEN_DEFAULT)) < 0)
return ret;
@@ -1453,15 +1458,15 @@ virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
* @target: target definition ptr of volume to update
* @fd: fd of storage volume to update, via virStorageBackendOpenVol*, or -1
* @sb: details about file (must match @fd, if that is provided)
- * @allocation: If not NULL, updated allocation information will be stored
- * @capacity: If not NULL, updated capacity info will be stored
+ * @updateCapacity: If true, updated capacity info will be stored
*
* Returns 0 for success, -1 on a legitimate error condition.
*/
int
virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target,
int fd,
- struct stat *sb)
+ struct stat *sb,
+ bool updateCapacity)
{
#if WITH_SELINUX
security_context_t filecon = NULL;
@@ -1477,10 +1482,12 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target,
/* Regular files may be sparse, so logical size (capacity) is not same
* as actual allocation above
*/
- target->capacity = sb->st_size;
+ if (updateCapacity)
+ target->capacity = sb->st_size;
} else if (S_ISDIR(sb->st_mode)) {
target->allocation = 0;
- target->capacity = 0;
+ if (updateCapacity)
+ target->capacity = 0;
} else if (fd >= 0) {
off_t end;
/* XXX this is POSIX compliant, but doesn't work for CHAR files,
@@ -1496,7 +1503,8 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target,
return -1;
}
target->allocation = end;
- target->capacity = end;
+ if (updateCapacity)
+ target->capacity = end;
}
if (!target->perms && VIR_ALLOC(target->perms) < 0)
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index 5997077..456b9d7 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -137,14 +137,17 @@ int virStorageBackendVolOpen(const char *path, struct stat *sb,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
+ bool updateCapacity,
bool withBlockVolFormat,
unsigned int openflags);
int virStorageBackendUpdateVolTargetInfo(virStorageSourcePtr target,
+ bool updateCapacity,
bool withBlockVolFormat,
unsigned int openflags);
int virStorageBackendUpdateVolTargetInfoFD(virStorageSourcePtr target,
int fd,
- struct stat *sb);
+ struct stat *sb,
+ bool updateCapacity);
char *virStorageBackendStablePath(virStoragePoolObjPtr pool,
const char *devpath,
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 9cebcca..13336fc 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -113,7 +113,7 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
}
/* Refresh allocation/capacity/perms */
- if (virStorageBackendUpdateVolInfo(vol, false,
+ if (virStorageBackendUpdateVolInfo(vol, true, false,
VIR_STORAGE_VOL_OPEN_DEFAULT) < 0)
return -1;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 3694c26..5a2add8 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -84,7 +84,8 @@ virStorageBackendProbeTarget(virStorageSourcePtr target,
goto error; /* Take care to propagate ret, it is not always -1 */
fd = ret;
- if ((ret = virStorageBackendUpdateVolTargetInfoFD(target, fd, &sb)) < 0) {
+ if ((ret = virStorageBackendUpdateVolTargetInfoFD(target, fd,
+ &sb, true)) < 0) {
goto error;
}
@@ -913,7 +914,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
vol->backingStore.format = backingStoreFormat;
ignore_value(virStorageBackendUpdateVolTargetInfo(
- &vol->backingStore, false,
+ &vol->backingStore, true, false,
VIR_STORAGE_VOL_OPEN_DEFAULT));
/* If this failed, the backing file is currently unavailable,
* the capacity, allocation, owner, group and mode are unknown.
@@ -1190,8 +1191,10 @@ virStorageBackendFileSystemVolRefresh(virConnectPtr conn,
{
int ret;
- /* Refresh allocation / permissions info in case its changed */
- ret = virStorageBackendUpdateVolInfo(vol, false,
+ /* Refresh allocation / permissions info in case its changed
+ * don't update the capacity value for this pass
+ */
+ ret = virStorageBackendUpdateVolInfo(vol, false, false,
VIR_STORAGE_VOL_FS_OPEN_FLAGS);
if (ret < 0)
return ret;
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index e0a25df..28db909 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -267,7 +267,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlusterStatePtr state,
if (VIR_ALLOC(vol) < 0)
goto cleanup;
- if (virStorageBackendUpdateVolTargetInfoFD(&vol->target, -1, st) < 0)
+ if (virStorageBackendUpdateVolTargetInfoFD(&vol->target, -1, st, true) < 0)
goto cleanup;
if (virStorageBackendGlusterSetMetadata(state, vol, name) < 0)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index ed3a012..a597e67 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -149,7 +149,7 @@ virStorageBackendLogicalMakeVol(char **const groups,
if (!vol->key && VIR_STRDUP(vol->key, groups[2]) < 0)
goto cleanup;
- if (virStorageBackendUpdateVolInfo(vol, false,
+ if (virStorageBackendUpdateVolInfo(vol, true, false,
VIR_STORAGE_VOL_OPEN_DEFAULT) < 0)
goto cleanup;
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index f0ed189..8c3b0df 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -60,7 +60,7 @@ virStorageBackendMpathNewVol(virStoragePoolObjPtr pool,
if (virAsprintf(&vol->target.path, "/dev/%s", dev) < 0)
goto cleanup;
- if (virStorageBackendUpdateVolInfo(vol, true,
+ if (virStorageBackendUpdateVolInfo(vol, true, true,
VIR_STORAGE_VOL_OPEN_DEFAULT) < 0) {
goto cleanup;
}
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index c448d7f..71bcf56 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -199,7 +199,7 @@ virStorageBackendSCSINewLun(virStoragePoolObjPtr pool,
goto free_vol;
}
- if (virStorageBackendUpdateVolInfo(vol, true,
+ if (virStorageBackendUpdateVolInfo(vol, true, true,
VIR_STORAGE_VOL_OPEN_DEFAULT) < 0) {
retval = -1;
goto free_vol;
--
1.9.0
10 years, 6 months
[libvirt] [PATCHv2 0/3] fix virstoragetest failure on 32-bit
by Eric Blake
v1 was here, but it got nacked for being ugly:
https://www.redhat.com/archives/libvir-list/2014-April/msg01132.html
so in this version, I improved virstring first, then used the
new clean function.
This is a build-breaker fix, so it deserves to be in 1.2.4;
but it is large enough that it needs a review to go in.
Eric Blake (3):
util: fix uint parsing on 64-bit platforms
util: new stricter unsigned int parsing
storage: reject negative indices
src/libvirt_private.syms | 3 +
src/util/virstoragefile.c | 2 +-
src/util/virstring.c | 98 +++++++++++++++++++++--
src/util/virstring.h | 14 +++-
tests/virstringtest.c | 200 +++++++++++++++++++++++++++++++++++++++++++++-
5 files changed, 307 insertions(+), 10 deletions(-)
--
1.9.0
10 years, 6 months