[libvirt] Java client error on Windows 7 64 bit for Libvirt on KVM
by george john
Hi,
I need some help in building a Java client on Windows 7 64 bit plaftorm to manage a KVM using the libvirt APIs. Using the instructions at http://libvirt.org/java.html, i was able to build libvirt.jar. My understanding is that libvirt.jar uses JNA to call libvirt's native windows library. I tried using the libvirt dlls in the experimental Windows installation package mentioned in http://libvirt.org/windows.html at http://libvirt.org/sources/win32_experimental/Libvirt-0.8.8-0.exe
but whenever I try to connect to my remote API, I get the below Java exception :
Exception in thread "main" java.lang.UnsatisfiedLinkError: %1 is not a valid Win32 application.
at com.sun.jna.Native.open(Native Method)
at com.sun.jna.Native.open(Native.java:1718)
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:210)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:322)
at com.sun.jna.Library$Handler.<init>(Library.java:142)
at com.sun.jna.Native.loadLibrary(Native.java:387)
at com.sun.jna.Native.loadLibrary(Native.java:366)
at org.libvirt.jna.Libvirt.<clinit>(Unknown Source)
at org.libvirt.Library.<clinit>(Unknown Source)
at org.libvirt.Connect.<init>(Unknown Source)
at Main.main(Main.java:8)
But when I try the same client code on a Windows XP 32 bit machine (with 32 bit JVM), I don't see this problem and the connection succeeds. So it looks like the problem is that I am not using 64 bit windows libvirt dlls and 64 bit JVM cannot load 32 bit dlls. Is there a Windows installer with 64 bit Libvirt dlls ? Or are the 64 bit version of DLLs published somewhere?
I tried using Matthias Bolte's msys_setup script (I tried in 2 machines) and in both machines, I get the below error when I try to run compile_libxml2.sh as per instructions https://github.com/photron/msys_setup/blob/master/readme_libvirt.txt
Last few lines before the error is :
>>>>>>>>>>>>>>>>>
make[5]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python'
make[4]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python'
Making install in tests
make[4]: Entering directory `/src/libxml2/libxml2-2.9.0-0/python/tests'
make[5]: Entering directory `/src/libxml2/libxml2-2.9.0-0/python/tests'
make[5]: Nothing to be done for `install-exec-am'.
test -z "/share/doc/libxml2-python-2.9.0/examples" || /bin/mkdir -p "/share/doc/
libxml2-python-2.9.0/examples"
/bin/install -c -m 644 build.py attribs.py tst.py tstxpath.py xpathext.py push.
py pushSAX.py pushSAXhtml.py error.py serialize.py validate.py tstURI.py cutnpas
te.py xpathret.py xpath.py outbuf.py inbuf.py resolver.py regexp.py reader.py re
ader2.py reader3.py reader4.py reader5.py reader6.py reader7.py reader8.py reade
rnext.py walker.py nsdel.py ctxterror.py readererr.py relaxng.py schema.py threa
d2.py sync.py tstLastError.py indexes.py dtdvalid.py tstmem.py '/share/doc/libxm
l2-python-2.9.0/examples'
/bin/install -c -m 644 validDTD.py validSchemas.py validRNG.py compareNodes.py
xpathns.py xpathleak.py tst.xml valid.xml invalid.xml test.dtd '/share/doc/libxm
l2-python-2.9.0/examples'
make[5]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python/tests'
make[4]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python/tests'
make[3]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python'
make[2]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python'
make[1]: Leaving directory `/src/libxml2/libxml2-2.9.0-0'
+ cp /python/Lib/site-packages/libxml2mod.dll /python/DLLs/libxml2mod.pyd
cp: cannot stat `/python/Lib/site-packages/libxml2mod.dll': No such file or dire
ctory
>>>>>>>>>>>>>>>>>>
Do you know how this error could be resolved? All help will be greatly appreciated.
Thank you.
11 years, 6 months
[libvirt] [PATCH] Fix typo in augeas comment
by Martin Kletzander
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Pushed as 'trivial' before 1.0.5 as suggested [1] by Michal
[1] http://www.redhat.com/archives/libvir-list/2013-April/msg02059.html
---
src/qemu/libvirtd_qemu.aug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index 61740a9..a3dcb30 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -74,7 +74,7 @@ module Libvirtd_qemu =
| int_entry "keepalive_interval"
| int_entry "keepalive_count"
- (* Each enty in the config is one of the following three ... *)
+ (* Each entry in the config is one of the following ... *)
let entry = vnc_entry
| spice_entry
| remote_display_entry
--
1.8.2.1
11 years, 6 months
Re: [libvirt] [PATCH 2/4] QMP: add cpu-add command
by Eduardo Habkost
(CCing libvir-list)
On Tue, Apr 30, 2013 at 08:34:01AM +0200, Igor Mammedov wrote:
> Adds "cpu-add id=xxx" QMP command.
>
> cpu-add's "id" argument is a CPU number in a range [0..max-cpus)
>
> Example QMP command:
> -> { "execute": "cpu-add", "arguments": { "id": 2 } }
> <- { "return": {} }
>
> Signed-off-by: Igor Mammedov <imammedo(a)redhat.com>
> Acked-by: Luiz Capitulino <lcapitulino(a)redhat.com>
> Reviewed-by: Eric Blake <eblake(a)redhat.com>
The only way to find out if CPU hotplug is really available on a given
machine-type is by actually trying to run cpu-add, right? Is this
sufficient for libvirt requirements?
> ---
> v7:
> * added "Since 1.5" to cpu-add qapi schema definition
> v6:
> * added valid values description to qapi schema
> * split out cpu_hot_add hooks introduction into separate patch
> * split out implementation of cpu_hot_add for target-i386
> v5:
> * accept id=[0..max_cpus) range in cpu-add command
> v4:
> * merge "qmp: add cpu-add qmp command" & "target-i386: implement CPU hot-add" patches
> * move notifier call to CPUCLass.realize()
> * add hook cpu_hot_add to QEMUMachine
> * make QEMUMachineInitArgs global and keep default cpu_model there
>
> v3:
> * it appears that 'online/offline' in cpu-set are confusing people
> with what command actually does and users might have to distinguish
> if 'offline' is not implemented by parsing error message. To simplify
> things replace cpu-set with cpu-add command to show more clear what
> command does and just add cpu-del when CPU remove is implemented.
>
> v2:
> * s/cpu_set/cpu-set/
> * qmp doc style fix
> * use bool type instead of opencodding online/offline string
> suggested-by: Eric Blake <eblake(a)redhat.com>
> ---
> qapi-schema.json | 13 +++++++++++++
> qmp-commands.hx | 23 +++++++++++++++++++++++
> qmp.c | 10 ++++++++++
> 3 files changed, 46 insertions(+)
>
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 5b0fb3b..6f58b0f 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -1387,6 +1387,19 @@
> { 'command': 'cpu', 'data': {'index': 'int'} }
>
> ##
> +# @cpu-add
> +#
> +# Adds CPU with specified ID
> +#
> +# @id: ID of CPU to be created, valid values [0..max_cpus)
> +#
> +# Returns: Nothing on success
> +#
> +# Since 1.5
> +##
> +{ 'command': 'cpu-add', 'data': {'id': 'int'} }
> +
> +##
> # @memsave:
> #
> # Save a portion of guest memory to a file.
> diff --git a/qmp-commands.hx b/qmp-commands.hx
> index 0e89132..ed99eb8 100644
> --- a/qmp-commands.hx
> +++ b/qmp-commands.hx
> @@ -385,6 +385,29 @@ Note: CPUs' indexes are obtained with the 'query-cpus' command.
> EQMP
>
> {
> + .name = "cpu-add",
> + .args_type = "id:i",
> + .mhandler.cmd_new = qmp_marshal_input_cpu_add,
> + },
> +
> +SQMP
> +cpu-add
> +-------
> +
> +Adds virtual cpu
> +
> +Arguments:
> +
> +- "id": cpu id (json-int)
> +
> +Example:
> +
> +-> { "execute": "cpu-add", "arguments": { "id": 2 } }
> +<- { "return": {} }
> +
> +EQMP
> +
> + {
> .name = "memsave",
> .args_type = "val:l,size:i,filename:s,cpu:i?",
> .mhandler.cmd_new = qmp_marshal_input_memsave,
> diff --git a/qmp.c b/qmp.c
> index ed6c7ef..dd34be6 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -24,6 +24,7 @@
> #include "hw/qdev.h"
> #include "sysemu/blockdev.h"
> #include "qom/qom-qobject.h"
> +#include "hw/boards.h"
>
> NameInfo *qmp_query_name(Error **errp)
> {
> @@ -108,6 +109,15 @@ void qmp_cpu(int64_t index, Error **errp)
> /* Just do nothing */
> }
>
> +void qmp_cpu_add(int64_t id, Error **errp)
> +{
> + if (current_machine->hot_add_cpu) {
> + current_machine->hot_add_cpu(id, errp);
> + } else {
> + error_setg(errp, "Not supported");
> + }
> +}
> +
> #ifndef CONFIG_VNC
> /* If VNC support is enabled, the "true" query-vnc command is
> defined in the VNC subsystem */
> --
> 1.8.2.1
>
--
Eduardo
11 years, 6 months
[libvirt] [PATCH] virsh: clarify vol-{down,up}load description
by Ján Tomko
Mention file/volume contents instead of just 'file'/'volume'.
Also change Download->download in vol-download help,
to be consistent with other volume commands.
https://bugzilla.redhat.com/show_bug.cgi?id=955537
---
tools/virsh-volume.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 0ca295f..728bc23 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -590,10 +590,10 @@ cleanup:
*/
static const vshCmdInfo info_vol_upload[] = {
{.name = "help",
- .data = N_("upload a file into a volume")
+ .data = N_("upload file contents to a volume")
},
{.name = "desc",
- .data = N_("Upload a file into a volume")
+ .data = N_("Upload file contents to a volume")
},
{.name = NULL}
};
@@ -704,10 +704,10 @@ cleanup:
*/
static const vshCmdInfo info_vol_download[] = {
{.name = "help",
- .data = N_("Download a volume to a file")
+ .data = N_("download volume contents to a file")
},
{.name = "desc",
- .data = N_("Download a volume to a file")
+ .data = N_("Download volume contents to a file")
},
{.name = NULL}
};
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH v2] qemu: Generate agent socket path if missing
by Michal Privoznik
It's not desired to force users imagine path for a socket they
are not even supposed to connect to. On the other hand, we
already have a release where the qemu agent socket path is
exposed to XML, so we cannot silently drop it from there.
The new path is generated in form:
$LOCALSTATEDIR/lib/libvirt/qemu/channel/target/$domain.$name
---
docs/formatdomain.html.in | 7 ++++++-
libvirt.spec.in | 1 +
src/Makefile.am | 1 +
src/conf/domain_conf.c | 34 ++++++++++++++++------------------
src/qemu/qemu_domain.c | 16 ++++++++++++++++
5 files changed, 40 insertions(+), 19 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 888c005..59cbe9b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3928,7 +3928,12 @@ qemu-kvm -net nic,model=? /dev/null
then libvirt can interact with a guest agent installed in the
guest, for actions such as guest shutdown or file system quiescing.
<span class="since">Since 0.7.7, guest agent interaction
- since 0.9.10</span></dd>
+ since 0.9.10</span> Moreover, <span class="since">since 1.0.5</span>
+ it is possible to have source path auto generated for virtio unix channels.
+ This is very useful in case of a qemu guest agent, where users don't
+ usually care about the source path since it's libvirt who talks to
+ the guest agent. In case users want to utilize this feature, they should
+ leave <code><source></code> element out.
<dt><code>spicevmc</code></dt>
<dd>Paravirtualized SPICE channel. The domain must also have a
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 328b009..11fc12d 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1719,6 +1719,7 @@ fi
%if %{with_qemu}
%ghost %dir %attr(0700, root, root) %{_localstatedir}/run/libvirt/qemu/
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/
+%dir %attr{0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/lib/libvirt/qemu/channel/target/
%dir %attr(0750, %{qemu_user}, %{qemu_group}) %{_localstatedir}/cache/libvirt/qemu/
%endif
%if %{with_lxc}
diff --git a/src/Makefile.am b/src/Makefile.am
index 3adddb4..914b57d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2098,6 +2098,7 @@ if WITH_SANLOCK
endif
if WITH_QEMU
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu"
+ $(MKDIR_P) "$(DESTDIR)$(localstatedir)/lib/libvirt/qemu/channel/target"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/run/libvirt/qemu"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/cache/libvirt/qemu"
$(MKDIR_P) "$(DESTDIR)$(localstatedir)/log/libvirt/qemu"
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dc0ecaa..839e849 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6507,7 +6507,9 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def,
break;
case VIR_DOMAIN_CHR_TYPE_UNIX:
- if (path == NULL) {
+ /* path can be auto generated */
+ if (!path &&
+ chr_def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing source path attribute for char device"));
goto error;
@@ -6602,7 +6604,6 @@ virDomainChrDefParseXML(xmlXPathContextPtr ctxt,
char *type = NULL;
const char *nodeName;
virDomainChrDefPtr def;
- int remaining;
bool seenTarget = false;
if (!(def = virDomainChrDefNew()))
@@ -6626,29 +6627,26 @@ virDomainChrDefParseXML(xmlXPathContextPtr ctxt,
}
cur = node->children;
- remaining = virDomainChrSourceDefParseXML(&def->source, cur, flags,
- def, ctxt,
- vmSeclabels, nvmSeclabels);
- if (remaining < 0)
- goto error;
- if (remaining) {
- while (cur != NULL) {
- if (cur->type == XML_ELEMENT_NODE) {
- if (xmlStrEqual(cur->name, BAD_CAST "target")) {
- seenTarget = true;
- if (virDomainChrDefParseTargetXML(def, cur) < 0) {
- goto error;
- }
+ while (cur != NULL) {
+ if (cur->type == XML_ELEMENT_NODE) {
+ if (xmlStrEqual(cur->name, BAD_CAST "target")) {
+ seenTarget = true;
+ if (virDomainChrDefParseTargetXML(def, cur) < 0) {
+ goto error;
}
}
- cur = cur->next;
}
+ cur = cur->next;
}
if (!seenTarget &&
((def->targetType = virDomainChrDefaultTargetType(def->deviceType)) < 0))
goto cleanup;
+ if (virDomainChrSourceDefParseXML(&def->source, node->children, flags, def,
+ ctxt, vmSeclabels, nvmSeclabels) < 0)
+ goto error;
+
if (def->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
if (def->targetType != VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -14094,8 +14092,8 @@ virDomainChrSourceDefFormat(virBufferPtr buf,
case VIR_DOMAIN_CHR_TYPE_UNIX:
virBufferAsprintf(buf, " <source mode='%s'",
def->data.nix.listen ? "bind" : "connect");
- virBufferEscapeString(buf, " path='%s'/>\n",
- def->data.nix.path);
+ virBufferEscapeString(buf, " path='%s'", def->data.nix.path);
+ virBufferAddLit(buf, "/>\n");
break;
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a7aabdf..d8a87a8 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -745,6 +745,22 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr dev,
(def->os.arch == VIR_ARCH_S390 || def->os.arch == VIR_ARCH_S390X))
dev->data.chr->targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO;
+ /* auto generate unix socket path */
+ if (dev->type == VIR_DOMAIN_DEVICE_CHR &&
+ dev->data.chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
+ dev->data.chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
+ dev->data.chr->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
+ !dev->data.chr->source.data.nix.path &&
+ (driver && (cfg = virQEMUDriverGetConfig(driver)))) {
+
+ if (virAsprintf(&dev->data.chr->source.data.nix.path,
+ "%s/channel/target/%s.%s",
+ cfg->libDir, def->name,
+ dev->data.chr->target.name) < 0)
+ goto no_memory;
+ dev->data.chr->source.data.nix.listen = true;
+ }
+
ret = 0;
cleanup:
--
1.8.1.5
11 years, 6 months
[libvirt] RFE: Ability to freeze/thaw guest using libvirt/virsh APIs
by Deepak C Shetty
I am sending this mail based on the below IRC discussion.
Apr 23 18:55:02 <deepakcs> Hi all, is there a way to just do a
fsfreeze (and un-freeze) of VM usign virsh. I don't see any option today....
Apr 23 18:55:52 <deepakcs> there is option to take snapshot (which
in turn would do freeze/un-freeze), but i want to exercise the
freeze/un-freeze only.. w/o the snapshot
Apr 23 19:23:57 <eblake> deepakcs: virsh qemu-agent-command can
trigger any agent command
Apr 23 19:24:35 <eblake> but it is officially unsupported - more
of a development aid
Apr 23 19:26:38 <eblake> if it turns out that freezing the guest
with libvirt commands is worth promoting into a supported api, instead
of the qemu-agent-command backdoor, then report that as an RFE to the list
Apr 23 19:27:14 <deepakcs> eblake, sorry was in a mtg..
Apr 23 19:28:03 <deepakcs> eblake, yeah.. i was wondering that it
would be good to have freeze/un-freeze as supported virsh ops.. then it
helps users exploit snapshot functionality provided by things like
storage arrays (as an example)
Apr 23 19:28:47 <eblake> well, as qemu continues to add more
snapshot building blocks, it may make sense
11 years, 6 months
[libvirt] [PATCH v2] virsh: fix incorrect argument errors for long options
by Ján Tomko
For long options, print:
* the option as specified by the user if it's unknown
* the cannoncial long option if its argument is not
a number (and should be)
And for missing arguments, print both the short and
the long option name.
(Doing only one of those would require either parsing
argv ourselves or let getopt print the errors, since
we can't tell long and short options apart by optopt
or longindex)
https://bugzilla.redhat.com/show_bug.cgi?id=949373
---
v1: https://www.redhat.com/archives/libvir-list/2013-April/msg01653.html
tools/virsh.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 6ec2f7b..ac86608 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2978,7 +2978,8 @@ vshAllowedEscapeChar(char c)
static bool
vshParseArgv(vshControl *ctl, int argc, char **argv)
{
- int arg, len, debug;
+ int arg, len, debug, i;
+ int longindex = -1;
struct option opt[] = {
{"debug", required_argument, NULL, 'd'},
{"help", no_argument, NULL, 'h'},
@@ -2995,11 +2996,12 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
/* Standard (non-command) options. The leading + ensures that no
* argument reordering takes place, so that command options are
* not confused with top-level virsh options. */
- while ((arg = getopt_long(argc, argv, "+:d:hqtc:vVrl:e:", opt, NULL)) != -1) {
+ while ((arg = getopt_long(argc, argv, "+:d:hqtc:vVrl:e:", opt, &longindex)) != -1) {
switch (arg) {
case 'd':
if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) {
- vshError(ctl, "%s", _("option -d takes a numeric argument"));
+ vshError(ctl, _("option %s takes a numeric argument"),
+ longindex == -1 ? "-d" : "--debug");
exit(EXIT_FAILURE);
}
if (debug < VSH_ERR_DEBUG || debug > VSH_ERR_ERROR)
@@ -3050,15 +3052,24 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
}
break;
case ':':
- vshError(ctl, _("option '-%c' requires an argument"), optopt);
- exit(EXIT_FAILURE);
+ for (i = 0; opt[i].name != NULL; i++) {
+ if (opt[i].val == optopt) {
+ vshError(ctl, _("option '-%c'/'--%s' requires an argument"),
+ optopt, opt[i].name);
+ exit(EXIT_FAILURE);
+ }
+ }
case '?':
- vshError(ctl, _("unsupported option '-%c'. See --help."), optopt);
+ if (optopt)
+ vshError(ctl, _("unsupported option '-%c'. See --help."), optopt);
+ else
+ vshError(ctl, _("unsupported option '%s'. See --help."), argv[optind - 1]);
exit(EXIT_FAILURE);
default:
vshError(ctl, _("unknown option"));
exit(EXIT_FAILURE);
}
+ longindex = -1;
}
if (argc > optind) {
--
1.8.1.5
11 years, 6 months
[libvirt] [PATCH] qemu: Error out if spice port autoallocation is requested, but disabled
by Peter Krempa
When a user requests auto-allocation of the spice TLS port but spice TLS
is disabled in qemu.conf, we start the machine and let qemu fail instead
of erroring out sooner.
Add an error message so that this doesn't happen.
---
src/qemu/qemu_process.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f12d7d5..e81e57f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3292,8 +3292,14 @@ qemuProcessSPICEAllocatePorts(virQEMUDriverPtr driver,
graphics->data.spice.port = port;
}
- if (cfg->spiceTLS &&
- (needTLSPort || graphics->data.spice.tlsPort == -1)) {
+ if (needTLSPort || graphics->data.spice.tlsPort == -1) {
+ if (!cfg->spiceTLS) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Auto allocation of spice TLS port requested "
+ "but spice is disabled in qemu.conf"));
+ goto error;
+ }
+
if (virPortAllocatorAcquire(driver->remotePorts, &tlsPort) < 0)
goto error;
--
1.8.2.1
11 years, 6 months
[libvirt] [PATCH] network: Don't remove transient network if creating of config file fails
by Peter Krempa
On the off-chance that creation of persistent configuration file would
fail when defining a network that is already started as transient, the
code would remove the transient data structure and thus the network.
This patch changes the code so that in such case, the network is again
marked as transient and left behind.
---
src/network/bridge_driver.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 27dd230..64c71af 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3160,8 +3160,13 @@ static virNetworkPtr networkDefine(virConnectPtr conn, const char *xml) {
freeDef = false;
if (virNetworkSaveConfig(driver->networkConfigDir, def) < 0) {
- virNetworkRemoveInactive(&driver->networks, network);
- network = NULL;
+ if (!virNetworkObjIsActive(network)) {
+ virNetworkRemoveInactive(&driver->networks, network);
+ network = NULL;
+ goto cleanup;
+ }
+ network->persistent = 0;
+ virNetworkDefFree(network->newDef);
goto cleanup;
}
--
1.8.2.1
11 years, 6 months