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

Re: [libvirt] [PATCH] Check disk target collision when parsing domain xml



On Thu, Aug 21, 2008 at 11:20:13PM -0400, Cole Robinson wrote:
> The current domain xml parsing doesn't check if disks
> are specified with duplicate targets ("hda" etc.). The
> attached patch adds a check for this.
> 
> Thanks,
> Cole
> 

> commit 27df1653474738a2ce83c89e7bdb2c4f7327f9b6
> Author: Cole Robinson <crobinso dhcp-100-19-219 bos redhat com>
> Date:   Thu Aug 21 14:58:04 2008 -0400
> 
>     Check for duplicate disk targets when parsing domain xml.
> 
> diff --git a/src/domain_conf.c b/src/domain_conf.c
> index 6b23474..ed6cc8b 100644
> --- a/src/domain_conf.c
> +++ b/src/domain_conf.c
> @@ -1955,6 +1955,12 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
>          } else {
>              virDomainDiskDefPtr ptr = def->disks;
>              while (ptr) {
> +                if (ptr->next && STREQ(disk->dst, ptr->next->dst)) {

I'm confused as to why you're comparing for dups against ptr->next->dst
instead of ptr->dst. It would seem to miss a duplication disk target
check for the very first device..

> +                    virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
> +                                         _("duplicate disk target '%s'"),
> +                                         disk->dst);
> +                    goto error;
> +                }
>                  if (!ptr->next || virDomainDiskCompare(disk, ptr->next) < 0) {
>                      disk->next = ptr->next;
>                      ptr->next = disk;

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]