Daniel P. Berrange wrote:
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(a)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..
I was a bit confused myself. This came before I realized the
device ordering was a little funky, so I just blindly used
ptr->next. This is however fixed to work correctly with my
later patch ("Fix disk device ordering").
- Cole