[libvirt] [PATCH 1/4] parallels: add isCt parameter to prlsdkGetDiskInfo and prlsdkAddDisk
Signed-off-by: Maxim Nestratov mnestra...@parallels.com --- src/parallels/parallels_sdk.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 05f11b0..874638f 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -452,7 +452,8 @@ prlsdkAddDomainVideoInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) static int prlsdkGetDiskInfo(PRL_HANDLE prldisk, virDomainDiskDefPtr disk, - bool isCdrom) + bool isCdrom, + bool isCt) { char *buf = NULL; PRL_UINT32 buflen = 0; @@ -627,7 +628,7 @@ prlsdkAddDomainHardDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) if (!(disk = virDomainDiskDefNew(NULL))) goto error; -if (prlsdkGetDiskInfo(hdd, disk, false) 0) +if (prlsdkGetDiskInfo(hdd, disk, false, IS_CT(def)) 0) goto error; if (VIR_APPEND_ELEMENT(def-disks, def-ndisks, disk) 0) @@ -667,7 +668,7 @@ prlsdkAddDomainOpticalDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) if (!(disk = virDomainDiskDefNew(NULL))) goto error; -if (prlsdkGetDiskInfo(cdrom, disk, true) 0) +if (prlsdkGetDiskInfo(cdrom, disk, true, IS_CT(def)) 0) goto error; PrlHandle_Free(cdrom); @@ -2882,7 +2883,10 @@ static int prlsdkDelDisk(PRL_HANDLE sdkdom, int idx) return ret; } -static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootDisk) +static int prlsdkAddDisk(PRL_HANDLE sdkdom, + virDomainDiskDefPtr disk, + bool bootDisk, + bool isCt) { PRL_RESULT pret; PRL_HANDLE sdkdisk = PRL_INVALID_HANDLE; @@ -3063,7 +3067,7 @@ prlsdkAttachVolume(virDomainObjPtr dom, virDomainDiskDefPtr disk) if (PRL_FAILED(waitJob(job))) goto cleanup; -ret = prlsdkAddDisk(privdom-sdkdom, disk, false); +ret = prlsdkAddDisk(privdom-sdkdom, disk, false, IS_CT(dom-def)); if (ret == 0) { job = PrlVm_CommitEx(privdom-sdkdom, PVCF_DETACH_HDD_BUNDLE); if (PRL_FAILED(waitJob(job))) { @@ -3286,7 +3290,7 @@ prlsdkDoApplyConfig(virConnectPtr conn, needBoot = false; bootDisk = true; } -if (prlsdkAddDisk(sdkdom, def-disks[i], bootDisk) 0) +if (prlsdkAddDisk(sdkdom, def-disks[i], bootDisk, IS_CT(def)) 0) goto error; } -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/4] parallels: process '/' mount point correctly for containers
Since we are going to add block devices as root disks we have to specify root mount point for boot block devices. But we shouldn't do this if a filesystem disk with such target mount point already exists. Signed-off-by: Maxim Nestratov mnestra...@parallels.com --- src/parallels/parallels_sdk.c | 19 ++- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 874638f..e4d69f4 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -3047,6 +3047,13 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, if (prlsdkAddDeviceToBootList(sdkdom, devIndex, devType, 0) 0) goto cleanup; + +/* If we add physical device as a boot disk to container + * we have to specify mount point for it */ +if (isCt) { +pret = PrlVmDevHd_SetMountPoint(sdkdisk, /); +prlsdkCheckRetGoto(pret, cleanup); +} } return 0; @@ -3281,6 +3288,13 @@ prlsdkDoApplyConfig(virConnectPtr conn, goto error; } +for (i = 0; i def-nfss; i++) { +if (STREQ(def-fss[i]-dst, /)) +needBoot = false; +if (prlsdkAddFS(sdkdom, def-fss[i]) 0) +goto error; +} + for (i = 0; i def-ndisks; i++) { bool bootDisk = false; @@ -3294,11 +3308,6 @@ prlsdkDoApplyConfig(virConnectPtr conn, goto error; } -for (i = 0; i def-nfss; i++) { -if (prlsdkAddFS(sdkdom, def-fss[i]) 0) -goto error; -} - return 0; error: -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/4] parallels: report SATA bus type for container block devices disks
As we can add disks based on block devices to containers and bus type doesn't have any meaning here, let us report always SATA for them. Signed-off-by: Maxim Nestratov mnestra...@parallels.com --- src/parallels/parallels_sdk.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index e4d69f4..432cfe2 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -496,8 +496,13 @@ prlsdkGetDiskInfo(PRL_HANDLE prldisk, if (virDomainDiskSetSource(disk, buf) 0) goto cleanup; -pret = PrlVmDev_GetIfaceType(prldisk, ifType); -prlsdkCheckRetGoto(pret, cleanup); +/* Let physical devices added to CT look like SATA disks */ +if (isCt) +ifType = PMS_SATA_DEVICE; +else { +pret = PrlVmDev_GetIfaceType(prldisk, ifType); +prlsdkCheckRetGoto(pret, cleanup); +} pret = PrlVmDev_GetStackIndex(prldisk, pos); prlsdkCheckRetGoto(pret, cleanup); -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 4/4] parallels: treat block devices as disks for containers
We are going to add block devices as disks for containers not as filesystems. Signed-off-by: Maxim Nestratov mnestra...@parallels.com --- src/parallels/parallels_sdk.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 432cfe2..e97f729 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -612,10 +612,16 @@ prlsdkAddDomainHardDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) prlsdkCheckRetGoto(pret, error); for (i = 0; i hddCount; ++i) { + +PRL_UINT32 emulatedType; + pret = PrlVmCfg_GetHardDisk(sdkdom, i, hdd); prlsdkCheckRetGoto(pret, error); -if (IS_CT(def)) { +pret = PrlVmDev_GetEmulatedType(hdd, emulatedType); +prlsdkCheckRetGoto(pret, error); + +if (PDT_USE_REAL_DEVICE != emulatedType IS_CT(def)) { if (VIR_ALLOC(fs) 0) goto error; -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [v2] storage-pool: API to get/set autostart flag
Meh, I keep sending without libvirt-glib in subject.. On Wed, Jun 3, 2015 at 11:35 AM, Zeeshan Ali (Khattak) zeesha...@gnome.org wrote: Add binding for virStoragePoolGetAutostart virStoragePoolSetAutostart. --- libvirt-gobject/libvirt-gobject-storage-pool.c | 51 ++ libvirt-gobject/libvirt-gobject-storage-pool.h | 5 +++ libvirt-gobject/libvirt-gobject.sym| 6 +++ 3 files changed, 62 insertions(+) diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c index f3eac0d..7f26b1b 100644 --- a/libvirt-gobject/libvirt-gobject-storage-pool.c +++ b/libvirt-gobject/libvirt-gobject-storage-pool.c @@ -1048,6 +1048,57 @@ gboolean gvir_storage_pool_delete (GVirStoragePool *pool, return TRUE; } +/** + * gvir_storage_pool_get_autostart: + * @pool: the storage pool + * @err: return location for any #GError + * + * Return value: #True if autostart is enabled, #False otherwise. + */ +gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool, + GError **err) +{ +int ret; + +g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE); +g_return_val_if_fail(err == NULL || *err == NULL, FALSE); + +if (virStoragePoolGetAutostart(pool-priv-handle, ret)) { +gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR, + 0, + Failed to get autostart flag from storage pool); +} + +return !!ret; +} + +/** + * gvir_storage_pool_set_autostart: + * @pool: the storage pool + * @autostart: Whether or not to autostart + * @err: return location for any #GError + * + * Sets whether or not storage pool @pool is started automatically on boot. + * + * Return value: #TRUE on success, #FALSE otherwise. + */ +gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool, + gboolean autostart, + GError **err) +{ +g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE); +g_return_val_if_fail(err == NULL || *err == NULL, FALSE); + +if (virStoragePoolSetAutostart(pool-priv-handle, autostart)) { +gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR, + 0, + Failed to set autostart flag on storage pool); +return FALSE; +} + +return TRUE; +} + static void gvir_storage_pool_delete_helper(GSimpleAsyncResult *res, GObject *object, diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.h b/libvirt-gobject/libvirt-gobject-storage-pool.h index f8529f0..f7f879c 100644 --- a/libvirt-gobject/libvirt-gobject-storage-pool.h +++ b/libvirt-gobject/libvirt-gobject-storage-pool.h @@ -166,6 +166,11 @@ void gvir_storage_pool_delete_async (GVirStoragePool *pool, gboolean gvir_storage_pool_delete_finish(GVirStoragePool *pool, GAsyncResult *result, GError **err); +gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool, + GError **err); +gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool, + gboolean autostart, + GError **err); G_END_DECLS diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym index 927cad9..dcda675 100644 --- a/libvirt-gobject/libvirt-gobject.sym +++ b/libvirt-gobject/libvirt-gobject.sym @@ -265,4 +265,10 @@ LIBVIRT_GOBJECT_0.2.0 { gvir_domain_open_graphics_fd; } LIBVIRT_GOBJECT_0.1.9; +LIBVIRT_GOBJECT_0.2.1 { + global: + gvir_storage_pool_get_autostart; + gvir_storage_pool_set_autostart; +} LIBVIRT_GOBJECT_0.2.0; + # define new API here using predicted next version number -- 2.4.2 -- Regards, Zeeshan Ali (Khattak) Befriend GNOME: http://www.gnome.org/friends/ -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [libvirt-glib v2] storage-pool: API to get/set autostart flag
Add binding for virStoragePoolGetAutostart virStoragePoolSetAutostart. --- libvirt-gobject/libvirt-gobject-storage-pool.c | 51 ++ libvirt-gobject/libvirt-gobject-storage-pool.h | 5 +++ libvirt-gobject/libvirt-gobject.sym| 6 +++ 3 files changed, 62 insertions(+) diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c index f3eac0d..7f26b1b 100644 --- a/libvirt-gobject/libvirt-gobject-storage-pool.c +++ b/libvirt-gobject/libvirt-gobject-storage-pool.c @@ -1048,6 +1048,57 @@ gboolean gvir_storage_pool_delete (GVirStoragePool *pool, return TRUE; } +/** + * gvir_storage_pool_get_autostart: + * @pool: the storage pool + * @err: return location for any #GError + * + * Return value: #True if autostart is enabled, #False otherwise. + */ +gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool, + GError **err) +{ +int ret; + +g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE); +g_return_val_if_fail(err == NULL || *err == NULL, FALSE); + +if (virStoragePoolGetAutostart(pool-priv-handle, ret)) { +gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR, + 0, + Failed to get autostart flag from storage pool); +} + +return !!ret; +} + +/** + * gvir_storage_pool_set_autostart: + * @pool: the storage pool + * @autostart: Whether or not to autostart + * @err: return location for any #GError + * + * Sets whether or not storage pool @pool is started automatically on boot. + * + * Return value: #TRUE on success, #FALSE otherwise. + */ +gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool, + gboolean autostart, + GError **err) +{ +g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE); +g_return_val_if_fail(err == NULL || *err == NULL, FALSE); + +if (virStoragePoolSetAutostart(pool-priv-handle, autostart)) { +gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR, + 0, + Failed to set autostart flag on storage pool); +return FALSE; +} + +return TRUE; +} + static void gvir_storage_pool_delete_helper(GSimpleAsyncResult *res, GObject *object, diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.h b/libvirt-gobject/libvirt-gobject-storage-pool.h index f8529f0..f7f879c 100644 --- a/libvirt-gobject/libvirt-gobject-storage-pool.h +++ b/libvirt-gobject/libvirt-gobject-storage-pool.h @@ -166,6 +166,11 @@ void gvir_storage_pool_delete_async (GVirStoragePool *pool, gboolean gvir_storage_pool_delete_finish(GVirStoragePool *pool, GAsyncResult *result, GError **err); +gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool, + GError **err); +gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool, + gboolean autostart, + GError **err); G_END_DECLS diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym index 927cad9..dcda675 100644 --- a/libvirt-gobject/libvirt-gobject.sym +++ b/libvirt-gobject/libvirt-gobject.sym @@ -265,4 +265,10 @@ LIBVIRT_GOBJECT_0.2.0 { gvir_domain_open_graphics_fd; } LIBVIRT_GOBJECT_0.1.9; +LIBVIRT_GOBJECT_0.2.1 { + global: + gvir_storage_pool_get_autostart; + gvir_storage_pool_set_autostart; +} LIBVIRT_GOBJECT_0.2.0; + # define new API here using predicted next version number -- 2.4.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 0/9] Selective block device migration implementation
On Wed, Jun 03, 2015 at 11:11:45AM -0600, Eric Blake wrote: On 06/01/2015 02:41 PM, John Ferlan wrote: And, `make` seems to fail here: $ ~/tinker-space/libvirt/./autogen.sh --system $ make -j4 [. . .] /home/kashyapc/tinker-space/libvirt/./src/qemu/qemu_migration.c: In function 'qemuMigrationRun': /home/kashyapc/tinker-space/libvirt/./src/qemu/qemu_migration.c:1997:17: error: 'format' may be used uninitialized in this function [-Werror=maybe-uninitialized] mon_ret = qemuMonitorDriveMirror(priv-mon, diskAlias, nbd_dest, ^ /home/kashyapc/tinker-space/libvirt/./src/qemu/qemu_migration.c:1971:21: note: 'format' was declared here const char *format; See my response to 3/9. If you initialize to NULL you'll be able to compile. But you'll end up corrupting your guest if your source has a qcow2 disk. The patch needs to be tweaked to mirror to NBD as raw rather than as the source's format. Will wait for the next revision of this patch set to test. Also read your other response from here: https://www.redhat.com/archives/libvir-list/2015-June/msg00153.html PS: Apologies if this ends up being a double email, the first email was accidentally sent from my @fedoraproject.org address (which is not subscribed to this list). Unsubscribed mails can still get through to the list, it just requires a moderation delay on the first time an email address is seen. Yeah, I was hoping someone would let in only one of the messages. But, noted. :-) Thanks. -- /kashyap -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/4 v2] parallels: better support of volume based disks in containers
v1-v2 change: * Single patch was split into smaller pieces * Corrected conflict of / mount point in case both filesystem and block device disks are being added. It is possible to attach volumes to containers but since they are added they are reported erroneously as filesystems. This is fixed in this patch set. As soon as bus type has no meaning for containers we always report SATA for such disks. In case a container is created with a disk based on physical volume and there is no filesystem disk with root mount point we are expected to specify mount point block device based disk to be able to boot from it. Maxim Nestratov (4): parallels: add isCt parameter to prlsdkGetDiskInfo and prlsdkAddDisk parallels: process '/' mount point correctly for containers parallels: report SATA bus type for container block devices disks parallels: treat block devices as disks for containers src/parallels/parallels_sdk.c | 52 +++ 1 file changed, 38 insertions(+), 14 deletions(-) -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [v2] storage-pool: API to get/set autostart flag
Add binding for virStoragePoolGetAutostart virStoragePoolSetAutostart. --- libvirt-gobject/libvirt-gobject-storage-pool.c | 51 ++ libvirt-gobject/libvirt-gobject-storage-pool.h | 5 +++ libvirt-gobject/libvirt-gobject.sym| 6 +++ 3 files changed, 62 insertions(+) diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.c b/libvirt-gobject/libvirt-gobject-storage-pool.c index f3eac0d..7f26b1b 100644 --- a/libvirt-gobject/libvirt-gobject-storage-pool.c +++ b/libvirt-gobject/libvirt-gobject-storage-pool.c @@ -1048,6 +1048,57 @@ gboolean gvir_storage_pool_delete (GVirStoragePool *pool, return TRUE; } +/** + * gvir_storage_pool_get_autostart: + * @pool: the storage pool + * @err: return location for any #GError + * + * Return value: #True if autostart is enabled, #False otherwise. + */ +gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool, + GError **err) +{ +int ret; + +g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE); +g_return_val_if_fail(err == NULL || *err == NULL, FALSE); + +if (virStoragePoolGetAutostart(pool-priv-handle, ret)) { +gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR, + 0, + Failed to get autostart flag from storage pool); +} + +return !!ret; +} + +/** + * gvir_storage_pool_set_autostart: + * @pool: the storage pool + * @autostart: Whether or not to autostart + * @err: return location for any #GError + * + * Sets whether or not storage pool @pool is started automatically on boot. + * + * Return value: #TRUE on success, #FALSE otherwise. + */ +gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool, + gboolean autostart, + GError **err) +{ +g_return_val_if_fail(GVIR_IS_STORAGE_POOL(pool), FALSE); +g_return_val_if_fail(err == NULL || *err == NULL, FALSE); + +if (virStoragePoolSetAutostart(pool-priv-handle, autostart)) { +gvir_set_error_literal(err, GVIR_STORAGE_POOL_ERROR, + 0, + Failed to set autostart flag on storage pool); +return FALSE; +} + +return TRUE; +} + static void gvir_storage_pool_delete_helper(GSimpleAsyncResult *res, GObject *object, diff --git a/libvirt-gobject/libvirt-gobject-storage-pool.h b/libvirt-gobject/libvirt-gobject-storage-pool.h index f8529f0..f7f879c 100644 --- a/libvirt-gobject/libvirt-gobject-storage-pool.h +++ b/libvirt-gobject/libvirt-gobject-storage-pool.h @@ -166,6 +166,11 @@ void gvir_storage_pool_delete_async (GVirStoragePool *pool, gboolean gvir_storage_pool_delete_finish(GVirStoragePool *pool, GAsyncResult *result, GError **err); +gboolean gvir_storage_pool_get_autostart(GVirStoragePool *pool, + GError **err); +gboolean gvir_storage_pool_set_autostart(GVirStoragePool *pool, + gboolean autostart, + GError **err); G_END_DECLS diff --git a/libvirt-gobject/libvirt-gobject.sym b/libvirt-gobject/libvirt-gobject.sym index 927cad9..dcda675 100644 --- a/libvirt-gobject/libvirt-gobject.sym +++ b/libvirt-gobject/libvirt-gobject.sym @@ -265,4 +265,10 @@ LIBVIRT_GOBJECT_0.2.0 { gvir_domain_open_graphics_fd; } LIBVIRT_GOBJECT_0.1.9; +LIBVIRT_GOBJECT_0.2.1 { + global: + gvir_storage_pool_get_autostart; + gvir_storage_pool_set_autostart; +} LIBVIRT_GOBJECT_0.2.0; + # define new API here using predicted next version number -- 2.4.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] util: Clear output broadcast address before filling it in
Since commit 55ace7c4789c8a7408139460f4b639cee00e5125, the sockettest fails without VIR_TEST_DEBUG set. The problem is found by test number 42 (co-incidence?), which tests range '192.168.122.1' - '192.168.122.255' in network '192.168.122.0/24'. That is supposed to fail because the end address is equal to the broadcast address. When comparing these two in 'virSocketAddrEqual(end, broadcast)', there is a check for sin_addr as well as for sin_port. That port, however, is different when we do not enable test debugging. With the testing enabled, the port is 0 (correctly initialized), but without that it has a random number there. And that's because the structure is not initialized anywhere. By zeroing the structure before filling in the info, we make sure we return only the address and not any information that was not requested. And the test work once again. Signed-off-by: Martin Kletzander mklet...@redhat.com --- Notes: Pushed as a build-breaker. src/util/virsocketaddr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index 34f2af31b2e7..81539b3730d4 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -505,6 +505,8 @@ virSocketAddrBroadcast(const virSocketAddr *addr, const virSocketAddr *netmask, virSocketAddrPtr broadcast) { +memset(broadcast, 0, sizeof(*broadcast)); + if ((addr-data.stor.ss_family != AF_INET) || (netmask-data.stor.ss_family != AF_INET)) { broadcast-data.stor.ss_family = AF_UNSPEC; -- 2.4.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/4] storage: Refactor storage pool type checks
Refactor the code for both startPool (*Mount) and stopPool (*Unmount) code paths by introducing virStorageBackendFileSystemValidateFS. Signed-off-by: John Ferlan jfer...@redhat.com --- src/storage/storage_backend_fs.c | 85 ++-- 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index b70902a..9a1343d 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -334,6 +334,41 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE return ret; } +/** + * @pool storage pool to check FS types + * + * Determine if storage pool FS types are properly set up + * + * Return 0 if everything's OK, -1 on error + */ +static int +virStorageBackendFileSystemValidateFS(virStoragePoolObjPtr pool) +{ +if (pool-def-type == VIR_STORAGE_POOL_NETFS) { +if (pool-def-source.nhost != 1) { +virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, + _(Expected exactly 1 host for the storage pool)); +return -1; +} +if (pool-def-source.hosts[0].name == NULL) { +virReportError(VIR_ERR_INTERNAL_ERROR, + %s, _(missing source host)); +return -1; +} +if (pool-def-source.dir == NULL) { +virReportError(VIR_ERR_INTERNAL_ERROR, + %s, _(missing source path)); +return -1; +} +} else { +if (pool-def-source.ndevice != 1) { +virReportError(VIR_ERR_INTERNAL_ERROR, + %s, _(missing source device)); +return -1; +} +} +return 0; +} /** * @pool storage pool to check for status @@ -390,29 +425,8 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) int ret = -1; int rc; -if (pool-def-type == VIR_STORAGE_POOL_NETFS) { -if (pool-def-source.nhost != 1) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, - _(Expected exactly 1 host for the storage pool)); -return -1; -} -if (pool-def-source.hosts[0].name == NULL) { -virReportError(VIR_ERR_INTERNAL_ERROR, - %s, _(missing source host)); -return -1; -} -if (pool-def-source.dir == NULL) { -virReportError(VIR_ERR_INTERNAL_ERROR, - %s, _(missing source path)); -return -1; -} -} else { -if (pool-def-source.ndevice != 1) { -virReportError(VIR_ERR_INTERNAL_ERROR, - %s, _(missing source device)); -return -1; -} -} +if (virStorageBackendFileSystemValidateFS(pool) 0) +return -1; /* Short-circuit if already mounted */ if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 0) { @@ -486,29 +500,8 @@ virStorageBackendFileSystemUnmount(virStoragePoolObjPtr pool) int ret = -1; int rc; -if (pool-def-type == VIR_STORAGE_POOL_NETFS) { -if (pool-def-source.nhost != 1) { -virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s, - _(Expected exactly 1 host for the storage pool)); -return -1; -} -if (pool-def-source.hosts[0].name == NULL) { -virReportError(VIR_ERR_INTERNAL_ERROR, - %s, _(missing source host)); -return -1; -} -if (pool-def-source.dir == NULL) { -virReportError(VIR_ERR_INTERNAL_ERROR, - %s, _(missing source dir)); -return -1; -} -} else { -if (pool-def-source.ndevice != 1) { -virReportError(VIR_ERR_INTERNAL_ERROR, - %s, _(missing source device)); -return -1; -} -} +if (virStorageBackendFileSystemValidateFS(pool) 0) +return -1; /* Short-circuit if already unmounted */ if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 1) -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/4] storage: FS backend adjust error message on error path
https://bugzilla.redhat.com/show_bug.cgi?id=1181087 Currently the assumption on the error message is that there are no source device path's defined when the != 1 check fails, but in reality the value could 0 or 2 or more, so adjust the error message accordingly to make it clearer what the error really is. Signed-off-by: John Ferlan jfer...@redhat.com --- src/storage/storage_backend_fs.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 9a1343d..3c39646 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -362,8 +362,13 @@ virStorageBackendFileSystemValidateFS(virStoragePoolObjPtr pool) } } else { if (pool-def-source.ndevice != 1) { -virReportError(VIR_ERR_INTERNAL_ERROR, - %s, _(missing source device)); +if (pool-def-source.ndevice == 0) +virReportError(VIR_ERR_INTERNAL_ERROR, %s, + _(missing source device)); +else +virReportError(VIR_ERR_INTERNAL_ERROR, %s, + _(Expected exactly 1 device for the + storage pool)); return -1; } } -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/4] storage: Remove extraneous @conn from function comments
Over time the parameters changed, but the comment wasn't updated Signed-off-by: John Ferlan jfer...@redhat.com --- src/storage/storage_backend_fs.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 337b8d3..b70902a 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -336,7 +336,6 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE /** - * @conn connection to report errors against * @pool storage pool to check for status * * Determine if a storage pool is already mounted @@ -369,7 +368,6 @@ virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool) } /** - * @conn connection to report errors against * @pool storage pool to mount * * Ensure that a FS storage pool is mounted on its target location. @@ -474,7 +472,6 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) } /** - * @conn connection to report errors against * @pool storage pool to unmount * * Ensure that a FS storage pool is not mounted on its target location. -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 4/4] storage: Add check for valid FS types in checkPool callback
https://bugzilla.redhat.com/show_bug.cgi?id=1181087 The virStorageBackendFileSystemIsMounted is called from three source paths checkPool, startPool, and stopPool. Both start and stop validate the FS fields before calling *IsMounted; however the check path there is no call. This could lead the code into returning a true in isActive if for some reason the target path for the pool was mounted. The assumption being that if it was mounted, then we believe we started/mounted it. It's also of note that commit id '81165294' added an error message for the start/mount path regarding that the target is already mounted so fail the start. That check was adjusted by commit id '13fde7ce' to only message if actually mounted. At one time this led to the libvirtd restart autostart code to declare that the pool was active even though the startPool would inhibit startup and the stopPool would inhibit shutdown. The autostart path changed as of commit id '2a31c5f0' as part of the keep storage pools started between libvirtd restarts. This patch adds the same check made prior to start/mount and stop/unmount to ensure we have a valid configuration before attempting to see if the target is already mounted to declare isActive or not. Finding an improper configuration will now cause an error at checkPool, which should make it so we can no longer be left in a situation where the pool was started and we have no way to stop it. Signed-off-by: John Ferlan jfer...@redhat.com --- src/storage/storage_backend_fs.c | 4 1 file changed, 4 insertions(+) diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 3c39646..b8c5a59 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -537,6 +537,10 @@ virStorageBackendFileSystemCheck(virStoragePoolObjPtr pool, } else { int ret; *isActive = false; + +if (virStorageBackendFileSystemValidateFS(pool) 0) +return -1; + if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 0) { if (ret 0) return -1; -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/4] Fix some issues is FS backend
https://bugzilla.redhat.com/show_bug.cgi?id=1181087 Patch 1 was just found by inspection Patch 2 sets up for the the eventual fix Patch 3 Adjusts the error message to make it clearer what the problem is Patch 4 Adds a check in the checkPool path for valid FS storage pool config before checking for IsMounted and declaring isActive = true John Ferlan (4): storage: Remove extraneous @conn from function comments storage: Refactor storage pool type checks storage: FS backend adjust error message on error path storage: Add check for valid FS types in checkPool callback src/storage/storage_backend_fs.c | 97 1 file changed, 48 insertions(+), 49 deletions(-) -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virsh: Fix Ctrl-C behavior when watching a job
On Tue, Jun 02, 2015 at 17:37:35 +0200, Ján Tomko wrote: On Mon, Jun 01, 2015 at 09:05:59PM +0200, Jiri Denemark wrote: When watching a job (save, managedsave, dump, migrate) virsh spawns a thread to call the appropriate API and waits for the result while watching for interruption signals (SIGINT, Ctrl-C on the terminal). Whenever such signal is caught, virsh calls virDomainAbortJob, stops waiting for the job, and returns the result of virDomainAbortJob. This is wrong because the job might have finished in the meantime or it might have been cancelled by someone else and virsh would just report the failure to abort the job. However, we are not interested in the virDomainAbortJob's result at all, we need to keep waiting for the main job to finish and report its result instead. https://bugzilla.redhat.com/show_bug.cgi?id=1131755 Signed-off-by: Jiri Denemark jdene...@redhat.com --- tools/virsh-domain.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) ACK Pushed, thanks. Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: monitor: Add memory balloon support for virtio-ccw
On 06/02/2015 05:56 PM, Ján Tomko wrote: On Tue, Jun 02, 2015 at 11:27:35AM +0200, Boris Fiuczynski wrote: The search for the memory ballon driver object is extended by a second known name virtio-ballon-ccw in support for virtio-ccw. Signed-off-by: Boris Fiuczynski fiu...@linux.vnet.ibm.com Reviewed-by: Christian Borntraeger borntrae...@de.ibm.com --- src/qemu/qemu_monitor.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f959b74..1a88329 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1141,9 +1141,9 @@ qemuMonitorFindObjectPath(qemuMonitorPtr mon, /** - * Search the qom objects for the balloon driver object by it's known name - * of virtio-balloon-pci. The entry for the driver will be found by using - * function qemuMonitorFindObjectPath. + * Search the qom objects for the balloon driver object by it's known names s/it's/its/ Will fix + * of virtio-balloon-pci or virtio-ballon-ccw. The entry for the driver + * will be found by using function qemuMonitorFindObjectPath. * * Once found, check the entry to ensure it has the correct property listed. * If it does not, then obtaining statistics from QEMU will not be possible. @@ -1183,7 +1183,8 @@ qemuMonitorFindBalloonObjectPath(qemuMonitorPtr mon, return -1; } -if (qemuMonitorFindObjectPath(mon, curpath, virtio-balloon-pci, path) 0) +if (qemuMonitorFindObjectPath(mon, curpath, virtio-balloon-pci, path) 0 +qemuMonitorFindObjectPath(mon, curpath, virtio-balloon-ccw, path) 0) return -1; qemuMonitorFindObjectPath can return: 0 - Found -1 - Error bail out -2 - Not found But it only reports an error when returning -1. There is a (pre-existing) missing virReportError in that case. When looking at the code how qemuMonitorFindBalloonObjectPath was used I got the impression that this was intentional since there is mon-balloonpath and mon-ballooninit that are checked after the first unsuccessful call of qemuMonitorFindBalloonObjectPath that report the error Cannot determine balloon device path. That is why I stuck with that idea of just reporting Cannot determine balloon device path. Do you suggest to report additional errors when the qemuMonitorFindObjectPath fails with Error bail out, Not found (PCI) and Not found (CCW) and later always Cannot determine balloon device path? Looking for the ccw balloon only makes sense when the pci one was not found. A fatal error (-1) when finding the PCI balloon was not found will very probably be fatal for CCW as well. Jan -- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research Development GmbH Vorsitzender des Aufsichtsrats: Martina Köderitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCHv3] qemu: fix unsuitable error report when get memory stats
On Wed, Jun 03, 2015 at 09:07:49AM +0800, Wang Yufei wrote: From: Zhang Bo oscar.zhan...@huawei.com when we run the command 'virsh dommemstat xxx', althrough memballoon's model is set 'none' in vm's XML, it still reports an error in libvirtd.log. error : qemuMonitorFindBalloonObjectPath:1042 : internal error: Cannot determine balloon device path Apparently, if we don't set memballoon, we don't need to set balloon device path. This doesn't happen to me, there must be some information missing. Or maybe you haven't tried it with the current master. Signed-off-by: Wang Yufei james.wangyu...@huawei.com Signed-off-by: Zhang Bo oscar.zhan...@huawei.com --- src/qemu/qemu_monitor.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index f959b74..8c3c6f3 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1169,8 +1169,10 @@ qemuMonitorFindBalloonObjectPath(qemuMonitorPtr mon, if (mon-balloonpath) { return 0; } else if (mon-ballooninit) { -virReportError(VIR_ERR_INTERNAL_ERROR, %s, - _(Cannot determine balloon device path)); +if (vm-def-memballoon +vm-def-memballoon-model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) +virReportError(VIR_ERR_INTERNAL_ERROR, %s, + _(Cannot determine balloon device path)); Anyway, you're missing curly brackets around two-line body. return -1; And you still return -1, so instead of error : qemuMonitorFindBalloonObjectPath:1042 : internal error: Cannot determine balloon device path you'll probably get the catch-all: An error occurred, but the cause is unknown } -- 1.7.12.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list signature.asc Description: PGP signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 14/35] qemu: process: Refactor setup of memory ballooning
On Tue, Jun 02, 2015 at 16:12:25 +0200, Ján Tomko wrote: On Fri, May 29, 2015 at 03:33:35PM +0200, Peter Krempa wrote: Since the monitor code now supports ullongs when setting balloon size, drop the legacy code with overflow checking. Additionally the comment mentioning that the job is treated as a sync job does not make sense any more since the monitor is entered asynchronously. --- src/qemu/qemu_process.c | 38 -- 1 file changed, 16 insertions(+), 22 deletions(-) ACK to patches 10-14. I've pushed now patches 1-14 according to the reviews. Thanks. Peter signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 6/9] util: virTypedParams{Filter, PickStrings}
On Tue, May 26, 2015 at 15:01:48 +0200, Michal Privoznik wrote: From: Pavel Boldin pbol...@mirantis.com Add multikey API: * virTypedParamsFilter that returns all the parameters with specified name. * virTypedParamsPickStrings that returns a list with all the values for specified name and string type. ... diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 716dd2f..845a0b8 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -713,6 +713,8 @@ LIBVIRT_1.2.15 { LIBVIRT_1.2.16 { global: virDomainSetUserPassword; +virTypedParamsFilter; +virTypedParamsPickStrings; } LIBVIRT_1.2.15; # define new API here using predicted next version number diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index e91ca99..d88d4a7 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -481,6 +481,57 @@ virTypedParamsGet(virTypedParameterPtr params, } +/** + * virTypedParamsFilter: + * @params: array of typed parameters + * @nparams: number of parameters in the @params array + * @name: name of the parameter to find + * @ret: pointer to the returned array + * + * + * Filters @params retaining only the parameters named @name in the + * resulting array @ret. Caller should free the @ret array but not + * the items since they are pointing to the @params elements. + * + * Returns amount of elements in @ret on success, -1 on error. + */ +int +virTypedParamsFilter(virTypedParameterPtr params, + int nparams, + const char *name, + virTypedParameterPtr **ret) I don't think we should make this API public. We can use it as an internal helper for implementing the other public API(s) but I don't see how this API could be any helpful to libvirt users. ... /** + * virTypedParamsPickStrings: + * @params: array of typed parameters + * @nparams: number of parameters in the @params array + * @name: name of the parameter to find + * @values: array of returned values + * @picked: pointer to the amount of picked strings. + * + * Finds all parameters with desired @name within @params and + * store their values into @values. The @values array is self + * allocated and its length is stored into @picked. When no + * longer needed, caller should free the returned array, but not + * the items since they are taken from @params array. + * + * Returns 0 on success, -1 otherwise. + */ +int +virTypedParamsPickStrings(virTypedParameterPtr params, + int nparams, + const char *name, + const char ***values, + size_t *picked) I don't really like the API name. We have several virTypedParamsGet* APIs including virTypedParamsGetString and I think we should be consistent when creating this new API and call it virTypedParamsGetAllStrings or something similar. We could also directly return the number of strings stored in @values, but having the extra @picked parameter works too. Although, I'd suggest renaming it. Jirka -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/8 v3] parallels: add vz driver
On 05/28/2015 11:05 AM, Dmitry Guryanov wrote: On 05/26/2015 08:12 PM, Maxim Nestratov wrote: v2-v3 change: * Patch parallels: set virtType depending on driver name reworked. Implemented ability to set virtType depending on driver name. v1-v2 change: * Only parallels: accept vz as a driver uri and name patch is changed. Fixed ability to connect to 'parallels' driver and deal with 'Paralells' domain virt type. ACK to the whole series, but I'll push it after libvirt's release. Since there was no objections, I've pushed it. Maxim Nestratov (8): parallels: introduce vz driver constant and string parallels: use newly introduced VIR_DOMAIN_VIRT_VZ parallels: add new guest capabilities assigned to vz driver parallels: accept vz as a driver uri and name parallels: add a new vz connection driver and hypervisor structures parallels: increment the number of connection drivers parallels: recommend to connect to vz:///system when connection fails parallels: set virtType depending on driver name src/conf/domain_conf.c| 19 src/conf/domain_conf.h| 1 + src/libvirt.c | 2 +- src/parallels/parallels_driver.c | 63 +++ src/parallels/parallels_network.c | 3 +- src/parallels/parallels_sdk.c | 6 +++- src/parallels/parallels_storage.c | 3 +- src/parallels/parallels_utils.h | 1 + 8 files changed, 82 insertions(+), 16 deletions(-) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list -- Dmitry Guryanov -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 30/35] qemu: Refactor qemuDomainSetBlkioParameters by reusing virDomainObjGetDefs
On Fri, May 29, 2015 at 03:33:51PM +0200, Peter Krempa wrote: --- src/qemu/qemu_driver.c | 22 +++--- 1 file changed, 7 insertions(+), 15 deletions(-) ACK to patches 23-30 Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 35/35] qemu: Refactor qemuDomainSetVcpusFlags by reusing virDomainObjGetDefs
On Fri, May 29, 2015 at 03:33:56PM +0200, Peter Krempa wrote: --- src/qemu/qemu_driver.c | 22 -- 1 file changed, 8 insertions(+), 14 deletions(-) ACK to patches 31-35 Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] Canging bridge names on live migration
Hello, i wonder, if there's a possibility to change a name of a shared interface in virtual machine config, while doing migration. The problem is: hypervisor1 (source) uses shared interface name br0. hypervisor2 (target) uses shared interface name br500. Live migration fails, because target hypervisor does not have br0 interface. Thank you -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] docs: php: remove reference to Red Hat
On 06/03/2015 02:48 PM, Ján Tomko wrote: Also remove the redudant apostrophe from it's. --- docs/php.html.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/php.html.in b/docs/php.html.in index d9a3c1b..c10b0aa 100644 --- a/docs/php.html.in +++ b/docs/php.html.in @@ -6,8 +6,7 @@ h2Presentation/h2 pThe libvirt-php, originally called php-libvirt, is the PHP API bindings for - the libvirt virtualization toolkit originally developed by Radek Hladik but - currently maintained by Red Hat./p + the libvirt virtualization toolkit originally developed by Radek Hladik./p h2Getting the source/h2 p The PHP bindings code source is now maintained in a a @@ -26,7 +25,7 @@ It can also be browsed at p/p h2Project pages/h2 -pSince February 2011 the project have it's own pages hosted at libvirt.org. For more information on the project +pSince February 2011 the project has its own pages hosted at libvirt.org. For more information on the project please refer to a href=http://libvirt.org/php;http://libvirt.org/php/a. /p You missed index.html.in in libvirt-php repo. ACK with that 1 adjustment. Erik -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] util: Clear output broadcast address before filling it in
On 06/03/2015 06:54 AM, Martin Kletzander wrote: Since commit 55ace7c4789c8a7408139460f4b639cee00e5125, the sockettest fails without VIR_TEST_DEBUG set. The problem is found by test number 42 (co-incidence?), which tests range '192.168.122.1' - '192.168.122.255' in network '192.168.122.0/24'. That is supposed to fail because the end address is equal to the broadcast address. Interesting that this test did fail for me (over many separate runs, including once again just now). I guess I was lucky to randomly get a 0 in the port every time. When comparing these two in 'virSocketAddrEqual(end, broadcast)', there is a check for sin_addr as well as for sin_port. That port, however, is different when we do not enable test debugging. With the testing enabled, the port is 0 (correctly initialized), but without that it has a random number there. And that's because the structure is not initialized anywhere. By zeroing the structure before filling in the info, we make sure we return only the address and not any information that was not requested. And the test work once again. ACK. -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] docs: php: remove reference to Red Hat
Also remove the redudant apostrophe from it's. --- docs/php.html.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/php.html.in b/docs/php.html.in index d9a3c1b..c10b0aa 100644 --- a/docs/php.html.in +++ b/docs/php.html.in @@ -6,8 +6,7 @@ h2Presentation/h2 pThe libvirt-php, originally called php-libvirt, is the PHP API bindings for - the libvirt virtualization toolkit originally developed by Radek Hladik but - currently maintained by Red Hat./p + the libvirt virtualization toolkit originally developed by Radek Hladik./p h2Getting the source/h2 p The PHP bindings code source is now maintained in a a @@ -26,7 +25,7 @@ It can also be browsed at p/p h2Project pages/h2 -pSince February 2011 the project have it's own pages hosted at libvirt.org. For more information on the project +pSince February 2011 the project has its own pages hosted at libvirt.org. For more information on the project please refer to a href=http://libvirt.org/php;http://libvirt.org/php/a. /p -- 2.3.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] parallels: add block device statistics to driver
On 05/22/2015 10:42 AM, Nikolay Shirokovskiy wrote: Statistics provided through PCS SDK. As we have only async interface in SDK we need to be subscribed to statistics in order to get it. Trivial solution on every stat request to subscribe, wait event and then unsubscribe will lead to significant delays in case of a number of successive requests, as the event will be delivered on next PCS server notify cycle. On the other hand we don't want to keep unnesessary subscribtion. So we take an hibrid solution to subcsribe on first request and then keep a subscription while requests are active. We populate cache of statistics on subscribtion events and use this cache to serve libvirts requests. Signed-off-by: Nikolay Shirokovskiy nshirokovs...@parallels.com --- src/parallels/parallels_driver.c | 106 + src/parallels/parallels_sdk.c| 193 -- src/parallels/parallels_sdk.h|2 + src/parallels/parallels_utils.h | 15 +++ 4 files changed, 285 insertions(+), 31 deletions(-) diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 4b87213..ce59e00 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -51,6 +51,7 @@ #include nodeinfo.h #include virstring.h #include cpu/cpu.h +#include virtypedparam.h #include parallels_driver.h #include parallels_utils.h @@ -1179,6 +1180,109 @@ parallelsDomainGetMaxMemory(virDomainPtr domain) return ret; } +static int +parallelsDomainBlockStats(virDomainPtr domain, const char *path, + virDomainBlockStatsPtr stats) +{ +virDomainObjPtr dom = NULL; +int ret = -1; +size_t i; +int idx; + +if (!(dom = parallelsDomObjFromDomain(domain))) +return -1; + +if (*path) { +if ((idx = virDomainDiskIndexByName(dom-def, path, false)) 0) { +virReportError(VIR_ERR_INVALID_ARG, _(invalid path: %s), path); +goto cleanup; +} +if (prlsdkGetBlockStats(dom, dom-def-disks[idx], stats) 0) +goto cleanup; +} else { +virDomainBlockStatsStruct s; + +#define PARALLELS_ZERO_STATS(VAR, TYPE, NAME) \ +stats-VAR = 0; + +PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_ZERO_STATS) + +#undef PARALLELS_ZERO_STATS + Why don't you use memset here? +for (i = 0; i dom-def-ndisks; i++) { +if (prlsdkGetBlockStats(dom, dom-def-disks[i], s) 0) +goto cleanup; + +#define PARALLELS_SUM_STATS(VAR, TYPE, NAME)\ +if (s.VAR != -1)\ +stats-VAR += s.VAR; + +PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_SUM_STATS) + +#undef PARALLELS_SUM_STATS +} +} +stats-errs = -1; +ret = 0; + + cleanup: +if (dom) +virObjectUnlock(dom); + +return ret; +} + +static int +parallelsDomainBlockStatsFlags(virDomainPtr domain, + const char *path, + virTypedParameterPtr params, + int *nparams, + unsigned int flags) +{ +virDomainBlockStatsStruct stats; +int ret = -1; +size_t i; + +virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1); +/* We don't return strings, and thus trivially support this flag. */ +flags = ~VIR_TYPED_PARAM_STRING_OKAY; + +if (parallelsDomainBlockStats(domain, path, stats) 0) +goto cleanup; + +if (*nparams == 0) { +#define PARALLELS_COUNT_STATS(VAR, TYPE, NAME) \ +if ((stats.VAR) != -1) \ +++*nparams; + +PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_COUNT_STATS) + +#undef PARALLELS_COUNT_STATS +ret = 0; +goto cleanup; +} + +i = 0; +#define PARALLELS_BLOCK_STATS_ASSIGN_PARAM(VAR, TYPE, NAME) \ +if (i *nparams (stats.VAR) != -1) { \ +if (virTypedParameterAssign(params + i, TYPE, \ +VIR_TYPED_PARAM_LLONG, (stats.VAR)) 0) \ +goto cleanup; \ +i++; \ +} + +PARALLELS_BLOCK_STATS_FOREACH(PARALLELS_BLOCK_STATS_ASSIGN_PARAM) + +#undef PARALLELS_BLOCK_STATS_ASSIGN_PARAM + +*nparams = i; +ret = 0; + + cleanup: +return ret; +} + + static virHypervisorDriver parallelsDriver = { .name = Parallels, .connectOpen = parallelsConnectOpen,/* 0.10.0 */ @@ -1228,6 +1332,8 @@ static virHypervisorDriver parallelsDriver = { .domainManagedSave = parallelsDomainManagedSave, /* 1.2.14 */ .domainManagedSaveRemove = parallelsDomainManagedSaveRemove, /* 1.2.14 */ .domainGetMaxMemory = parallelsDomainGetMaxMemory, /* 1.2.15 */ +.domainBlockStats =
[libvirt] [PATCH] maint: remove redundant apostrophes from 'its'
--- docs/formatnode.html.in | 2 +- src/conf/storage_conf.c | 2 +- src/esx/esx_driver.c| 2 +- src/esx/esx_network_driver.c| 2 +- src/esx/esx_storage_backend_iscsi.c | 2 +- src/esx/esx_storage_backend_vmfs.c | 2 +- src/libxl/libxl_domain.c| 2 +- src/network/bridge_driver.c | 2 +- src/parallels/parallels_storage.c | 2 +- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_migration.c | 2 +- src/vbox/vbox_common.c | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/formatnode.html.in b/docs/formatnode.html.in index ba9a0f8..3ff1bef 100644 --- a/docs/formatnode.html.in +++ b/docs/formatnode.html.in @@ -122,7 +122,7 @@ This optional element contains information on PCI Express part of the device. For example, it can contain a child element codelink/code which addresses the PCI Express device's link. - While a device has it's own capabilities + While a device has its own capabilities (codevalidity='cap'/code), the actual run time capabilities are negotiated on the device initialization (codevalidity='sta'/code). The codelink/code element then diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index df536d4..4bbed4f 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -2335,7 +2335,7 @@ matchFCHostToSCSIHost(virConnectPtr conn, char *parent_name = NULL; unsigned int fc_hostnum; -/* If we have a parent defined, get it's hostnum, and compare to the +/* If we have a parent defined, get its hostnum, and compare to the * scsi_hostnum. If they are the same, then we have a match */ if (fc_adapter.data.fchost.parent diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index bf51213..c304ff3 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -267,7 +267,7 @@ esxParseVMXFileName(const char *fileName, void *opaque) * in the documentation of esxParseVMXFileName. * * Firstly parse the datastore path. Then use the datastore name to lookup the - * datastore and it's mount path. Finally concatenate the mount path, directory + * datastore and its mount path. Finally concatenate the mount path, directory * and file name to an absolute path and return it. Detect the separator type * based on the mount path. */ diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c index 6793b80..b19c06a 100644 --- a/src/esx/esx_network_driver.c +++ b/src/esx/esx_network_driver.c @@ -38,7 +38,7 @@ #define VIR_FROM_THIS VIR_FROM_ESX /* - * The UUID of a network is the MD5 sum of it's key. Therefore, verify that + * The UUID of a network is the MD5 sum of its key. Therefore, verify that * UUID and MD5 sum match in size, because we rely on that. */ verify(MD5_DIGEST_SIZE == VIR_UUID_BUFLEN); diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c index e4d2692..a9a19cf 100644 --- a/src/esx/esx_storage_backend_iscsi.c +++ b/src/esx/esx_storage_backend_iscsi.c @@ -42,7 +42,7 @@ #define VIR_FROM_THIS VIR_FROM_ESX /* - * The UUID of a storage pool is the MD5 sum of it's mount path. Therefore, + * The UUID of a storage pool is the MD5 sum of its mount path. Therefore, * verify that UUID and MD5 sum match in size, because we rely on that. */ verify(MD5_DIGEST_SIZE == VIR_UUID_BUFLEN); diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c index 0dcf419..d03d33a 100644 --- a/src/esx/esx_storage_backend_vmfs.c +++ b/src/esx/esx_storage_backend_vmfs.c @@ -48,7 +48,7 @@ VIR_LOG_INIT(esx.esx_storage_backend_vmfs); /* - * The UUID of a storage pool is the MD5 sum of it's mount path. Therefore, + * The UUID of a storage pool is the MD5 sum of its mount path. Therefore, * verify that UUID and MD5 sum match in size, because we rely on that. */ verify(MD5_DIGEST_SIZE == VIR_UUID_BUFLEN); diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index f339d9c..d925917 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -518,7 +518,7 @@ libxlDomainEventHandler(void *data, VIR_LIBXL_EVENT_CONST libxl_event *event) /* * Similar to the xl implementation, ignore SUSPEND. Any actions needed - * after calling libxl_domain_suspend() are handled by it's callers. + * after calling libxl_domain_suspend() are handled by its callers. */ if (xl_reason == LIBXL_SHUTDOWN_REASON_SUSPEND) goto error; diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 72be51e..3d6721b 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -1601,7 +1601,7 @@ networkRadvdConfContents(virNetworkObjPtr network, char **configstr) return ret; } -/* write file and return it's name (which must be freed by caller) */ +/* write file and
Re: [libvirt] [PATCH 16/35] qemu: Add helper to update domain balloon size and refactor usage places
On Fri, May 29, 2015 at 03:33:37PM +0200, Peter Krempa wrote: When qemu does not support the balloon event the current memory size needs to be queried. Since there are two places that implement the same logic, split it out into a function and reuse. --- src/qemu/qemu_domain.c | 64 ++ src/qemu/qemu_domain.h | 3 ++ src/qemu/qemu_driver.c | 84 +- 3 files changed, 75 insertions(+), 76 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index db8554b..661181f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3182,3 +3182,67 @@ qemuDomainMachineIsI440FX(const virDomainDef *def) STRPREFIX(def-os.machine, pc-i440) || STRPREFIX(def-os.machine, rhel)); } + + +/** + * qemuDomainUpdateCurrentMemorySize: + * + * Updates the current balloon size from the monitor if necessary. In case when + * the balloon is not present for the domain, the function recalculates the + * maximum size to reflect possible changes. + * + * Returns 0 on success and updates vm-def-mem.cur_balloon if necessary, -1 on + * error and reports libvirt error. + */ +int +qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver, + virDomainObjPtr vm) +{ +qemuDomainObjPrivatePtr priv = vm-privateData; +unsigned long long balloon; +int ret = -1; + +/* inactive domain doesn't need size update */ +if (!virDomainObjIsActive(vm)) +return 0; + +/* if no balloning is available, the current size equals to the current + * full memory size */ +if (!vm-def-memballoon || +vm-def-memballoon-model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) { +vm-def-mem.cur_balloon = virDomainDefGetMemoryActual(vm-def); +return 0; +} + +/* current size is always automagically updated via the event */ +if (virQEMUCapsGet(priv-qemuCaps, QEMU_CAPS_BALLOON_EVENT)) +return 0; + +/* here we need to ask the monitor */ + +/* Don't delay if someone's using the monitor, just use existing most + * recent data instead */ +if (qemuDomainJobAllowed(priv, QEMU_JOB_QUERY)) { +if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) 0) +return -1; + +if (!virDomainObjIsActive(vm)) { +virReportError(VIR_ERR_OPERATION_INVALID, %s, + _(domain is not running)); +goto endjob; +} + +qemuDomainObjEnterMonitor(driver, vm); +ret = qemuMonitorGetBalloonInfo(priv-mon, balloon); +if (qemuDomainObjExitMonitor(driver, vm) 0) +ret = -1; + + endjob: +qemuDomainObjEndJob(driver, vm); + +if (ret 0) +return -1; ACK if you actually use the 'balloon' value to update cur_balloon here. Jan +} + +return 0; +} signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 17/35] qemu: Refactor qemuDomainGetInfo
On Fri, May 29, 2015 at 03:33:38PM +0200, Peter Krempa wrote: Since the returned structure uses unsigned long for memory sizes add a few overflow checks to notify the user in case we are not able to represent given values. --- src/qemu/qemu_driver.c | 41 - 1 file changed, 24 insertions(+), 17 deletions(-) @@ -2625,30 +2628,34 @@ static int qemuDomainGetInfo(virDomainPtr dom, -info-maxMem = virDomainDefGetMemoryActual(vm-def); - if (virDomainObjIsActive(vm)) { -if (qemuDomainUpdateCurrentMemorySize(driver, vm) 0) +if (VIR_ASSIGN_IS_OVERFLOW(info-memory, vm-def-mem.cur_balloon)) { +virReportError(VIR_ERR_OVERFLOW, %s, + _(Current memory size too large)); goto cleanup; +} -info-memory = vm-def-mem.cur_balloon; -} else { -info-memory = 0; +if (qemuGetProcessInfo((info-cpuTime), NULL, NULL, vm-pid, 0) 0) { +virReportError(VIR_ERR_OPERATION_FAILED, %s, + _(cannot read cputime for domain)); +goto cleanup; +} } -info-nrVirtCpu = vm-def-vcpus; This line should stay. ACK with that change. Jan ret = 0; cleanup: signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 22/35] libxl: Don't remove vcpu pin definition in libxlDomainCleanup
On Fri, May 29, 2015 at 03:33:43PM +0200, Peter Krempa wrote: The vCPU pinning definition gets removed when the domain definition is being freed later. If there is no next configuration it would remove the configured pinning. --- src/libxl/libxl_domain.c | 11 --- 1 file changed, 11 deletions(-) ACK to patches 18-22 Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] maint: remove redundant apostrophes from 'its'
On Wed, 2015-06-03 at 14:48 +0200, Ján Tomko wrote: --- docs/formatnode.html.in | 2 +- src/conf/storage_conf.c | 2 +- src/esx/esx_driver.c| 2 +- src/esx/esx_network_driver.c| 2 +- src/esx/esx_storage_backend_iscsi.c | 2 +- src/esx/esx_storage_backend_vmfs.c | 2 +- src/libxl/libxl_domain.c| 2 +- src/network/bridge_driver.c | 2 +- src/parallels/parallels_storage.c | 2 +- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_migration.c | 2 +- src/vbox/vbox_common.c | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) Redundant: I don't think it means what you think it means ;) Cheers. -- Andrea Bolognani Software Engineer - Virtualization Team $ python -c print('a'.join(['', 'bologn', '@redh', 't.com'])) -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH] util: process: Refactor and fix virProcessSetAffinity
Refactor the function to return the bitmap instead of an integer and the inner workings so that they make more sense. This patch also fixes possible segfault on old systems that was introduced by commit: commit f1a43a8e4139b028257ef4ed05a81cfb5f8a8741 Author: Hu Tao hu...@cn.fujitsu.com Date: Fri Sep 14 15:46:59 2012 +0800 use virBitmap to store cpu affinity info --- Pushed after review on the libvirt-security list. src/qemu/qemu_driver.c | 5 +-- src/util/virprocess.c | 102 ++--- src/util/virprocess.h | 4 +- 3 files changed, 48 insertions(+), 63 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f32b87e..63001b1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1457,8 +1457,7 @@ qemuDomainHelperGetVcpus(virDomainObjPtr vm, virVcpuInfoPtr info, int maxinfo, unsigned char *cpumap = VIR_GET_CPUMAP(cpumaps, maplen, v); virBitmapPtr map = NULL; -if (virProcessGetAffinity(priv-vcpupids[v], - map, hostcpus) 0) +if (!(map = virProcessGetAffinity(priv-vcpupids[v]))) return -1; virBitmapToDataBuf(map, cpumap, maplen); @@ -5727,7 +5726,7 @@ qemuDomainGetIOThreadsLive(virQEMUDriverPtr driver, goto endjob; info_ret[i]-iothread_id = iothreads[i]-iothread_id; -if (virProcessGetAffinity(iothreads[i]-thread_id, map, hostcpus) 0) +if (!(map = virProcessGetAffinity(iothreads[i]-thread_id))) goto endjob; if (virBitmapToData(map, info_ret[i]-cpumap, diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 501569f..a38cb75 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -468,71 +468,60 @@ int virProcessSetAffinity(pid_t pid, virBitmapPtr map) return 0; } -int virProcessGetAffinity(pid_t pid, - virBitmapPtr *map, - int maxcpu) +virBitmapPtr +virProcessGetAffinity(pid_t pid) { size_t i; -# ifdef CPU_ALLOC -/* New method dynamically allocates cpu mask, allowing unlimted cpus */ -int numcpus = 1024; -size_t masklen; cpu_set_t *mask; +size_t masklen; +virBitmapPtr ret = NULL; -/* Not only may the statically allocated cpu_set_t be too small, - * but there is no way to ask the kernel what size is large enough. - * So you have no option but to pick a size, try, catch EINVAL, - * enlarge, and re-try. - * - * http://lkml.org/lkml/2009/7/28/620 - */ - realloc: -masklen = CPU_ALLOC_SIZE(numcpus); -mask = CPU_ALLOC(numcpus); +# ifdef CPU_ALLOC +/* 262144 cpus ought to be enough for anyone */ +masklen = CPU_ALLOC_SIZE(1024 8); +mask = CPU_ALLOC(1024 8); if (!mask) { virReportOOMError(); -return -1; +return NULL; } CPU_ZERO_S(masklen, mask); +# else +if (VIR_ALLOC(mask) 0) +return NULL; + +masklen = sizeof(*mask); +CPU_ZERO(mask); +# endif + if (sched_getaffinity(pid, masklen, mask) 0) { -CPU_FREE(mask); -if (errno == EINVAL -numcpus (1024 8)) { /* 262144 cpus ought to be enough for anyone */ -numcpus = numcpus 2; -goto realloc; -} virReportSystemError(errno, _(cannot get CPU affinity of process %d), pid); -return -1; +goto cleanup; } -*map = virBitmapNew(maxcpu); -if (!*map) -return -1; +if (!(ret = virBitmapNew(masklen * 8))) + goto cleanup; -for (i = 0; i maxcpu; i++) +for (i = 0; i masklen * 8; i++) { +# ifdef CPU_ALLOC if (CPU_ISSET_S(i, masklen, mask)) -ignore_value(virBitmapSetBit(*map, i)); -CPU_FREE(mask); +ignore_value(virBitmapSetBit(ret, i)); # else -/* Legacy method uses a fixed size cpu mask, only allows up to 1024 cpus */ -cpu_set_t mask; - -CPU_ZERO(mask); -if (sched_getaffinity(pid, sizeof(mask), mask) 0) { -virReportSystemError(errno, - _(cannot get CPU affinity of process %d), pid); -return -1; +if (CPU_ISSET(i, mask)) +ignore_value(virBitmapSetBit(ret, i)); +# endif } -for (i = 0; i maxcpu; i++) -if (CPU_ISSET(i, mask)) -ignore_value(virBitmapSetBit(*map, i)); + cleanup: +# ifdef CPU_ALLOC +CPU_FREE(mask); +# else +VIR_FREE(mask); # endif -return 0; +return ret; } #elif defined(HAVE_BSD_CPU_AFFINITY) @@ -562,29 +551,29 @@ int virProcessSetAffinity(pid_t pid, return 0; } -int virProcessGetAffinity(pid_t pid, - virBitmapPtr *map, - int maxcpu) +virBitmapPtr +virProcessGetAffinity(pid_t pid) { size_t i; cpuset_t mask; - -if (!(*map = virBitmapNew(maxcpu))) -return -1;
Re: [libvirt] [PATCH 15/35] qemu: process: Update current balloon state to maximum on vm startup
On Fri, May 29, 2015 at 03:33:36PM +0200, Peter Krempa wrote: After libvirt issues the balloon resize command, the current balloon size needs to be changed to the maximum memory size since the vCPUs were not started and thus the balloon driver could not return the memory. Since GetXMLDesc and other APIs return the balloon size without updating it in case they are not able to obtain the job and the memory balloon does not support the asynchronous event the sizing might be incorrect. --- src/qemu/qemu_process.c | 5 + 1 file changed, 5 insertions(+) ACK Jan signature.asc Description: Digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [RFC] libvirt support multi-thread compression for live migration
Eric, Thank you for reply. Is it necessary to expose these two APIs to user application? + virdomainMigrateSetCapabilities + virdomainMigrateGetCapabilities For qemu , the migration capabilities are xbzrle, rdma-pin-all, auto-converge, zero-blocks and compress. Sorry , I use outlook. Will change to thunderbird. -Original Message- From: Qiao, Liyong Sent: Wednesday, June 3, 2015 7:49 AM To: Eric Blake; Feng, Shaohe; libvir-list@redhat.com Cc: Bhandaru, Malini K; Ding, Jian-feng; Chylinski, Arek; Koniszewski, Pawel; Li, Liang Z; berra...@redhat.com; veill...@redhat.com Subject: Re: [RFC] libvirt support multi-thread compression for live migration On 2015年06月03日 01:02, Eric Blake wrote: On 06/02/2015 07:56 AM, Qiao, Liyong wrote: Hi Eric Thanks for replying the mail, replied in lines. +virdomainMigrateGetParameters(virDomainPtr domain, + int *level, + int *threads, + int *dthreads, + int flags) + I'd rather we used virTypedParameters, to make it easier to use the same API to pass ALL future possible tuning parameters, rather than just hard-coding to only the parameters of this one feature. Okay ,that sound good, but if virTypedParameters can be passed to qemu_driver such as qemu_monitor_json.c qemu_monitor_text.c ? [Your quoting style makes it very hard to distinguish original text from added text. Please consider changing your outgoing mail process to ensure that you add another level of quoting to all previous text so that your added text is the only unquoted text. Also, configure your mailer to wrap long lines.] hi Eric, sorry about the inconvenient mail client, I switch outlook to thunder bird, hopes it will be better. Use existing API for a guide - for example, virDomainSetBlockIoTune takes virTypedParamters, as well as defines a specific set of parameters that it will understand. The set of parameters can be enlarged without needing a new API (good for backporting features without requiring a .so version bump), but for any given libvirt version, the set of features understood is finite and limited to what you can translate to the QMP call. So qemu_driver.c would take the virTypedParameters, reject the ones it does not understand, and convert the ones it does understand into the 'int level, int threads, int dthreads' parameters used in qemu_monitor_json.c where you drive the actual QMP command with fixed parameters and types. ah, that helps, thanks for kindly supporting, we will think a bit more to how implement this API (taken virTypedParamters as parameter) If we think that it is worth always turning on both compression styles simultaneously, then reuse the bit. Otherwise, we need a different bit, and users can choose which (or both) of the two compression styles as desired. +1 for reuse compressed, and we can set compress-level, +compress-threads, compress-dthreads by +virdomainMigrateSetParameters(maybe some new virsh command--- +migrate-setparameter) But how can we passing these parameter when we using `virsh migrate `, is there any parameter we can use in 'virsh migrate' command ? Can you point me out ? The underlying API already has a form that takes virTypedParameters (see virDomainMigrate3()), so your first task is to figure out how to extend the API to expose new typed parameters for your new migration tunings. Once that is done, then you can worry about how to tweak the 'virsh migrate' client to pass in those new parameters. -- BR, Eli(Li Yong)Qiao -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2] check if console/channel PTY is null before attempting to open
On 31.05.2015 17:55, Shivaprasad G Bhat wrote: Console/channel devices have their pty devices assigned when the emulator is actually started. If time is spent in guest preparation, someone attempts to open the console/channel, the libvirt crashes in virChrdevLockFilePath(). The patch attempts to fix the crash by adding a check before attempting to open. Signed-off-by: Shivaprasad G Bhat sb...@linux.vnet.ibm.com --- src/conf/virchrdev.c |5 + 1 file changed, 5 insertions(+) diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 5f28f29..701b326 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -350,6 +350,11 @@ int virChrdevOpen(virChrdevsPtr devs, switch (source-type) { case VIR_DOMAIN_CHR_TYPE_PTY: path = source-data.file.path; +if (!path) { +virReportError(VIR_ERR_OPERATION_FAILED, %s, + _(PTY device is not yet assigned)); +return -1; +} break; case VIR_DOMAIN_CHR_TYPE_UNIX: path = source-data.nix.path; ACKed and pushed. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 3/9] qemuMigrationDriveMirror: Pass disk format to qemu
[adding libvirt-security] On 05/29/2015 05:29 AM, John Ferlan wrote: On 05/26/2015 09:01 AM, Michal Privoznik wrote: When playing with disk migration lately, I've noticed this warning in domain logs: WARNING: Image format was not specified for 'nbd://masina:49153/drive-virtio-disk0' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. Ouch. On first reading this, I was worried that we had a repeat of qemu CVE-2008-2004 or libvirt CVE-2010-2239 on our hands, where undesired probing can cause a guest to behave incorrectly. However, I _think_ that in this case we are safe. The probe in this instance is to a just-created NBD volume (that is, libvirt created it, not the end user) and it is completely blank (we have not yet mirrored into it) so it will always probe as raw (the probe cannot guess wrong unless there is data in sector 0 that resembles some other disk type). So, I think that we have dodged needing a CVE. So I started digging into qemu source code to see what has triggered the warning. I'd expect qemu to know formats of guest's disks since we tell them on command line. This lead me to qmp_drive_mirror() where the following can be found: if (!has_format) { format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs-drv-format_name; } That's correct for local file mirroring. But for NBD mirroring, I think we want to force raw and NOT reuse the source formatting, even when the destination file will be qcow2. Remember, the whole point of setting up an NBD mirror is that the local file on the destination side is created as the same format as the source (let's assume qcow2), then NBD is started to serve up the guest-visible contents of that file as raw. We want to mirror the guest-visible contents from the source to the destination using ONLY raw data (and the NBD server on the destination is then mapping that raw data back into the qcow2 format on the destination file). So, format is automatically initialized from the disk iff mode != existing. Unfortunately, in migration we are tied to use this mode (NBD doesn't support creating new images). Therefore the only way to avoid this warning is to pass format. The format that libvirt thinks should be in sync with qemu anyway. Signed-off-by: Michal Privoznik mpriv...@redhat.com --- src/qemu/qemu_migration.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) NACK to this change; instead, qemu_migration.c should pass raw instead of NULL. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] maint: remove redundant apostrophes from 'its'
On 06/03/2015 06:48 AM, Ján Tomko wrote: s/redundant/incorrect/ They would only be redundant if having them was correct but optional; but in all cases you touched, they were grammatically wrong: there is no optional ', it is either its (possessive) or it's (short for it is). --- docs/formatnode.html.in | 2 +- src/conf/storage_conf.c | 2 +- src/esx/esx_driver.c| 2 +- src/esx/esx_network_driver.c| 2 +- src/esx/esx_storage_backend_iscsi.c | 2 +- src/esx/esx_storage_backend_vmfs.c | 2 +- src/libxl/libxl_domain.c| 2 +- src/network/bridge_driver.c | 2 +- src/parallels/parallels_storage.c | 2 +- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_migration.c | 2 +- src/vbox/vbox_common.c | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) ACK with the subject tweaked -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/2] storage: Generate correct parameters for CIFS
https://bugzilla.redhat.com/show_bug.cgi?id=1186969 When generating the path to the dir for a CIFS/Samba driver, the code would generate a source path for the mount using %s:%s while the mount.cifs expects to see //%s/%s. So check for the cifsfs and format the source path appropriately. Additionally, since there is no means to authenticate, the mount needs a -o guest on the command line in order to anonymously mount the Samba directory. Signed-off-by: John Ferlan jfer...@redhat.com --- docs/formatstorage.html.in | 7 +-- docs/storage.html.in | 3 ++- src/storage/storage_backend_fs.c | 29 - 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in index 17558f8..b6f4361 100644 --- a/docs/formatstorage.html.in +++ b/docs/formatstorage.html.in @@ -124,11 +124,14 @@ span class=sinceSince 0.4.1/span/dd dtcodedir/code/dt ddProvides the source for pools backed by directories (pool -type codedir/code), or optionally to select a subdirectory +types codedir/code, codenetfs/code, codegluster/code), +or optionally to select a subdirectory within a pool that resembles a filesystem (pool type codegluster/code). May only occur once. Contains a single attribute codepath/code -which is the fully qualified path to the backing directory. +which is the fully qualified path to the backing directory or +for a codenetfs/code pool type using codeformat/code +type cifs, the path to the Samba share without the leading slash. span class=sinceSince 0.4.1/span/dd dtcodeadapter/code/dt ddProvides the source for pools backed by SCSI adapters (pool diff --git a/docs/storage.html.in b/docs/storage.html.in index 92e9ae7..0b467d5 100644 --- a/docs/storage.html.in +++ b/docs/storage.html.in @@ -291,7 +291,8 @@ the a href=#StorageBackendGlustergluster/a pool.) /li li -codecifs/code - use the SMB (samba) or CIFS file system +codecifs/code - use the SMB (samba) or CIFS file system. +The mount will use -o guest to mount the directory anonymously. /li /ul diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 337b8d3..6ba698c 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -388,6 +388,8 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) pool-def-source.format == VIR_STORAGE_POOL_NETFS_AUTO); bool glusterfs = (pool-def-type == VIR_STORAGE_POOL_NETFS pool-def-source.format == VIR_STORAGE_POOL_NETFS_GLUSTERFS); +bool cifsfs = (pool-def-type == VIR_STORAGE_POOL_NETFS + pool-def-source.format == VIR_STORAGE_POOL_NETFS_CIFS); virCommandPtr cmd = NULL; int ret = -1; int rc; @@ -427,11 +429,17 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) } if (pool-def-type == VIR_STORAGE_POOL_NETFS) { -if (virAsprintf(src, %s:%s, -pool-def-source.hosts[0].name, -pool-def-source.dir) == -1) -return -1; - +if (pool-def-source.format == VIR_STORAGE_POOL_NETFS_CIFS) { +if (virAsprintf(src, //%s/%s, +pool-def-source.hosts[0].name, +pool-def-source.dir) == -1) +return -1; +} else { +if (virAsprintf(src, %s:%s, +pool-def-source.hosts[0].name, +pool-def-source.dir) == -1) +return -1; +} } else { if (VIR_STRDUP(src, pool-def-source.devices[0].path) 0) return -1; @@ -453,6 +461,17 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) direct-io-mode=1, pool-def-target.path, NULL); +else if (cifsfs) +cmd = virCommandNewArgList(MOUNT, + -t, + (pool-def-type == VIR_STORAGE_POOL_FS ? + virStoragePoolFormatFileSystemTypeToString(pool-def-source.format) : + virStoragePoolFormatFileSystemNetTypeToString(pool-def-source.format)), + src, + pool-def-target.path, + -o, + guest, + NULL); else cmd = virCommandNewArgList(MOUNT, -t, -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] virnetdev: fix moving of 802.11 phys
On 01.06.2015 20:40, Lubomir Rintel wrote: There was a couple of problems with the style fixes applied to the original patch: 1.) virFileReadAllQuiet comparison was incorrectly parenthesized when moved into a condition, causing the len to be set to the result of comparison. This, together with the removed underflow check would underflow the phy buffer. 2.) The logic was broken. Failure to call ip would abort the function, thus the iw branch would never be reached. This aims to fix the issues and work around possible style complains :) Signed-off-by: Lubomir Rintel lkund...@v3.sk --- src/util/virnetdev.c | 46 +- 1 file changed, 21 insertions(+), 25 deletions(-) ACked and pushed. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 0/2] Adjust netfs CIFS/Samba formatting
https://bugzilla.redhat.com/show_bug.cgi?id=1186969 The first patch follows a previous change to fix/adjust the gluster specific rng formatting The second patch resolves the particular issue ensuring to generate the source path with the //%s/%s instead of %s:%s and with the -o group to connect to the Samba serbver. John Ferlan (2): storage: Fix the schema and add tests for cifs pool storage: Generate correct parameters for CIFS docs/formatstorage.html.in | 7 -- docs/schemas/storagepool.rng| 24 +++- docs/storage.html.in| 3 ++- src/storage/storage_backend_fs.c| 29 - tests/storagepoolxml2xmlin/pool-netfs-cifs.xml | 12 ++ tests/storagepoolxml2xmlout/pool-netfs-cifs.xml | 15 + tests/storagepoolxml2xmltest.c | 1 + 7 files changed, 82 insertions(+), 9 deletions(-) create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-cifs.xml create mode 100644 tests/storagepoolxml2xmlout/pool-netfs-cifs.xml -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 9/9] virsh: selective block device migration
On 30.05.2015 17:24, Pavel Boldin wrote: Michal, Should I fix these or will you do it? Pavel I'll fix it and resend. Currently I'm buried in something else, so somewhere next week it's feasible. Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v3 0/9] Selective block device migration implementation
On 06/01/2015 02:41 PM, John Ferlan wrote: And, `make` seems to fail here: $ ~/tinker-space/libvirt/./autogen.sh --system $ make -j4 [. . .] /home/kashyapc/tinker-space/libvirt/./src/qemu/qemu_migration.c: In function 'qemuMigrationRun': /home/kashyapc/tinker-space/libvirt/./src/qemu/qemu_migration.c:1997:17: error: 'format' may be used uninitialized in this function [-Werror=maybe-uninitialized] mon_ret = qemuMonitorDriveMirror(priv-mon, diskAlias, nbd_dest, ^ /home/kashyapc/tinker-space/libvirt/./src/qemu/qemu_migration.c:1971:21: note: 'format' was declared here const char *format; See my response to 3/9. If you initialize to NULL you'll be able to compile. But you'll end up corrupting your guest if your source has a qcow2 disk. The patch needs to be tweaked to mirror to NBD as raw rather than as the source's format. PS: Apologies if this ends up being a double email, the first email was accidentally sent from my @fedoraproject.org address (which is not subscribed to this list). Unsubscribed mails can still get through to the list, it just requires a moderation delay on the first time an email address is seen. -- Eric Blake eblake redhat com+1-919-301-3266 Libvirt virtualization library http://libvirt.org signature.asc Description: OpenPGP digital signature -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/2] storage: Fix the schema and add tests for cifs pool
Commit id '887dd362' added support for a netfs pool format type 'cifs' and 'gluster' in order to add rng support for Samba and glusterfs netfs pools. Originally, the CIFS type support was added as part of commit id '61fb6979'. Eventually commit id 'b325be12' fixed the gluster rng definition to match expectations. As it turns out the CIFS rng needed a similar change since the directory path is not an absDirPath, rather just a dirPath will be required. Signed-off-by: John Ferlan jfer...@redhat.com --- docs/schemas/storagepool.rng| 24 +++- tests/storagepoolxml2xmlin/pool-netfs-cifs.xml | 12 tests/storagepoolxml2xmlout/pool-netfs-cifs.xml | 15 +++ tests/storagepoolxml2xmltest.c | 1 + 4 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-cifs.xml create mode 100644 tests/storagepoolxml2xmlout/pool-netfs-cifs.xml diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng index db6ff49..d6bf772 100644 --- a/docs/schemas/storagepool.rng +++ b/docs/schemas/storagepool.rng @@ -314,6 +314,15 @@ /element /define + define name='sourceinfonetfscifs' +element name='dir' + attribute name='path' +ref name='dirPath'/ + /attribute + empty/ +/element + /define + define name='sourceinfonetfsgluster' element name='dir' attribute name='path' @@ -400,7 +409,6 @@ choice valueauto/value valuenfs/value -valuecifs/value /choice /attribute /element @@ -488,6 +496,20 @@ group interleave ref name='sourceinfohost'/ +ref name='sourceinfonetfscifs'/ +element name='format' + attribute name='type' +valuecifs/value + /attribute +/element +optional +ref name='sourceinfovendor'/ +/optional + /interleave +/group +group + interleave +ref name='sourceinfohost'/ ref name='sourceinfonetfsgluster'/ element name='format' attribute name='type' diff --git a/tests/storagepoolxml2xmlin/pool-netfs-cifs.xml b/tests/storagepoolxml2xmlin/pool-netfs-cifs.xml new file mode 100644 index 000..0bc6380 --- /dev/null +++ b/tests/storagepoolxml2xmlin/pool-netfs-cifs.xml @@ -0,0 +1,12 @@ +pool type='netfs' + source +host name='example.com'/ +format type='cifs'/ +dir path='samba_share'/ + /source + namenetfs-cifs/name + uuidd5609ced-94b1-489e-b218-eff35c30336a/uuid + target +path/mnt/cifs/path + /target +/pool diff --git a/tests/storagepoolxml2xmlout/pool-netfs-cifs.xml b/tests/storagepoolxml2xmlout/pool-netfs-cifs.xml new file mode 100644 index 000..afaa7d0 --- /dev/null +++ b/tests/storagepoolxml2xmlout/pool-netfs-cifs.xml @@ -0,0 +1,15 @@ +pool type='netfs' + namenetfs-cifs/name + uuidd5609ced-94b1-489e-b218-eff35c30336a/uuid + capacity unit='bytes'0/capacity + allocation unit='bytes'0/allocation + available unit='bytes'0/available + source +host name='example.com'/ +dir path='samba_share'/ +format type='cifs'/ + /source + target +path/mnt/cifs/path + /target +/pool diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c index bec1b8f..b03c4b0 100644 --- a/tests/storagepoolxml2xmltest.c +++ b/tests/storagepoolxml2xmltest.c @@ -84,6 +84,7 @@ mymain(void) DO_TEST(pool-iscsi-auth); DO_TEST(pool-netfs); DO_TEST(pool-netfs-gluster); +DO_TEST(pool-netfs-cifs); DO_TEST(pool-scsi); DO_TEST(pool-scsi-type-scsi-host); DO_TEST(pool-scsi-type-fc-host); -- 2.1.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list