On 06/15/2010 05:18 PM, Chris Wright wrote:
- size for each section would be useful (breaks protocol)
   - while size is possibly useful, breaks protocol

It is not necessary to break the protocol. If you're okay with only having the size information when the migration data has been saved to a file, you can put the directory at the end of the migration data, after the EOF section. Something like

   QEMU_VM_SECTION_EOF
   QEMU_VM_SECTION_DIRECTORY
      copy of the migration data, with the actual data replaced
      by a single 8-byte pointer to the beginning of the section:

      QEMU_VM_SECTION_START
      <section id>
      5 "block"
      <instance id>
      <version id>
      <8-byte pointer>

      QEMU_VM_SECTION_START
      <section id>
      3 "ram"
      <instance id>
      <version id>
      <8-byte pointer>

      ...
      QEMU_VM_SECTION_FULL
      <section id>
      10 "cpu_common"
      <instance id>
      <version id>
      <8-byte pointer>

      ...
      QEMU_VM_SECTION_EOF
      <8-byte pointer>

      QEMU_VM_SECTION_DIRECTORY
      <8-byte pointer>

Note that by definition the last 8 bytes will point to the beginning of the directory. You can read the last 18 bytes to reduce (to almost zero) the possibility of a false positive.

The directory table can be built at save time and streamed after the EOF without causing an error if the receiver closes its connection during the streaming of the directory.

Paolo

Reply via email to