On 11/14/2017 11:37 AM, Wouter Verhelst wrote: > On Tue, Nov 14, 2017 at 10:41:39AM -0600, Eric Blake wrote: >> Another thought - with structured replies, we finally have a way to let >> the client ask for the server to send resize information whenever the >> server wants, rather than having to be polled by a new client request >> all the time. This is possible by having the server reply with a chunk >> without the NBD_REPLY_FLAG_DONE bit, for as many times as it wants, >> (that is, the server never officially ends the response to the single >> client request for on-going status, until the client sends an >> NBD_CMD_DISC). > > Hrm, yeah, that could work. > > Minor downside of this would be that a client would now be expected to > continue listening "forever" (probably needs to do a blocking read() or > a select() on the socket), whereas with the current situation a client > could get away with only reading for as long as it expects data. > > I don't think that should be a blocker, but it might be something we > might want to document. > >> I don't think the server should go into this mode without a flag bit >> from the client requesting it (as it potentially ties up a thread that >> could otherwise be used for parallel processing of other requests), > > Yeah. I think we should probably initiate this with a BLOCK_STATUS > message that has a flag with which we mean "don't stop sending data on > the given region for contexts that support it".
Now we're mixing NBD_CMD_BLOCK_STATUS and NBD_CMD_RESIZE; I was thinking of the open-ended command for being informed of all server-side-initiated size changes in response to RESIZE; but your mention of an open-ended BLOCK_STATUS has an interesting connotation of being able to get live updates as sections of a file are dirtied. I also remember from talking with Vladimir during KVM Forum last month that one of the shortfalls of the NBD protocol is that you can only ever send a length of up to 32 bits on the command side (unless we introduce structured commands in addition to our current work to add structured replies); even querying the full status of a 1TB volume would require at least 256 NBD_CMD_BLOCK_STATUS calls. But having a special case of a length of 0 meaning to report status as long as the server is interested could reduce the number of round trips by letting the server report more than 4G of status in response to one client query. There was also a thread a while ago about the possibility of a per-export flag denoting a volume is known to contain all-zeroes on startup, which can be used as a handy shortcut to having to query block status over each slice of the file; we weren't sure about burning a per-export flag on that information, but having it be a special mode of NBD_CMD_BLOCK_STATUS may be easy enough to codify. > > However, I could imagine that there might be some cases wherein a server > might be able to go into such a mode for two or more metadata contexts, > and where a client might want to go into that mode for one of them but > not all of them, while still wanting some information from them. > > This could be covered with metadata context syntax, but it's annoying > and shouldn't be necessary. > > I'm starting to think I made a mistake when I said NBD_CMD_BLOCK_STATUS > can't take a metadata context ID. Okay, there's no space for it, but > that shouldn't have been a blocker. > > Thoughts? Nothing says the server has to reply the same length of information when replying for multiple selected metadata contexts; but if we allow different reply sizes all in one query, we may also need some way to easily tell that the server has stopped sending metadata for one context even though it is still providing additional replies for another context. And maybe we do want to someday start thinking about structured requests; where being able to do per-command selection of metadata contexts (instead of per-export selection) may indeed be the first use case. > >> and that the server could reject a repeat command with the flag if it >> is already serving a previous open-ended request. > > Right. > > On the other hand, I can imagine that a client might also want to tell > the server that it is no longer interested in an outstanding request. In > such a case, it should be able to cancel it. Good point - if we allow the client to request an open-ended reply, it's also nice to let the client decide how long that open-endedness should last. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature