[libvirt] [PATCH] qemu: Remove bogus codes in function getCompressionType
The error will never be reported, remove the codes, and also improve the docs in qemu.conf to tell user the truth. --- src/qemu/qemu.conf |4 src/qemu/qemu_driver.c | 16 +--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 145062c..75d945b 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -199,6 +199,10 @@ # save_image_format is used when you use 'virsh save' at scheduled saving. # dump_image_format is used when you use 'virsh dump' at emergency crashdump. # +# If the specified format is not valid (the valid formats are raw, lzop, +# gzip, bzip2, and xz), or the compress program is not available, raw +# will be used as the format silently without error or warning. +# # save_image_format = raw # dump_image_format = raw diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b928004..48fc46a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2712,19 +2712,13 @@ getCompressionType(struct qemud_driver *driver) */ if (driver-dumpImageFormat) { compress = qemudSaveCompressionTypeFromString(driver-dumpImageFormat); -if (compress 0) { -qemuReportError(VIR_ERR_OPERATION_FAILED, %s, -_(Invalid dump image format specified in - configuration file, using raw)); +/* Use raw as the format if the specified format is not valid, + * or the compress program is not available, + */ +if (compress 0) return QEMUD_SAVE_FORMAT_RAW; -} -if (!qemudCompressProgramAvailable(compress)) { -qemuReportError(VIR_ERR_OPERATION_FAILED, -%s, _(Compression program for dump image format -in configuration file isn't available, -using raw)); +if (!qemudCompressProgramAvailable(compress)) return QEMUD_SAVE_FORMAT_RAW; -} } return compress; } -- 1.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
As plannned we are entering the freeze for libvirt-0.9.4 . I have made a release candidate 1 tarball (and associated rpms) at ftp://libvirt.org/libvirt/libvirt-0.9.4-rc1.tar.gz This seems to pass my minimal tests without problems, but please give it a try too and report problems, I will probably make an rc2 on Thursday or Friday, and then the final release next Monday or Tuesday, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] tools: format percent strings of nodecpustats
* tools/virsh.c: format strings display for virsh nodecpustats --percent. * how to reproduce? % virsh nodecpustats --percent usage:2.0% user : 1.0% system: 1.0% idle : 98.0% iowait: 0.0% * after format strings % virsh nodecpustats --percent usage : 2.0% user : 1.0% system: 1.0% idle : 98.0% iowait: 0.0% Signed-off-by: Alex Jia a...@redhat.com --- tools/virsh.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index e46da31..f1166a9 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -4459,11 +4459,11 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) usage = (user_time + sys_time) / total_time * 100; vshPrint(ctl, %-15s %5.1lf%%\n, - _(usage:), usage); + _(usage :), usage); vshPrint(ctl, %-15s %5.1lf%%\n, - _(user :), user_time / total_time * 100); + _(user :), user_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, - _(system:), sys_time / total_time * 100); + _(system:), sys_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, _(idle :), idle_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] FYI: qemu -M option deprecated upstream, removed from -help output
On 07/25/2011 10:22 PM, Eric Blake wrote: As long as QEMU supports -M ? it should not be a problem. The -M option is not scraped from -help output. If -M is going away, then libvirt _should_ scrape -help output to see whether to use -M or -machine, rather than blindly using -M. -M going away will take a while (and will likely never happen). Paolo -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Libvirt-announce] Start of freeze for libvirt-0.9.4 and availability of rc1
于 2011年07月26日 14:48, Daniel Veillard 写道: As plannned we are entering the freeze for libvirt-0.9.4 . I have made a release candidate 1 tarball (and associated rpms) at ftp://libvirt.org/libvirt/libvirt-0.9.4-rc1.tar.gz This seems to pass my minimal tests without problems, but please give it a try too and report problems, I will probably make an rc2 on Thursday or Friday, and then the final release next Monday or Tuesday, thanks ! Daniel make check failed. # VIR_TEST_DEBUG=1 ./qemuxml2argvtest 135) QEMU XML-2-ARGV cpu-topology2 ... libvir: error : internal error Child process (LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -cpu ?) status unexpected: exit status 1 FAILED 136) QEMU XML-2-ARGV cpu-topology3 ... OK 137) QEMU XML-2-ARGV cpu-minimum1 ... libvir: error : internal error Child process (LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -cpu ?) status unexpected: exit status 1 FAILED 138) QEMU XML-2-ARGV cpu-minimum2 ... libvir: error : internal error Child process (LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -cpu ?) status unexpected: exit status 1 FAILED 139) QEMU XML-2-ARGV cpu-exact1 ... libvir: error : internal error Child process (LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -cpu ?) status unexpected: exit status 1 FAILED 140) QEMU XML-2-ARGV cpu-exact2 ... libvir: error : internal error Child process (LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -cpu ?) status unexpected: exit status 1 FAILED 141) QEMU XML-2-ARGV cpu-strict1 ... libvir: error : internal error Child process (LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -cpu ?) status unexpected: exit status 1 FAILED Part of the debug log: 141) QEMU XML-2-ARGV cpu-strict1 ... 16:53:50.554: 24630: debug : virCommandRunAsync:2040 : About to run LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -M ? 16:53:50.555: 24630: debug : virCommandRunAsync:2056 : Command result 0, with PID 24645 16:53:50.556: 24630: debug : virCommandRun:1862 : Result exit status 1, stdout: '' stderr: '16:53:50.555: 24645: debug : virCommandHook:1959 : Hook is done 0 libvir: error : cannot execute binary /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh: Permission denied Command works well in Bash. [root@Osier libvirt-0.9.4]# LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -M ? pc Still looking. Osier -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Libvirt-announce] Start of freeze for libvirt-0.9.4 and availability of rc1
On Tue, Jul 26, 2011 at 05:02:49PM +0800, Osier Yang wrote: 于 2011年07月26日 14:48, Daniel Veillard 写道: As plannned we are entering the freeze for libvirt-0.9.4 . I have made a release candidate 1 tarball (and associated rpms) at ftp://libvirt.org/libvirt/libvirt-0.9.4-rc1.tar.gz This seems to pass my minimal tests without problems, but please give it a try too and report problems, I will probably make an rc2 on Thursday or Friday, and then the final release next Monday or Tuesday, thanks ! Daniel make check failed. # VIR_TEST_DEBUG=1 ./qemuxml2argvtest 135) QEMU XML-2-ARGV cpu-topology2 ... libvir: error : internal error Child process (LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -cpu ?) status unexpected: exit status 1 FAILED [...] 141) QEMU XML-2-ARGV cpu-strict1 ... 16:53:50.554: 24630: debug : virCommandRunAsync:2040 : About to run LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh -M ? 16:53:50.555: 24630: debug : virCommandRunAsync:2056 : Command result 0, with PID 24645 16:53:50.556: 24630: debug : virCommandRun:1862 : Result exit status 1, stdout: '' stderr: '16:53:50.555: 24645: debug : virCommandHook:1959 : Hook is done 0 libvir: error : cannot execute binary /home/osier/work/tar/libvirt-0.9.4/tests/qemuxml2argvdata/./qemu.sh: Permission denied Command works well in Bash. weird ... I don't think we changed this for ages ... I just tried this locally and could not reproduce this (./configure --prefix=/usr ; make ; make check ...) Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tests: fix compilation failures
On Mon, Jul 25, 2011 at 01:36:23PM -0600, Eric Blake wrote: On 07/25/2011 09:39 AM, Daniel P. Berrange wrote: (struct testTLSCertReq): Alter time members. (testTLSGenerateCert): Reflect the change. (mymain): Reduce stack usage. --- -/* if zero, then the current time will be used */ -time_t start; -time_t expire; +/* zero for current time, or non-zero for hours from now */ +int start_offset; +/* zero for 24 hours from now, or non-zero for hours from now */ +int expire_offset; }; This is actually a change in semantics introduced here. The start/expire values were treated as absolute values, eg in places we pass '1' for expiry time to indicate a time way in the past. This has now become 1 hour into the future. This is why the 3 expiry tests were broken. I pushed the following change to make sure the expiry tests have times in the past again +++ b/tests/virnettlscontexttest.c @@ -1112,7 +1112,7 @@ mymain(void) true, true, true, true, true, GNUTLS_KEY_KEY_CERT_SIGN, false, false, NULL, NULL, -0, 1, +0, -1, Ah - while I fixed the future stamps, I forgot to fix the past stamps. ACK to this change; however, I still find it odd that the start time is now but the expire time is in the past. Instead, shouldn't we be using something like start time of -2 and expire time of -1, so the start time still comes before the expire time? Well we're not really testing the start time in this scenario, so it doesn't really matter either way. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix import of private key with older gnutls
On Mon, Jul 25, 2011 at 06:18:42PM +0100, Daniel P. Berrange wrote: With older GNUTLS the gnutls_x509_privkey_import function is unable to import our private key. Instead we must use the alternative gnutls_x509_privkey_import_pkcs8() (as certtool does). * virnettlscontexttest.c: Fix import of private key with older gnutls. Also add missing newlines to key I just got in trouble with an older gnutls trying to build on RHEL-5 too: ../src/.libs/libvirt-net-rpc.a(libvirt_net_rpc_la-virnettlscontext.o): In function `virNetTLSContextCheckCertBasicConstraints': /u/veillard/libvirt/src/rpc/virnettlscontext.c:149: undefined reference to `gnutls_x509_crt_get_basic_constraints' collect2: ld returned 1 exit status Maybe we should check for that specific entry point in configure and disable that part of the cert checking if not available, opinion ? Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] set cpu bandwidth for the vm
On Mon, Jul 25, 2011 at 01:37:14PM +0800, Wen Congyang wrote: The cpu bandwidth is applied at the vcpu group level. We should apply it at the vm group level too, because the vm may do heavy I/O, and it will affect the other vm. We apply cpu bandwidth at the vcpu and the vm group level, so we must ensure that max(child_quota) = parent_quota when we modify cpu bandwidth. Ahh, interesting problem ! --- src/qemu/qemu_cgroup.c | 38 ++--- src/qemu/qemu_driver.c | 103 --- 2 files changed, 101 insertions(+), 40 deletions(-) ACK Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH ] send-key: Implement Python API
On Thu, Jul 21, 2011 at 05:21:10PM +0800, Lai Jiangshan wrote: Signed-off-by: Lai Jiangshan la...@cn.fujitsu.com --- diff --git a/python/libvirt-override.c b/python/libvirt-override.c index b713b6a..1ef5bfa 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -3789,6 +3789,53 @@ libvirt_virStreamSend(PyObject *self ATTRIBUTE_UNUSED, return py_retval; } +static PyObject * +libvirt_virDomainSendKey(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ +PyObject *py_retval; +virDomainPtr domain; +PyObject *pyobj_domain; +PyObject *pyobj_list; +int codeset; +int holdtime; +unsigned int flags; +int ret; +int i; +unsigned int keycodes[VIR_DOMAIN_SEND_KEY_MAX_KEYS]; +unsigned int nkeycodes; + +if (!PyArg_ParseTuple(args, (char *)OiiOii:virDomainSendKey, + pyobj_domain, codeset, holdtime, pyobj_list, + nkeycodes, flags)) { +DEBUG(%s failed to parse tuple\n, __FUNCTION__); +return VIR_PY_INT_FAIL; +} +domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + +if (!PyList_Check(pyobj_list)) { +return VIR_PY_INT_FAIL; +} + +if (nkeycodes != PyList_Size(pyobj_list) || +nkeycodes VIR_DOMAIN_SEND_KEY_MAX_KEYS) { +return VIR_PY_INT_FAIL; +} + +for (i = 0; i nkeycodes; i++) { +keycodes[i] = (int)PyInt_AsLong(PyList_GetItem(pyobj_list, i)); +} + +LIBVIRT_BEGIN_ALLOW_THREADS; +ret = virDomainSendKey(domain, codeset, holdtime, keycodes, nkeycodes, flags); +LIBVIRT_END_ALLOW_THREADS; + +DEBUG(virDomainSendKey ret=%d\n, ret); + +py_retval = libvirt_intWrap(ret); +return py_retval; +} + / * * * The registration stuff * @@ -3872,6 +3919,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) virDomainGetJobInfo, libvirt_virDomainGetJobInfo, METH_VARARGS, NULL}, {(char *) virDomainSnapshotListNames, libvirt_virDomainSnapshotListNames, METH_VARARGS, NULL}, {(char *) virDomainRevertToSnapshot, libvirt_virDomainRevertToSnapshot, METH_VARARGS, NULL}, +{(char *) virDomainSendKey, libvirt_virDomainSendKey, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; ACK Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix import of private key with older gnutls
On Tue, Jul 26, 2011 at 06:14:27PM +0800, Daniel Veillard wrote: On Mon, Jul 25, 2011 at 06:18:42PM +0100, Daniel P. Berrange wrote: With older GNUTLS the gnutls_x509_privkey_import function is unable to import our private key. Instead we must use the alternative gnutls_x509_privkey_import_pkcs8() (as certtool does). * virnettlscontexttest.c: Fix import of private key with older gnutls. Also add missing newlines to key I just got in trouble with an older gnutls trying to build on RHEL-5 too: ../src/.libs/libvirt-net-rpc.a(libvirt_net_rpc_la-virnettlscontext.o): In function `virNetTLSContextCheckCertBasicConstraints': /u/veillard/libvirt/src/rpc/virnettlscontext.c:149: undefined reference to `gnutls_x509_crt_get_basic_constraints' collect2: ld returned 1 exit status Maybe we should check for that specific entry point in configure and disable that part of the cert checking if not available, I'm looking into that now. There may well be a different function I can use to get the same data. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] gnulib compiler warning detection broken on RHEL5 autoconf
I was wondering why I didn't see any compile warnings from the broken gnutls code on RHEL5 when I noticed that we were building without any compiler warning flags at all. It seems configure fails on RHEL5 vintage autoconf checking whether compiler handles -Wall... ./configure: line 75468: ${$as_gl_Warn+set}: bad substitution I'm guessing it is the gl_WARN_ADD() macro that is at fault somehow. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix build with gnutls 1.0.x branch
From: Daniel P. Berrange berra...@redhat.com --- src/rpc/virnettlscontext.c | 15 +++ tests/virnettlscontexttest.c |2 +- 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index db03669..2a58ede 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -139,6 +139,15 @@ static int virNetTLSContextCheckCertTimes(gnutls_x509_crt_t cert, return 0; } + +#ifndef GNUTLS_1_0_COMPAT +/* + * The gnutls_x509_crt_get_basic_constraints function isn't + * available in GNUTLS 1.0.x branches. This isn't critical + * though, since gnutls_certificate_verify_peers2 will do + * pretty much the same check at runtime, so we can just + * disable this code + */ static int virNetTLSContextCheckCertBasicConstraints(gnutls_x509_crt_t cert, const char *certFile, bool isServer, @@ -180,6 +189,8 @@ static int virNetTLSContextCheckCertBasicConstraints(gnutls_x509_crt_t cert, return 0; } +#endif + static int virNetTLSContextCheckCertKeyUsage(gnutls_x509_crt_t cert, const char *certFile, @@ -412,9 +423,11 @@ static int virNetTLSContextCheckCert(gnutls_x509_crt_t cert, isServer, isCA) 0) return -1; +#ifndef GNUTLS_1_0_COMPAT if (virNetTLSContextCheckCertBasicConstraints(cert, certFile, isServer, isCA) 0) return -1; +#endif if (virNetTLSContextCheckCertKeyUsage(cert, certFile, isCA) 0) @@ -1019,11 +1032,13 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt, /* !sess-isServer, since on the client, we're validating the * server's cert, and on the server, the client's cert */ +#ifndef GNUTLS_1_0_COMPAT if (virNetTLSContextCheckCertBasicConstraints(cert, [session], !sess-isServer, false) 0) { gnutls_x509_crt_deinit(cert); goto authdeny; } +#endif if (virNetTLSContextCheckCertKeyUsage(cert, [session], false) 0) { diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c index f2af4f0..12ecf1e 100644 --- a/tests/virnettlscontexttest.c +++ b/tests/virnettlscontexttest.c @@ -33,7 +33,7 @@ #include command.h #include network.h -#if !defined WIN32 HAVE_LIBTASN1_H +#if !defined WIN32 HAVE_LIBTASN1_H !defined GNUTLS_1_0_COMPAT # include libtasn1.h # include gnutls/gnutls.h # include gnutls/x509.h -- 1.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix typos in virsh.pod file
From: Daniel P. Berrange berra...@redhat.com * tools/virsh.pod: Fix missing tag in docs --- tools/virsh.pod |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index 5b7fa9c..ed9eb93 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -798,7 +798,7 @@ value are kilobytes (i.e. blocks of 1024 bytes). =back =item Bblkiotune Idomain-id [I--weight Bweight] [[I--config] -[I--live] | [I--current]] +[I--live] | [I--current]] Display or set the blkio parameters. QEMU/KVM supports I--weight. I--weight is in range [100, 1000]. @@ -811,7 +811,7 @@ exclusive. If no flag is specified, behavior is different depending on hypervisor. =item Bsetvcpus Idomain-id Icount [I--maximum] [[I--config] -[I--live] | [I--current]] +[I--live] | [I--current]] Change the number of virtual CPUs active in a guest domain. By default, this command works on active guest domains. To change the settings for an -- 1.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On Tue, Jul 26, 2011 at 08:48, Daniel Veillard veill...@redhat.com wrote: As plannned we are entering the freeze for libvirt-0.9.4 . I have made a release candidate 1 tarball (and associated rpms) at ftp://libvirt.org/libvirt/libvirt-0.9.4-rc1.tar.gz This seems to pass my minimal tests without problems, but please give it a try too and report problems, I will probably make an rc2 on Thursday or Friday, and then the final release next Monday or Tuesday, thanks ! This fails on F-13 with: /bin/sh ../libtool --silent --tag=CC --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib -I../gnulib/lib -I../include -I../src/util -I../include -DIN_LIBVIRT-I../src/conf -I/usr/include/libxml2 -Wall -W -Wformat-y2k -Wformat-security -Winit-self -Wmissing-include-dirs -Wunused -Wunknown-pragmas -Wstrict-aliasing -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes -Wmissing-declarations -Wmissing-noreturn -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wvolatile-register-var -Wdisabled-optimization -Wbuiltin-macro-redefined -Wmudflap -Wpacked-bitfield-compat -Wsync-nand -Wattributes -Wcoverage-mismatch -Wmultichar -Wno-missing-field-initializers -Wno-sign-compare -Wframe-larger-than=4096 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-all --param=ssp-buffer-size=4 -fexceptions -fasynchronous-unwind-tables -fdiagnostics-show-option -funit-at-a-time-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c -o libvirt_driver_qemu_la-qemu_command.lo `test -f 'qemu/qemu_command.c' || echo './'`qemu/qemu_command.c In file included from qemu/qemu_command.c:40: ./network/bridge_driver.h:58:4: error: invalid preprocessing directive #defing -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv3 1/2] conf: add listen subelement to domain graphics element
On Mon, Jul 25, 2011 at 05:00:51AM -0400, Laine Stump wrote: Once it's plugged in, the listen element will be an optional replacement for the listen, port, tlsPort, and autoport attributes that graphics elements already have. If the listen type='address', it will have an attribute called 'address' which will contain an IP address or dns name that the guest's display server should listen on. If, however, type='network', the listen element should have an attribute called 'network' that will be set to the name of a network configuration to get the IP address from. * docs/schemas/domain.rng: updated to allow the listen element * docs/formatdomain.html.in: document the listen element and its attributes. * src/conf/domain_conf.[hc]: 1) The domain parser, formatter, and data structure are modified to support 0 or more listen subelements to each graphics element. The old style legacy attributes are also still accepted, and will be stored internally just as if they were a separate listen element. On output (i.e. format), the first listen element will be duplicated in the legacy attributes of the graphic element. 2) The following attributes have been removed from the unions in virDomainGRaphicsDef for graphics types vnc, rdp, and spice: listen port tlsPort autoport These attributes are all present in the listen subelement (aka virDomainGraphicsListenDef) I think it is a somewhat overkill to have 'autoport' be a setting per-listen element. I can't imagine people want a fixed port number on one IP addr, but a dynamic port number on another IP addr. So we could just keep that on the top level element. Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] network: Fix typo
Introduced by commit 239322cb, reported by Ruben Kerkhof. --- src/network/bridge_driver.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h index 518a5ba..4913126 100644 --- a/src/network/bridge_driver.h +++ b/src/network/bridge_driver.h @@ -55,7 +55,7 @@ int networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, # define networkAllocateActualDevice(iface) 0 # define networkNotifyActualDevice(iface) 0 # define networkReleaseActualDevice(iface) 0 -# defing networkGetNetworkAddress(netname, netaddr) (-2) +# define networkGetNetworkAddress(netname, netaddr) (-2) # define networkBuildDhcpDaemonCommandLine(network, cmdout, pidfile, dctx) 0 # endif -- 1.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: Fix typo
On Tue, Jul 26, 2011 at 08:25:10PM +0800, Osier Yang wrote: Introduced by commit 239322cb, reported by Ruben Kerkhof. --- src/network/bridge_driver.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h index 518a5ba..4913126 100644 --- a/src/network/bridge_driver.h +++ b/src/network/bridge_driver.h @@ -55,7 +55,7 @@ int networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, # define networkAllocateActualDevice(iface) 0 # define networkNotifyActualDevice(iface) 0 # define networkReleaseActualDevice(iface) 0 -# defing networkGetNetworkAddress(netname, netaddr) (-2) +# define networkGetNetworkAddress(netname, netaddr) (-2) # define networkBuildDhcpDaemonCommandLine(network, cmdout, pidfile, dctx) 0 # endif ACK Daniel -- |: http://berrange.com -o-http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] network: Fix typo
于 2011年07月26日 19:51, Daniel P. Berrange 写道: On Tue, Jul 26, 2011 at 08:25:10PM +0800, Osier Yang wrote: Introduced by commit 239322cb, reported by Ruben Kerkhof. --- src/network/bridge_driver.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h index 518a5ba..4913126 100644 --- a/src/network/bridge_driver.h +++ b/src/network/bridge_driver.h @@ -55,7 +55,7 @@ int networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network, # define networkAllocateActualDevice(iface) 0 # define networkNotifyActualDevice(iface) 0 # define networkReleaseActualDevice(iface) 0 -# defing networkGetNetworkAddress(netname, netaddr) (-2) +# define networkGetNetworkAddress(netname, netaddr) (-2) # define networkBuildDhcpDaemonCommandLine(network, cmdout, pidfile, dctx) 0 # endif ACK Daniel Thanks, pushed. Osier -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] doc: Add doc for blockpull and blockjob commands
Commit b31abc6f0 introduce commands blockpull and blockjob, but forgot to add the docs meanwhile. --- tools/virsh.pod | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index 5b7fa9c..02c98c8 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -430,6 +430,27 @@ Get memory stats for a running domain. Get block device size info for a domain. +=item Bblockpull Idomain Ipath [Ibandwidth] + +Populate a disk from its backing image. Once all data from its backing +image has been pulled, the disk no longer depends on the backing image. +It pulls data for the entire disk in the background, the process of the +operation can be checked with Bblockjob. + +Ipath specifies fully-qualified path of the disk. +Ibandwidth specifies copying bandwidth limit in Mbps. + +=item Bblockjob Idomain Ipath [I--abort] [I--info] [Ibandwidth] + +Manage active block operations. + +Ipath specifies fully-qualified path of the disk. +If I--live is specified, the active job on the specified disk will +be aborted. +If I--info is specified, the active job information on the specified +disk will be printed. +Ibandwidth can be used to set bandwidth limit for the active job. + =item Bdominfo Idomain-id Returns basic information about the domain. -- 1.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix typos in virsh.pod file
于 2011年07月26日 18:56, Daniel P. Berrange 写道: From: Daniel P. Berrangeberra...@redhat.com * tools/virsh.pod: Fix missing tag in docs --- tools/virsh.pod |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index 5b7fa9c..ed9eb93 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -798,7 +798,7 @@ value are kilobytes (i.e. blocks of 1024 bytes). =back =item Bblkiotune Idomain-id [I--weight Bweight] [[I--config] -[I--live] | [I--current]] +[I--live] | [I--current]] Display or set the blkio parameters. QEMU/KVM supports I--weight. I--weight is in range [100, 1000]. @@ -811,7 +811,7 @@ exclusive. If no flag is specified, behavior is different depending on hypervisor. =item Bsetvcpus Idomain-id Icount [I--maximum] [[I--config] -[I--live] | [I--current]] +[I--live] | [I--current]] Change the number of virtual CPUs active in a guest domain. By default, this command works on active guest domains. To change the settings for an ACK Osier -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH v3] Add support for fd: protocol
sVirt provides SELinux MAC isolation for Qemu guest processes and their corresponding resources (image files). sVirt provides this support by labeling guests and resources with security labels that are stored in file system extended attributes. Some file systems, such as NFS, do not support the extended attribute security namespace, which is needed for image file isolation when using the sVirt SELinux security driver in libvirt. The proposed solution entails a combination of Qemu, libvirt, and SELinux patches that work together to isolate multiple guests' images when they're stored in the same NFS mount. This results in an environment where sVirt isolation and NFS image file isolation can both be provided. This patch contains the Qemu code to support this solution. I would like to solicit input from the libvirt community prior to starting the libvirt patch. Currently, Qemu opens an image file in addition to performing the necessary read and write operations. The proposed solution will move the open out of Qemu and into libvirt. Once libvirt opens an image file for the guest, it will pass the file descriptor to Qemu via a new fd: protocol. If the image file resides in an NFS mount, the following SELinux policy changes will provide image isolation: - A new SELinux boolean is created (e.g. virt_read_write_nfs) to allow Qemu (svirt_t) to only have SELinux read and write permissions on nfs_t files - Qemu (svirt_t) also gets SELinux use permissions on libvirt (virtd_t) file descriptors Following is a sample invocation of Qemu using the fd: protocol on the command line: qemu -drive file=fd:4,format=qcow2 The fd: protocol is also supported by the drive_add monitor command. This requires that the specified file descriptor is passed to the monitor alongside a prior getfd monitor command. There are some additional features provided by certain image types where Qemu reopens the image file. All of these scenarios will be unsupported for the fd: protocol, at least for this patch: - The -snapshot command line option - The savevm monitor command - The snapshot_blkdev monitor command - Use of copy-on-write image files - The -cdrom command line option - The -drive command line option with media=cdrom - The change monitor command The thought is that this support can be added in the future, but is not required for the initial fd: support. This patch was tested with the following formats: raw, cow, qcow, qcow2, qed, and vmdk, using the fd: protocol from the command line and the monitor. Tests were also run to verify existing file name support and qemu-img were not regressed. Non-valid file descriptors, fd: without format, snapshot and backing files, and cdrom were also tested. v2: - Add drive_add monitor command support - Fence off unsupported features that re-open image file v3: - Fence off cdrom and change monitor command support Signed-off-by: Corey Bryant cor...@linux.vnet.ibm.com --- block.c | 16 ++ block.h |1 + block/cow.c |5 +++ block/qcow.c |5 +++ block/qcow2.c |5 +++ block/qed.c |4 ++ block/raw-posix.c | 81 +++-- block/vmdk.c |5 +++ block_int.h |1 + blockdev.c| 19 monitor.c |5 +++ monitor.h |1 + qemu-options.hx |8 +++-- qemu-tool.c |5 +++ 14 files changed, 149 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 24a25d5..500db84 100644 --- a/block.c +++ b/block.c @@ -536,6 +536,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} + /* if snapshot, we create a temporary backing file and open it instead of opening 'filename' directly */ @@ -585,6 +589,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, /* Find the right image format driver */ if (!drv) { +/* format must be specified for fd: protocol */ +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} ret = find_image_format(filename, drv); } @@ -1460,6 +1468,11 @@ int bdrv_enable_write_cache(BlockDriverState *bs) return bs-enable_write_cache; } +int bdrv_is_fd_protocol(BlockDriverState *bs) +{ +return bs-fd_protocol; +} + /* XXX: no longer used */ void bdrv_set_change_cb(BlockDriverState *bs, void (*change_cb)(void *opaque, int reason), @@ -1964,6 +1977,9 @@ int bdrv_snapshot_create(BlockDriverState *bs, BlockDriver *drv = bs-drv; if (!drv) return -ENOMEDIUM; +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} if (drv-bdrv_snapshot_create) return drv-bdrv_snapshot_create(bs, sn_info); if (bs-file)
Re: [libvirt] [PATCH] Fix build with gnutls 1.0.x branch
On Tue, Jul 26, 2011 at 11:56:19AM +0100, Daniel P. Berrange wrote: From: Daniel P. Berrange berra...@redhat.com --- src/rpc/virnettlscontext.c | 15 +++ tests/virnettlscontexttest.c |2 +- 2 files changed, 16 insertions(+), 1 deletions(-) diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index db03669..2a58ede 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -139,6 +139,15 @@ static int virNetTLSContextCheckCertTimes(gnutls_x509_crt_t cert, return 0; } + +#ifndef GNUTLS_1_0_COMPAT +/* + * The gnutls_x509_crt_get_basic_constraints function isn't + * available in GNUTLS 1.0.x branches. This isn't critical + * though, since gnutls_certificate_verify_peers2 will do + * pretty much the same check at runtime, so we can just + * disable this code + */ static int virNetTLSContextCheckCertBasicConstraints(gnutls_x509_crt_t cert, const char *certFile, bool isServer, @@ -180,6 +189,8 @@ static int virNetTLSContextCheckCertBasicConstraints(gnutls_x509_crt_t cert, return 0; } +#endif + static int virNetTLSContextCheckCertKeyUsage(gnutls_x509_crt_t cert, const char *certFile, @@ -412,9 +423,11 @@ static int virNetTLSContextCheckCert(gnutls_x509_crt_t cert, isServer, isCA) 0) return -1; +#ifndef GNUTLS_1_0_COMPAT if (virNetTLSContextCheckCertBasicConstraints(cert, certFile, isServer, isCA) 0) return -1; +#endif if (virNetTLSContextCheckCertKeyUsage(cert, certFile, isCA) 0) @@ -1019,11 +1032,13 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt, /* !sess-isServer, since on the client, we're validating the * server's cert, and on the server, the client's cert */ +#ifndef GNUTLS_1_0_COMPAT if (virNetTLSContextCheckCertBasicConstraints(cert, [session], !sess-isServer, false) 0) { gnutls_x509_crt_deinit(cert); goto authdeny; } +#endif if (virNetTLSContextCheckCertKeyUsage(cert, [session], false) 0) { diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c index f2af4f0..12ecf1e 100644 --- a/tests/virnettlscontexttest.c +++ b/tests/virnettlscontexttest.c @@ -33,7 +33,7 @@ #include command.h #include network.h -#if !defined WIN32 HAVE_LIBTASN1_H +#if !defined WIN32 HAVE_LIBTASN1_H !defined GNUTLS_1_0_COMPAT # include libtasn1.h # include gnutls/gnutls.h # include gnutls/x509.h ACK, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix typos in virsh.pod file
On Tue, Jul 26, 2011 at 11:56:30AM +0100, Daniel P. Berrange wrote: From: Daniel P. Berrange berra...@redhat.com * tools/virsh.pod: Fix missing tag in docs --- tools/virsh.pod |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index 5b7fa9c..ed9eb93 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -798,7 +798,7 @@ value are kilobytes (i.e. blocks of 1024 bytes). =back =item Bblkiotune Idomain-id [I--weight Bweight] [[I--config] -[I--live] | [I--current]] +[I--live] | [I--current]] Display or set the blkio parameters. QEMU/KVM supports I--weight. I--weight is in range [100, 1000]. @@ -811,7 +811,7 @@ exclusive. If no flag is specified, behavior is different depending on hypervisor. =item Bsetvcpus Idomain-id Icount [I--maximum] [[I--config] -[I--live] | [I--current]] +[I--live] | [I--current]] Change the number of virtual CPUs active in a guest domain. By default, this command works on active guest domains. To change the settings for an ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On Tue, Jul 26, 2011 at 01:02:21PM +0200, Ruben Kerkhof wrote: On Tue, Jul 26, 2011 at 08:48, Daniel Veillard veill...@redhat.com wrote: This fails on F-13 with: [...] In file included from qemu/qemu_command.c:40: ./network/bridge_driver.h:58:4: error: invalid preprocessing directive #defing Ah this was compiled without network in some ways Osier already fixed this in git, thanks for the report ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC PATCH 0/5] Support online resizing of block devices.
On 07/25/2011 11:51 PM, Osier Yang wrote: This patch series introduce new API virDomainBlockResize to expose qemu monitor command block_size, which is for resizing the a block device while the domain is running. The prototype for the new API is: int virDomainBlockResize (virDomainPtr dom, const char *path, unsigned long long size, unsigned int flags) Sounds nice, but it missed the rc1 freeze. This will have to wait for 0.9.5. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [PATCH v3] Add support for fd: protocol
I have to say I really hate it. We've been working hard on getting rid of special cases in the qemu block layer, and this sprinkles them all over. I'd recommend to fix your security model instead. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3] Add support for fd: protocol
On 07/26/2011 06:51 AM, Corey Bryant wrote: There are some additional features provided by certain image types where Qemu reopens the image file. All of these scenarios will be unsupported for the fd: protocol, at least for this patch: - The -snapshot command line option - The savevm monitor command - The snapshot_blkdev monitor command - Use of copy-on-write image files - The -cdrom command line option - The -drive command line option with media=cdrom - The change monitor command The thought is that this support can be added in the future, but is not required for the initial fd: support. Libvirt will eventually need support for fd passing on savevm, snapshot_blkdev, and change monitor commands, as well as for -cdrom, before this feature can be used to provide the desired security enhancements. I agree that for an incremental patch, you don't have to solve all points at once, but until all places have been modified to support fd usage, you aren't gaining any security, except for severely constrained guests. Furthermore, how do you plan to map fd: to filename? There's already been big threads on why snapshot_blkdev needs both the new fd: and the name of the old backing file at the same time, so that qemu can write the correct headers into new qcow2 files. But your proposal precludes that, since qemu -drive file=fd:4,format=qcow2 is not letting qemu know the file name of fd:4 that would later have to be written into a qcow2 header. I'm afraid that we need a better solution that gets both fd and filename mapped together, before this stands a chance of being useful. That said, I'm strongly in favor of getting the open() burden moved out of qemu into libvirt, because of the potential it has for increased security. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [PATCH v3] Add support for fd: protocol
On 07/26/2011 07:02 AM, Christoph Hellwig wrote: I have to say I really hate it. We've been working hard on getting rid of special cases in the qemu block layer, and this sprinkles them all over. I'd recommend to fix your security model instead. What is it that you hate - the particular qemu implementation expressed by this patch (in which case, we're all ears for a better implementation), or the need for fd passing (which libvirt is strongly in favor of, and which there really is no other way to fix the security model to work well with file systems like NFS that lack per-file labels)? In my mind, increased security trumps poor aesthetics - if the patch really does make it possible to enhance security, then the special casing to support the patch is worth it. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [PATCH v3] Add support for fd: protocol
Am 26.07.2011 15:02, schrieb Christoph Hellwig: I have to say I really hate it. We've been working hard on getting rid of special cases in the qemu block layer, and this sprinkles them all over. I'd recommend to fix your security model instead. I think the problem here is more with the implementation that with the intention. I agree that you just can't do this. A patch adding support for a fd: protocol should touch block/fd.c and nothing else. You can add some supporting patches that extend the generic block layer to support e.g. formats that can't reopen. However, if you touch the code of other block drivers, you're doing it wrong. Kevin -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] set cpu bandwidth for the vm
At 07/26/2011 06:24 PM, Daniel P. Berrange write: On Mon, Jul 25, 2011 at 01:37:14PM +0800, Wen Congyang wrote: The cpu bandwidth is applied at the vcpu group level. We should apply it at the vm group level too, because the vm may do heavy I/O, and it will affect the other vm. We apply cpu bandwidth at the vcpu and the vm group level, so we must ensure that max(child_quota)= parent_quota when we modify cpu bandwidth. Ahh, interesting problem ! --- src/qemu/qemu_cgroup.c | 38 ++--- src/qemu/qemu_driver.c | 103 --- 2 files changed, 101 insertions(+), 40 deletions(-) ACK Thanks, pushed. Daniel -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3] Add support for fd: protocol
Am 26.07.2011 16:00, schrieb Eric Blake: On 07/26/2011 06:51 AM, Corey Bryant wrote: There are some additional features provided by certain image types where Qemu reopens the image file. All of these scenarios will be unsupported for the fd: protocol, at least for this patch: - The -snapshot command line option - The savevm monitor command - The snapshot_blkdev monitor command - Use of copy-on-write image files - The -cdrom command line option - The -drive command line option with media=cdrom - The change monitor command The thought is that this support can be added in the future, but is not required for the initial fd: support. Libvirt will eventually need support for fd passing on savevm, snapshot_blkdev, and change monitor commands, as well as for -cdrom, before this feature can be used to provide the desired security enhancements. I agree that for an incremental patch, you don't have to solve all points at once, but until all places have been modified to support fd usage, you aren't gaining any security, except for severely constrained guests. Furthermore, how do you plan to map fd: to filename? There's already been big threads on why snapshot_blkdev needs both the new fd: and the name of the old backing file at the same time, so that qemu can write the correct headers into new qcow2 files. That's a problem to solve in snapshot_blkdev, not in -drive. In general qemu doesn't need and shouldn't know the file name if it's meant to use an fd. Kevin -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] bandwidth: Integrate bandwidth into portgroups
Every DomainNetDef has a bandwidth, as does every portgroup. Whenever a DomainNetDef of type NETWORK is about to be used, a call is made to networkAllocateActualDevice(). This function chooses the best bandwidth object and places it in the DomainActualNetDef. From that point on, whenever some code needs to use the bandwidth data for the interface, it's retrieved with virDomainNetGetActualBandwidth(), which will always return the best info as determined in the previous step. --- docs/formatnetwork.html.in |2 + src/conf/domain_conf.c | 25 ++- src/conf/domain_conf.h |3 ++ src/conf/network_conf.c | 10 +++ src/conf/network_conf.h |1 + src/libvirt_private.syms|1 + src/network/bridge_driver.c | 19 +- src/util/network.c | 56 +++ src/util/network.h |2 + 9 files changed, 116 insertions(+), 3 deletions(-) diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index f0ff703..ddfa77c 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -129,6 +129,8 @@ numbers, The units for codeaverage/code and codepeak/code attributes are kilobytes per second, and for the codeburst/code just kilobytes. The rate is shared equally within domains connected to the network. +Moreover, codebandwidth/code element can be included in +codeportgroup/code element. span class=sinceSince 0.9.4/span /p diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 072c970..031862a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -753,6 +753,8 @@ virDomainActualNetDefFree(virDomainActualNetDefPtr def) break; } +virBandwidthDefFree(def-bandwidth); + VIR_FREE(def); } @@ -2621,6 +2623,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node, virDomainActualNetDefPtr actual = NULL; int ret = -1; xmlNodePtr save_ctxt = ctxt-node; +xmlNodePtr bandwidth_node = NULL; char *type = NULL; char *mode = NULL; @@ -2677,6 +2680,11 @@ virDomainActualNetDefParseXML(xmlNodePtr node, } } +bandwidth_node = virXPathNode(./bandwidth, ctxt); +if (bandwidth_node +!(actual-bandwidth = virBandwidthDefParseNode(bandwidth_node))) +goto error; + *def = actual; actual = NULL; ret = 0; @@ -8713,6 +8721,10 @@ virDomainActualNetDefFormat(virBufferPtr buf, default: break; } + +if (virBandwidthDefFormat(buf, def-bandwidth, ) 0) +goto error; + virBufferAddLit(buf, /actual\n); ret = 0; @@ -8855,7 +8867,8 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAddLit(buf, /tune\n); } -if (virBandwidthDefFormat(buf, def-bandwidth, ) 0) +if (virBandwidthDefFormat(buf, virDomainNetGetActualBandwidth(def), +) 0) return -1; if (virDomainDeviceInfoFormat(buf, def-info, flags) 0) @@ -11383,3 +11396,13 @@ virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface) return NULL; return iface-data.network.actual-data.direct.virtPortProfile; } + +virBandwidthPtr +virDomainNetGetActualBandwidth(virDomainNetDefPtr iface) +{ +if ((iface-type == VIR_DOMAIN_NET_TYPE_NETWORK) +iface-data.network.actual iface-data.network.actual-bandwidth) { +return iface-data.network.actual-bandwidth; +} +return iface-bandwidth; +} diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 212f0c5..715d995 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -362,6 +362,7 @@ struct _virDomainActualNetDef { virVirtualPortProfileParamsPtr virtPortProfile; } direct; } data; +virBandwidthPtr bandwidth; }; /* Stores the virtual network interface configuration */ @@ -1490,6 +1491,8 @@ char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface); int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface); virVirtualPortProfileParamsPtr virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface); +virBandwidthPtr +virDomainNetGetActualBandwidth(virDomainNetDefPtr iface); int virDomainControllerInsert(virDomainDefPtr def, virDomainControllerDefPtr controller); diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 1ef80dc..6714c20 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -92,6 +92,8 @@ virPortGroupDefClear(virPortGroupDefPtr def) { VIR_FREE(def-name); VIR_FREE(def-virtPortProfile); +virBandwidthDefFree(def-bandwidth); +def-bandwidth = NULL; } static void @@ -771,6 +773,7 @@ virNetworkPortGroupParseXML(virPortGroupDefPtr def, xmlNodePtr save; xmlNodePtr virtPortNode; +xmlNodePtr bandwidth_node; char *isDefault = NULL; int result = -1; @@ -790,6 +793,12 @@
Re: [libvirt] [Qemu-devel] [PATCH v3] Add support for fd: protocol
On 07/26/2011 10:05 AM, Kevin Wolf wrote: Am 26.07.2011 15:02, schrieb Christoph Hellwig: I have to say I really hate it. We've been working hard on getting rid of special cases in the qemu block layer, and this sprinkles them all over. I'd recommend to fix your security model instead. I think the problem here is more with the implementation that with the intention. I agree that you just can't do this. A patch adding support for a fd: protocol should touch block/fd.c and nothing else. You can add some supporting patches that extend the generic block layer to support e.g. formats that can't reopen. However, if you touch the code of other block drivers, you're doing it wrong. Kevin I'll look into this approach, but on the surface it seems like this could prevent a lot of code reuse in block/raw-posix.c. Regards, Corey -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv3 1/2] conf: add listen subelement to domain graphics element
On 07/26/2011 07:35 AM, Daniel P. Berrange wrote: On Mon, Jul 25, 2011 at 05:00:51AM -0400, Laine Stump wrote: Once it's plugged in, thelisten element will be an optional replacement for the listen, port, tlsPort, and autoport attributes that graphics elements already have. If thelisten type='address', it will have an attribute called 'address' which will contain an IP address or dns name that the guest's display server should listen on. If, however, type='network', thelisten element should have an attribute called 'network' that will be set to the name of a network configuration to get the IP address from. * docs/schemas/domain.rng: updated to allow thelisten element * docs/formatdomain.html.in: document thelisten element and its attributes. * src/conf/domain_conf.[hc]: 1) The domain parser, formatter, and data structure are modified to support 0 or morelisten subelements to eachgraphics element. The old style legacy attributes are also still accepted, and will be stored internally just as if they were a separatelisten element. On output (i.e. format), the first listen element will be duplicated in the legacy attributes of thegraphic element. 2) The following attributes have been removed from the unions in virDomainGRaphicsDef for graphics types vnc, rdp, and spice: listen port tlsPort autoport These attributes are all present in thelisten subelement (aka virDomainGraphicsListenDef) I think it is a somewhat overkill to have 'autoport' be a setting per-listen element. I can't imagine people want a fixed port number on one IP addr, but a dynamic port number on another IP addr. So we could just keep that on the top level element. Although I agree with you for config purposes, it looks to me like the real use of autoport is that in the live XML it allows differentiating between ports that were manually specified and those that were automatically allocated (really, that seems like its main purpose, since simply not giving a port also implies autoport). If we have only a single autoport attribute for all the listens, we'll have to put in extra code that makes sure if they specify port for one listen, they do it for all of them. Otherwise there will be no way to know which ports to strip out when writing the inactive XML (since the same attribute is used for config and status)... So really, nobody should ever need to explicitly say autoport='yes' anywhere in their config anyway, it just happens when they don't give any port='...'. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [PATCH v3] Add support for fd: protocol
Am 26.07.2011 16:46, schrieb Corey Bryant: On 07/26/2011 10:05 AM, Kevin Wolf wrote: Am 26.07.2011 15:02, schrieb Christoph Hellwig: I have to say I really hate it. We've been working hard on getting rid of special cases in the qemu block layer, and this sprinkles them all over. I'd recommend to fix your security model instead. I think the problem here is more with the implementation that with the intention. I agree that you just can't do this. A patch adding support for a fd: protocol should touch block/fd.c and nothing else. You can add some supporting patches that extend the generic block layer to support e.g. formats that can't reopen. However, if you touch the code of other block drivers, you're doing it wrong. I'll look into this approach, but on the surface it seems like this could prevent a lot of code reuse in block/raw-posix.c. What I meant here is more about modifying qcow2, VMDK etc. I still need to look into the details of what you share with raw-posix.c. Kevin -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Fix race in ref counting when handling RPC jobs
From: Daniel P. Berrange berra...@redhat.com When an incoming RPC message is ready for processing, virNetServerClientDispatchRead() will invoke the 'dispatchFunc' callback. This is set to virNetServerDispatchNewMessage This function puts the message + client in a queue for processing by the thread pool. The thread pool worker function is virNetServerHandleJob The first thing this does is acquire an extra reference on the 'client'. Unfortunately, between the time the message+client are put on the thread pool queue, and the time the worker runs, the client object may have had its last reference removed. We clearly need to add the reference to the client object before putting the client on the processing queue * src/rpc/virnetserverclient.c: Add a reference to the client when invoking the dispatch function * src/rpc/virnetserver.c: Don't acquire a reference to the client when in the worker thread --- src/rpc/virnetserver.c |2 -- src/rpc/virnetserverclient.c |2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index 2b9dd4d..c93c3f8 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -131,8 +131,6 @@ static void virNetServerHandleJob(void *jobOpaque, void *opaque) virNetServerProgramPtr prog = NULL; size_t i; -virNetServerClientRef(job-client); - virNetServerLock(srv); VIR_DEBUG(server=%p client=%p message=%p, srv, job-client, job-msg); diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index 317d59c..3c0dba8 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -763,10 +763,12 @@ readmore: /* Send off to for normal dispatch to workers */ if (msg) { +client-refs++; if (!client-dispatchFunc || client-dispatchFunc(client, msg, client-dispatchOpaque) 0) { virNetMessageFree(msg); client-wantClose = true; +client-refs--; return; } } -- 1.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Fix race in ref counting when handling RPC jobs
On 07/26/2011 08:56 AM, Daniel P. Berrange wrote: From: Daniel P. Berrangeberra...@redhat.com When an incoming RPC message is ready for processing, virNetServerClientDispatchRead() will invoke the 'dispatchFunc' callback. This is set to virNetServerDispatchNewMessage This function puts the message + client in a queue for processing by the thread pool. The thread pool worker function is virNetServerHandleJob The first thing this does is acquire an extra reference on the 'client'. Unfortunately, between the time the message+client are put on the thread pool queue, and the time the worker runs, the client object may have had its last reference removed. We clearly need to add the reference to the client object before putting the client on the processing queue ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] Build: fix build if HAVE_AVAHI is not defined
Fix the build if HAVE_AVAHI is not defined. Signed-off-by: Stefan Berger stef...@linux.vnet.ibm.com --- src/rpc/virnetserver.c |2 ++ 1 file changed, 2 insertions(+) Index: libvirt-acl/src/rpc/virnetserver.c === --- libvirt-acl.orig/src/rpc/virnetserver.c +++ libvirt-acl/src/rpc/virnetserver.c @@ -783,7 +783,9 @@ void virNetServerFree(virNetServerPtr sr VIR_FREE(srv-clients); VIR_FREE(srv-mdnsGroupName); +#if HAVE_AVAHI virNetServerMDNSFree(srv-mdns); +#endif #if HAVE_DBUS if (srv-sysbus) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Build: fix build if HAVE_AVAHI is not defined
On 07/26/2011 09:11 AM, Stefan Berger wrote: Fix the build if HAVE_AVAHI is not defined. Signed-off-by: Stefan Berger stef...@linux.vnet.ibm.com --- src/rpc/virnetserver.c | 2 ++ 1 file changed, 2 insertions(+) Index: libvirt-acl/src/rpc/virnetserver.c === --- libvirt-acl.orig/src/rpc/virnetserver.c +++ libvirt-acl/src/rpc/virnetserver.c @@ -783,7 +783,9 @@ void virNetServerFree(virNetServerPtr sr VIR_FREE(srv-clients); VIR_FREE(srv-mdnsGroupName); +#if HAVE_AVAHI virNetServerMDNSFree(srv-mdns); +#endif ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3] Add support for fd: protocol
Am 26.07.2011 14:51, schrieb Corey Bryant: sVirt provides SELinux MAC isolation for Qemu guest processes and their corresponding resources (image files). sVirt provides this support by labeling guests and resources with security labels that are stored in file system extended attributes. Some file systems, such as NFS, do not support the extended attribute security namespace, which is needed for image file isolation when using the sVirt SELinux security driver in libvirt. The proposed solution entails a combination of Qemu, libvirt, and SELinux patches that work together to isolate multiple guests' images when they're stored in the same NFS mount. This results in an environment where sVirt isolation and NFS image file isolation can both be provided. This patch contains the Qemu code to support this solution. I would like to solicit input from the libvirt community prior to starting the libvirt patch. Currently, Qemu opens an image file in addition to performing the necessary read and write operations. The proposed solution will move the open out of Qemu and into libvirt. Once libvirt opens an image file for the guest, it will pass the file descriptor to Qemu via a new fd: protocol. If the image file resides in an NFS mount, the following SELinux policy changes will provide image isolation: - A new SELinux boolean is created (e.g. virt_read_write_nfs) to allow Qemu (svirt_t) to only have SELinux read and write permissions on nfs_t files - Qemu (svirt_t) also gets SELinux use permissions on libvirt (virtd_t) file descriptors Following is a sample invocation of Qemu using the fd: protocol on the command line: qemu -drive file=fd:4,format=qcow2 The fd: protocol is also supported by the drive_add monitor command. This requires that the specified file descriptor is passed to the monitor alongside a prior getfd monitor command. There are some additional features provided by certain image types where Qemu reopens the image file. All of these scenarios will be unsupported for the fd: protocol, at least for this patch: - The -snapshot command line option - The savevm monitor command - The snapshot_blkdev monitor command - Use of copy-on-write image files - The -cdrom command line option - The -drive command line option with media=cdrom - The change monitor command The thought is that this support can be added in the future, but is not required for the initial fd: support. This patch was tested with the following formats: raw, cow, qcow, qcow2, qed, and vmdk, using the fd: protocol from the command line and the monitor. Tests were also run to verify existing file name support and qemu-img were not regressed. Non-valid file descriptors, fd: without format, snapshot and backing files, and cdrom were also tested. v2: - Add drive_add monitor command support - Fence off unsupported features that re-open image file v3: - Fence off cdrom and change monitor command support Signed-off-by: Corey Bryant cor...@linux.vnet.ibm.com --- block.c | 16 ++ block.h |1 + block/cow.c |5 +++ block/qcow.c |5 +++ block/qcow2.c |5 +++ block/qed.c |4 ++ block/raw-posix.c | 81 +++-- block/vmdk.c |5 +++ block_int.h |1 + blockdev.c| 19 monitor.c |5 +++ monitor.h |1 + qemu-options.hx |8 +++-- qemu-tool.c |5 +++ 14 files changed, 149 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 24a25d5..500db84 100644 --- a/block.c +++ b/block.c @@ -536,6 +536,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} Hm, shouldn't that just work even with fd? + /* if snapshot, we create a temporary backing file and open it instead of opening 'filename' directly */ @@ -585,6 +589,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, /* Find the right image format driver */ if (!drv) { +/* format must be specified for fd: protocol */ +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} This isn't really required to make fd work. ret = find_image_format(filename, drv); } @@ -1460,6 +1468,11 @@ int bdrv_enable_write_cache(BlockDriverState *bs) return bs-enable_write_cache; } +int bdrv_is_fd_protocol(BlockDriverState *bs) +{ +return bs-fd_protocol; +} The generic block layer shouldn't have any special cases based on the format driver. If you need to do something different for fd, think about what property of fd it is that requires the special case
Re: [libvirt] [PATCH 1/1] Fix incorrect implication about list options
On 07/25/2011 09:20 PM, Dave Allan wrote: The description of the list command seemed to suggest that it could take a set of domains as an argument, which is not correct in the current HEAD. If virsh list is intended to take a list of domains, then this patch should be NAK'd and a bug opened against virsh list. Reported by hachi on #virt v2: Change language to include transient domains +++ b/tools/virsh.pod @@ -268,7 +268,7 @@ Inject NMI to the guest. =item Blist [I--inactive | I--all] -Prints information about one or more domains. If no domains are +Prints information about existing domains. If no options are specified it prints out information about running domains. ACK and applied. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Build: fix build if HAVE_AVAHI is not defined
On 07/26/2011 11:12 AM, Eric Blake wrote: On 07/26/2011 09:11 AM, Stefan Berger wrote: Fix the build if HAVE_AVAHI is not defined. Signed-off-by: Stefan Berger stef...@linux.vnet.ibm.com --- src/rpc/virnetserver.c | 2 ++ 1 file changed, 2 insertions(+) Index: libvirt-acl/src/rpc/virnetserver.c === --- libvirt-acl.orig/src/rpc/virnetserver.c +++ libvirt-acl/src/rpc/virnetserver.c @@ -783,7 +783,9 @@ void virNetServerFree(virNetServerPtr sr VIR_FREE(srv-clients); VIR_FREE(srv-mdnsGroupName); +#if HAVE_AVAHI virNetServerMDNSFree(srv-mdns); +#endif ACK. Pushed. Stefan -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: Remove bogus codes in function getCompressionType
On 07/26/2011 01:04 AM, Osier Yang wrote: The error will never be reported, remove the codes, and also improve the docs in qemu.conf to tell user the truth. --- src/qemu/qemu.conf |4 src/qemu/qemu_driver.c | 16 +--- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf index 145062c..75d945b 100644 --- a/src/qemu/qemu.conf +++ b/src/qemu/qemu.conf @@ -199,6 +199,10 @@ # save_image_format is used when you use 'virsh save' at scheduled saving. # dump_image_format is used when you use 'virsh dump' at emergency crashdump. # +# If the specified format is not valid (the valid formats are raw, lzop, +# gzip, bzip2, and xz), or the compress program is not available, raw It's a maintenance nightmare to document the list of compression types twice, especially when it appears only one paragraph earlier. The current wording ties the earlier list to only save_image_format, so a better approach is one that makes it clear that a single list is good for both variables. Maybe a better wording would be: # The default format for Qemu/KVM guest save images is raw; that is, the # memory from the domain is dumped out directly to a file. If you have # guests with a large amount of memory, however, this can take up quite # a bit of space. If you would like to compress the images while they # are being saved to disk, you can also set lzop, gzip, bzip2, or # xz for either image variable. Note that this means you slow down # the process of saving a domain in order to save disk space; the list # above is in descending order by performance and ascending order by # compression ratio. # # save_image_format is used when you use 'virsh save' at scheduled # saving, and it is an error if the requested compression is not found. # # dump_image_format is used when you use 'virsh dump' at emergency # crashdump, and if the requested compression is not found, this falls # back to raw compression. # +# will be used as the format silently without error or warning. Can we at least get a log message? It could be nice when inspecting a dump file to learn why it was not compressed, by then reading the log file and seeing a message that: +/* Use raw as the format if the specified format is not valid, + * or the compress program is not available, + */ +if (compress 0) return QEMUD_SAVE_FORMAT_RAW; the requested qemu.conf format was invalid, or -} -if (!qemudCompressProgramAvailable(compress)) { -qemuReportError(VIR_ERR_OPERATION_FAILED, -%s, _(Compression program for dump image format -in configuration file isn't available, -using raw)); +if (!qemudCompressProgramAvailable(compress)) return QEMUD_SAVE_FORMAT_RAW; the requested compression is valid, but not found on the machine. I agree that qemuReportError() is not the right approach, since we are proceeding with raw as the fallback, but silence instead of a log message about why we used the fallback is not ideal. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tools: format percent strings of nodecpustats
On 07/26/2011 01:32 AM, Alex Jia wrote: * tools/virsh.c: format strings display for virsh nodecpustats --percent. * how to reproduce? % virsh nodecpustats --percent usage:2.0% user : 1.0% system: 1.0% idle : 98.0% iowait: 0.0% Yuck. ACK that we need to fix this. * after format strings % virsh nodecpustats --percent usage : 2.0% user : 1.0% system: 1.0% idle : 98.0% iowait: 0.0% Still yuck. Now we have some cases with two fields, and some with three, making this harder to machine parse. Better would be: % virsh nodecpustats --percent usage:2.0% user: 1.0% system: 1.0% idle:98.0% iowait: 0.0% vshPrint(ctl, %-15s %5.1lf%%\n, - _(usage:), usage); + _(usage :), usage); By _always_ sticking the : directly by the text, translators don't have to realize that the whitespace in the string being translated was intended to be significant for alignment purposes (that is, alignment should always be done independently of translations, whereas your solution was only aligned for English). Also, it better matches the behavior of 'virsh dominfo', which also has aligned fields but does not line up the colons. Here's what I squashed in before pushing: diff --git i/tools/virsh.c w/tools/virsh.c index d08b78f..113124f 100644 --- i/tools/virsh.c +++ w/tools/virsh.c @@ -4438,9 +4438,9 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) if (!flag_percent) { if (!flag_utilization) { -vshPrint(ctl, %-15s %20llu\n, _(user :), cpu_stats[0].user); +vshPrint(ctl, %-15s %20llu\n, _(user:), cpu_stats[0].user); vshPrint(ctl, %-15s %20llu\n, _(system:), cpu_stats[0].sys); -vshPrint(ctl, %-15s %20llu\n, _(idle :), cpu_stats[0].idle); +vshPrint(ctl, %-15s %20llu\n, _(idle:), cpu_stats[0].idle); vshPrint(ctl, %-15s %20llu\n, _(iowait:), cpu_stats[0].iowait); } } else { @@ -4448,7 +4448,7 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) usage = cpu_stats[0].util; vshPrint(ctl, %-15s %5.1lf%%\n, _(usage:), usage); -vshPrint(ctl, %-15s %5.1lf%%\n, _(idle :), 100 - usage); +vshPrint(ctl, %-15s %5.1lf%%\n, _(idle:), 100 - usage); } else { user_time = cpu_stats[1].user - cpu_stats[0].user; sys_time= cpu_stats[1].sys- cpu_stats[0].sys; @@ -4459,13 +4459,13 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) usage = (user_time + sys_time) / total_time * 100; vshPrint(ctl, %-15s %5.1lf%%\n, - _(usage :), usage); + _(usage:), usage); vshPrint(ctl, %-15s %5.1lf%%\n, - _(user :), user_time / total_time * 100); + _(user:), user_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, _(system:), sys_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, - _(idle :), idle_time / total_time * 100); + _(idle:), idle_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, _(iowait:), iowait_time / total_time * 100); } -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] FYI: qemu -M option deprecated upstream, removed from -help output
On 07/26/2011 02:53 AM, Paolo Bonzini wrote: On 07/25/2011 10:22 PM, Eric Blake wrote: As long as QEMU supports -M ? it should not be a problem. The -M option is not scraped from -help output. If -M is going away, then libvirt _should_ scrape -help output to see whether to use -M or -machine, rather than blindly using -M. -M going away will take a while (and will likely never happen). While that may be true, we've already been bitten in the past by using undocumented commands. See for example commit e997c268efd, where qemu-img silently quit supporting -e, but libvirt had been using it under the assumption that it would continue to work. I'll work up a patch for this. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] gnulib compiler warning detection broken on RHEL5 autoconf
On 07/26/2011 04:45 AM, Daniel P. Berrange wrote: I was wondering why I didn't see any compile warnings from the broken gnutls code on RHEL5 when I noticed that we were building without any compiler warning flags at all. It seems configure fails on RHEL5 vintage autoconf checking whether compiler handles -Wall... ./configure: line 75468: ${$as_gl_Warn+set}: bad substitution Yuck. I'll take a look (it may be that older autoconf has a bug, and I merely need to backport a workaround for that bug fix). I'm guessing it is the gl_WARN_ADD() macro that is at fault somehow. Very possible, in fact, it may be a case of gl_WARN_ADD using an autoconf macro and assuming newer semantics, where a bit more work is needed to guarantee support with autoconf 2.59. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
I have this failure for bsd: rpc/virnetserver.c:786: error: 'virNetServer' has no member named 'mdns' gmake[3]: *** [libvirt_net_rpc_server_la-virnetserver.lo] Error 1 gmake[3]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/src' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/src' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4' gmake: *** [all] Error 2 *** Error code 1 -jgh -- Jason Helfman System Administrator experts-exchange.com http://www.experts-exchange.com/M_4830110.html E4AD 7CF1 1396 27F6 79DD 4342 5E92 AD66 8C8C FBA5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On 07/26/2011 10:18 AM, Jason Helfman wrote: I have this failure for bsd: rpc/virnetserver.c:786: error: 'virNetServer' has no member named 'mdns' gmake[3]: *** [libvirt_net_rpc_server_la-virnetserver.lo] Error 1 gmake[3]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/src' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/src' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4' gmake: *** [all] Error 2 *** Error code 1 Already fixed: https://www.redhat.com/archives/libvir-list/2011-July/msg01836.html -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On Tue, Jul 26, 2011 at 10:24:57AM -0600, Eric Blake thus spake: On 07/26/2011 10:18 AM, Jason Helfman wrote: I have this failure for bsd: rpc/virnetserver.c:786: error: 'virNetServer' has no member named 'mdns' gmake[3]: *** [libvirt_net_rpc_server_la-virnetserver.lo] Error 1 gmake[3]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/src' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/src' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4' gmake: *** [all] Error 2 *** Error code 1 Already fixed: https://www.redhat.com/archives/libvir-list/2011-July/msg01836.html Thanks! I have this error now, though. No difference between the tarball source and the git sources for this file. remote.c:1643: error: 'tmp' undeclared (first use in this function) gmake[3]: *** [libvirtd-remote.o] Error 1 gmake[3]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/daemon' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/daemon' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4' gmake: *** [all] Error 2 *** Error code 1 Thanks, Jason -- Jason Helfman System Administrator experts-exchange.com http://www.experts-exchange.com/M_4830110.html E4AD 7CF1 1396 27F6 79DD 4342 5E92 AD66 8C8C FBA5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [PATCH v3] Add support for fd: protocol
Kevin, thanks for the input. On 07/26/2011 11:18 AM, Kevin Wolf wrote: Am 26.07.2011 14:51, schrieb Corey Bryant: sVirt provides SELinux MAC isolation for Qemu guest processes and their corresponding resources (image files). sVirt provides this support by labeling guests and resources with security labels that are stored in file system extended attributes. Some file systems, such as NFS, do not support the extended attribute security namespace, which is needed for image file isolation when using the sVirt SELinux security driver in libvirt. The proposed solution entails a combination of Qemu, libvirt, and SELinux patches that work together to isolate multiple guests' images when they're stored in the same NFS mount. This results in an environment where sVirt isolation and NFS image file isolation can both be provided. This patch contains the Qemu code to support this solution. I would like to solicit input from the libvirt community prior to starting the libvirt patch. Currently, Qemu opens an image file in addition to performing the necessary read and write operations. The proposed solution will move the open out of Qemu and into libvirt. Once libvirt opens an image file for the guest, it will pass the file descriptor to Qemu via a new fd: protocol. If the image file resides in an NFS mount, the following SELinux policy changes will provide image isolation: - A new SELinux boolean is created (e.g. virt_read_write_nfs) to allow Qemu (svirt_t) to only have SELinux read and write permissions on nfs_t files - Qemu (svirt_t) also gets SELinux use permissions on libvirt (virtd_t) file descriptors Following is a sample invocation of Qemu using the fd: protocol on the command line: qemu -drive file=fd:4,format=qcow2 The fd: protocol is also supported by the drive_add monitor command. This requires that the specified file descriptor is passed to the monitor alongside a prior getfd monitor command. There are some additional features provided by certain image types where Qemu reopens the image file. All of these scenarios will be unsupported for the fd: protocol, at least for this patch: - The -snapshot command line option - The savevm monitor command - The snapshot_blkdev monitor command - Use of copy-on-write image files - The -cdrom command line option - The -drive command line option with media=cdrom - The change monitor command The thought is that this support can be added in the future, but is not required for the initial fd: support. This patch was tested with the following formats: raw, cow, qcow, qcow2, qed, and vmdk, using the fd: protocol from the command line and the monitor. Tests were also run to verify existing file name support and qemu-img were not regressed. Non-valid file descriptors, fd: without format, snapshot and backing files, and cdrom were also tested. v2: - Add drive_add monitor command support - Fence off unsupported features that re-open image file v3: - Fence off cdrom and change monitor command support Signed-off-by: Corey Bryantcor...@linux.vnet.ibm.com --- block.c | 16 ++ block.h |1 + block/cow.c |5 +++ block/qcow.c |5 +++ block/qcow2.c |5 +++ block/qed.c |4 ++ block/raw-posix.c | 81 +++-- block/vmdk.c |5 +++ block_int.h |1 + blockdev.c| 19 monitor.c |5 +++ monitor.h |1 + qemu-options.hx |8 +++-- qemu-tool.c |5 +++ 14 files changed, 149 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 24a25d5..500db84 100644 --- a/block.c +++ b/block.c @@ -536,6 +536,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} Hm, shouldn't that just work even with fd? My thought was that the proposed SELinux changes would prevent the open of the temporary backing file if the file corresponding to fd resides on NFS. But perhaps the backing file is not opened on NFS? + /* if snapshot, we create a temporary backing file and open it instead of opening 'filename' directly */ @@ -585,6 +589,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, /* Find the right image format driver */ if (!drv) { +/* format must be specified for fd: protocol */ +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} This isn't really required to make fd work. If format is not specified, the file needs to be opened and probed to
Re: [libvirt] [Qemu-devel] [PATCH v3] Add support for fd: protocol
On 26.07.2011, at 18:57, Corey Bryant wrote: Kevin, thanks for the input. On 07/26/2011 11:18 AM, Kevin Wolf wrote: Am 26.07.2011 14:51, schrieb Corey Bryant: sVirt provides SELinux MAC isolation for Qemu guest processes and their corresponding resources (image files). sVirt provides this support by labeling guests and resources with security labels that are stored in file system extended attributes. Some file systems, such as NFS, do not support the extended attribute security namespace, which is needed for image file isolation when using the sVirt SELinux security driver in libvirt. The proposed solution entails a combination of Qemu, libvirt, and SELinux patches that work together to isolate multiple guests' images when they're stored in the same NFS mount. This results in an environment where sVirt isolation and NFS image file isolation can both be provided. This patch contains the Qemu code to support this solution. I would like to solicit input from the libvirt community prior to starting the libvirt patch. Currently, Qemu opens an image file in addition to performing the necessary read and write operations. The proposed solution will move the open out of Qemu and into libvirt. Once libvirt opens an image file for the guest, it will pass the file descriptor to Qemu via a new fd: protocol. If the image file resides in an NFS mount, the following SELinux policy changes will provide image isolation: - A new SELinux boolean is created (e.g. virt_read_write_nfs) to allow Qemu (svirt_t) to only have SELinux read and write permissions on nfs_t files - Qemu (svirt_t) also gets SELinux use permissions on libvirt (virtd_t) file descriptors Following is a sample invocation of Qemu using the fd: protocol on the command line: qemu -drive file=fd:4,format=qcow2 The fd: protocol is also supported by the drive_add monitor command. This requires that the specified file descriptor is passed to the monitor alongside a prior getfd monitor command. There are some additional features provided by certain image types where Qemu reopens the image file. All of these scenarios will be unsupported for the fd: protocol, at least for this patch: - The -snapshot command line option - The savevm monitor command - The snapshot_blkdev monitor command - Use of copy-on-write image files - The -cdrom command line option - The -drive command line option with media=cdrom - The change monitor command The thought is that this support can be added in the future, but is not required for the initial fd: support. This patch was tested with the following formats: raw, cow, qcow, qcow2, qed, and vmdk, using the fd: protocol from the command line and the monitor. Tests were also run to verify existing file name support and qemu-img were not regressed. Non-valid file descriptors, fd: without format, snapshot and backing files, and cdrom were also tested. v2: - Add drive_add monitor command support - Fence off unsupported features that re-open image file v3: - Fence off cdrom and change monitor command support Signed-off-by: Corey Bryantcor...@linux.vnet.ibm.com --- block.c | 16 ++ block.h |1 + block/cow.c |5 +++ block/qcow.c |5 +++ block/qcow2.c |5 +++ block/qed.c |4 ++ block/raw-posix.c | 81 +++-- block/vmdk.c |5 +++ block_int.h |1 + blockdev.c| 19 monitor.c |5 +++ monitor.h |1 + qemu-options.hx |8 +++-- qemu-tool.c |5 +++ 14 files changed, 149 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 24a25d5..500db84 100644 --- a/block.c +++ b/block.c @@ -536,6 +536,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} Hm, shouldn't that just work even with fd? My thought was that the proposed SELinux changes would prevent the open of the temporary backing file if the file corresponding to fd resides on NFS. But perhaps the backing file is not opened on NFS? Then make a new flag that allows you to prohibit backing files. + /* if snapshot, we create a temporary backing file and open it instead of opening 'filename' directly */ @@ -585,6 +589,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, /* Find the right image format driver */ if (!drv) { +/* format must be
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On 07/26/2011 10:40 AM, Jason Helfman wrote: Thanks! I have this error now, though. No difference between the tarball source and the git sources for this file. remote.c:1643: error: 'tmp' undeclared (first use in this function) gmake[3]: *** [libvirtd-remote.o] Error 1 That's odd. Line 1643 is in remoteDispatchDomainGetBlockJobInfo, which unconditionally declares virDomainBlockJobInfo tmp at line 1631. I can't see why you would be running into a compilation error here; can you give us better details? -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] bandwidth: Integrate bandwidth into portgroups
On 07/26/2011 10:35 AM, Michal Privoznik wrote: Every DomainNetDef has a bandwidth, as does every portgroup. Whenever a DomainNetDef of type NETWORK is about to be used, a call is made to networkAllocateActualDevice(). This function chooses the best bandwidth object and places it in the DomainActualNetDef. From that point on, whenever some code needs to use the bandwidth data for the interface, it's retrieved with virDomainNetGetActualBandwidth(), which will always return the best info as determined in the previous step. --- docs/formatnetwork.html.in |2 + src/conf/domain_conf.c | 25 ++- src/conf/domain_conf.h |3 ++ src/conf/network_conf.c | 10 +++ src/conf/network_conf.h |1 + src/libvirt_private.syms|1 + src/network/bridge_driver.c | 19 +- src/util/network.c | 56 +++ src/util/network.h |2 + 9 files changed, 116 insertions(+), 3 deletions(-) You missed the two most important changes :-) The bandwidth pointer sent to virBandwidthEnable needs to use virDomainNetGetActualBandwidth() rather than referencing the def-bandwidth directly. diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index f0ff703..ddfa77c 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -129,6 +129,8 @@ numbers, The units forcodeaverage/code andcodepeak/code attributes are kilobytes per second, and for thecodeburst/code just kilobytes. The rate is shared equally within domains connected to the network. +Moreover,codebandwidth/code element can be included in +codeportgroup/code element. span class=sinceSince 0.9.4/span /p diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 072c970..031862a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -753,6 +753,8 @@ virDomainActualNetDefFree(virDomainActualNetDefPtr def) break; } +virBandwidthDefFree(def-bandwidth); + VIR_FREE(def); } @@ -2621,6 +2623,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node, virDomainActualNetDefPtr actual = NULL; int ret = -1; xmlNodePtr save_ctxt = ctxt-node; +xmlNodePtr bandwidth_node = NULL; char *type = NULL; char *mode = NULL; @@ -2677,6 +2680,11 @@ virDomainActualNetDefParseXML(xmlNodePtr node, } } +bandwidth_node = virXPathNode(./bandwidth, ctxt); +if (bandwidth_node +!(actual-bandwidth = virBandwidthDefParseNode(bandwidth_node))) +goto error; + *def = actual; actual = NULL; ret = 0; @@ -8713,6 +8721,10 @@ virDomainActualNetDefFormat(virBufferPtr buf, default: break; } + +if (virBandwidthDefFormat(buf, def-bandwidth, ) 0) +goto error; + virBufferAddLit(buf, /actual\n); ret = 0; @@ -8855,7 +8867,8 @@ virDomainNetDefFormat(virBufferPtr buf, virBufferAddLit(buf, /tune\n); } -if (virBandwidthDefFormat(buf, def-bandwidth, ) 0) +if (virBandwidthDefFormat(buf, virDomainNetGetActualBandwidth(def), +) 0) This is the one case where we want to specifically use def-bandwidth rather than virDomainNetGetActualBandwidth. Otherwise you end up writing the portgroup's bandwidth settings into the interface directly; then the next time you change the settings in the portgroup, they don't take effect in the interface because it now has its own private bandwidth settings, which take precedence over those in the portgroup. return -1; if (virDomainDeviceInfoFormat(buf,def-info, flags) 0) @@ -11383,3 +11396,13 @@ virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface) return NULL; return iface-data.network.actual-data.direct.virtPortProfile; } + +virBandwidthPtr +virDomainNetGetActualBandwidth(virDomainNetDefPtr iface) +{ +if ((iface-type == VIR_DOMAIN_NET_TYPE_NETWORK) +iface-data.network.actual iface-data.network.actual-bandwidth) { +return iface-data.network.actual-bandwidth; +} +return iface-bandwidth; +} diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 212f0c5..715d995 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -362,6 +362,7 @@ struct _virDomainActualNetDef { virVirtualPortProfileParamsPtr virtPortProfile; } direct; } data; +virBandwidthPtr bandwidth; }; /* Stores the virtual network interface configuration */ @@ -1490,6 +1491,8 @@ char *virDomainNetGetActualDirectDev(virDomainNetDefPtr iface); int virDomainNetGetActualDirectMode(virDomainNetDefPtr iface); virVirtualPortProfileParamsPtr virDomainNetGetActualDirectVirtPortProfile(virDomainNetDefPtr iface); +virBandwidthPtr +virDomainNetGetActualBandwidth(virDomainNetDefPtr iface); int
Re: [libvirt] gnulib compiler warning detection broken on RHEL5 autoconf
On 07/26/2011 10:05 AM, Eric Blake wrote: On 07/26/2011 04:45 AM, Daniel P. Berrange wrote: I was wondering why I didn't see any compile warnings from the broken gnutls code on RHEL5 when I noticed that we were building without any compiler warning flags at all. It seems configure fails on RHEL5 vintage autoconf checking whether compiler handles -Wall... ./configure: line 75468: ${$as_gl_Warn+set}: bad substitution Yuck. I'll take a look (it may be that older autoconf has a bug, and I merely need to backport a workaround for that bug fix). I'm guessing it is the gl_WARN_ADD() macro that is at fault somehow. Very possible, in fact, it may be a case of gl_WARN_ADD using an autoconf macro and assuming newer semantics, where a bit more work is needed to guarantee support with autoconf 2.59. Yep. Bug is in gnulib. When using AS_VAR_PUSHDEF, autoconf 2.59 requires that all subsequent uses of that placeholder be used _unquoted_ until the AS_VAR_POPDEF. Newer autoconf fixed things to work with the typical autoconf quoting rules, but gnulib wants to work with autoconf 2.59, so it must use the older syntax. I'll be pushing a gnulib fix shortly. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On Tue, Jul 26, 2011 at 11:45:19AM -0600, Eric Blake thus spake: On 07/26/2011 10:40 AM, Jason Helfman wrote: Thanks! I have this error now, though. No difference between the tarball source and the git sources for this file. remote.c:1643: error: 'tmp' undeclared (first use in this function) gmake[3]: *** [libvirtd-remote.o] Error 1 That's odd. Line 1643 is in remoteDispatchDomainGetBlockJobInfo, which unconditionally declares virDomainBlockJobInfo tmp at line 1631. I can't see why you would be running into a compilation error here; can you give us better details? remote.c: At top level: remote.c:409: error: negative width in bit-field '_gl_verify_error_if_negative' remote.c: In function 'remoteDispatchDomainGetBlockJobInfo': remote.c:1630: error: 'virDomainBlockJobInfo' undeclared (first use in this function) remote.c:1630: error: (Each undeclared identifier is reported only once remote.c:1630: error: for each function it appears in.) remote.c:1630: error: expected ';' before 'tmp' remote.c:1643: warning: implicit declaration of function 'virDomainGetBlockJobInfo' remote.c:1643: warning: nested extern declaration of 'virDomainGetBlockJobInfo' [-Wnested-externs] remote.c:1643: error: 'tmp' undeclared (first use in this function) gmake[3]: *** [libvirtd-remote.o] Error 1 gmake[3]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/daemon' gmake[2]: *** [all] Error 2 gmake[2]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4/daemon' gmake[1]: *** [all-recursive] Error 1 gmake[1]: Leaving directory `/home/jhelfman/ports/devel/libvirt/work/libvirt-0.9.4' gmake: *** [all] Error 2 *** Error code 1 -- Jason Helfman System Administrator experts-exchange.com http://www.experts-exchange.com/M_4830110.html E4AD 7CF1 1396 27F6 79DD 4342 5E92 AD66 8C8C FBA5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On 07/26/2011 12:16 PM, Jason Helfman wrote: remote.c: At top level: remote.c:409: error: negative width in bit-field '_gl_verify_error_if_negative' remote.c: In function 'remoteDispatchDomainGetBlockJobInfo': remote.c:1630: error: 'virDomainBlockJobInfo' undeclared (first use in this function) Ah. You're running into the same problem that has been previously reported of compiling against the stale installed libvirt.h instead of the just-built in-tree libvirt.h. Matthias had started a patch for that, but it never got finished. https://www.redhat.com/archives/libvir-list/2011-May/msg01926.html -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On 07/26/2011 12:28 PM, Zdenek Styblik wrote: ~~~ SNIP ~~~ rpc/virnetserver.c: In function 'virNetServerFree': rpc/virnetserver.c:786:5: warning: implicit declaration of function 'virNetServerMDNSFree' [-Wimplicit-function-declaration] rpc/virnetserver.c:786:5: warning: nested extern declaration of 'virNetServerMDNSFree' [-Wnested-externs] rpc/virnetserver.c:786:29: error: 'virNetServer' has no member named 'mdns' That's already been solved: https://www.redhat.com/archives/libvir-list/2011-July/msg01836.html -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] Start of freeze for libvirt-0.9.4 and availability of rc1
On Tue, Jul 26, 2011 at 12:26:20PM -0600, Eric Blake thus spake: On 07/26/2011 12:16 PM, Jason Helfman wrote: remote.c: At top level: remote.c:409: error: negative width in bit-field '_gl_verify_error_if_negative' remote.c: In function 'remoteDispatchDomainGetBlockJobInfo': remote.c:1630: error: 'virDomainBlockJobInfo' undeclared (first use in this function) Ah. You're running into the same problem that has been previously reported of compiling against the stale installed libvirt.h instead of the just-built in-tree libvirt.h. Matthias had started a patch for that, but it never got finished. https://www.redhat.com/archives/libvir-list/2011-May/msg01926.html I de-installed the port, and then continued with the make process, and it installed just fine. What is the status of this patch? If this isn't going to make it into the release, I can warn users that this port needs to be de-installed prior to building the port. Thanks, Jason -- Jason Helfman System Administrator experts-exchange.com http://www.experts-exchange.com/M_4830110.html E4AD 7CF1 1396 27F6 79DD 4342 5E92 AD66 8C8C FBA5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [Qemu-devel] [PATCH v3] Add support for fd: protocol
On 07/26/2011 01:10 PM, Alexander Graf wrote: On 26.07.2011, at 18:57, Corey Bryant wrote: Kevin, thanks for the input. On 07/26/2011 11:18 AM, Kevin Wolf wrote: Am 26.07.2011 14:51, schrieb Corey Bryant: sVirt provides SELinux MAC isolation for Qemu guest processes and their corresponding resources (image files). sVirt provides this support by labeling guests and resources with security labels that are stored in file system extended attributes. Some file systems, such as NFS, do not support the extended attribute security namespace, which is needed for image file isolation when using the sVirt SELinux security driver in libvirt. The proposed solution entails a combination of Qemu, libvirt, and SELinux patches that work together to isolate multiple guests' images when they're stored in the same NFS mount. This results in an environment where sVirt isolation and NFS image file isolation can both be provided. This patch contains the Qemu code to support this solution. I would like to solicit input from the libvirt community prior to starting the libvirt patch. Currently, Qemu opens an image file in addition to performing the necessary read and write operations. The proposed solution will move the open out of Qemu and into libvirt. Once libvirt opens an image file for the guest, it will pass the file descriptor to Qemu via a new fd: protocol. If the image file resides in an NFS mount, the following SELinux policy changes will provide image isolation: - A new SELinux boolean is created (e.g. virt_read_write_nfs) to allow Qemu (svirt_t) to only have SELinux read and write permissions on nfs_t files - Qemu (svirt_t) also gets SELinux use permissions on libvirt (virtd_t) file descriptors Following is a sample invocation of Qemu using the fd: protocol on the command line: qemu -drive file=fd:4,format=qcow2 The fd: protocol is also supported by the drive_add monitor command. This requires that the specified file descriptor is passed to the monitor alongside a prior getfd monitor command. There are some additional features provided by certain image types where Qemu reopens the image file. All of these scenarios will be unsupported for the fd: protocol, at least for this patch: - The -snapshot command line option - The savevm monitor command - The snapshot_blkdev monitor command - Use of copy-on-write image files - The -cdrom command line option - The -drive command line option with media=cdrom - The change monitor command The thought is that this support can be added in the future, but is not required for the initial fd: support. This patch was tested with the following formats: raw, cow, qcow, qcow2, qed, and vmdk, using the fd: protocol from the command line and the monitor. Tests were also run to verify existing file name support and qemu-img were not regressed. Non-valid file descriptors, fd: without format, snapshot and backing files, and cdrom were also tested. v2: - Add drive_add monitor command support - Fence off unsupported features that re-open image file v3: - Fence off cdrom and change monitor command support Signed-off-by: Corey Bryantcor...@linux.vnet.ibm.com --- block.c | 16 ++ block.h |1 + block/cow.c |5 +++ block/qcow.c |5 +++ block/qcow2.c |5 +++ block/qed.c |4 ++ block/raw-posix.c | 81 +++-- block/vmdk.c |5 +++ block_int.h |1 + blockdev.c| 19 monitor.c |5 +++ monitor.h |1 + qemu-options.hx |8 +++-- qemu-tool.c |5 +++ 14 files changed, 149 insertions(+), 12 deletions(-) diff --git a/block.c b/block.c index 24a25d5..500db84 100644 --- a/block.c +++ b/block.c @@ -536,6 +536,10 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags, char tmp_filename[PATH_MAX]; char backing_filename[PATH_MAX]; +if (bdrv_is_fd_protocol(bs)) { +return -ENOTSUP; +} Hm, shouldn't that just work even with fd? My thought was that the proposed SELinux changes would prevent the open of the temporary backing file if the file corresponding to fd resides on NFS. But perhaps the backing file is not opened on NFS? Then make a new flag that allows you to prohibit backing files. + /*
[libvirt] [PATCH] build: support warnings on RHEL 5
Without this, a configure built by autoconf 2.59 was broken when trying to detect which compiler warning flags were supported. * .gnulib: Update to latest, for warnings.m4 fix. * src/qemu/qemu_conf.c (includes): Drop unused include. * src/uml/uml_conf.c (include): Likewise. Reported by Daniel P. Berrange. --- * .gnulib a918da4...336406c (86): include-next, warnings: support older autoconf fseek, ftell: Fix doc. Add dependencies to the 'largefile' module. fcntl: Move AC_LIBOBJ invocation to module description. fcntl: Remove call-in from fchdir.m4. dup3: Remove potential call-in from fchdir.m4. dup2: Move AC_LIBOBJ invocation to module description. dup2: Remove call-in from fchdir.m4. fclose: Move AC_LIBOBJ invocation to module description. fclose: Remove call-in from close.m4. close: Move AC_LIBOBJ invocation to module description. close: Remove call-in from fchdir.m4. open: Move AC_LIBOBJ invocation to module description. open: Remove call-in from fchdir.m4. fchdir: Start to remove gl_REPLACE_* idiom. * lib/ftell.c (ftell): Comment out cast. close: use gl_REPLACE_FCLOSE only if defined test-select.h: avoid warning from gcc's -Wmissing-declarations doc: Mention the effects of AC_SYS_LARGEFILE. doc: Fix typo. doc: Mention fsusage. Reorder ChangeLog entries to match the order in which the changes went in at the central repository. doc: Mention new glibc headers and functions. ftell: don't include unistd.h ftell: do not assume wraparound signed arithmetic Attribution for last commit. close: No longer depend on module 'fclose'. fsusage: Enable large volume support on AIX = 5.2. fsusage: Restore previous behaviour on AIX, Cygwin, Interix. fsusage: Support large volumes on glibc/Hurd, HP-UX, Solaris, MacOS X. * README: Modernize discussion of signed integers. select tests, pselect tests: Refactor. sys_select tests: Check the signature of FD_*. largefile: new module, replacing large-inode fsusage: port to MacOS X 10.7 with 4 TiB file systems large-inode: New module extensions: Enable extensions on MacOS X 10.5 and later. file-has-acl: use acl_extended_file_nofollow if available Declare system functions in a way that works with C++. maint.mk: prohibit inclusion of verify.h without use timer-time: A new module to check for timer_settime() pthread_sigmask: assume POSIX threads if --avoid=threadlib strstr: Update cross-compilation guess. getopt-gnu: suppress core dumps from detection code pthread_sigmask: ensure usleep is declared doc: Document NonStop portability issues. ffsl, ffsll: Avoid unportable behaviour. ffs: More tests. ffsl, ffsll: new modules ffs: fix m4 prerequisite ffs: avoid undefined behavior pthread_sigmask: Rely on module 'threadlib'. regex: Depend on module 'strcase'. warn-on-use: fix typo in file name strings: Document module. Rename module '_Noreturn' to 'snippet/_Noreturn'. Mention the changes. Rename module 'warn-on-use' to 'snippet/warn-on-use'. Rename module 'unused-parameter' to 'snippet/unused-parameter'. Rename module 'link-warning' to 'snippet/link-warning'. Rename module 'c++defs' to 'snippet/c++defs'. Rename module 'arg-nonnull' to 'snippet/arg-nonnull'. Improve ChangeLog to summarize _Noreturn better. modules/_Exit-tests: test _Noreturn too stdnoreturn, stdnoreturn-tests: remove modules _Noreturn: Ignore __STDC_VERSION__; observe _MSC_VER. _Noreturn-tests: remove module * top/maint.mk: Adjust to new noreturn support. xalloc: use stdnoreturn.h xstrtol: use stdnoreturn.h xmemdup0: use stdnoreturn.h sigpipe-die: use stdnoreturn.h openat: use stdnoreturn.h * lib/openat-die.c (openat_save_fail): Modernize comment. * lib/xalloc-die.c (xalloc_die): Modernize comment. * lib/glthread/thread.h: Modernize comment. obstack: use _Noreturn c-stack: use _Noreturn exclude_tests: use _Noreturn argmatch-tests: use _Noreturn stdlib: use _Noreturn stdnoreturn-tests: new module stdnoreturn: new module _Noreturn-tests: new module _Noreturn: new module * m4/gnulib-common.m4 (gl_COMMON_BODY): Add _Noreturn. .gnulib |2 +- src/qemu/qemu_conf.c |1 - src/uml/uml_conf.c |1 - 3 files changed, 1 insertions(+), 3 deletions(-) diff --git a/.gnulib b/.gnulib index a918da4..336406c 16 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit a918da4d61d28be61a12605c9d35e2cf3966d866 +Subproject commit 336406c13cc08ee13d6a15cc8cf86efb9132a830 diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 6efca6b..443e08d 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -46,7 +46,6 @@ #include conf.h #include util.h #include memory.h -#include verify.h #include datatypes.h #include xml.h #include nodeinfo.h diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index c4b6e75..417271e 100644 ---
Re: [libvirt] [PATCH] freebsd: Fix build problem due to picking up the wrong libvirt.h
2011/6/1 Eric Blake ebl...@redhat.com: On 05/31/2011 02:51 PM, Matthias Bolte wrote: AM_GNU_GETTEXT calls AM_ICONV_LINK. AM_ICONV_LINK saves and alters CPPFLAGS, but doesn't restore it when it finds libiconv. This results in /usr/local/include ending up in the gcc command line before the include path for the local include directory. This makes gcc pick a previous installed libvirt.h instead of the correct one from the source tree. Workaround this problem by saving and restoring CPPFLAGS around the AM_GNU_GETTEXT call. --- configure.ac | 8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/configure.ac b/configure.ac index b2ba930..8f46dbd 100644 --- a/configure.ac +++ b/configure.ac @@ -2011,8 +2011,16 @@ dnl Enable building libvirtd? AM_CONDITIONAL([WITH_LIBVIRTD],[test x$with_libvirtd = xyes]) dnl Check for gettext - don't go any newer than what RHEL 5 supports +dnl +dnl save and restore CPPFLAGS around gettext check as the internal iconv +dnl check might leave -I/usr/local/include in CPPFLAGS on FreeBSD resulting +dnl in the build picking up previously installed libvirt/libvirt.h instead +dnl of the correct one from the soucre tree + +save_CPPFLAGS=$CPPFLAGS AM_GNU_GETTEXT_VERSION([0.17]) AM_GNU_GETTEXT([external]) +CPPFLAGS=$save_CPPFLAGS Does this still pick up /usr/local/include later in the command line, for the portion of the build that actually needs to include iconf headers, but in a position after our internal headers have been found first? I didn't check, but when we assume that AM_GNU_GETTEXT extends CPPFLAGS for a reason and not just by accident then we need to preserve it's additions to CPPFLAGS but in a later place in the commandline. As the actual problem is that CPPFLAGS comes before -I../include. I was actually thinking that we should instead work around this by setting AM_CPPFLAGS somewhere in our Makefile.am files. That is, when AM_CPPFLAGS is set, then automake outputs $(AM_CPPFLAGS) $(CPPFLAGS) when producing compilation rules, such that our internal CPPFLAGS settings come first in the command line, prior to anything inherited during configure (including the internal iconv settings). That is, with new enough automake, I think this alternative patch solve your BSD compilation (although other directories need the same treatment), without needing any configure.ac hacks. On the other hand, it looks like RHEL 5 only supports automake 1.9.6, and the automake NEWS doesn't mention AM_CPPFLAGS until 1.10 :( So even if the approach in my patch solves your issue, I think it's a non-starter, and something like your patch may be the best we can do. But I'm still worried that we have to use -I/usr/local/include somewhere in the command line, which means we would have to modify src/Makefile.am (and friends) to have: INCLUDES= ... $(GETTEXT_CPPFLAGS) where GETTEXT_CPPFLAGS is substituted with the difference in $save_CPPFLAGS and $CPPFLAGS prior to the point where we restore $CPPFLAGS. That's probably what we should do here. Now how to compute this difference? When we assume that save_CPPFLAGS and CPPFLAGS have a common prefix that we need to strip to get GETTEXT_CPPFLAGS then we could do it like this echo $(CPPFLAGS) | cut -c 1-`expr length $(save_CPPFLAGS)` --complement - This is probably neither the best nor a robustest way to do this. Do you have a better idea? -- Matthias Bolte http://photron.blogspot.com -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] build: support warnings on RHEL 5
On 07/26/2011 02:25 PM, Eric Blake wrote: Without this, a configure built by autoconf 2.59 was broken when trying to detect which compiler warning flags were supported. * .gnulib: Update to latest, for warnings.m4 fix. * src/qemu/qemu_conf.c (includes): Drop unused include. * src/uml/uml_conf.c (include): Likewise. Reported by Daniel P. Berrange. --- * .gnulib a918da4...336406c (86): close: No longer depend on module 'fclose'. This gnulib commit means that we also have to modify bootstrap.conf to explicitly pull in the fclose module (we were previously relying on it, but only implicitly). I plan to squash this in: diff --git i/bootstrap.conf w/bootstrap.conf index 2fc457e..f006a47 100644 --- i/bootstrap.conf +++ w/bootstrap.conf @@ -36,6 +36,7 @@ configmake count-one-bits crypto/md5 dirname-lgpl +fclose fcntl-h ffs fnmatch -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] freebsd: Fix build problem due to picking up the wrong libvirt.h
On 07/26/2011 02:45 PM, Matthias Bolte wrote: +++ b/configure.ac @@ -2011,8 +2011,16 @@ dnl Enable building libvirtd? AM_CONDITIONAL([WITH_LIBVIRTD],[test x$with_libvirtd = xyes]) dnl Check for gettext - don't go any newer than what RHEL 5 supports +dnl +dnl save and restore CPPFLAGS around gettext check as the internal iconv +dnl check might leave -I/usr/local/include in CPPFLAGS on FreeBSD resulting +dnl in the build picking up previously installed libvirt/libvirt.h instead +dnl of the correct one from the soucre tree + +save_CPPFLAGS=$CPPFLAGS AM_GNU_GETTEXT_VERSION([0.17]) AM_GNU_GETTEXT([external]) +CPPFLAGS=$save_CPPFLAGS But I'm still worried that we have to use -I/usr/local/include somewhere in the command line, which means we would have to modify src/Makefile.am (and friends) to have: INCLUDES= ... $(GETTEXT_CPPFLAGS) where GETTEXT_CPPFLAGS is substituted with the difference in $save_CPPFLAGS and $CPPFLAGS prior to the point where we restore $CPPFLAGS. That's probably what we should do here. Now how to compute this difference? When we assume that save_CPPFLAGS and CPPFLAGS have a common prefix that we need to strip to get GETTEXT_CPPFLAGS then we could do it like this echo $(CPPFLAGS) | cut -c 1-`expr length $(save_CPPFLAGS)` --complement - This is probably neither the best nor a robustest way to do this. Do you have a better idea? Yep (although I haven't tested it thoroughly): save_CPPFLAGS=$CPPFLAGS AM_GNU_GETTEXT_VERSION([0.17]) AM_GNU_GETTEXT([external]) GETTEXT_CPPFLAGS= if test x$save_CPPFLAGS != x$CPPFLAGS; then set dummy $CPPFLAGS for var do case $var in $save_CPPFLAGS ) ;; *) GETTEXT_CPPFLAGS=$GETTEXT_CPPFLAGS $var ;; esac done fi CPPFLAGS=$save_CPPFLAGS -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] build: avoid type-punning compiler warning
On RHEL 5, with gcc 4.1.2: rpc/virnetsaslcontext.c: In function 'virNetSASLSessionUpdateBufSize': rpc/virnetsaslcontext.c:396: warning: dereferncing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] * src/rpc/virnetsaslcontext.c (virNetSASLSessionUpdateBufSize): Use a union to work around gcc warning. --- src/rpc/virnetsaslcontext.c | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c index 71796b9..a0752dd 100644 --- a/src/rpc/virnetsaslcontext.c +++ b/src/rpc/virnetsaslcontext.c @@ -390,10 +390,13 @@ cleanup: static int virNetSASLSessionUpdateBufSize(virNetSASLSessionPtr sasl) { -unsigned *maxbufsize; +union { +unsigned *maxbufsize; +const void *ptr; +} u; int err; -err = sasl_getprop(sasl-conn, SASL_MAXOUTBUF, (const void **)maxbufsize); +err = sasl_getprop(sasl-conn, SASL_MAXOUTBUF, u.ptr); if (err != SASL_OK) { virNetError(VIR_ERR_INTERNAL_ERROR, _(cannot get security props %d (%s)), @@ -402,8 +405,8 @@ static int virNetSASLSessionUpdateBufSize(virNetSASLSessionPtr sasl) } VIR_DEBUG(Negotiated bufsize is %u vs requested size %zu, - *maxbufsize, sasl-maxbufsize); -sasl-maxbufsize = *maxbufsize; + *u.maxbufsize, sasl-maxbufsize); +sasl-maxbufsize = *u.maxbufsize; return 0; } -- 1.7.4.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 06/10] qemu: Remove special case for virDomainBlockStats
On 07/18/2011 06:27 PM, Jiri Denemark wrote: Like other query commands, this can now be called directly during migration. --- src/qemu/qemu_domain.h|4 --- src/qemu/qemu_driver.c| 54 +++-- src/qemu/qemu_migration.c | 18 --- 3 files changed, 18 insertions(+), 58 deletions(-) ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/10] qemu: Remove special case for virDomainGetBlockInfo
On 07/22/2011 03:10 PM, Eric Blake wrote: On 07/18/2011 06:27 PM, Jiri Denemark wrote: Like other query commands, this can now be called directly during migration. --- src/qemu/qemu_domain.h | 4 src/qemu/qemu_driver.c | 42 -- src/qemu/qemu_migration.c | 14 -- 3 files changed, 12 insertions(+), 48 deletions(-) ACK. In fact, it might be possible to shuffle the series and push this even before the new MIGRATE_CHANGE_PROTECTION stuff, although I haven't tried that yet. I've tried it now. This patch can be shuffled, but some of the other cleanups cannot (patch 7/10 introduced QEMU_JOB_MIGRATION_OP and used it in code added earlier by patch 1/10), so I'm not going to do any shuffling. On IRC, danpb told me that he tested the 10 patches as-is with no failures on the libvirt-tck migration behemoth (over 900 tests, with all sorts of cross-compatibility checking), but that he still needed to test my changes to patch 3/10. Once that completes, and he decides whether to ACK my changes, we can get this series pushed, hopefully before 0.9.4-RC2 is built (this series definitely fits in the release, as it is fixing a safety bug without adding any new API, just a new bit to an existing API). -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 08/10] qemu: Remove special case for virDomainMigrateSetMaxDowntime
On 07/18/2011 06:27 PM, Jiri Denemark wrote: Call qemu monitor command directly within a special job that is only allowed during outgoing migration. --- src/qemu/qemu_domain.c|1 - src/qemu/qemu_domain.h|6 -- src/qemu/qemu_driver.c| 23 +++ src/qemu/qemu_migration.c | 13 - 4 files changed, 15 insertions(+), 28 deletions(-) ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 07/10] qemu: Remove special case for virDomainMigrateSetMaxSpeed
On 07/18/2011 06:27 PM, Jiri Denemark wrote: Call qemu monitor command directly within a special job that is only allowed during outgoing migration. --- src/qemu/qemu_domain.c|1 + src/qemu/qemu_domain.h|3 +-- src/qemu/qemu_driver.c| 23 +++ src/qemu/qemu_migration.c | 21 + src/qemu/qemu_process.c |1 + 5 files changed, 23 insertions(+), 26 deletions(-) -VIR_DEBUG(Requesting migration speed change to %luMbs, bandwidth); -priv-job.signalsData.migrateBandwidth = bandwidth; -priv-job.signals |= QEMU_JOB_SIGNAL_MIGRATE_SPEED; -ret = 0; +VIR_DEBUG(Setting migration bandwidth to %luMbs, bandwidth); +ignore_value(qemuDomainObjEnterMonitor(driver, vm)); Might be nice to add a comment about why qemuDomainObjEnterMonitor won't fail here (if I understand correctly, it is because we only get this far if priv-job.active represents a migration job, but qemuDomainObjEnterMonitorInternal can only fail if priv-job.active is QEMU_JOB_NONE), but this isn't the first time this file uses ignore_value() without comments. ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 09/10] qemu: Remove special case for virDomainSuspend
On 07/18/2011 06:27 PM, Jiri Denemark wrote: --- src/qemu/qemu_domain.h|1 - src/qemu/qemu_driver.c| 46 ++-- src/qemu/qemu_migration.c |6 + 3 files changed, 24 insertions(+), 29 deletions(-) ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 04/10] qemu: Recover from interrupted migration
On 07/22/2011 03:06 PM, Eric Blake wrote: + case QEMU_MIGRATION_PHASE_PERFORM2: + case QEMU_MIGRATION_PHASE_PERFORM3: + /* migration is still in progress, let's cancel it and resume the + * domain */ + VIR_DEBUG(Canceling unfinished outgoing migration of domain %s, + vm-def-name); + /* TODO cancel possibly running migrate operation */ As in issue qemuMonitorMigrateCancel, but ignoring if it fails? Might be reasonable, but probably as a separate patch. Should have read the series first - you did this in patch 10/10. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 10/10] qemu: Remove special case for virDomainAbortJob
On 07/18/2011 06:27 PM, Jiri Denemark wrote: This doesn't abort migration job in any phase, yet. --- src/qemu/qemu_domain.c|9 +--- src/qemu/qemu_domain.h| 12 +++--- src/qemu/qemu_driver.c| 36 ++--- src/qemu/qemu_migration.c | 48 - src/qemu/qemu_process.c | 12 +- 5 files changed, 39 insertions(+), 78 deletions(-) ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv3 1/2] conf: add listen subelement to domain graphics element
On 07/26/2011 08:50 AM, Laine Stump wrote: I think it is a somewhat overkill to have 'autoport' be a setting per-listen element. I can't imagine people want a fixed port number on one IP addr, but a dynamic port number on another IP addr. So we could just keep that on the top level element. Although I agree with you for config purposes, it looks to me like the real use of autoport is that in the live XML it allows differentiating between ports that were manually specified and those that were automatically allocated (really, that seems like its main purpose, since simply not giving a port also implies autoport). If we have only a single autoport attribute for all the listens, we'll have to put in extra code that makes sure if they specify port for one listen, they do it for all of them. Is it that hard to add that additional validation? Regardless of that answer, and whether this requires a v4, I'll go ahead and review v3 code as if we decide that autoport-per-listen is acceptable. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] python: Properly report errors if virStreamRecv fails
We only want to raise the special value -2. -1 should return None which tells the bindings to throw an exception. --- python/libvirt-override.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 70e0238..bdff0e9 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -4138,8 +4138,10 @@ libvirt_virStreamRecv(PyObject *self ATTRIBUTE_UNUSED, buf[ret -1 ? ret : 0] = '\0'; DEBUG(StreamRecv ret=%d strlen=%d\n, ret, (int) strlen(buf)); -if (ret 0) +if (ret == -2) return libvirt_intWrap(ret); +if (ret 0) +return VIR_PY_NONE; return libvirt_charPtrSizeWrap((char *) buf, (Py_ssize_t) ret); } -- 1.7.4.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] python: Properly report errors if virStreamRecv fails
On 07/26/2011 05:26 PM, Cole Robinson wrote: We only want to raise the special value -2. -1 should return None which tells the bindings to throw an exception. --- python/libvirt-override.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 70e0238..bdff0e9 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -4138,8 +4138,10 @@ libvirt_virStreamRecv(PyObject *self ATTRIBUTE_UNUSED, buf[ret -1 ? ret : 0] = '\0'; DEBUG(StreamRecv ret=%d strlen=%d\n, ret, (int) strlen(buf)); -if (ret 0) +if (ret == -2) return libvirt_intWrap(ret); +if (ret 0) +return VIR_PY_NONE; return libvirt_charPtrSizeWrap((char *) buf, (Py_ssize_t) ret); ACK. -- Eric Blake ebl...@redhat.com+1-801-349-2682 Libvirt virtualization library http://libvirt.org -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] python: Properly report errors if virStreamRecv fails
On 07/26/2011 07:27 PM, Eric Blake wrote: On 07/26/2011 05:26 PM, Cole Robinson wrote: We only want to raise the special value -2. -1 should return None which tells the bindings to throw an exception. --- python/libvirt-override.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 70e0238..bdff0e9 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -4138,8 +4138,10 @@ libvirt_virStreamRecv(PyObject *self ATTRIBUTE_UNUSED, buf[ret -1 ? ret : 0] = '\0'; DEBUG(StreamRecv ret=%d strlen=%d\n, ret, (int) strlen(buf)); -if (ret 0) +if (ret == -2) return libvirt_intWrap(ret); +if (ret 0) +return VIR_PY_NONE; return libvirt_charPtrSizeWrap((char *) buf, (Py_ssize_t) ret); ACK. Speedy! Pushed now. - Cole -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv3 1/2] conf: add listen subelement to domain graphics element
On 07/25/2011 03:00 AM, Laine Stump wrote: Once it's plugged in, thelisten element will be an optional replacement for the listen, port, tlsPort, and autoport attributes that graphics elements already have. If thelisten type='address', it will have an attribute called 'address' which will contain an IP address or dns name that the guest's display server should listen on. If, however, type='network', thelisten element should have an attribute called 'network' that will be set to the name of a network configuration to get the IP address from. 91 files changed, 1274 insertions(+), 343 deletions(-) Big diff, but like you said mostly mechanical. @@ -2110,6 +2116,70 @@ qemu-kvm -net nic,model=? /dev/null /dd /dl +p + Rather than putting the information used to setup the listening setup is a noun, but here you want a verb form: s/setup/set up/ +dtcodeautoport/code/dt +ddIf set to 'yes', a listen port will be determined +automatically at runtime, and reflected in the domain's live +XML. +/dd May need tweaks depending on the decision on where autoport should live. @@ -1500,6 +1503,49 @@ /choice /element /define + +define name=listenElements +zeroOrMore +element name=listen +optional +attribute name=type +choice +valueaddress/value +valuenetwork/value /me curses thunderbird for squashing whitespace in my reply I'm not sure this is right. I think we want to require either type=address (which implies address=nnn must also be present, and network=nnn must not be present) or type=network (which implies that network=nnn must be present, and address=nnn might show up in live XML dumpxml output to show what was resolved, but is ignored in input parsing. Also, autoport=yes and port=nnn should be a forbidden combination. That is, I think this should be as follows (assuming we keep autoport in listen, further changes if autoport is global only): define name=listenElements zeroOrMore element name=listen choice group attribute name=type valueaddress/value /attribute attribute name=address ref name=addrIPorName/ /attribute /group group attribute name=type valuenetwork/value /attribute attribute name=network text/ /attribute optional attribute name=address ref name=addrIPorName/ /attribute /optional /group /choice choice attribute name=autoport valueyes/value /attribute group optional attribute name=autoport valueno/value /attribute /optional optional attribute name=port ref name=PortNumber/ /attribute /optional optional attribute name=tlsPort ref name=PortNumber/ /attribute /optional /group /choice /element +/zeroOrMore +/define Two spaces too much indentation on /define (not like it shows up any better in my nitpick, though). @@ -4010,19 +4029,118 @@ virDomainGraphicsAuthDefParseXML(xmlNodePtr node, return 0; } +static int +virDomainGraphicsListenParseXML(virDomainGraphicsListenDefPtr def, +xmlNodePtr node, +enum virDomainGraphicsType graphicsType, +unsigned int flags) +{ +int ret = -1; +char *type = virXMLPropString(node, type); +char *address = virXMLPropString(node, address); +char *network = virXMLPropString(node, network); +char *port = virXMLPropString(node, port); +char *tlsPort = virXMLPropString(node, tlsPort); +char *autoport = virXMLPropString(node, autoport); + +if (type (def-type = virDomainGraphicsListenTypeFromString(type)) 0) { +virDomainReportError(VIR_ERR_XML_ERROR, + _(unknown graphics listen type '%s'), type); +goto error; +} Shouldn't this fail if type is not found? That is, I think type is a mandatory attribute (must be address or network). + +if (address address[0]) { +def-address = address; +address = NULL; Should we reject address if not VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS? I learned with my virDomainSaveImageDefineXML patch that parsing must be symmetric to output format. Since your output function produces address for network mode on live xml but skips it for inactive, you _must_ make the parser leave address as NULL on parsing if (flags VIR_DOMAIN_XML_INACTIVE) and network mode is detected. +} + +if (network network[0]) { +if (def-type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) { +virDomainReportError(VIR_ERR_XML_ERROR, +
[libvirt] [PATCH 1/4] python: add python binding for virDomainGetBlkioParameters
--- python/libvirt-override-api.xml |6 +- python/libvirt-override.c | 79 +- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml index a8929b1..00f8e6a 100644 --- a/python/libvirt-override-api.xml +++ b/python/libvirt-override-api.xml @@ -208,10 +208,10 @@ arg name='params' type='virBlkioParameterPtr' info='pointer to blkio tunable objects'/ /function function name='virDomainGetBlkioParameters' file='python' - infoGet the blkio parameters, the @params array will be filled with the values./info - return type='int' info='-1 in case of error, 0 in case of success.'/ + infoGet the blkio parameters/info + return type='virSchedParameterPtr' info='None in case of error, returns a dictionary of params'/ arg name='domain' type='virDomainPtr' info='pointer to domain object'/ - arg name='params' type='virBlkioParameterPtr' info='pointer to blkio tunable objects'/ + arg name='flags' type='int' info='an ORapos;ed set of virDomainModificationImpact'/ /function function name='virDomainSetMemoryParameters' file='python' infoChange the memory tunables/info diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 70e0238..beb0969 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -572,11 +572,84 @@ libvirt_virDomainSetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED, return VIR_PY_INT_FAIL; } -/* FIXME: This is a place holder for the implementation. */ static PyObject * libvirt_virDomainGetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED, - PyObject *args ATTRIBUTE_UNUSED) { -return VIR_PY_INT_FAIL; + PyObject *args) { +virDomainPtr domain; +PyObject *pyobj_domain, *info; +int i_retval; +int nparams = 0, i; +unsigned int flags; +virTypedParameterPtr params; + +if (!PyArg_ParseTuple(args, (char *)Oi:virDomainGetBlkioParameters, + pyobj_domain, flags)) +return(NULL); +domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainGetBlkioParameters(domain, NULL, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; + +if (i_retval 0) +return VIR_PY_NONE; + +if ((params = malloc(sizeof(*params)*nparams)) == NULL) +return VIR_PY_NONE; + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainGetBlkioParameters(domain, params, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; + +if (i_retval 0) { +free(params); +return VIR_PY_NONE; +} + +/* convert to a Python tuple of long objects */ +if ((info = PyDict_New()) == NULL) { +free(params); +return VIR_PY_NONE; +} +for (i = 0 ; i nparams ; i++) { +PyObject *key, *val; + +switch (params[i].type) { +case VIR_TYPED_PARAM_INT: +val = PyInt_FromLong((long)params[i].value.i); +break; + +case VIR_TYPED_PARAM_UINT: +val = PyInt_FromLong((long)params[i].value.ui); +break; + +case VIR_TYPED_PARAM_LLONG: +val = PyLong_FromLongLong((long long)params[i].value.l); +break; + +case VIR_TYPED_PARAM_ULLONG: +val = PyLong_FromLongLong((long long)params[i].value.ul); +break; + +case VIR_TYPED_PARAM_DOUBLE: +val = PyFloat_FromDouble((double)params[i].value.d); +break; + +case VIR_TYPED_PARAM_BOOLEAN: +val = PyBool_FromLong((long)params[i].value.b); +break; + +default: +free(params); +Py_DECREF(info); +return VIR_PY_NONE; +} + +key = libvirt_constcharPtrWrap(params[i].field); +PyDict_SetItem(info, key, val); +} +free(params); +return(info); } /* FIXME: This is a place holder for the implementation. */ -- 1.7.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/4] python: add python binding for virDomainGetMemoryParameters
--- python/libvirt-override-api.xml |6 +- python/libvirt-override.c | 79 +- 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml index 928bfb7..0a67f9d 100644 --- a/python/libvirt-override-api.xml +++ b/python/libvirt-override-api.xml @@ -221,10 +221,10 @@ arg name='params' type='virMemoryParameterPtr' info='pointer to memory tunable objects'/ /function function name='virDomainGetMemoryParameters' file='python' - infoGet the memory parameters, the @params array will be filled with the values./info - return type='int' info='-1 in case of error, 0 in case of success.'/ + infoGet the memory parameters/info + return type='virSchedParameterPtr' info='None in case of error, returns a dictionary of params'/ arg name='domain' type='virDomainPtr' info='pointer to domain object'/ - arg name='params' type='virMemoryParameterPtr' info='pointer to memory tunable objects'/ + arg name='flags' type='int' info='an ORapos;ed set of virDomainModificationImpact'/ /function function name='virConnectListStoragePools' file='python' infolist the storage pools, stores the pointers to the names in @names/info diff --git a/python/libvirt-override.c b/python/libvirt-override.c index e53451f..7ab67e9 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -747,11 +747,84 @@ libvirt_virDomainSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED, return VIR_PY_INT_FAIL; } -/* FIXME: This is a place holder for the implementation. */ static PyObject * libvirt_virDomainGetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED, - PyObject *args ATTRIBUTE_UNUSED) { -return VIR_PY_INT_FAIL; + PyObject *args) { +virDomainPtr domain; +PyObject *pyobj_domain, *info; +int i_retval; +int nparams = 0, i; +unsigned int flags; +virTypedParameterPtr params; + +if (!PyArg_ParseTuple(args, (char *)Oi:virDomainGetMemoryParameters, + pyobj_domain, flags)) +return(NULL); +domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainGetMemoryParameters(domain, NULL, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; + +if (i_retval 0) +return VIR_PY_NONE; + +if ((params = malloc(sizeof(*params)*nparams)) == NULL) +return VIR_PY_NONE; + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainGetMemoryParameters(domain, params, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; + +if (i_retval 0) { +free(params); +return VIR_PY_NONE; +} + +/* convert to a Python tuple of long objects */ +if ((info = PyDict_New()) == NULL) { +free(params); +return VIR_PY_NONE; +} +for (i = 0 ; i nparams ; i++) { +PyObject *key, *val; + +switch (params[i].type) { +case VIR_TYPED_PARAM_INT: +val = PyInt_FromLong((long)params[i].value.i); +break; + +case VIR_TYPED_PARAM_UINT: +val = PyInt_FromLong((long)params[i].value.ui); +break; + +case VIR_TYPED_PARAM_LLONG: +val = PyLong_FromLongLong((long long)params[i].value.l); +break; + +case VIR_TYPED_PARAM_ULLONG: +val = PyLong_FromLongLong((long long)params[i].value.ul); +break; + +case VIR_TYPED_PARAM_DOUBLE: +val = PyFloat_FromDouble((double)params[i].value.d); +break; + +case VIR_TYPED_PARAM_BOOLEAN: +val = PyBool_FromLong((long)params[i].value.b); +break; + +default: +free(params); +Py_DECREF(info); +return VIR_PY_NONE; +} + +key = libvirt_constcharPtrWrap(params[i].field); +PyDict_SetItem(info, key, val); +} +free(params); +return(info); } static PyObject * -- 1.7.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/4] python: add python binding for virDomainSetBlkioParameters
--- python/libvirt-override-api.xml |1 + python/libvirt-override.c | 94 +- 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml index 00f8e6a..928bfb7 100644 --- a/python/libvirt-override-api.xml +++ b/python/libvirt-override-api.xml @@ -206,6 +206,7 @@ return type='int' info='-1 in case of error, 0 in case of success.'/ arg name='domain' type='virDomainPtr' info='pointer to domain object'/ arg name='params' type='virBlkioParameterPtr' info='pointer to blkio tunable objects'/ + arg name='flags' type='int' info='an ORapos;ed set of virDomainModificationImpact'/ /function function name='virDomainGetBlkioParameters' file='python' infoGet the blkio parameters/info diff --git a/python/libvirt-override.c b/python/libvirt-override.c index beb0969..e53451f 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -565,11 +565,99 @@ libvirt_virDomainSetSchedulerParametersFlags(PyObject *self ATTRIBUTE_UNUSED, } -/* FIXME: This is a place holder for the implementation. */ static PyObject * libvirt_virDomainSetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED, - PyObject *args ATTRIBUTE_UNUSED) { -return VIR_PY_INT_FAIL; + PyObject *args) { +virDomainPtr domain; +PyObject *pyobj_domain, *info; +int i_retval; +int nparams = 0, i; +unsigned int flags; +virTypedParameterPtr params; + +if (!PyArg_ParseTuple(args, + (char *)OOi:virDomainSetBlkioParameters, + pyobj_domain, info, flags)) +return(NULL); +domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainGetBlkioParameters(domain, NULL, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; + +if (i_retval 0) +return VIR_PY_INT_FAIL; + +if ((params = malloc(sizeof(*params)*nparams)) == NULL) +return VIR_PY_INT_FAIL; + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainGetBlkioParameters(domain, params, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; + +if (i_retval 0) { +free(params); +return VIR_PY_INT_FAIL; +} + +/* convert to a Python tuple of long objects */ +for (i = 0; i nparams; i++) { +PyObject *key, *val; +key = libvirt_constcharPtrWrap(params[i].field); +val = PyDict_GetItem(info, key); +Py_DECREF(key); + +if (val == NULL) +continue; + +switch (params[i].type) { +case VIR_TYPED_PARAM_INT: +params[i].value.i = (int)PyInt_AS_LONG(val); +break; + +case VIR_TYPED_PARAM_UINT: +params[i].value.ui = (unsigned int)PyInt_AS_LONG(val); +break; + +case VIR_TYPED_PARAM_LLONG: +params[i].value.l = (long long)PyLong_AsLongLong(val); +break; + +case VIR_TYPED_PARAM_ULLONG: +params[i].value.ul = (unsigned long long)PyLong_AsLongLong(val); +break; + +case VIR_TYPED_PARAM_DOUBLE: +params[i].value.d = (double)PyFloat_AsDouble(val); +break; + +case VIR_TYPED_PARAM_BOOLEAN: +{ +/* Hack - Python's definition of Py_True breaks strict + * aliasing rules, so can't directly compare :-( + */ +PyObject *hacktrue = PyBool_FromLong(1); +params[i].value.b = hacktrue == val ? 1: 0; +Py_DECREF(hacktrue); +} +break; + +default: +free(params); +return VIR_PY_INT_FAIL; +} +} + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainSetBlkioParameters(domain, params, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; +if (i_retval 0) { +free(params); +return VIR_PY_INT_FAIL; +} + +free(params); +return VIR_PY_INT_SUCCESS; } static PyObject * -- 1.7.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 4/4] python: add python binding for virDomainSetMemoryParameters
--- python/libvirt-override-api.xml |1 + python/libvirt-override.c | 94 +- 2 files changed, 92 insertions(+), 3 deletions(-) diff --git a/python/libvirt-override-api.xml b/python/libvirt-override-api.xml index 0a67f9d..2fa5eed 100644 --- a/python/libvirt-override-api.xml +++ b/python/libvirt-override-api.xml @@ -219,6 +219,7 @@ return type='int' info='-1 in case of error, 0 in case of success.'/ arg name='domain' type='virDomainPtr' info='pointer to domain object'/ arg name='params' type='virMemoryParameterPtr' info='pointer to memory tunable objects'/ + arg name='flags' type='int' info='an ORapos;ed set of virDomainModificationImpact'/ /function function name='virDomainGetMemoryParameters' file='python' infoGet the memory parameters/info diff --git a/python/libvirt-override.c b/python/libvirt-override.c index 7ab67e9..d4e536e 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -740,11 +740,99 @@ libvirt_virDomainGetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED, return(info); } -/* FIXME: This is a place holder for the implementation. */ static PyObject * libvirt_virDomainSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED, - PyObject *args ATTRIBUTE_UNUSED) { -return VIR_PY_INT_FAIL; + PyObject *args) { +virDomainPtr domain; +PyObject *pyobj_domain, *info; +int i_retval; +int nparams = 0, i; +unsigned int flags; +virTypedParameterPtr params; + +if (!PyArg_ParseTuple(args, + (char *)OOi:virDomainSetMemoryParameters, + pyobj_domain, info, flags)) +return(NULL); +domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain); + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainGetMemoryParameters(domain, NULL, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; + +if (i_retval 0) +return VIR_PY_INT_FAIL; + +if ((params = malloc(sizeof(*params)*nparams)) == NULL) +return VIR_PY_INT_FAIL; + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainGetMemoryParameters(domain, params, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; + +if (i_retval 0) { +free(params); +return VIR_PY_INT_FAIL; +} + +/* convert to a Python tuple of long objects */ +for (i = 0; i nparams; i++) { +PyObject *key, *val; +key = libvirt_constcharPtrWrap(params[i].field); +val = PyDict_GetItem(info, key); +Py_DECREF(key); + +if (val == NULL) +continue; + +switch (params[i].type) { +case VIR_TYPED_PARAM_INT: +params[i].value.i = (int)PyInt_AS_LONG(val); +break; + +case VIR_TYPED_PARAM_UINT: +params[i].value.ui = (unsigned int)PyInt_AS_LONG(val); +break; + +case VIR_TYPED_PARAM_LLONG: +params[i].value.l = (long long)PyLong_AsLongLong(val); +break; + +case VIR_TYPED_PARAM_ULLONG: +params[i].value.ul = (unsigned long long)PyLong_AsLongLong(val); +break; + +case VIR_TYPED_PARAM_DOUBLE: +params[i].value.d = (double)PyFloat_AsDouble(val); +break; + +case VIR_TYPED_PARAM_BOOLEAN: +{ +/* Hack - Python's definition of Py_True breaks strict + * aliasing rules, so can't directly compare :-( + */ +PyObject *hacktrue = PyBool_FromLong(1); +params[i].value.b = hacktrue == val ? 1: 0; +Py_DECREF(hacktrue); +} +break; + +default: +free(params); +return VIR_PY_INT_FAIL; +} +} + +LIBVIRT_BEGIN_ALLOW_THREADS; +i_retval = virDomainSetMemoryParameters(domain, params, nparams, flags); +LIBVIRT_END_ALLOW_THREADS; +if (i_retval 0) { +free(params); +return VIR_PY_INT_FAIL; +} + +free(params); +return VIR_PY_INT_SUCCESS; } static PyObject * -- 1.7.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] doc: Add doc for blockpull and blockjob commands
On Tue, Jul 26, 2011 at 09:03:22PM +0800, Osier Yang wrote: Commit b31abc6f0 introduce commands blockpull and blockjob, but forgot to add the docs meanwhile. --- tools/virsh.pod | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index 5b7fa9c..02c98c8 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -430,6 +430,27 @@ Get memory stats for a running domain. Get block device size info for a domain. +=item Bblockpull Idomain Ipath [Ibandwidth] + +Populate a disk from its backing image. Once all data from its backing +image has been pulled, the disk no longer depends on the backing image. +It pulls data for the entire disk in the background, the process of the +operation can be checked with Bblockjob. + +Ipath specifies fully-qualified path of the disk. +Ibandwidth specifies copying bandwidth limit in Mbps. + +=item Bblockjob Idomain Ipath [I--abort] [I--info] [Ibandwidth] + +Manage active block operations. + +Ipath specifies fully-qualified path of the disk. +If I--live is specified, the active job on the specified disk will +be aborted. +If I--info is specified, the active job information on the specified +disk will be printed. +Ibandwidth can be used to set bandwidth limit for the active job. + =item Bdominfo Idomain-id Returns basic information about the domain. ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ dan...@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] doc: Add doc for blockpull and blockjob commands
于 2011年07月27日 10:44, Daniel Veillard 写道: On Tue, Jul 26, 2011 at 09:03:22PM +0800, Osier Yang wrote: Commit b31abc6f0 introduce commands blockpull and blockjob, but forgot to add the docs meanwhile. --- tools/virsh.pod | 21 + 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/tools/virsh.pod b/tools/virsh.pod index 5b7fa9c..02c98c8 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -430,6 +430,27 @@ Get memory stats for a running domain. Get block device size info for a domain. +=item Bblockpull Idomain Ipath [Ibandwidth] + +Populate a disk from its backing image. Once all data from its backing +image has been pulled, the disk no longer depends on the backing image. +It pulls data for the entire disk in the background, the process of the +operation can be checked with Bblockjob. + +Ipath specifies fully-qualified path of the disk. +Ibandwidth specifies copying bandwidth limit in Mbps. + +=item Bblockjob Idomain Ipath [I--abort] [I--info] [Ibandwidth] + +Manage active block operations. + +Ipath specifies fully-qualified path of the disk. +If I--live is specified, the active job on the specified disk will +be aborted. +If I--info is specified, the active job information on the specified +disk will be printed. +Ibandwidth can be used to set bandwidth limit for the active job. + =item Bdominfo Idomain-id Returns basic information about the domain. ACK, Daniel Thanks, pushed. Osier -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] virsh: fix memory leak in cmdVolPath code
* tools/virsh.c: avoid memory leak in cmdVolPath. * how to reproduce? % dd if=/dev/zero of=/var/lib/libvirt/images/foo.img count=1 bs=10M % virsh pool-refresh default % valgrind -v --leak-check=full virsh vol-path --vol /var/lib/libvirt/images/foo.img * actual results: Detected in valgrind run: ==16436== 32 bytes in 1 blocks are definitely lost in loss record 7 of 22 ==16436==at 0x4A05FDE: malloc (vg_replace_malloc.c:236) ==16436==by 0x386A314B3D: xdr_string (in /lib64/libc-2.12.so) ==16436==by 0x3DF8CD770D: xdr_remote_nonnull_string (remote_protocol.c:30) ==16436==by 0x3DF8CD7EC8: xdr_remote_storage_vol_get_path_ret (remote_protocol.c:2952) ==16436==by 0x3DF8CDF161: virNetMessageDecodePayload (virnetmessage.c:286) ==16436==by 0x3DF8CDE9E5: virNetClientProgramCall (virnetclientprogram.c:318) ==16436==by 0x3DF8CC28A2: call (remote_driver.c:3929) ==16436==by 0x3DF8CC8412: remoteStorageVolGetPath (remote_client_bodies.h:5219) ==16436==by 0x3DF8C9BF14: virStorageVolGetPath (libvirt.c:11389) ==16436==by 0x418ECA: cmdVolPath (virsh.c:8754) ==16436==by 0x410CC2: vshCommandRun (virsh.c:12758) ==16436==by 0x41F286: main (virsh.c:14110) ==16436== ==16436== LEAK SUMMARY: ==16436==definitely lost: 32 bytes in 1 blocks Signed-off-by: Alex Jia a...@redhat.com --- tools/virsh.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 841df61..d194a8b 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -9326,6 +9326,7 @@ cmdVolPath(vshControl *ctl, const vshCmd *cmd) { virStorageVolPtr vol; const char *name = NULL; +char * StorageVolPath; if (!vshConnectionUsability(ctl, ctl-conn)) return false; @@ -9334,7 +9335,13 @@ cmdVolPath(vshControl *ctl, const vshCmd *cmd) return false; } -vshPrint(ctl, %s\n, virStorageVolGetPath(vol)); +if ((StorageVolPath = virStorageVolGetPath(vol)) == NULL) { +virStorageVolFree(vol); +return false; +} + +vshPrint(ctl, %s\n, StorageVolPath); +VIR_FREE(StorageVolPath); virStorageVolFree(vol); return true; } -- 1.7.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tools: format percent strings of nodecpustats
On 07/26/2011 11:52 PM, Eric Blake wrote: On 07/26/2011 01:32 AM, Alex Jia wrote: * tools/virsh.c: format strings display for virsh nodecpustats --percent. * how to reproduce? % virsh nodecpustats --percent usage:2.0% user : 1.0% system: 1.0% idle : 98.0% iowait: 0.0% Yuck. ACK that we need to fix this. * after format strings % virsh nodecpustats --percent usage : 2.0% user : 1.0% system: 1.0% idle : 98.0% iowait: 0.0% Still yuck. Now we have some cases with two fields, and some with three, making this harder to machine parse. Better would be: % virsh nodecpustats --percent usage:2.0% user: 1.0% system: 1.0% idle:98.0% iowait: 0.0% vshPrint(ctl, %-15s %5.1lf%%\n, - _(usage:), usage); + _(usage :), usage); By _always_ sticking the : directly by the text, translators don't have to realize that the whitespace in the string being translated was intended to be significant for alignment purposes (that is, alignment should always be done independently of translations, whereas your solution was only aligned for English). Also, it better matches the behavior of 'virsh dominfo', which also has aligned fields but does not line up the colons. Here's what I squashed in before pushing: diff --git i/tools/virsh.c w/tools/virsh.c index d08b78f..113124f 100644 --- i/tools/virsh.c +++ w/tools/virsh.c @@ -4438,9 +4438,9 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) if (!flag_percent) { if (!flag_utilization) { -vshPrint(ctl, %-15s %20llu\n, _(user :), cpu_stats[0].user); +vshPrint(ctl, %-15s %20llu\n, _(user:), cpu_stats[0].user); vshPrint(ctl, %-15s %20llu\n, _(system:), cpu_stats[0].sys); -vshPrint(ctl, %-15s %20llu\n, _(idle :), cpu_stats[0].idle); +vshPrint(ctl, %-15s %20llu\n, _(idle:), cpu_stats[0].idle); vshPrint(ctl, %-15s %20llu\n, _(iowait:), cpu_stats[0].iowait); } } else { @@ -4448,7 +4448,7 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) usage = cpu_stats[0].util; vshPrint(ctl, %-15s %5.1lf%%\n, _(usage:), usage); -vshPrint(ctl, %-15s %5.1lf%%\n, _(idle :), 100 - usage); +vshPrint(ctl, %-15s %5.1lf%%\n, _(idle:), 100 - usage); } else { user_time = cpu_stats[1].user - cpu_stats[0].user; sys_time= cpu_stats[1].sys- cpu_stats[0].sys; @@ -4459,13 +4459,13 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) usage = (user_time + sys_time) / total_time * 100; vshPrint(ctl, %-15s %5.1lf%%\n, - _(usage :), usage); + _(usage:), usage); vshPrint(ctl, %-15s %5.1lf%%\n, - _(user :), user_time / total_time * 100); + _(user:), user_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, _(system:), sys_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, - _(idle :), idle_time / total_time * 100); + _(idle:), idle_time / total_time * 100); vshPrint(ctl, %-15s %5.1lf%%\n, _(iowait:), iowait_time / total_time * 100); } Agree, thanks for your review and modification. Regards, Alex -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: fix memory leak in cmdVolPath code
于 2011年07月27日 11:33, Alex Jia 写道: * tools/virsh.c: avoid memory leak in cmdVolPath. * how to reproduce? % dd if=/dev/zero of=/var/lib/libvirt/images/foo.img count=1 bs=10M % virsh pool-refresh default % valgrind -v --leak-check=full virsh vol-path --vol /var/lib/libvirt/images/foo.img * actual results: Detected in valgrind run: ==16436== 32 bytes in 1 blocks are definitely lost in loss record 7 of 22 ==16436==at 0x4A05FDE: malloc (vg_replace_malloc.c:236) ==16436==by 0x386A314B3D: xdr_string (in /lib64/libc-2.12.so) ==16436==by 0x3DF8CD770D: xdr_remote_nonnull_string (remote_protocol.c:30) ==16436==by 0x3DF8CD7EC8: xdr_remote_storage_vol_get_path_ret (remote_protocol.c:2952) ==16436==by 0x3DF8CDF161: virNetMessageDecodePayload (virnetmessage.c:286) ==16436==by 0x3DF8CDE9E5: virNetClientProgramCall (virnetclientprogram.c:318) ==16436==by 0x3DF8CC28A2: call (remote_driver.c:3929) ==16436==by 0x3DF8CC8412: remoteStorageVolGetPath (remote_client_bodies.h:5219) ==16436==by 0x3DF8C9BF14: virStorageVolGetPath (libvirt.c:11389) ==16436==by 0x418ECA: cmdVolPath (virsh.c:8754) ==16436==by 0x410CC2: vshCommandRun (virsh.c:12758) ==16436==by 0x41F286: main (virsh.c:14110) ==16436== ==16436== LEAK SUMMARY: ==16436==definitely lost: 32 bytes in 1 blocks Signed-off-by: Alex Jiaa...@redhat.com --- tools/virsh.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/tools/virsh.c b/tools/virsh.c index 841df61..d194a8b 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -9326,6 +9326,7 @@ cmdVolPath(vshControl *ctl, const vshCmd *cmd) { virStorageVolPtr vol; const char *name = NULL; +char * StorageVolPath; if (!vshConnectionUsability(ctl, ctl-conn)) return false; @@ -9334,7 +9335,13 @@ cmdVolPath(vshControl *ctl, const vshCmd *cmd) return false; } -vshPrint(ctl, %s\n, virStorageVolGetPath(vol)); +if ((StorageVolPath = virStorageVolGetPath(vol)) == NULL) { +virStorageVolFree(vol); +return false; +} + +vshPrint(ctl, %s\n, StorageVolPath); +VIR_FREE(StorageVolPath); virStorageVolFree(vol); return true; } ACK, but it will be better if docs of virStorageVolGetPath in src/libvirt.c can be updated, (to tell the returned path must be freed by caller). Osier -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list