Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-14 Thread Markus Armbruster
Paolo Bonzini writes: > Il 13/03/2014 16:00, Markus Armbruster ha scritto: >> Paolo Bonzini writes: >> >>> Il 13/03/2014 14:18, Markus Armbruster ha scritto: Paolo Bonzini writes: > Il 12/03/2014 18:00, Markus Armbruster ha scritto: >> +} else if (!runstate_check(RUN_STATE

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-14 Thread Markus Armbruster
Fam Zheng writes: > On Thu, 03/13 14:25, Markus Armbruster wrote: >> Fam Zheng writes: >> >> > On Wed, 03/12 18:00, Markus Armbruster wrote: >> >> Opening an encrypted image takes an additional step: setting the key. >> >> Between open and the key set, the image must not be used. >> >> >> >> W

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Fam Zheng
On Thu, 03/13 14:25, Markus Armbruster wrote: > Fam Zheng writes: > > > On Wed, 03/12 18:00, Markus Armbruster wrote: > >> Opening an encrypted image takes an additional step: setting the key. > >> Between open and the key set, the image must not be used. > >> > >> We have some protection agains

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Markus Armbruster
Paolo Bonzini writes: > Il 13/03/2014 14:18, Markus Armbruster ha scritto: >> Paolo Bonzini writes: >> >>> Il 12/03/2014 18:00, Markus Armbruster ha scritto: +} else if (!runstate_check(RUN_STATE_PRELAUNCH) +&& !runstate_check(RUN_STATE_PAUSED)) { /* HACK */ >>> >>> Wh

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Paolo Bonzini
Il 13/03/2014 16:00, Markus Armbruster ha scritto: Paolo Bonzini writes: Il 13/03/2014 14:18, Markus Armbruster ha scritto: Paolo Bonzini writes: Il 12/03/2014 18:00, Markus Armbruster ha scritto: +} else if (!runstate_check(RUN_STATE_PRELAUNCH) +&& !runstate_check(RUN_STA

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Paolo Bonzini
Il 13/03/2014 14:18, Markus Armbruster ha scritto: > Paolo Bonzini writes: > >> Il 12/03/2014 18:00, Markus Armbruster ha scritto: >>> +} else if (!runstate_check(RUN_STATE_PRELAUNCH) >>> +&& !runstate_check(RUN_STATE_PAUSED)) { /* HACK */ >> >> Why not "if (runstate_is_running())

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Paolo Bonzini
Il 13/03/2014 14:27, Eric Blake ha scritto: >> +} else if (!runstate_check(RUN_STATE_PRELAUNCH) >> +&& !runstate_check(RUN_STATE_PAUSED)) { /* HACK */ > > Why not "if (runstate_is_running())"? Because that lacks PRELAUNCH, but PRELAUNCH also needs the protection. Nope, PRELAUN

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Eric Blake
On 03/13/2014 04:43 AM, Paolo Bonzini wrote: > Il 12/03/2014 18:00, Markus Armbruster ha scritto: >> +} else if (!runstate_check(RUN_STATE_PRELAUNCH) >> +&& !runstate_check(RUN_STATE_PAUSED)) { /* HACK */ > > Why not "if (runstate_is_running())"? Because that lacks PRELAUNCH, but

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Markus Armbruster
Fam Zheng writes: > On Wed, 03/12 18:00, Markus Armbruster wrote: >> Opening an encrypted image takes an additional step: setting the key. >> Between open and the key set, the image must not be used. >> >> We have some protection against accidental use in place: you can't >> unpause a guest whil

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Markus Armbruster
Paolo Bonzini writes: > Il 12/03/2014 18:00, Markus Armbruster ha scritto: >> +} else if (!runstate_check(RUN_STATE_PRELAUNCH) >> +&& !runstate_check(RUN_STATE_PAUSED)) { /* HACK */ > > Why not "if (runstate_is_running())"? The predicate actually wanted here is "monitor command '

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Paolo Bonzini
Il 12/03/2014 18:00, Markus Armbruster ha scritto: +} else if (!runstate_check(RUN_STATE_PRELAUNCH) +&& !runstate_check(RUN_STATE_PAUSED)) { /* HACK */ Why not "if (runstate_is_running())"? Paolo +error_setg(errp, + "Guest must be stopped for opening

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-13 Thread Fam Zheng
On Wed, 03/12 18:00, Markus Armbruster wrote: > Opening an encrypted image takes an additional step: setting the key. > Between open and the key set, the image must not be used. > > We have some protection against accidental use in place: you can't > unpause a guest while we're missing keys. You

Re: [Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-12 Thread Eric Blake
On 03/12/2014 11:00 AM, Markus Armbruster wrote: > Opening an encrypted image takes an additional step: setting the key. > Between open and the key set, the image must not be used. > > We have some protection against accidental use in place: you can't > unpause a guest while we're missing keys. Y

[Qemu-devel] [PATCH] blockdev: Refuse to open encrypted image unless paused

2014-03-12 Thread Markus Armbruster
Opening an encrypted image takes an additional step: setting the key. Between open and the key set, the image must not be used. We have some protection against accidental use in place: you can't unpause a guest while we're missing keys. You can, however, hot-plug block devices lacking keys into a