Re: [PATCH v2] xen: Prevent updating device when attaching a device

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

 



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 ?

The patch looks good aside from that question

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]