[libvirt] [PATCH v2] xen: Prevent updating device when attaching a device
Daniel Veillard
veillard at redhat.com
Thu Feb 10 06:09:36 UTC 2011
On Wed, Feb 09, 2011 at 02:01:25PM +0000, Daniel P. Berrange wrote:
> On Wed, Feb 09, 2011 at 04:51:27PM +0800, Osier Yang wrote:
> > When attaching a device that already exists, xend driver updates
> > the device with "device_configure", it causes problems (e.g. for
> > disk device, 'device_configure' only can be used to update device
> > like CDROM), on the other hand, we provide additional API
> > (virDomainUpdateDevice) to update device, this fix is to raise up
> > errors instead of updating the existed device which is not CDROM
> > device.
> >
> > Changes from v1 to v2:
> > - allow update CDROM
> >
> > * src/xen/xend_internal.c
> > ---
> > src/xen/xend_internal.c | 42 +++++++++++++++++++++++++++++++++++++-----
> > 1 files changed, 37 insertions(+), 5 deletions(-)
>
>
>
> >
> > diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> > index cd30336..bc23595 100644
> > --- a/src/xen/xend_internal.c
> > +++ b/src/xen/xend_internal.c
> > @@ -3965,6 +3965,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
> > virDomainDefPtr def = NULL;
> > virBuffer buf = VIR_BUFFER_INITIALIZER;
> > char class[8], ref[80];
> > + char *target = NULL;
> >
> > if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
> > virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> > @@ -4029,6 +4030,13 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
> > STREQ(def->os.type, "hvm") ? 1 : 0,
> > priv->xendConfigVersion, 1) < 0)
> > goto cleanup;
> > +
> > + if (dev->data.disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
>
> I can't remember if Xen supports it or not, but do we need DEVICE_FLOPPY
> here too ?
I would guess that yes, we use it in the xend driver
> The patch looks good aside from that question
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel at veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
More information about the libvir-list
mailing list