[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [RFC] Interface for disk hotadd/remove



On Thu, Aug 13, 2009 at 10:58:34PM +0200, Wolfgang Mauerer wrote:
> On Thu, Aug 13, 2009 at 8:31 PM, Daniel P. Berrange<berrange redhat com> wrote:
> > So the key to deciding how to deal with hotplug, is to first decide how
> > to represent disk controllers in the domain XML.
> >
> > At boot time, if you list multiple  SCSI disks in the XML, you get a single
> > controller with multiple disks attached. As such the current semantics of
> > the hotplug implementation for SCSI are divergant from the semantics at
> > boot time. This has the consequence that if you boot a guest with 2 SCSI
> > drives, then hot-attach one more you get 2 controllers, 3 disk. If you
> > then shutdown & boot the guest again, you'll have 1 controller, 1 disks.
> >
> > This says to me that the hotplug implementation for QEMU SCSI should be
> > fixed so that if you supply <disk> it adds a disk to the existing SCSI
> > controller. Obviously it requires some QEMU support for this first.
> 
> Qemu support for this is already there (I was not quite clear on that,
> the thing I'm currently adding additionally is hot-remove). I completely
> agree that the current semantics of libvirt-controlled disk-hotplug in qemu
> provide some possibilities for improvement, but I was not sure if it's
> okay to change the semantics of a libvirt command whilst preserving its syntax.

In this case the semantics of the hotplug command are broken, so we're
merely fixing them to be consistent with semantics at normal boot.  Thus
it is acceptable to change it in this particular case.

> > Thus my feeling would be todo something like adding a new <controller>
> > element to represent a disk controller. Support hotplugging <controller>
> > instances directly with obvious semantics.
> >
> > Then extend the <disk> schema to allow a controller name/identifier to
> > be provided. If no controller is listed then plug the disk into the
> > first available controller slot, otherwise use the explicitly requested
> > controller. Never implicitily add new controllers, unless dealing with
> > a legacy QEMU without the disk hotplug support that you're writing.
> 
> Sounds reasonable to me. Roughly, that would lead to something along
> the lines of (for a SCSI host on the PCI bus)
> 
> <controller type="scsi" id="my_controller" >
>     <bus addr="00:04"/>
> </controller>
> 
> <disk type="scsi">
>     <source file="disk.img"/>
>     <controller id="my_controller" unit="0"/>
> </disk>
> 
> This allows for specifying both the address of the controller on the
> bus, and to identify the disk on the controller -- this is important for
> hot-remove if multiple "physically" identical disks are attached to a single
> controller.

Yes that idea sounds reasonable.

> If virDomainAttachDevice is fed with a <disk> element containing
> an explicitely specified controller id, libvirt can then simply add the
> disk if the controller exists, or add controller+disk if the controller
> is not yet present on the machine. If the controller is not specified
> and none is present in the system, follow the current behaviour. If
> no controller is specified, but a controller is present, just add the
> disk, not controller+disk, breaking current behaviour. For hot-remove,
> do the reverse action (though I'll consider under which circumstances
> it is desirable to remove the controller when a disk is supposed to be
> removed, but these details are best discussed once I've done the
> code, I suppose).  Does what I've outlined correspond to your idea?

Yes, with one minor change - if the disk XML contains a controller,
but the controller doesn't exist, then we should return an error
and requiring the app to explicitly add the <controller> separately.

Regards,
Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]