From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkdYo-0002RJ-VS for qemu-devel@nongnu.org; Fri, 09 Oct 2015 15:42:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkdYn-0004fe-SR for qemu-devel@nongnu.org; Fri, 09 Oct 2015 15:42:34 -0400 References: <1443632849-10940-1-git-send-email-jsnow@redhat.com> From: Eric Blake Message-ID: <5618189D.4030600@redhat.com> Date: Fri, 9 Oct 2015 13:42:21 -0600 MIME-Version: 1.0 In-Reply-To: <1443632849-10940-1-git-send-email-jsnow@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2gL2OCFQus9W8OMcOP16VXs23J4LlvUA0" Subject: Re: [Qemu-devel] [PATCH v2] migration: disallow migrate_add_blocker during migration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, quintela@redhat.com, jcody@redhat.com, dgilbert@redhat.com, amit.shah@redhat.com, =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --2gL2OCFQus9W8OMcOP16VXs23J4LlvUA0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/30/2015 11:07 AM, John Snow wrote: > If a migration is already in progress and somebody attempts > to add a migration blocker, this should rightly fail. >=20 > Add an errp parameter and a retcode return value to migrate_add_blocker= =2E >=20 > This is part one of two for a solution to prohibit e.g. block jobs > from running concurrently with migration. And should be independently useful, whether or not part 2 is taken. >=20 > Signed-off-by: John Snow > --- > +++ b/hw/misc/ivshmem.c > @@ -740,7 +740,10 @@ static int pci_ivshmem_init(PCIDevice *dev) > if (s->role_val =3D=3D IVSHMEM_PEER) { > error_setg(&s->migration_blocker, > "Migration is disabled when using feature 'peer mod= e' in device 'ivshmem'"); > - migrate_add_blocker(s->migration_blocker); > + if (migrate_add_blocker(s->migration_blocker, NULL) < 0) { > + error_report("Unable to prohibit migration during ivshmem = init"); > + exit(1); > + } Marc-Andr=C3=A9 has been trying to get rid of exit(1) calls here, but thi= s matched the style at the time you wrote it. > +++ b/hw/scsi/vhost-scsi.c > @@ -239,8 +239,14 @@ static void vhost_scsi_realize(DeviceState *dev, E= rror **errp) > vhost_dummy_handle_output); > if (err !=3D NULL) { > error_propagate(errp, err); > - close(vhostfd); > - return; > + goto close_fd; > + } > + > + error_setg(&s->migration_blocker, > + "vhost-scsi does not support migration"); Indentation looks unusual... > @@ -262,9 +268,16 @@ static void vhost_scsi_realize(DeviceState *dev, E= rror **errp) > /* Note: we can also get the minimum tpgt from kernel */ > s->target =3D vs->conf.boot_tpgt; > =20 > - error_setg(&s->migration_blocker, > - "vhost-scsi does not support migration"); =2E..although it was merely preserved across code motion. You may still want to fix it, though. > +++ b/hw/virtio/vhost.c > @@ -926,13 +926,25 @@ int vhost_dev_init(struct vhost_dev *hdev, void *= opaque, > goto fail; > } > =20 > - for (i =3D 0; i < hdev->nvqs; ++i) { > - r =3D vhost_virtqueue_init(hdev, hdev->vqs + i, hdev->vq_index= + i); > - if (r < 0) { > - goto fail_vq; > - } > - } > hdev->features =3D features; > + hdev->migration_blocker =3D NULL; > + > + if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) { > + error_setg(&hdev->migration_blocker, > + "Migration disabled: vhost lacks VHOST_F_LOG_ALL fe= ature."); error_setg() messages shouldn't end in '.', although this is once again code motion. As before, you could fix it up. > +++ b/stubs/migr-blocker.c > @@ -1,8 +1,9 @@ > #include "qemu-common.h" > #include "migration/migration.h" > =20 > -void migrate_add_blocker(Error *reason) > +int migrate_add_blocker(Error *reason, Error **errp) > { > + return 0; Should this set errp and return -EBUSY, so that callers don't assume that their blocker is effective when you really ignored the blocker? Then again, pre-patch, you silently ignored the blocker, so I guess it's not much worse in semantics. I spotted some minor things, but am comfortable with: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --2gL2OCFQus9W8OMcOP16VXs23J4LlvUA0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWGBidAAoJEKeha0olJ0NqbDAH/0Ic5JHZnZMjjMwSRD/GViFh mbFJ8tVxAfmZMiWyVuEQqgJYPE1xOwhBzzJGYII2p7ez1cGgLC1MF7H4N//Ll3Uj IOyikxNsjJH9tNQ8uKc2q+ubZBzJ0WHUhQtNgtuIbpTTvTXGKEojJcqznFCEzpjS h7VubC5O+qiaMDqqe7AJxB8B2qYfR2rIujGIsVHwNU8b8i6VRBdMLE2G096pMxvi 1XiJPbmi6JsWVB+KJJcOkeiWT1cCVeLlrMIyaMWgi1RijVcI9SnbozvBjjd6gUSY Z55eTZkVdHLlt6V+GXHYAWT9+T/WiGfwS/Iky7QG+iOmhyVEZ7q3bmxpVhA9pKg= =r9HY -----END PGP SIGNATURE----- --2gL2OCFQus9W8OMcOP16VXs23J4LlvUA0--