[libvirt] [PATCH] Fix the incorrect memory freeing which will result in crash
by Wu Zongyong
The number of elements in new_params is equal to the length of info,
instead of nparams, so it's wrong to free new_params using nparams.
Signed-off-by: Wu Zongyong <wuzongyo(a)mail.ustc.edu.cn>
---
libvirt-override.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libvirt-override.c b/libvirt-override.c
index db14244..dac4250 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -632,7 +632,7 @@ libvirt_virDomainSetSchedulerParametersFlags(PyObject *self ATTRIBUTE_UNUSED,
int nparams = 0;
Py_ssize_t size = 0;
unsigned int flags;
- virTypedParameterPtr params, new_params = NULL;
+ virTypedParameterPtr params = NULL, new_params = NULL;
if (!PyArg_ParseTuple(args,
(char *)"OOI:virDomainSetScedulerParametersFlags",
@@ -694,7 +694,7 @@ libvirt_virDomainSetSchedulerParametersFlags(PyObject *self ATTRIBUTE_UNUSED,
cleanup:
virTypedParamsFree(params, nparams);
- virTypedParamsFree(new_params, nparams);
+ virTypedParamsFree(new_params, size);
return ret;
}
@@ -7682,7 +7682,7 @@ libvirt_virNodeSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
int nparams = 0;
Py_ssize_t size = 0;
unsigned int flags;
- virTypedParameterPtr params, new_params = NULL;
+ virTypedParameterPtr params = NULL, new_params = NULL;
if (!PyArg_ParseTuple(args,
(char *)"OOI:virNodeSetMemoryParameters",
@@ -7741,7 +7741,7 @@ libvirt_virNodeSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
cleanup:
virTypedParamsFree(params, nparams);
- virTypedParamsFree(new_params, nparams);
+ virTypedParamsFree(new_params, size);
return ret;
}
--
2.10.0.windows.1
7 years, 11 months
[libvirt] Entering freeze for libvirt-3.0.0
by Daniel Veillard
As planned, I tagged the RC1 in git and pushed signed tarball and rpms
to the usual location:
ftp://libvirt.org/libvirt/
This seems to work fine in my limited testing but as usual we need
community feedback on it and especially testing on different systems and
architectures, so please give it a try !
If everything works fine then I will push rc2 on Friday and hopefully
3.0.0 final on Monday,
so please give it a try to make sure that 0.0 release is nonetheless
a good one :-)
thanks !
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
7 years, 11 months
[libvirt] TSC frequency configuration & invtsc migration (was Re: [PATCH 4/4] kvm: Allow migration with invtsc)
by Eduardo Habkost
On Wed, Jan 04, 2017 at 11:39:16AM -0200, Eduardo Habkost wrote:
> On Wed, Jan 04, 2017 at 09:56:56AM -0200, Marcelo Tosatti wrote:
> > On Tue, Dec 27, 2016 at 05:21:20PM -0200, Eduardo Habkost wrote:
> > > Instead of blocking migration on the source when invtsc is
> > > enabled, rely on the migration destination to ensure there's no
> > > TSC frequency mismatch.
> > >
> > > We can't allow migration unconditionally because we don't know if
> > > the destination is a QEMU version that is really going to ensure
> > > there's no TSC frequency mismatch. To ensure we are migrating to
> > > a destination that won't ignore SET_TSC_KHZ errors, allow invtsc
> > > migration only on pc-*-2.9 and newer.
> > >
> > > Signed-off-by: Eduardo Habkost <ehabkost(a)redhat.com>
[...]
> > > @@ -2655,12 +2656,14 @@ int kvm_arch_put_registers(CPUState *cpu, int level)
> > > }
> > >
> > > if (level == KVM_PUT_FULL_STATE) {
> > > - /* We don't check for kvm_arch_set_tsc_khz() errors here,
> > > - * because TSC frequency mismatch shouldn't abort migration,
> > > - * unless the user explicitly asked for a more strict TSC
> > > - * setting (e.g. using an explicit "tsc-freq" option).
> > > + /* Migration TSC frequency mismatch is fatal only if we are
> > > + * actually reporting Invariant TSC to the guest.
> > > */
> > > - kvm_arch_set_tsc_khz(cpu);
> > > + ret = kvm_arch_set_tsc_khz(cpu);
> > > + if ((x86_cpu->env.features[FEAT_8000_0007_EDX] & CPUID_APM_INVTSC) &&
> > > + ret < 0) {
> > > + return ret;
> > > + }
> > > }
> >
> > Will the guest continue in the source in this case?
> >
> > I think this is past the point where migration has been declared
> > successful.
> >
> > Otherwise looks good.
>
> Good point. I will make additional tests and see if there's some
> other place where the kvm_arch_set_tsc_khz() call can be moved
> to.
So, if we solve this and do something on (for example) post_load,
we still have a problem: device state is migrated after RAM. This
means QEMU will check for TSC scaling and abort migration very
late.
We could solve that by manually registering a SaveVMHandler that
will send the TSC frequency on save_live_setup, so migration is
aborted earlier.
But: this sounds like just a complex hack to work around the real
problems:
1) TSC frequency is guest-visible, and anything that affects
guest ABI should depend on the VM configuration, not on host
capabilities;
2) Setting TSC frequency depending on the host will make
migratability unpredictable for management software: the same
VM config could be migratable to host A when started on host
B, but not migratable to host A when started on host C.
I suggest we allow migration with invtsc if and only if
tsc-frequency is set explicitly by management software. In other
words, apply only patches 1/4 and 2/4 from this series. After
that, we will need libvirt support for configuring tsc-frequency.
--
Eduardo
7 years, 11 months
[libvirt] [PATCH v3 0/2] Allow migration with invtsc if TSC frequency is explicitly set
by Eduardo Habkost
This series makes QEMU accept migration if tsc-frequency is
explicitly set on configuration. As management software is
required to keep device configuration the same on migration
source or destination, explicit tsc-frequency will ensure that
either:
* The destination host has a matching TSC frequency; or
* The destination host has TSC scaling available.
Changelog
=========
v2 -> v3:
* Fix build failure ((missing closing braces)
v1 -> v2:
* v1 series subject was:
* [PATCH 0/4] Allow migration with invtsc if there's no
frequency mismatch
* Removed patches 3/4 and 4/4, that allowed migration
if no explicit tsc-frequency was set. Implementing the check on
post_load or post_init is not enough to make migration abort,
so we will need a more complex solution to implement that
feature.
Plans for future work
=====================
1) Querying host TSC frequency/scaling capability
-------------------------------------------------
I plan to include TSC frequency/scaling information on
query-cpu-model-expansion model="host" in a future series. Then
management software will be able to automatically configure TSC
frequency when invtsc is enabled, instead of requiring the user
to configure it explicitly. While we don't implement that, invtsc
migration will be possible only if the user configures TSC
frequency manually.
2) invtsc migration with no explicit TSC frequency
--------------------------------------------------
A future series can implement migration when TSC frequency is not
specified explicitly. It will be a bit more complex because it
requires either letting the destination abort the migration, or
sending TSC frequency/scaling information from destination to
source.
---
Cc: Marcelo Tosatti <mtosatti(a)redhat.com>
Cc: "Daniel P. Berrange" <berrange(a)redhat.com>
Cc: Paolo Bonzini <pbonzini(a)redhat.com>
Cc: kvm(a)vger.kernel.org
Cc: Haozhong Zhang <haozhong.zhang(a)intel.com>
Cc: "Michael S. Tsirkin" <mst(a)redhat.com>
Cc: Igor Mammedov <imammedo(a)redhat.com>
Cc: libvir-list(a)redhat.com
Cc: Jiri Denemark <jdenemar(a)redhat.com>
Eduardo Habkost (2):
kvm: Simplify invtsc check
kvm: Allow invtsc migration if tsc-khz is set explicitly
target/i386/kvm.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
--
2.11.0.259.g40922b1
7 years, 11 months
[libvirt] [PATCH] Post-release version bump to 3.1.0
by Michal Privoznik
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under trivial rule.
configure.ac | 2 +-
docs/news.xml | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 9e41f8983..a217fc165 100644
--- a/configure.ac
+++ b/configure.ac
@@ -16,7 +16,7 @@ dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
-AC_INIT([libvirt], [3.0.0], [libvir-list(a)redhat.com], [], [http://libvirt.org])
+AC_INIT([libvirt], [3.1.0], [libvir-list(a)redhat.com], [], [http://libvirt.org])
AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
diff --git a/docs/news.xml b/docs/news.xml
index b912d8a62..4ff0cb638 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -10,6 +10,17 @@
and optionally a description where it's explained in more detail -->
<libvirt>
+ <release version="v3.1.0" date="unreleased">
+ <section title="New features">
+ <change/>
+ </section>
+ <section title="Improvements">
+ <change/>
+ </section>
+ <section title="Bug fixes">
+ <change/>
+ </section>
+ </release>
<release version="v3.0.0" date="2017-01-17">
<section title="New features">
<change>
--
2.11.0
7 years, 11 months
[libvirt] [PATCH] tests: Distribute qemuhotplugtestcpus
by Michal Privoznik
Starting from a245abce436f4f333 another set of tests for
qemuhotplugtest has been introduced. This time for vcpu hotplug.
However, the test data (which live in qemuhotplugtestcpus dir)
are not being distributed properly.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
Pushed under build breaker rule.
tests/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c7d474817..87197841b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -121,6 +121,7 @@ EXTRA_DIST = \
qemucapabilitiesdata \
qemucaps2xmldata \
qemuhelpdata \
+ qemuhotplugtestcpus \
qemuhotplugtestdevices \
qemuhotplugtestdomains \
qemumonitorjsondata \
--
2.11.0
7 years, 11 months
[libvirt] [PATCH 0/4] gluster: cleanup and fix code for pool discovery
by Peter Krempa
Peter Krempa (4):
storage: Fix error reporting when looking up storage pool sources
storage: gluster: Report error if no volumes were found in pool lookup
storage: gluster: Remove build-time dependency on the 'gluster' cli
tool
spec: Depend on the gluster command line tool
configure.ac | 2 +-
libvirt.spec.in | 4 +++
src/storage/storage_backend.c | 48 ++++++++++++++++++++---------------
src/storage/storage_backend.h | 3 ++-
src/storage/storage_backend_fs.c | 22 ++++++++++------
src/storage/storage_backend_gluster.c | 14 +++++++---
6 files changed, 60 insertions(+), 33 deletions(-)
--
2.11.0
7 years, 11 months
[libvirt] [PATCH] news: Fix xml dump of autogenerated websocket
by Nikolay Shirokovskiy
---
Sorry for delay and thus not getting this news bit into release notes
in time.
docs/news.xml | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index 95b021a..3ff8f4e 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -274,6 +274,15 @@
for x86_64 HVM domains.
</description>
</change>
+ <change>
+ <summary>
+ qemu: Fix xml dump of autogenerated websocket
+ </summary>
+ <description>
+ As a result autogenerated websocket port is regenerated on domain restore,
+ migration and such as it should be.
+ </description>
+ </change>
</section>
</release>
<release version="v2.5.0" date="2016-12-04">
--
1.8.3.1
7 years, 11 months
[libvirt] Release of libvirt-3.0.0
by Daniel Veillard
So I got mixed reports in the last day about the state of the head
but one of the big issues seems solved, and I'm not sure keeping the
freeze much longer will help, so libvirt-3.0.0 is out. It's tagged in
git, signed tarball and rpms are available at thet usual place:
ftp://libvirt.org/libvirt/
I also pushed python bindings release too which one can find at
ftp://libvirt.org/libvirt/python/
It includes a fair amount of changes despite the slowdown around the end of
year break:
* New features
- Domain events for metadata content changes
The domain events framework has a new event ID that can be used to get
notifications when domain metadata content changes.
- Event notifications for the secret object
The secret object now supports event notifications, covering lifcycle
changes and secret value changes.
- New localPtr attribute for "ip" element in network XML
- qemu: Support QEMU group I/O throttling
Add the capability to allow group I/O throttling via a new domain
<disk> <iotune> subelement "group_name" to allow sharing I/O throttling
quota between multiple drives.
- nss: Introduce libvirt_guest
New libvirt_guest nss module that translates libvirt guest names into
IP addresses.
- daemon: Add support for runtime logging settings adjustment
Logging-related settings like log outputs and filters can now be
adjusted during runtime using the admin interface without the necessity
of the daemon's restart.
- storage: Add virStorageVolInfoFlags API
Add the API to support using the VIR_STORAGE_VOL_GET_PHYSICAL flag in
order to return the host physical size in bytes of the image container
in the allocation field of the _virStorageVolInfo structure. The
--physical flag has been added to the virsh vol-info command to access
the data.
- libxl: Implement virDomainGetMaxVcpus API
- storage: Add overwrite flag checking for logical pool
Add support for the OVERWRITE flags for the logical storage backend
including checking for existing data on the target volumes when
building a new logical pool on target volume(s).
- qemu: Add support for guest CPU configuration on s390(x)
* Improvements
- perf: Add more perf statistics
Add support to get the count of branch instructions executed, branch
misses, bus cycles, stalled frontend cpu cycles, stalled backend cpu
cycles, and ref cpu cycles by applications running on the platform.
- conf: Display <physical> for volume xml
Add a display of the <physical> size of a disk volume in the output of
the volume XML.
- qemu: Use virtio-pci by default for aarch64 mach-virt guests
virtio-pci provides several advantages over virtio-mmio, such as the
ability to hotplug devices and improved performance. While opting in to
virtio-pci has been possible for a while, newly-defined guests will now
use it automatically.
- vbox: remove support for VirtualBox 3.x and older
Those old VirtualBox versions have been unsupported by upstream for a
long time and the API of 4.0 and newer has diverged enough to require
code abstractions to handle differences. Removing support for those old
versions drops lots of code from the driver and simplifies the logic to
ease implementation of new features going forward.
- virsh: pool-info: introduce option --bytes
Add option --bytes to virsh pool-info in order ti allow display of
units in bytes rather than default of human readable output.
- scsi: Add parent wwnn/wwpn or fabric capability for createVport
Improve the algorithm searching for the parent scsi_host device for
vHBA/NPIV scsi_host creation. Rather than supplying the "parent" by
name, it's now possible to define the parent by it's wwnn/wwpn or
fabric_wwn in the node device create XML or the storage pool XML.
- qemu: aggregate pcie-root-ports onto multiple functions of a slot
When pcie-root-ports are added to pcie-root in order to provide a place
to connect PCI Express endpoint devices, libvirt now aggregates
multiple root ports together onto the same slot (up to 8 per slot) in
order to conserve slots. Using this method, it's possible to connect
more than 200 endpoint devices to a guest that uses PCIe without
requiring setup of any PCIe switches.
* Bug fixes
- lxc: fix accidental killing of containers during libvirtd restart
The libvirt_lxc process was previously not moved into the container
scope. As a result, if systemd reloads its config after a container is
started, when libvirtd is later restarted it will accidentally kill the
containers.
- qemu: Correct GetBlockInfo values
For an active domain, correct the physical value provided for a raw
sparse file backed storage and the allocation value provided for a
qcow2 file backed storage that hasn't yet been opened on the domain.
- qemu: Make virtio console usable on ppc64 guests
The chardev detection code has been improved and can now handle this
configuration properly.
- qemu: Enable mount namespace
To avoid funny races with udev relabelling devices under our hands and
to enhance security, libvirt now spawns each qemu process with its own
/dev.
- storage: Fix implementation of no-overwrite for file system backend
Fix file system storage backend implementation of the OVERWRITE flags
to be consistent between code and documentation. Add checks to ensure
that when building a new file system on a target volume that there is
not something already on the disk in a format that libvirt can
recognize.
- qemu: Create hugepage path on per domain basis
Historically, all hugepage enabled domains shared the same path under
hugetlbfs. This left libvirt unable to correctly set security labels on
it. With this release, however, each domain is put into a separate path
which is also correctly labeled.
- conf: Reject domains with duplicate drive addresses
Reject duplicate drive addresses for disks and hostdevs at domain
definition.
- libxl: reverse defaults on HVM net device attach
Fixes network interface attach for HVM domains when no model is
specified. Emulated hotplug isn't yet supported and hence we should
default to the general working scenario.
- libxl: always enable pae for x86_64 HVM
By default pae is disabled in libxl. Without an explicit <pae/> setting
in the domain <features> configuration, an x86_64 HVM domain would be
get an i686 environment. pae should always be enabled for x86_64 HVM
domains.
Thanks everybody for your contributions to this release, hopefully that
won't be a brown paper bag one !
Daniel
--
Daniel Veillard | Red Hat Developers Tools http://developer.redhat.com/
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
7 years, 11 months
[libvirt] [PATCH v2] Add support for Veritas HyperScale (VxHS) block device protocol
by Ashish Mittal
Sample XML for a vxhs vdisk is as follows:
<disk type='network' device='disk'>
<driver name='qemu' type='raw' cache='none'/>
<source protocol='vxhs' name='eb90327c-8302-4725-9e1b-4e85ed4dc251'>
<host name='192.168.0.1' port='9999'/>
</source>
<backingStore/>
<target dev='vda' bus='virtio'/>
<serial>eb90327c-8302-4725-9e1b-4e85ed4dc251</serial>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04'
function='0x0'/>
</disk>
Signed-off-by: Ashish Mittal <Ashish.Mittal(a)veritas.com>
---
v2 changelog:
(1) Added code for JSON parsing of a VxHS vdisk.
(2) Added test case to verify JSON parsing.
(3) Added missing switch-case checks for VIR_STORAGE_NET_PROTOCOL_VXHS.
(4) Fixed line wrap in qemuxml2argv-disk-drive-network-vxhs.args.
docs/formatdomain.html.in | 15 ++++--
docs/schemas/domaincommon.rng | 1 +
src/libxl/libxl_conf.c | 1 +
src/qemu/qemu_command.c | 4 ++
src/qemu/qemu_driver.c | 3 ++
src/qemu/qemu_parse_command.c | 25 +++++++++
src/util/virstoragefile.c | 63 +++++++++++++++++++++-
src/util/virstoragefile.h | 1 +
src/xenconfig/xen_xl.c | 1 +
.../qemuxml2argv-disk-drive-network-vxhs.args | 24 +++++++++
.../qemuxml2argv-disk-drive-network-vxhs.xml | 34 ++++++++++++
tests/qemuxml2argvtest.c | 1 +
tests/virstoragetest.c | 16 ++++++
13 files changed, 185 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index f7bef51..2a071c9 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2319,9 +2319,9 @@
<dd>
The <code>protocol</code> attribute specifies the protocol to
access to the requested image. Possible values are "nbd",
- "iscsi", "rbd", "sheepdog" or "gluster". If the
- <code>protocol</code> attribute is "rbd", "sheepdog" or
- "gluster", an additional attribute <code>name</code> is
+ "iscsi", "rbd", "sheepdog", "gluster" or "vxhs". If the
+ <code>protocol</code> attribute is "rbd", "sheepdog", "gluster"
+ or "vxhs", an additional attribute <code>name</code> is
mandatory to specify which volume/image will be used. For "nbd",
the <code>name</code> attribute is optional. For "iscsi"
(<span class="since">since 1.0.4</span>), the <code>name</code>
@@ -2329,6 +2329,9 @@
target's name by a slash (e.g.,
<code>iqn.2013-07.com.example:iscsi-pool/1</code>). If not
specified, the default LUN is zero.
+ For "vxhs" (<span class="since">since 2.5.0</span>), the
+ <code>name</code> is the UUID of the volume, assigned by the
+ HyperScale sever.
<span class="since">Since 0.8.7</span>
</dd>
<dt><code>volume</code></dt>
@@ -2431,6 +2434,12 @@
<td> one or more (<span class="since">Since 2.1.0</span>), just one prior to that </td>
<td> 24007 </td>
</tr>
+ <tr>
+ <td> vxhs </td>
+ <td> a server running Veritas HyperScale daemon </td>
+ <td> only one </td>
+ <td> 9999 </td>
+ </tr>
</table>
<p>
gluster supports "tcp", "rdma", "unix" as valid values for the
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4d76315..cdc39ca 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1470,6 +1470,7 @@
<value>ftp</value>
<value>ftps</value>
<value>tftp</value>
+ <value>vxhs</value>
</choice>
</attribute>
<optional>
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index b569dda..7e12d32 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -604,6 +604,7 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
case VIR_STORAGE_NET_PROTOCOL_SSH:
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
case VIR_STORAGE_NET_PROTOCOL_LAST:
case VIR_STORAGE_NET_PROTOCOL_NONE:
virReportError(VIR_ERR_NO_SUPPORT,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f8e48d2..1a52f12 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -491,6 +491,9 @@ qemuNetworkDriveGetPort(int protocol,
/* no default port specified */
return 0;
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
+ return 9999;
+
case VIR_STORAGE_NET_PROTOCOL_RBD:
case VIR_STORAGE_NET_PROTOCOL_LAST:
case VIR_STORAGE_NET_PROTOCOL_NONE:
@@ -1034,6 +1037,7 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
case VIR_STORAGE_NET_PROTOCOL_TFTP:
case VIR_STORAGE_NET_PROTOCOL_ISCSI:
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
ret = qemuBuildNetworkDriveURI(src, secinfo);
break;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b359e77..c76e9d4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13788,6 +13788,7 @@ qemuDomainSnapshotPrepareDiskExternalBackingInactive(virDomainDiskDefPtr disk)
case VIR_STORAGE_NET_PROTOCOL_FTPS:
case VIR_STORAGE_NET_PROTOCOL_TFTP:
case VIR_STORAGE_NET_PROTOCOL_SSH:
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
case VIR_STORAGE_NET_PROTOCOL_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("external inactive snapshots are not supported on "
@@ -13851,6 +13852,7 @@ qemuDomainSnapshotPrepareDiskExternalOverlayActive(virDomainSnapshotDiskDefPtr d
case VIR_STORAGE_NET_PROTOCOL_FTPS:
case VIR_STORAGE_NET_PROTOCOL_TFTP:
case VIR_STORAGE_NET_PROTOCOL_SSH:
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
case VIR_STORAGE_NET_PROTOCOL_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("external active snapshots are not supported on "
@@ -13996,6 +13998,7 @@ qemuDomainSnapshotPrepareDiskInternal(virConnectPtr conn,
case VIR_STORAGE_NET_PROTOCOL_FTPS:
case VIR_STORAGE_NET_PROTOCOL_TFTP:
case VIR_STORAGE_NET_PROTOCOL_SSH:
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
case VIR_STORAGE_NET_PROTOCOL_LAST:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("internal inactive snapshots are not supported on "
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 405e655..150e011 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -263,6 +263,16 @@ qemuParseNBDString(virDomainDiskDefPtr disk)
return -1;
}
+static int
+qemuParseVxHSString(virDomainDiskDefPtr def)
+{
+ virURIPtr uri = NULL;
+
+ if (!(uri = virURIParse(def->src->path)))
+ return -1;
+
+ return qemuParseDriveURIString(def, uri, "vxhs");
+}
/*
* This method takes a string representing a QEMU command line ARGV set
@@ -737,6 +747,12 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
if (VIR_STRDUP(def->src->path, vdi) < 0)
goto error;
}
+ } else if (STRPREFIX(def->src->path, "vxhs:")) {
+ def->src->type = VIR_STORAGE_TYPE_NETWORK;
+ def->src->protocol = VIR_STORAGE_NET_PROTOCOL_VXHS;
+
+ if (qemuParseVxHSString(def) < 0)
+ goto error;
} else {
def->src->type = VIR_STORAGE_TYPE_FILE;
}
@@ -1947,6 +1963,10 @@ qemuParseCommandLine(virCapsPtr caps,
disk->src->type = VIR_STORAGE_TYPE_NETWORK;
disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_SHEEPDOG;
val += strlen("sheepdog:");
+ } else if (STRPREFIX(val, "vxhs:")) {
+ disk->src->type = VIR_STORAGE_TYPE_NETWORK;
+ disk->src->protocol = VIR_STORAGE_NET_PROTOCOL_VXHS;
+ val += strlen("vxhs:");
} else {
disk->src->type = VIR_STORAGE_TYPE_FILE;
}
@@ -2023,6 +2043,11 @@ qemuParseCommandLine(virCapsPtr caps,
goto error;
break;
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
+ if (qemuParseVxHSString(disk) < 0)
+ goto error;
+
+ break;
case VIR_STORAGE_NET_PROTOCOL_HTTP:
case VIR_STORAGE_NET_PROTOCOL_HTTPS:
case VIR_STORAGE_NET_PROTOCOL_FTP:
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index ce6d213..e62f4e6 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -85,7 +85,8 @@ VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROTOCOL_LAST,
"ftp",
"ftps",
"tftp",
- "ssh")
+ "ssh",
+ "vxhs")
VIR_ENUM_IMPL(virStorageNetHostTransport, VIR_STORAGE_NET_HOST_TRANS_LAST,
"tcp",
@@ -2633,6 +2634,7 @@ virStorageSourceParseBackingColon(virStorageSourcePtr src,
case VIR_STORAGE_NET_PROTOCOL_ISCSI:
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
case VIR_STORAGE_NET_PROTOCOL_SSH:
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("malformed backing store path for protocol %s"),
protocol);
@@ -2964,6 +2966,64 @@ virStorageSourceParseBackingJSONRBD(virStorageSourcePtr src,
}
+static int
+virStorageSourceParseBackingJSONVXHS(virStorageSourcePtr src,
+ virJSONValuePtr json,
+ int opaque ATTRIBUTE_UNUSED)
+{
+ virJSONValuePtr server;
+ const char *hostname, *port;
+ const char *uri = virJSONValueObjectGetString(json, "filename");
+ const char *vdisk_id = virJSONValueObjectGetString(json, "vdisk-id");
+
+ src->type = VIR_STORAGE_TYPE_NETWORK;
+ src->protocol = VIR_STORAGE_NET_PROTOCOL_VXHS;
+
+ /* legacy URI based syntax passed via 'filename' option */
+ if (uri)
+ return virStorageSourceParseBackingJSONUriStr(src, uri,
+ VIR_STORAGE_NET_PROTOCOL_VXHS);
+
+ server = virJSONValueObjectGetObject(json, "server");
+ hostname = virJSONValueObjectGetString(server, "host");
+ port = virJSONValueObjectGetString(server, "port");
+
+ if (!vdisk_id) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("missing 'vdisk-id' attribute in "
+ "JSON backing definition for VxHS volume"));
+ return -1;
+ }
+ if (!server) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("missing 'server' attribute in "
+ "JSON backing definition for VxHS volume"));
+ return -1;
+ }
+ if (!hostname) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("missing hostname for tcp backing server in "
+ "JSON backing definition for VxHS volume"));
+ return -1;
+ }
+
+
+ if (VIR_STRDUP(src->path, vdisk_id) < 0)
+ return -1;
+
+ if (VIR_ALLOC_N(src->hosts, 1) < 0)
+ return -1;
+ src->nhosts = 1;
+
+ src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
+
+ if (VIR_STRDUP(src->hosts[0].name, hostname) < 0 ||
+ VIR_STRDUP(src->hosts[0].port, port) < 0)
+ return -1;
+
+ return 0;
+}
+
struct virStorageSourceJSONDriverParser {
const char *drvname;
int (*func)(virStorageSourcePtr src, virJSONValuePtr json, int opaque);
@@ -2985,6 +3045,7 @@ static const struct virStorageSourceJSONDriverParser jsonParsers[] = {
{"sheepdog", virStorageSourceParseBackingJSONSheepdog, 0},
{"ssh", virStorageSourceParseBackingJSONSSH, 0},
{"rbd", virStorageSourceParseBackingJSONRBD, 0},
+ {"vxhs", virStorageSourceParseBackingJSONVXHS, 0},
};
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 1f62244..e60b6e9 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -134,6 +134,7 @@ typedef enum {
VIR_STORAGE_NET_PROTOCOL_FTPS,
VIR_STORAGE_NET_PROTOCOL_TFTP,
VIR_STORAGE_NET_PROTOCOL_SSH,
+ VIR_STORAGE_NET_PROTOCOL_VXHS,
VIR_STORAGE_NET_PROTOCOL_LAST
} virStorageNetProtocol;
diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 18d9fe3..9fe24d6 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -942,6 +942,7 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src)
case VIR_STORAGE_NET_PROTOCOL_GLUSTER:
case VIR_STORAGE_NET_PROTOCOL_SHEEPDOG:
case VIR_STORAGE_NET_PROTOCOL_SSH:
+ case VIR_STORAGE_NET_PROTOCOL_VXHS:
case VIR_STORAGE_NET_PROTOCOL_LAST:
case VIR_STORAGE_NET_PROTOCOL_NONE:
virReportError(VIR_ERR_NO_SUPPORT,
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
new file mode 100644
index 0000000..f6e3e37
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.args
@@ -0,0 +1,24 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/libexec/qemu-kvm \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-cpu qemu32 \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=vxhs://192.168.0.1:9999/eb90327c-8302-4725-9e1b-4e85ed4dc251,\
+format=raw,if=none,id=drive-virtio-disk0,cache=none \
+-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,\
+id=virtio-disk0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.xml
new file mode 100644
index 0000000..45c807f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-vxhs.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/libexec/qemu-kvm</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source protocol='vxhs' name='eb90327c-8302-4725-9e1b-4e85ed4dc251'>
+ <host name='192.168.0.1' port='9999'/>
+ </source>
+ <backingStore/>
+ <target dev='vda' bus='virtio'/>
+ <serial>eb90327c-8302-4725-9e1b-4e85ed4dc251</serial>
+ <alias name='virtio-disk0'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ab3ad08..0c3470b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -892,6 +892,7 @@ mymain(void)
# endif
DO_TEST("disk-drive-network-rbd-ipv6", NONE);
DO_TEST_FAILURE("disk-drive-network-rbd-no-colon", NONE);
+ DO_TEST("disk-drive-network-vxhs", NONE);
DO_TEST("disk-drive-no-boot",
QEMU_CAPS_BOOTINDEX);
DO_TEST_PARSE_ERROR("disk-device-lun-type-invalid",
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index f766df1..a28fbd9 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -1492,6 +1492,22 @@ mymain(void)
"<source protocol='rbd' name='testshare'>\n"
" <host name='example.com'/>\n"
"</source>\n");
+ TEST_BACKING_PARSE("json:{\"file.driver\":\"vxhs\","
+ "\"file.filename\":\"vxhs://192.168.0.1:9999/c6718f6b-0401-441d-a8c3-1f0064d75ee0\""
+ "}",
+ "<source protocol='vxhs' name='c6718f6b-0401-441d-a8c3-1f0064d75ee0'>\n"
+ " <host name='192.168.0.1' port='9999'/>\n"
+ "</source>\n");
+ TEST_BACKING_PARSE("json:{\"file\":{\"driver\":\"vxhs\","
+ "\"vdisk-id\":\"c6718f6b-0401-441d-a8c3-1f0064d75ee0\","
+ "\"server\": { \"host\":\"example.com\","
+ "\"port\":\"1234\""
+ "}"
+ "}"
+ "}",
+ "<source protocol='vxhs' name='c6718f6b-0401-441d-a8c3-1f0064d75ee0'>\n"
+ " <host name='example.com' port='1234'/>\n"
+ "</source>\n");
cleanup:
/* Final cleanup */
--
2.5.5
7 years, 11 months