[Libguestfs] [PATCH 7/9] v2v: Introduce the concept of target buses.
Pino Toscano
ptoscano at redhat.com
Thu Jul 2 08:56:03 UTC 2015
On Wednesday 01 July 2015 18:54:49 Richard W.M. Jones wrote:
> The target VM will have several buses to which disks can be attached.
> Commonly it will have an IDE bus, and possibly a virtio-blk "bus" (not
> really a bus) and/or a SCSI bus.
>
> Virt-v2v does not model this at the moment. Disks are just added to
> the output XML in the order that we write them, and so they can move
> around with respect to the target VM.
>
> This commit introduces the idea that we should model the target disk
> buses, and we should try to assign fixed and removable disks to slots
> on each of those buses. In this commit, the modelling is not used by
> any output mode, but that will be fixed in the next commit.
> ---
> [...]
> + (* Now try to add the removable disks to the bus at the same slot
> + * they originally occupied, but if the slot is occupied, emit a
> + * a warning and insert the disk in the next empty slot in that bus.
> + *)
> + List.iter (
> + fun r ->
> + let bus = match r.s_removable_controller with
> + | None -> ide_bus (* Wild guess, but should be safe. *)
> + | Some Source_virtio_blk -> virtio_blk_bus
> + | Some Source_IDE -> ide_bus
> + | Some Source_SCSI -> scsi_bus in
> + match r.s_removable_slot with
> + | None -> ignore (insert_after bus 0 (BusSlotRemovable r))
> + | Some desired_slot_nr ->
> + if not (insert_after bus desired_slot_nr (BusSlotRemovable r)) then
> + warning (f_"removable %s device in slot %d clashes with another disk, so it has been moved to a higher numbered slot on the same bus. This may mean that this removable device has a different name inside the guest (for example a CD-ROM originally called /dev/hdc might move to /dev/hdd, or from D: to E: on a Windows guest).")
> + (match r.s_removable_type with
> + | CDROM -> s_"CD-ROM"
> + | Floppy -> s_"floppy disk")
> + desired_slot_nr
Imagine that first we get a source with no specified slot, so we insert
it at 0, and then we get a source which specifies the slot zero which
is then taken.
Maybe this iteration should be split into two separate, first adding all
the sources which specify a slot, and then all the ones which have no
specific slot. This way there is more probability to assign the slots
matching how they were originally, I think.
--
Pino Toscano
More information about the Libguestfs
mailing list