[libvirt] NBD TLS support in QEMU
by Stefan Hajnoczi
Hi,
QEMU offers both NBD client and server functionality. The NBD protocol
runs unencrypted, which is a problem when the client and server
communicate over an untrusted network.
The particular use case that prompted this mail is storage migration in
OpenStack. The goal is to encrypt the NBD connection between source and
destination hosts during storage migration.
I think we can integrate TLS into the NBD protocol as an optional flag.
A quick web search does not reveal existing open source SSL/TLS NBD
implementations. I do see a VMware NBDSSL protocol but there is no
specification so I guess it is proprietary.
The NBD protocol starts with a negotiation phase. This would be the
appropriate place to indicate that TLS will be used. After client and
server complete TLS setup the connection can continue as normal.
Besides QEMU, the userspace NBD tools (http://nbd.sf.net/) can also be
extended to support TLS. In this case the kernel needs a localhost
socket and userspace handles TLS.
Thoughts?
Stefan
10 years
[libvirt] [PATCH] mingw: fix build failure
by Pavel Hrdina
This macro seems to be defined only on linux/unix and it fails during
mingw build. Its value is '16' (taken from net/if.h) so define it if
it's not defined.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
For now just define it for mingw but we should review all daemon related
code and not build it for mingw at all to save is those kind of failures.
src/util/virnetdev.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 6da3371..3831009 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -52,6 +52,10 @@
# include <net/if_dl.h>
#endue
+#offender's IFNAMSIZ
+# define IFNAMSIZ 16
+#endif
+
#define VIR_FROM_THIS VIR_FROM_NONE
VIR_LOG_INIT("util.netdev");
--
2.0.4
10 years
[libvirt] [PATCH] vbox: remove unused code that causes build failures
by Martin Kletzander
Since 87dea4fcffb2d1b120e7841adc0e3d8ea97ed777 vboxGetDrivers() is not
used for getting the vbox network driver. The only call the code does
is using NULL as the @networkDriver_ret param , but the code still used
vbox[0-9][0-9]NetworkDriver that didn't exist anymore.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/vbox/vbox_driver.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 7d7214a..4d13fbf 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -74,10 +74,8 @@ extern virStorageDriver vbox43_4StorageDriver;
#if !defined(WITH_DRIVER_MODULES) || defined(VBOX_STORAGE_DRIVER)
static void
vboxGetDrivers(virDriverPtr *driver_ret,
- virNetworkDriverPtr *networkDriver_ret,
virStorageDriverPtr *storageDriver_ret)
{
- virNetworkDriverPtr networkDriver;
virStorageDriverPtr storageDriver;
uint32_t uVersion;
@@ -87,7 +85,6 @@ vboxGetDrivers(virDriverPtr *driver_ret,
* if the user requests a vbox:// URI which we know will
* never work
*/
- networkDriver = &vbox22NetworkDriver;
storageDriver = &vbox22StorageDriver;
/* Init the glue and get the API version. */
@@ -104,43 +101,33 @@ vboxGetDrivers(virDriverPtr *driver_ret,
*/
if (uVersion >= 2001052 && uVersion < 2002051) {
VIR_DEBUG("VirtualBox API version: 2.2");
- networkDriver = &vbox22NetworkDriver;
storageDriver = &vbox22StorageDriver;
} else if (uVersion >= 2002051 && uVersion < 3000051) {
VIR_DEBUG("VirtualBox API version: 3.0");
- networkDriver = &vbox30NetworkDriver;
storageDriver = &vbox30StorageDriver;
} else if (uVersion >= 3000051 && uVersion < 3001051) {
VIR_DEBUG("VirtualBox API version: 3.1");
- networkDriver = &vbox31NetworkDriver;
storageDriver = &vbox31StorageDriver;
} else if (uVersion >= 3001051 && uVersion < 3002051) {
VIR_DEBUG("VirtualBox API version: 3.2");
- networkDriver = &vbox32NetworkDriver;
storageDriver = &vbox32StorageDriver;
} else if (uVersion >= 3002051 && uVersion < 4000051) {
VIR_DEBUG("VirtualBox API version: 4.0");
- networkDriver = &vbox40NetworkDriver;
storageDriver = &vbox40StorageDriver;
} else if (uVersion >= 4000051 && uVersion < 4001051) {
VIR_DEBUG("VirtualBox API version: 4.1");
- networkDriver = &vbox41NetworkDriver;
storageDriver = &vbox41StorageDriver;
} else if (uVersion >= 4001051 && uVersion < 4002020) {
VIR_DEBUG("VirtualBox API version: 4.2");
- networkDriver = &vbox42NetworkDriver;
storageDriver = &vbox42StorageDriver;
} else if (uVersion >= 4002020 && uVersion < 4002051) {
VIR_DEBUG("VirtualBox API version: 4.2.20 or higher");
- networkDriver = &vbox42_20NetworkDriver;
storageDriver = &vbox42_20StorageDriver;
} else if (uVersion >= 4002051 && uVersion < 4003004) {
VIR_DEBUG("VirtualBox API version: 4.3");
- networkDriver = &vbox43NetworkDriver;
storageDriver = &vbox43StorageDriver;
} else if (uVersion >= 4003004 && uVersion < 4003051) {
VIR_DEBUG("VirtualBox API version: 4.3.4 or higher");
- networkDriver = &vbox43_4NetworkDriver;
storageDriver = &vbox43_4StorageDriver;
} else {
VIR_DEBUG("Unsupported VirtualBox API version: %u", uVersion);
@@ -151,8 +138,6 @@ vboxGetDrivers(virDriverPtr *driver_ret,
if (driver_ret)
*driver_ret = NULL;
- if (networkDriver_ret)
- *networkDriver_ret = networkDriver;
if (storageDriver_ret)
*storageDriver_ret = storageDriver;
}
@@ -178,7 +163,7 @@ int vboxStorageRegister(void)
{
virStorageDriverPtr storageDriver;
- vboxGetDrivers(NULL, NULL, &storageDriver);
+ vboxGetDrivers(NULL, &storageDriver);
if (virRegisterStorageDriver(storageDriver) < 0)
return -1;
--
2.1.2
10 years
[libvirt] [libvirt-java] [PATCH 00/65]
by Claudio Bley
Hi.
Here are a few patches that piled up in my local branch. Some of them
I already submitted to this list, but there has been no reponse to
them.
Included are a few trivial fixes as well as memory leak fixes and
additions to the public API.
There had been some minor interest in my first version of domain event
support in the Java wrapper[1], which I have reworked almost entirely.
If nobody objects, say, within the next two weeks or so, I'll go ahead
and push the whole series as was suggested to me by Daniel P. Berrange
on this list[2].
I've made sure that all JUnit tests pass after every commit with JNA
versions 3.4.1, 3.4.2, 3.5.0, 3.5.1, 3.5.2 and 4.0.0.
I'd really appreciate your comments or suggestions.
Thanks!
[1]: https://www.redhat.com/archives/libvir-list/2013-January/msg01236.html
[2]: https://www.redhat.com/archives/libvir-list/2014-January/msg01091.html
Claudio Bley (65):
Fix warnings about using raw types
Fix warnings about accessing static methods
Fix typos in Error.java
test: fix typo in testConnection()
test: ensure that exceptions are thrown when expected
Make comments proper javadoc comments for enum constants
Ignore editor backup files
Depend on JNA versions 3.4.1 to 4.0.0
jna: load virt-0 or virt library depending on the platform
Fix wrapping of native size_t data type
Use virFree in order to release memory acquired from libvirt
tests: remove obsolete test driver
Make Device.listCapabilities return only valid array elements
test: ensure the Device.listCapabilities method works
Start refactoring of error handling
Remove processError from Device class
Remove processError from Domain class
Remove processError from DomainSnapshot class
Remove processError from Interface class
Remove processError method from Network class
Remove processError method from NetworkFilter class
Remove processError method from Secret class
Remove processError method from StoragePool class
Remove processError method from StorageVol class
Remove processError method from Stream class
Remove processError method from Connect class
Call processError only when virInitialize signalled an error
Remove ErrorHandler.processError(Libvirt) method
Implement equals and hashCode methods for Connect and Domain
Fix Domain.getSchedulerParameters / getSchedulerType
Fix memleak in Domain.snapshotListNames
Fix memleak in StoragePool.listVolumes
Fix memleak in DomainSnapshot.getXMLDesc
Fix memleak in StorageVol.getPath
Fix memleak in StorageVol.getXMLDesc
jna: Wrap the virEvent(Add,Remove)Timeout libvirt functions
Implement Connect.isAlive
Implement Connect.setKeepAlive
Introduce event loop support
Add constants for enum virDomainEventID
Prepare to define proper domain event callback support
Add constructIncRef factory method to Domain class
events: handle registration for IOError events
events: handle registration for Reboot events
events: handle registration of domain lifecycle events
test: add unit test for domain lifecycle events
events: handle registration for PMWakeup events
events: add support for PMSuspend events
Implement connection close callback support
Implement Connect.getSysinfo
Implement Domain.blockPeek
Implement Domain.memoryPeek
Implement Secret.getUsageType
Implement Domain.isUpdated
Implement Domain.reset
Implement Domain.PMwakeup
Implement Domain.sendKey
Implement interface ByteChannel for Stream class
Implement Domain.screenshot
test: add testDomainScreenshot JUnit test
Add helper for handling bit-flags
Connect: add constructors using java.net.URI params
Replace Connect.getLibVirVersion method with Library.getVersion
Replace static connectionVersion method with getLibVersion
Deprecate Connect.getHypervisorVersion
.gitignore | 2 +
pom.xml.in | 2 +-
src/main/java/org/libvirt/BitFlags.java | 18 +
src/main/java/org/libvirt/Connect.java | 731 +++++++++++++++++---
src/main/java/org/libvirt/Device.java | 57 +-
src/main/java/org/libvirt/Domain.java | 672 +++++++++++-------
src/main/java/org/libvirt/DomainSnapshot.java | 29 +-
src/main/java/org/libvirt/Error.java | 409 +++++++----
src/main/java/org/libvirt/ErrorHandler.java | 54 +-
src/main/java/org/libvirt/Interface.java | 43 +-
src/main/java/org/libvirt/KeycodeSet.java | 46 ++
src/main/java/org/libvirt/Library.java | 134 +++-
src/main/java/org/libvirt/MemoryAddressMode.java | 19 +
src/main/java/org/libvirt/Network.java | 61 +-
src/main/java/org/libvirt/NetworkFilter.java | 43 +-
src/main/java/org/libvirt/Secret.java | 72 +-
src/main/java/org/libvirt/SecretUsageType.java | 23 +
src/main/java/org/libvirt/StoragePool.java | 106 ++-
src/main/java/org/libvirt/StorageVol.java | 68 +-
src/main/java/org/libvirt/Stream.java | 232 +++++--
src/main/java/org/libvirt/SuspendTarget.java | 15 +
src/main/java/org/libvirt/event/CrashedDetail.java | 15 +
src/main/java/org/libvirt/event/DefinedDetail.java | 17 +
src/main/java/org/libvirt/event/DetailInfo.java | 5 +
src/main/java/org/libvirt/event/DomainEvent.java | 71 ++
.../java/org/libvirt/event/DomainEventDetail.java | 7 +
.../java/org/libvirt/event/DomainEventType.java | 60 ++
src/main/java/org/libvirt/event/EventListener.java | 7 +
src/main/java/org/libvirt/event/IOErrorAction.java | 39 ++
.../java/org/libvirt/event/IOErrorListener.java | 21 +
.../java/org/libvirt/event/LifecycleListener.java | 24 +
.../java/org/libvirt/event/PMSuspendListener.java | 17 +
.../java/org/libvirt/event/PMSuspendReason.java | 5 +
.../java/org/libvirt/event/PMSuspendedDetail.java | 15 +
.../java/org/libvirt/event/PMWakeupListener.java | 17 +
.../java/org/libvirt/event/PMWakeupReason.java | 5 +
.../java/org/libvirt/event/RebootListener.java | 15 +
src/main/java/org/libvirt/event/ResumedDetail.java | 20 +
.../java/org/libvirt/event/ShutdownDetail.java | 12 +
src/main/java/org/libvirt/event/StartedDetail.java | 30 +
src/main/java/org/libvirt/event/StoppedDetail.java | 40 ++
.../java/org/libvirt/event/SuspendedDetail.java | 40 ++
.../java/org/libvirt/event/UndefinedDetail.java | 7 +
src/main/java/org/libvirt/jna/Libvirt.java | 121 +++-
src/main/java/org/libvirt/jna/SizeT.java | 19 +
.../java/org/libvirt/jna/SizeTByReference.java | 50 ++
src/main/java/org/libvirt/jna/virConnectAuth.java | 4 +-
.../java/org/libvirt/jna/virConnectCredential.java | 4 +-
.../java/org/libvirt/jna/virDomainBlockInfo.java | 4 +-
.../java/org/libvirt/jna/virDomainBlockStats.java | 4 +-
src/main/java/org/libvirt/jna/virDomainInfo.java | 4 +-
.../org/libvirt/jna/virDomainInterfaceStats.java | 4 +-
.../java/org/libvirt/jna/virDomainJobInfo.java | 4 +-
.../java/org/libvirt/jna/virDomainMemoryStats.java | 4 +-
src/main/java/org/libvirt/jna/virError.java | 4 +-
src/main/java/org/libvirt/jna/virNodeInfo.java | 4 +-
.../java/org/libvirt/jna/virSchedParameter.java | 4 +-
.../java/org/libvirt/jna/virStoragePoolInfo.java | 4 +-
.../java/org/libvirt/jna/virStorageVolInfo.java | 4 +-
src/main/java/org/libvirt/jna/virVcpuInfo.java | 4 +-
src/test/java/org/libvirt/TestJavaBindings.java | 139 +++-
src/test/java/org/libvirt/TestLibvirtGlobals.java | 4 +
src/test/java/test.java | 280 --------
63 files changed, 2807 insertions(+), 1187 deletions(-)
create mode 100644 src/main/java/org/libvirt/BitFlags.java
create mode 100644 src/main/java/org/libvirt/KeycodeSet.java
create mode 100644 src/main/java/org/libvirt/MemoryAddressMode.java
create mode 100644 src/main/java/org/libvirt/SecretUsageType.java
create mode 100644 src/main/java/org/libvirt/SuspendTarget.java
create mode 100644 src/main/java/org/libvirt/event/CrashedDetail.java
create mode 100644 src/main/java/org/libvirt/event/DefinedDetail.java
create mode 100644 src/main/java/org/libvirt/event/DetailInfo.java
create mode 100644 src/main/java/org/libvirt/event/DomainEvent.java
create mode 100644 src/main/java/org/libvirt/event/DomainEventDetail.java
create mode 100644 src/main/java/org/libvirt/event/DomainEventType.java
create mode 100644 src/main/java/org/libvirt/event/EventListener.java
create mode 100644 src/main/java/org/libvirt/event/IOErrorAction.java
create mode 100644 src/main/java/org/libvirt/event/IOErrorListener.java
create mode 100644 src/main/java/org/libvirt/event/LifecycleListener.java
create mode 100644 src/main/java/org/libvirt/event/PMSuspendListener.java
create mode 100644 src/main/java/org/libvirt/event/PMSuspendReason.java
create mode 100644 src/main/java/org/libvirt/event/PMSuspendedDetail.java
create mode 100644 src/main/java/org/libvirt/event/PMWakeupListener.java
create mode 100644 src/main/java/org/libvirt/event/PMWakeupReason.java
create mode 100644 src/main/java/org/libvirt/event/RebootListener.java
create mode 100644 src/main/java/org/libvirt/event/ResumedDetail.java
create mode 100644 src/main/java/org/libvirt/event/ShutdownDetail.java
create mode 100644 src/main/java/org/libvirt/event/StartedDetail.java
create mode 100644 src/main/java/org/libvirt/event/StoppedDetail.java
create mode 100644 src/main/java/org/libvirt/event/SuspendedDetail.java
create mode 100644 src/main/java/org/libvirt/event/UndefinedDetail.java
create mode 100644 src/main/java/org/libvirt/jna/SizeT.java
create mode 100644 src/main/java/org/libvirt/jna/SizeTByReference.java
delete mode 100644 src/test/java/test.java
--
1.7.9.5
10 years
[libvirt] [PATCHv7 0/7] Add non-FreeBSD guest support to Bhyve driver.
by Conrad Meyer
Drvbhyve hardcodes bhyveload(8) as the host bootloader for guests.
bhyveload(8) loader only supports FreeBSD guests.
This patch series adds <bootloader> and <bootloader_args> handling to
bhyve_command, so libvirt can boot non-FreeBSD guests in Bhyve.
Additionally, support for grub-bhyve(1)'s --cons-dev argument is added so that
interactive GRUB menus can be manipulated with the domain-configured serial
device.
See patch logs for further details.
Thanks,
Conrad
Changes in v7:
- Detect grub-bhyve support for --cons-dev automatically; only pass the
domain-configured serial device if supported.
- Add '-nocons' version of the grub-serial unit tests to confirm we construct
the loader Cmd correctly if the capability is missing.
Conrad Meyer (7):
bhyve: Support /domain/bootloader configuration for non-FreeBSD
guests.
bhyvexml2argv: Add loader argv tests.
domaincommon.rng: Add 'bootloader' to os=hvm schema for Bhyve
bhyvexml2argv: Add tests for domain-configured bootloader, args
bhyve: Probe grub-bhyve for --cons-dev capability
bhyve: Add console support for grub-bhyve bootloader
bhyvexml2argv: Add test for grub console support
docs/drvbhyve.html.in | 100 ++++++++++-
docs/formatdomain.html.in | 4 +-
docs/schemas/domaincommon.rng | 17 +-
src/bhyve/bhyve_capabilities.c | 37 ++++
src/bhyve/bhyve_capabilities.h | 3 +
src/bhyve/bhyve_command.c | 189 +++++++++++++++++++--
src/bhyve/bhyve_command.h | 5 +-
src/bhyve/bhyve_driver.c | 16 +-
src/bhyve/bhyve_driver.h | 2 +
src/bhyve/bhyve_process.c | 38 ++++-
src/bhyve/bhyve_utils.h | 2 +
.../bhyvexml2argv-acpiapic.ldargs | 1 +
tests/bhyvexml2argvdata/bhyvexml2argv-base.ldargs | 1 +
.../bhyvexml2argv-bhyveload-explicitargs.args | 3 +
.../bhyvexml2argv-bhyveload-explicitargs.ldargs | 1 +
.../bhyvexml2argv-bhyveload-explicitargs.xml | 23 +++
.../bhyvexml2argvdata/bhyvexml2argv-console.ldargs | 1 +
.../bhyvexml2argv-custom-loader.args | 3 +
.../bhyvexml2argv-custom-loader.ldargs | 1 +
.../bhyvexml2argv-custom-loader.xml | 24 +++
.../bhyvexml2argv-disk-cdrom-grub.args | 3 +
.../bhyvexml2argv-disk-cdrom-grub.devmap | 1 +
.../bhyvexml2argv-disk-cdrom-grub.ldargs | 2 +
.../bhyvexml2argv-disk-cdrom-grub.xml | 23 +++
.../bhyvexml2argv-disk-cdrom.ldargs | 1 +
.../bhyvexml2argv-disk-virtio.ldargs | 1 +
.../bhyvexml2argv-grub-defaults.args | 3 +
.../bhyvexml2argv-grub-defaults.devmap | 1 +
.../bhyvexml2argv-grub-defaults.ldargs | 2 +
.../bhyvexml2argv-grub-defaults.xml | 23 +++
.../bhyvexml2argvdata/bhyvexml2argv-macaddr.ldargs | 1 +
.../bhyvexml2argv-serial-grub-nocons.args | 4 +
.../bhyvexml2argv-serial-grub-nocons.devmap | 1 +
.../bhyvexml2argv-serial-grub-nocons.ldargs | 2 +
.../bhyvexml2argv-serial-grub-nocons.xml | 26 +++
.../bhyvexml2argv-serial-grub.args | 4 +
.../bhyvexml2argv-serial-grub.devmap | 1 +
.../bhyvexml2argv-serial-grub.ldargs | 2 +
.../bhyvexml2argv-serial-grub.xml | 26 +++
.../bhyvexml2argvdata/bhyvexml2argv-serial.ldargs | 1 +
tests/bhyvexml2argvtest.c | 71 +++++++-
41 files changed, 631 insertions(+), 39 deletions(-)
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-acpiapic.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-base.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-explicitargs.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-explicitargs.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-bhyveload-explicitargs.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-console.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-custom-loader.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-custom-loader.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-custom-loader.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.devmap
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom-grub.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-cdrom.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.devmap
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-grub-defaults.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-macaddr.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.devmap
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub-nocons.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.devmap
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial-grub.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-serial.ldargs
--
1.9.3
10 years
[libvirt] [PATCH] Use UPDATE_CPU when saving domain status
by Ján Tomko
We only format cpu model for MODE_CUSTOM in domain status XML,
but we always format features if they are present.
This is a problem if we have a domain using MODE_HOST_PASSTHROUGH
that has been managedsaved, then restored, since it now has
a feature list but no model in /var/run/libvirt/qemu.
Use UPDATE_CPU even for the status XML to prevent libvirt
from losing track of the domain.
Also accept a list of features for HOST_PASSTHROUGH even without
a model specified, to catch domains started with older libvirtd.
(We already accept the list of features with a model specified,
even though they have no effect for HOST_PASSTHROUGH)
https://bugzilla.redhat.com/show_bug.cgi?id=1030793
https://bugzilla.redhat.com/show_bug.cgi?id=1151885
---
src/conf/cpu_conf.c | 2 +-
src/conf/domain_conf.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 9b7fbb0..96e1c38 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -625,7 +625,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
(def->mode == VIR_CPU_MODE_CUSTOM && def->model)));
if (!def->model &&
- def->mode != VIR_CPU_MODE_HOST_MODEL &&
+ def->mode == VIR_CPU_MODE_CUSTOM &&
def->nfeatures) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Non-empty feature list specified without CPU model"));
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a351382..414161c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19621,6 +19621,7 @@ virDomainSaveStatus(virDomainXMLOptionPtr xmlopt,
virDomainObjPtr obj)
{
unsigned int flags = (VIR_DOMAIN_XML_SECURE |
+ VIR_DOMAIN_XML_UPDATE_CPU |
VIR_DOMAIN_XML_INTERNAL_STATUS |
VIR_DOMAIN_XML_INTERNAL_ACTUAL_NET |
VIR_DOMAIN_XML_INTERNAL_PCI_ORIG_STATES |
--
2.0.4
10 years
[libvirt] [PATCH][1.2.10] Relax duplicate SCSI host pool checking
by Ján Tomko
Since commit 3f99d64 no new scsi_host pools can be defined
if one of the already defined scsi_host pools does not refer
to an accessible scsi_host adapter.
Relax the check by skipping over these inaccessible pools
when checking for duplicates. If both of them are defined by
their parent, only compare their address and unique_id with
the re-introduced matchSCSIAdapterParent function.
---
This would be nice to get into 1.2.10, as the commit mentioned
above has not yet been released.
src/conf/storage_conf.c | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 19c452b..afd6cd4 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -2094,6 +2094,28 @@ getSCSIHostNumber(virStoragePoolSourceAdapter adapter,
VIR_FREE(name);
return ret;
}
+static bool
+matchSCSIAdapterParent(virStoragePoolObjPtr pool,
+ virStoragePoolDefPtr def)
+{
+ virDevicePCIAddressPtr pooladdr =
+ &pool->def->source.adapter.data.scsi_host.parentaddr;
+ virDevicePCIAddressPtr defaddr =
+ &def->source.adapter.data.scsi_host.parentaddr;
+ int pool_unique_id =
+ pool->def->source.adapter.data.scsi_host.unique_id;
+ int def_unique_id =
+ def->source.adapter.data.scsi_host.unique_id;
+ if (pooladdr->domain == defaddr->domain &&
+ pooladdr->bus == defaddr->bus &&
+ pooladdr->slot == defaddr->slot &&
+ pooladdr->function == defaddr->function &&
+ pool_unique_id == def_unique_id) {
+ return true;
+ }
+ return false;
+}
+
int
virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
@@ -2143,10 +2165,17 @@ virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
unsigned int pool_hostnum, def_hostnum;
+ if (pool->def->source.adapter.data.scsi_host.has_parent &&
+ def->source.adapter.data.scsi_host.has_parent &&
+ matchSCSIAdapterParent(pool, def)) {
+ matchpool = pool;
+ break;
+ }
+
if (getSCSIHostNumber(pool->def->source.adapter,
&pool_hostnum) < 0 ||
getSCSIHostNumber(def->source.adapter, &def_hostnum) < 0)
- goto error;
+ break;
if (pool_hostnum == def_hostnum)
matchpool = pool;
}
@@ -2188,10 +2217,6 @@ virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
ret = -1;
}
return ret;
-
- error:
- virStoragePoolObjUnlock(pool);
- return -1;
}
void
--
2.0.4
10 years
[libvirt] [PATCH v2] domain: fix parsing of memory tunables on 32-bit machines
by Eric Blake
Commit 6c9a8a4 (Oct 2014) exposed a long-standing issue on 32-bit
machines: code related to virDomainSetMemoryParameters has always
been documented as using a 64-bit limit, but it was implemented by
calling virDomainParseMemory which enforced an 'unsigned long'
limit. Since VIR_DOMAIN_MEMORY_PARAM_UNLIMITED capped to a
long is -1, but virDomainParseScaledValue no longer accepts
negative values, an attempt to use 2^53-1 as a hard memory limit
started failing the testsuite. However, the problem with capping
things artificially low has existed for much longer - ever since
commits 4888f0fb and 2e22f23 (Mar 2012) switched internal tracking
from 'unsigned long' to 'unsigned long long' (prior to that time,
the cap was a side-effect of the choice of types). We _have_ to
cap the balloon memory values, (no thanks to baked in 'unsigned long'
of API such as virDomainSetMaxMemory or virDomainGetInfo with no
counterpart API that guarantees 64-bit access to those numbers)
but memory parameters have never needed the artificial limit.
At any rate, the solution is to make the parser function gain a
parameter, and only do the reduced 32-bit cap for the values that
are constrained due to API.
* src/conf/domain_conf.h (_virDomainMemtune): Add comments.
* src/conf/domain_conf.c (virDomainParseMemory): Add parameter.
(virDomainDefParseXML): Adjust callers.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/conf/domain_conf.c | 25 ++++++++++++++-----------
src/conf/domain_conf.h | 14 ++++++++------
2 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 39befb0..c594325 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6373,19 +6373,22 @@ virDomainParseScaledValue(const char *xpath,
/* Parse a memory element located at XPATH within CTXT, and store the
- * result into MEM. If REQUIRED, then the value must exist;
- * otherwise, the value is optional. The value is in blocks of 1024.
- * Return 0 on success, -1 on failure after issuing error. */
+ * result into MEM, in blocks of 1024. If REQUIRED, then the value
+ * must exist; otherwise, the value is optional. The value must not
+ * exceed VIR_DOMAIN_MEMORY_PARAM_UNLIMITED once scaled; additionally,
+ * if CAPPED is true, the value must fit within an unsigned long (only
+ * matters on 32-bit platforms). Return 0 on success, -1 on failure
+ * after issuing error. */
static int
virDomainParseMemory(const char *xpath, xmlXPathContextPtr ctxt,
- unsigned long long *mem, bool required)
+ unsigned long long *mem, bool required, bool capped)
{
int ret = -1;
unsigned long long bytes, max;
/* On 32-bit machines, our bound is 0xffffffff * KiB. On 64-bit
* machines, our bound is off_t (2^63). */
- if (sizeof(unsigned long) < sizeof(long long))
+ if (capped && sizeof(unsigned long) < sizeof(long long))
max = 1024ull * ULONG_MAX;
else
max = LLONG_MAX;
@@ -12215,11 +12218,11 @@ virDomainDefParseXML(xmlDocPtr xml,
/* Extract domain memory */
if (virDomainParseMemory("./memory[1]", ctxt,
- &def->mem.max_balloon, true) < 0)
+ &def->mem.max_balloon, true, true) < 0)
goto error;
if (virDomainParseMemory("./currentMemory[1]", ctxt,
- &def->mem.cur_balloon, false) < 0)
+ &def->mem.cur_balloon, false, true) < 0)
goto error;
/* and info about it */
@@ -12339,19 +12342,19 @@ virDomainDefParseXML(xmlDocPtr xml,
/* Extract other memory tunables */
if (virDomainParseMemory("./memtune/hard_limit[1]", ctxt,
- &def->mem.hard_limit, false) < 0)
+ &def->mem.hard_limit, false, false) < 0)
goto error;
if (virDomainParseMemory("./memtune/soft_limit[1]", ctxt,
- &def->mem.soft_limit, false) < 0)
+ &def->mem.soft_limit, false, false) < 0)
goto error;
if (virDomainParseMemory("./memtune/min_guarantee[1]", ctxt,
- &def->mem.min_guarantee, false) < 0)
+ &def->mem.min_guarantee, false, false) < 0)
goto error;
if (virDomainParseMemory("./memtune/swap_hard_limit[1]", ctxt,
- &def->mem.swap_hard_limit, false) < 0)
+ &def->mem.swap_hard_limit, false, false) < 0)
goto error;
n = virXPathULong("string(./vcpu[1])", ctxt, &count);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9908d88..fbb3b2f 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1966,8 +1966,10 @@ typedef struct _virDomainMemtune virDomainMemtune;
typedef virDomainMemtune *virDomainMemtunePtr;
struct _virDomainMemtune {
- unsigned long long max_balloon; /* in kibibytes */
- unsigned long long cur_balloon; /* in kibibytes */
+ unsigned long long max_balloon; /* in kibibytes, capped at ulong thanks
+ to virDomainGetMaxMemory */
+ unsigned long long cur_balloon; /* in kibibytes, capped at ulong thanks
+ to virDomainGetInfo */
virDomainHugePagePtr hugepages;
size_t nhugepages;
@@ -1975,10 +1977,10 @@ struct _virDomainMemtune {
bool nosharepages;
bool locked;
int dump_core; /* enum virTristateSwitch */
- unsigned long long hard_limit; /* in kibibytes */
- unsigned long long soft_limit; /* in kibibytes */
- unsigned long long min_guarantee; /* in kibibytes */
- unsigned long long swap_hard_limit; /* in kibibytes */
+ unsigned long long hard_limit; /* in kibibytes, limit at off_t bytes */
+ unsigned long long soft_limit; /* in kibibytes, limit at off_t bytes */
+ unsigned long long min_guarantee; /* in kibibytes, limit at off_t bytes */
+ unsigned long long swap_hard_limit; /* in kibibytes, limit at off_t bytes */
};
typedef struct _virDomainPowerManagement virDomainPowerManagement;
--
1.9.3
10 years
[libvirt] [PATCH 0/2] Fix two coverity issues
by Pavel Hrdina
Both are false positive but its nice to make coverity happy.
Pavel Hrdina (2):
vbox_storage: fix coverity issue with overwriting value
hotplug: fix char device detach
src/qemu/qemu_hotplug.c | 12 ++++++++----
src/vbox/vbox_storage.c | 36 ++++++++++++++++--------------------
2 files changed, 24 insertions(+), 24 deletions(-)
--
2.0.4
10 years