[libvirt] [PATCH] docs: Fix disk "volume" description
by John Ferlan
Missing a close single quote and a 'be' before used.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Pushed as trivial.
docs/formatdomain.html.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 7b29e78..58b8cb6 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2158,9 +2158,9 @@
Using a LUN from an iSCSI source pool provides the same
features as a <code>disk</code> configured using
- <code>type</code> 'block' or 'network and <code>device</code>
+ <code>type</code> 'block' or 'network' and <code>device</code>
of 'lun' with respect to how the LUN is presented to and
- may used by the guest.
+ may be used by the guest.
<span class="since">Since 1.0.5</span>
</p>
--
2.5.5
8 years, 6 months
[libvirt] [PATCH] qemu: Add extra checks for secret destroy API's
by John Ferlan
Remove the possibility that a NULL hostdev->privateData or a
disk->privateData could crash libvirtd by checking for NULL
before dereferencing for the secinfo structure in the
qemuDomainSecret{Disk|Hostdev}Destroy functions. The hostdevPriv
could be NULL if qemuProcessNetworkPrepareDevices adds a new
hostdev during virDomainNetGetActualHostdev that then gets
inserted via virDomainHostdevInsert. The hostdevPriv was added
by commit id '27726d8' and is currently only used by scsi hostdev.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Discovered by laine and debugged on private IRC channel.
src/qemu/qemu_domain.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 93f0a01..0cddb86 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -903,7 +903,7 @@ qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
{
qemuDomainDiskPrivatePtr diskPriv = QEMU_DOMAIN_DISK_PRIVATE(disk);
- if (!diskPriv->secinfo)
+ if (!diskPriv || !diskPriv->secinfo)
return;
qemuDomainSecretInfoFree(&diskPriv->secinfo);
@@ -964,7 +964,7 @@ qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr hostdev)
qemuDomainHostdevPrivatePtr hostdevPriv =
QEMU_DOMAIN_HOSTDEV_PRIVATE(hostdev);
- if (!hostdevPriv->secinfo)
+ if (!hostdevPriv || !hostdevPriv->secinfo)
return;
qemuDomainSecretInfoFree(&hostdevPriv->secinfo);
--
2.5.5
8 years, 6 months
[libvirt] [PATCH] util: set vlan tag for macvtap passthrough mode on SRIOV VFs
by Laine Stump
SRIOV VFs used in macvtap passthrough mode can take advantage of the
SRIOV card's transparent vlan tagging. All the code was there to set
the vlan tag, and it has been used for SRIOV VFs used for hostdev
interfaces for several years, but for some reason, the vlan tag for
macvtap passthrough devices was stubbed out with a -1.
This patch moves a bit of common validation down to a lower level
(virNetDevReplaceNetConfig()) so it is shared by hostdev and macvtap
modes, and updates the macvtap caller to actually send the vlan config
instead of -1.
---
While adding the info to the docs, I got a bit carried away fixing up
the vlan-specific paragraphs. It someone really wants me to I can move
it into a separate patch, but it seemed like more trouble than it was
worth at the time...
docs/formatdomain.html.in | 61 +++++++++++++++++++++++++++------------------
src/lxc/lxc_process.c | 3 ++-
src/network/bridge_driver.c | 17 ++++++++-----
src/qemu/qemu_interface.c | 1 +
src/util/virhostdev.c | 23 ++---------------
src/util/virnetdev.c | 29 +++++++++++++++++----
src/util/virnetdev.h | 6 +++--
src/util/virnetdevmacvlan.c | 4 ++-
src/util/virnetdevmacvlan.h | 2 ++
9 files changed, 86 insertions(+), 60 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 97794b7..68f0295 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4032,7 +4032,7 @@
<p>
On Linux systems, the bridge device is normally a standard Linux
host bridge. On hosts that support Open vSwitch, it is also
- possible to connect to an open vSwitch bridge device by adding
+ possible to connect to an Open vSwitch bridge device by adding
a <code><virtualport type='openvswitch'/></code> to the
interface definition. (<span class="since">Since
0.9.11</span>). The Open vSwitch type virtualport accepts two
@@ -4816,34 +4816,47 @@ qemu-kvm -net nic,model=? /dev/null
<p>
If (and only if) the network connection used by the guest
- supports vlan tagging transparent to the guest, an
+ supports VLAN tagging transparent to the guest, an
optional <code><vlan></code> element can specify one or
- more vlan tags to apply to the guest's network
- traffic <span class="since">Since 0.10.0</span>. (openvswitch
- and type='hostdev' SR-IOV interfaces do support transparent vlan
- tagging of guest traffic; everything else, including standard
+ more VLAN tags to apply to the guest's network
+ traffic <span class="since">Since 0.10.0</span>. Network
+ connections that support guest-transparent VLAN tagging include
+ 1) type='bridge' interfaces connected to an Open vSwitch bridge
+ <span class="since">Since 0.10.0</span>, 2) SRIOV Virtual
+ Functions (VF) used via type='hostdev' (direct device
+ assignment) <span class="since">Since 0.10.0</span>, and 3)
+ SRIOV VFs used via type='direct' with mode='passthrough'
+ (macvtap "passthru" mode) <span class="since">Since
+ 1.3.4</span>; all other connection types, including standard
linux bridges and libvirt's own virtual networks, <b>do not</b>
support it. 802.1Qbh (vn-link) and 802.1Qbg (VEPA) switches
provide their own way (outside of libvirt) to tag guest traffic
- onto specific vlans.) To allow for specification of multiple
- tags (in the case of vlan trunking), a
- subelement, <code><tag></code>, specifies which vlan tag
- to use (for example: <code><tag id='42'/></code>. If an
- interface has more than one <code><vlan></code> element
- defined, it is assumed that the user wants to do VLAN trunking
- using all the specified tags. In the case that vlan trunking
- with a single tag is desired, the optional
+ onto specific vlans.) Each tag is given in a
+ separate <code><tag></code> subelement
+ of <code><vlan></code> (for example: <code><tag
+ id='42'/></code>). For VLAN trunking of multiple tags (which
+ is supported only on Open vSwitch connections),
+ multiple <code><tag></code> subelements can be specified,
+ which implies that the user wants to do VLAN trunking on the
+ interface for all the specified tags. In the case that VLAN
+ trunking of a single tag is desired, the optional
attribute <code>trunk='yes'</code> can be added to the toplevel
- vlan element.
- </p>
-
- <p>
- For network connections using openvswitch it is possible to
- configure the 'native-tagged' and 'native-untagged' vlan modes
- <span class="since">Since 1.1.0.</span> This uses the optional
- <code>nativeMode</code> attribute on the <code><tag></code>
- element: <code>nativeMode</code> may be set to 'tagged' or
- 'untagged'. The id attribute of the element sets the native vlan.
+ <code><vlan></code> element to differentiate trunking of a
+ single tag from normal tagging.
+ </p>
+
+ <p>
+ For network connections using Open vSwitch it is also possible
+ to configure 'native-tagged' and 'native-untagged' VLAN modes
+ <span class="since">Since 1.1.0.</span> This is done with the
+ optional <code>nativeMode</code> attribute on
+ the <code><tag></code> subelement: <code>nativeMode</code>
+ may be set to 'tagged' or 'untagged'. The <code>id</code>
+ attribute of the <code><tag></code> subelement
+ containing <code>nativeMode</code> sets which VLAN is considered
+ to be the "native" VLAN for this interface, and
+ the <code>nativeMode</code> attribute determines whether or not
+ traffic for that VLAN will be tagged.
</p>
<h5><a name="elementLink">Modifying virtual link state</a></h5>
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 0044ee5..8981d9a 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2015 Red Hat, Inc.
+ * Copyright (C) 2010-2016 Red Hat, Inc.
* Copyright IBM Corp. 2008
*
* lxc_process.c: LXC process lifecycle management
@@ -343,6 +343,7 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
net->ifname, &net->mac,
linkdev,
virDomainNetGetActualDirectMode(net),
+ virDomainNetGetActualVlan(net),
def->uuid,
prof,
&res_ifname,
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index a34da2a..7a2cadb 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3058,11 +3058,12 @@ networkValidate(virNetworkDriverStatePtr driver,
* a pool, and those using an Open vSwitch bridge.
*/
- vlanAllowed = ((def->forward.type == VIR_NETWORK_FORWARD_BRIDGE &&
+ vlanAllowed = (def->forward.type == VIR_NETWORK_FORWARD_HOSTDEV ||
+ def->forward.type == VIR_NETWORK_FORWARD_PASSTHROUGH ||
+ (def->forward.type == VIR_NETWORK_FORWARD_BRIDGE &&
def->virtPortProfile &&
def->virtPortProfile->virtPortType
- == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) ||
- def->forward.type == VIR_NETWORK_FORWARD_HOSTDEV);
+ == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH));
vlanUsed = def->vlan.nTags > 0;
for (i = 0; i < def->nPortGroups; i++) {
@@ -4277,11 +4278,15 @@ networkAllocateActualDevice(virDomainDefPtr dom,
*/
if (virDomainNetGetActualVlan(iface)) {
- /* vlan configuration via libvirt is only supported for
- * PCI Passthrough SR-IOV devices and openvswitch bridges.
- * otherwise log an error and fail
+ /* vlan configuration via libvirt is only supported for PCI
+ * Passthrough SR-IOV devices (hostdev or macvtap passthru
+ * mode) and openvswitch bridges. Otherwise log an error and
+ * fail
*/
if (!(actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV ||
+ (actualType == VIR_DOMAIN_NET_TYPE_DIRECT &&
+ virDomainNetGetActualDirectMode(iface)
+ == VIR_NETDEV_MACVLAN_MODE_PASSTHRU) ||
(actualType == VIR_DOMAIN_NET_TYPE_BRIDGE &&
virtport && virtport->virtPortType
== VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH))) {
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index ef789fa..b48ae50 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -266,6 +266,7 @@ qemuInterfaceDirectConnect(virDomainDefPtr def,
&net->mac,
virDomainNetGetActualDirectDev(net),
virDomainNetGetActualDirectMode(net),
+ virDomainNetGetActualVlan(net),
def->uuid,
virDomainNetGetActualVirtPortProfile(net),
&res_ifname,
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 933c942..980e590 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -1,6 +1,6 @@
/* virhostdev.c: hostdev management
*
- * Copyright (C) 2006-2007, 2009-2015 Red Hat, Inc.
+ * Copyright (C) 2006-2007, 2009-2016 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
* Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
*
@@ -387,7 +387,6 @@ virHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
virNetDevVPortProfilePtr virtPort;
int ret = -1;
int vf = -1;
- int vlanid = -1;
bool port_profile_associate = true;
if (virHostdevIsVirtualFunction(hostdev) != 1) {
@@ -416,27 +415,9 @@ virHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev,
port_profile_associate);
} else {
/* Set only mac and vlan */
- if (vlan) {
- if (vlan->nTags != 1 || vlan->trunk) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("vlan trunking is not supported "
- "by SR-IOV network devices"));
- goto cleanup;
- }
- if (vf == -1) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("vlan can only be set for SR-IOV VFs, but "
- "%s is not a VF"), linkdev);
- goto cleanup;
- }
- vlanid = vlan->tag[0];
- } else if (vf >= 0) {
- vlanid = 0; /* assure any current vlan tag is reset */
- }
-
ret = virNetDevReplaceNetConfig(linkdev, vf,
&hostdev->parent.data.net->mac,
- vlanid, stateDir);
+ vlan, stateDir);
}
cleanup:
VIR_FREE(linkdev);
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index bb17b84..7db4497 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2015 Red Hat, Inc.
+ * Copyright (C) 2007-2016 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
@@ -2547,7 +2547,8 @@ virNetDevRestoreVfConfig(const char *pflinkdev,
*/
int
virNetDevReplaceNetConfig(const char *linkdev, int vf,
- const virMacAddr *macaddress, int vlanid,
+ const virMacAddr *macaddress,
+ virNetDevVlanPtr vlan,
const char *stateDir)
{
int ret = -1;
@@ -2566,11 +2567,29 @@ virNetDevReplaceNetConfig(const char *linkdev, int vf,
linkdev = pfdevname;
}
- if (vf == -1)
+ if (vf == -1) {
+ if (vlan) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("vlan can only be set for SR-IOV VFs, but "
+ "%s is not a VF"), linkdev);
+ goto cleanup;
+ }
ret = virNetDevReplaceMacAddress(linkdev, macaddress, stateDir);
- else
+ } else {
+ int vlanid = 0; /* assure any current vlan tag is reset */
+
+ if (vlan) {
+ if (vlan->nTags != 1 || vlan->trunk) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("vlan trunking is not supported "
+ "by SR-IOV network devices"));
+ goto cleanup;
+ }
+ vlanid = vlan->tag[0];
+ }
ret = virNetDevReplaceVfConfig(linkdev, vf, macaddress, vlanid,
stateDir);
+ }
cleanup:
VIR_FREE(pfdevname);
@@ -2636,7 +2655,7 @@ int
virNetDevReplaceNetConfig(const char *linkdev ATTRIBUTE_UNUSED,
int vf ATTRIBUTE_UNUSED,
const virMacAddr *macaddress ATTRIBUTE_UNUSED,
- int vlanid ATTRIBUTE_UNUSED,
+ virNetDevVlanPtr vlan ATTRIBUTE_UNUSED,
const char *stateDir ATTRIBUTE_UNUSED)
{
virReportSystemError(ENOSYS, "%s",
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index dcc81a6..cbe7938 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2015 Red Hat, Inc.
+ * Copyright (C) 2007-2016 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
@@ -30,6 +30,7 @@
# include "virnetlink.h"
# include "virmacaddr.h"
# include "virpci.h"
+# include "virnetdevvlan.h"
# include "device_conf.h"
# ifdef HAVE_STRUCT_IFREQ
@@ -175,7 +176,8 @@ int virNetDevLinkDump(const char *ifname, int ifindex,
ATTRIBUTE_RETURN_CHECK;
int virNetDevReplaceNetConfig(const char *linkdev, int vf,
- const virMacAddr *macaddress, int vlanid,
+ const virMacAddr *macaddress,
+ virNetDevVlanPtr vlan,
const char *stateDir)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(5);
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index d755b93..c05c67f 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -975,6 +975,7 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested,
const virMacAddr *macaddress,
const char *linkdev,
virNetDevMacVLanMode mode,
+ virNetDevVlanPtr vlan,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
char **ifnameResult,
@@ -1021,7 +1022,7 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested,
if (virNetDevReplaceMacAddress(linkdev, macaddress, stateDir) < 0)
return -1;
} else {
- if (virNetDevReplaceNetConfig(linkdev, -1, macaddress, -1, stateDir) < 0)
+ if (virNetDevReplaceNetConfig(linkdev, -1, macaddress, vlan, stateDir) < 0)
return -1;
}
}
@@ -1281,6 +1282,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname ATTRIBUTE_UNUSED,
const virMacAddr *macaddress ATTRIBUTE_UNUSED,
const char *linkdev ATTRIBUTE_UNUSED,
virNetDevMacVLanMode mode ATTRIBUTE_UNUSED,
+ virNetDevVlanPtr vlan ATTRIBUTE_UNUSED,
const unsigned char *vmuuid ATTRIBUTE_UNUSED,
virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED,
char **res_ifname ATTRIBUTE_UNUSED,
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index 560593e..179a8a1 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -28,6 +28,7 @@
# include "virsocketaddr.h"
# include "virnetdevbandwidth.h"
# include "virnetdevvportprofile.h"
+# include "virnetdevvlan.h"
/* the mode type for macvtap devices */
typedef enum {
@@ -69,6 +70,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
const virMacAddr *macaddress,
const char *linkdev,
virNetDevMacVLanMode mode,
+ virNetDevVlanPtr vlan,
const unsigned char *vmuuid,
virNetDevVPortProfilePtr virtPortProfile,
char **res_ifname,
--
2.5.5
8 years, 6 months
[libvirt] [PATCH 0/8] disk device="lun" related fixes
by Peter Krempa
Fix a few invalid error messages, remove code that would make certain configs
vanish and reject block copy to a regular file.
Peter Krempa (8):
util: Replace virDomainDiskSourceIsBlockType with a new helper
lxc: Fix wrong error message on disk hotplug
qemu: Support <disk device='lun'> for iSCSI direct mapped volumes
qemu: command: Use more appropriate checking function for block
devices
conf: Kill now unused virDomainDiskSourceIsBlockType
qemu: command: Remove unnecessary label in qemuCheckDiskConfig
qemu: Reject invalid block copy targets for <disk device='lun'>
Revert "conf: Validate disk lun using correct types"
src/conf/domain_conf.c | 74 -----------------------------------------------
src/conf/domain_conf.h | 3 --
src/libvirt_private.syms | 2 +-
src/lxc/lxc_cgroup.c | 3 +-
src/lxc/lxc_driver.c | 9 ++++--
src/qemu/qemu_command.c | 29 +++++++------------
src/qemu/qemu_conf.c | 10 +++++--
src/qemu/qemu_domain.c | 31 ++++++++++++++++++++
src/qemu/qemu_domain.h | 3 ++
src/qemu/qemu_driver.c | 4 +++
src/util/virstoragefile.c | 16 +++++++++-
src/util/virstoragefile.h | 3 +-
tests/qemuxml2argvtest.c | 3 +-
13 files changed, 82 insertions(+), 108 deletions(-)
--
2.8.1
8 years, 6 months
[libvirt] [PATCH 0/7] Introduce APIs to get/set client processing controls
by Erik Skultety
- APIs enable retrieval of values for maximum number of clients allowed to be
connected, maximum number of clients allowed to wait for authentication, as
well as current (dynamic) values for both cases; expectedly, setter only allows
to set the limits available through libvirtd.conf
- until patch "makefile: Move include/Makefile.am to
include/libvirt/Makefile.am" is reviewed an pushed, config.status must be run
after after 1/7 for a successful build.
Erik Skultety (7):
libvirt-host: Move virTypedParam* to libvirt-common
admin: Enable usage of typed parameters
virnetserver: Introduce client processing controls getters
admin: Introduce some public constants related to client processing
controls
admin: Introduce virAdmServerGetClientProcessingControls
admin: Introduce virAdmServerSetClientProcessingControls
virt-admin: Introduce commands srv-clients-info and srv-clients-set
cfg.mk | 2 +-
daemon/admin.c | 85 ++++++++++++++++
daemon/admin_server.c | 77 +++++++++++++++
daemon/admin_server.h | 10 ++
include/libvirt/libvirt-admin.h | 52 ++++++++++
include/libvirt/libvirt-common.h.in | 185 +++++++++++++++++++++++++++++++++++
include/libvirt/libvirt-host.h | 186 ------------------------------------
src/admin/admin_protocol.x | 54 ++++++++++-
src/admin/admin_remote.c | 81 ++++++++++++++++
src/admin_protocol-structs | 45 +++++++++
src/libvirt-admin.c | 89 +++++++++++++++++
src/libvirt_admin_private.syms | 3 +
src/libvirt_admin_public.syms | 2 +
src/rpc/virnetserver.c | 82 ++++++++++++++++
src/rpc/virnetserver.h | 9 ++
tools/virt-admin.c | 182 +++++++++++++++++++++++++++++++++++
16 files changed, 956 insertions(+), 188 deletions(-)
--
2.4.11
8 years, 6 months
[libvirt] [PATCH 0/2] Some trivial admin fixes
by Erik Skultety
Flags checking should be done solely on the daemon side and therefore such
checks need to be removed from public APIs.
Erik Skultety (2):
admin: Remove flags checking from public API entry points
admin: Remove flags checking from virAdmConnectOpen public API
src/admin/admin_remote.c | 2 +-
src/libvirt-admin.c | 9 ++-------
2 files changed, 3 insertions(+), 8 deletions(-)
--
2.4.11
8 years, 6 months
[libvirt] [PATCH] storage: Fix regression cloning volume into a logical pool
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1318993
Commit id 'dd519a294' caused a regression cloning a volume into a
logical pool by removing just the 'allocation' adjustment during
storageVolCreateXMLFrom. Combined with the change to not require the
new volume input XML to have a capacity listed (commit id 'e3f1d2a8')
left the possibility that a copy from a larger volume into a smaller
volume would create a thin/sparse logical volume. If a thin lv becomes
fully populated, then LVM will set the partition 'inactive' and the
subsequent fdatasync() would fail.
In order to fix this in a backend agnostic manner, only adjust the
new capacity if not provided. Likewise, if the new allocation is not
provided, then use the capacity value as we document that if omitted,
the volume will be fully allocated at time of creation.
For a logical backend, that creation time is 'createVol', while for a
file backend, creation doesn't set the size, but the 'createRaw' called
during buildVolFrom will decide whether the file is sparse or not based
on the provided capacity and allocation value.
For volume clones that provide different allocation and capacity values
to allow for sparse files, there is no change.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
NOTE: Related bz's to previous changes:
https://bugzilla.redhat.com/show_bug.cgi?id=1130739
https://bugzilla.redhat.com/show_bug.cgi?id=1298065
I have tested using 'virsh vol-clone' and 'virt-clone' with and without
this patch applied. Both tests have the same results for the 'qemu-img info'
on the cloned file.
src/storage/storage_driver.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index fcc0991..4415a4c 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2034,11 +2034,22 @@ storageVolCreateXMLFrom(virStoragePoolPtr obj,
goto cleanup;
}
- /* Use the original volume's capacity in case the new capacity
- * is less than that, or it was omitted */
- if (newvol->target.capacity < origvol->target.capacity)
+ /* Use the original volume's capacity if the new capacity was omitted.
+ * If the provided newvol capacity is less than original, we cannot just
+ * use the original since the subsequent createVol has "competing needs"
+ * for backends. A logical volume backend could then create a thin lv
+ * that has different characteristics when copying from the original
+ * volume than perhaps a raw disk file. */
+ if (newvol->target.capacity == 0)
newvol->target.capacity = origvol->target.capacity;
+ /* If the new allocation is 0, then use capacity as it's specifically
+ * documented "If omitted when creating a volume, the volume will be
+ * fully allocated at time of creation.". This is especially important
+ * for logical volume creation. */
+ if (newvol->target.allocation == 0)
+ newvol->target.allocation = newvol->target.capacity;
+
if (!backend->buildVolFrom) {
virReportError(VIR_ERR_NO_SUPPORT,
"%s", _("storage pool does not support"
--
2.5.5
8 years, 6 months
[libvirt] [PATCH 0/4] some graphics cleanups and improvements
by Pavel Hrdina
Pavel Hrdina (4):
qemu_process: separate graphics port reservation
graphics: generate fake ports also for tests
qemu_process: merge graphics code into qemuProcessSetupGraphics
qemu_hotplug: fix checking graphics ports
src/qemu/qemu_driver.c | 12 ---
src/qemu/qemu_hotplug.c | 13 ++--
src/qemu/qemu_process.c | 86 +++++++++++-----------
src/qemu/qemu_process.h | 8 --
.../qemuhotplug-graphics-spice-listen-network.xml | 2 +-
.../qemuxml2argv-controller-order.args | 2 +-
.../qemuxml2argv-hugepages-numa.args | 2 +-
.../qemuxml2argv-video-device-pciaddr-default.args | 2 +-
8 files changed, 51 insertions(+), 76 deletions(-)
--
2.8.2
8 years, 6 months