Re: [libvirt] [PATCH 0/1] update copyright notice

2019-02-25 Thread David Kiarie
On Mon, Feb 25, 2019 at 8:04 PM Jim Fehlig  wrote:

> On 2/22/19 2:06 AM, David Kiarie wrote:
> >  > i did this as part of GSoC. there was no contract.
> >
> > I'm not entirely sure, but we might want to ask the SuSE folks
> whether
> > they agree.
> >
> >
> > i guess you can do that. my mentor was jim, he's around libvirt a lot.
>
> David is correct. There was no contract between him and SUSE. His work in
> the
> xl<->xml converter was done under a broader GSoC project.
>
> It sounds like the main grievance is the SUSE copyright in
> src/xenconfig/xen_xl.{ch} and tests/xlconfigtest.c. I suppose that came by
> way
> of copy-and-paste from other files. I'd be more than happy to send a patch
> removing the SUSE copyright from those files if that will put closure to
> this issue.
>

issue long closed (or at least as far as i am concerned :-)) and anyways
removing SUSE copyright from the files wasn't the right solution to the
issue.


>
> Regards,
> Jim
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 1/1] src/xenconfig: update copyright notice

2019-02-22 Thread David Kiarie
Signed-off-by: David Kiarie 
---
 src/xenconfig/xen_xl.c | 1 +
 src/xenconfig/xen_xl.h | 1 +
 tests/xlconfigtest.c   | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index accfc3a..64a5ddf 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -2,6 +2,7 @@
  * xen_xl.c: Xen XL parsing functions
  *
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (C) 2014 Kahurani
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
index e519186..4609a12 100644
--- a/src/xenconfig/xen_xl.h
+++ b/src/xenconfig/xen_xl.h
@@ -2,6 +2,7 @@
  * xen_xl.h: Xen XL parsing functions
  *
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (c) 2014 Kahurani
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index b1eb8a0..1207356 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2007, 2010-2011, 2014 Red Hat, Inc.
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (C) 2014 Kahurani
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
-- 
2.20.1

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


[libvirt] [PATCH 0/1] update copyright notice

2019-02-22 Thread David Kiarie
these patche follows up a very co-operative review on a preview patch or
lack of thereof.

i have updated this to reflect the exact name i use in person.

David Kiarie (1):
  src/xenconfig: update copyright notice

 src/xenconfig/xen_xl.c | 1 +
 src/xenconfig/xen_xl.h | 1 +
 tests/xlconfigtest.c   | 1 +
 3 files changed, 3 insertions(+)

-- 
2.20.1

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


Re: [libvirt] [PATCH 1/1] src/xenconfig: update copyright notice

2019-02-22 Thread David Kiarie
On Fri, Feb 22, 2019 at 12:08 PM Michal Privoznik 
wrote:

> On 2/21/19 7:44 PM, David Kiarie wrote:
> > Signed-off-by: David Kiarie 
> > ---
> >   src/xenconfig/xen_xl.c | 1 +
> >   src/xenconfig/xen_xl.h | 1 +
> >   tests/xlconfigtest.c   | 1 +
> >   3 files changed, 3 insertions(+)
> >
> > diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> > index accfc3a..8029579 100644
> > --- a/src/xenconfig/xen_xl.c
> > +++ b/src/xenconfig/xen_xl.c
> > @@ -2,6 +2,7 @@
> >* xen_xl.c: Xen XL parsing functions
> >*
> >* Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
> > + * Copyright (C) 2014 Kahurani Kiarie
> >*
> >* This library is free software; you can redistribute it and/or
> >* modify it under the terms of the GNU Lesser General Public
> > diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
> > index e519186..20b9f3d 100644
> > --- a/src/xenconfig/xen_xl.h
> > +++ b/src/xenconfig/xen_xl.h
> > @@ -2,6 +2,7 @@
> >* xen_xl.h: Xen XL parsing functions
> >*
> >* Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
> > + * Copyright (c) 2014 Kahurani Kiarie
> >*
> >* This library is free software; you can redistribute it and/or
> >* modify it under the terms of the GNU Lesser General Public
> > diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
> > index b1eb8a0..158d793 100644
> > --- a/tests/xlconfigtest.c
> > +++ b/tests/xlconfigtest.c
> > @@ -3,6 +3,7 @@
> >*
> >* Copyright (C) 2007, 2010-2011, 2014 Red Hat, Inc.
> >* Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
> > + * Copyright (C) Kahurani Kiarie
> >*
> >* This library is free software; you can redistribute it and/or
> >* modify it under the terms of the GNU Lesser General Public
> >
>
> Frankly, I find theese lines useless. Git blame tells you who wrote
> which lines of code.  I'm no laywer, but the way I understand copyrights
> in GPL projects is that it comes important only if project wants to
> change the licence (e.g. to BSD). Then it has to have confirmation from
> all copyright holders.
>
> But problem with keeping copyright holders in files is that noone tracks
> if they are still true. I mean, imagine somebody from company XYZ adding
> a few lines to virsomething.c. They also add a copyright line into the
> file. Later, when the code is reworked those lines are removed, but
> noone will ever remove the copyright line and thus it's outdated.
>
> Therefore, I think we should remove all copyright lines from all the
> files and just trust git to be able to generate list of authors from
> given state of repo.
>

exactly, that would fair.


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

Re: [libvirt] [PATCH 1/1] src/xenconfig: update copyright notice

2019-02-22 Thread David Kiarie
>
> Frankly, I find theese lines useless. Git blame tells you who wrote
>> which lines of code.  I'm no laywer, but the way I understand copyrights
>> in GPL projects is that it comes important only if project wants to
>> change the licence (e.g. to BSD). Then it has to have confirmation from
>> all copyright holders.
>>
>> But problem with keeping copyright holders in files is that noone tracks
>> if they are still true. I mean, imagine somebody from company XYZ adding
>> a few lines to virsomething.c. They also add a copyright line into the
>> file. Later, when the code is reworked those lines are removed, but
>> noone will ever remove the copyright line and thus it's outdated.
>>
>> Therefore, I think we should remove all copyright lines from all the
>> files and just trust git to be able to generate list of authors from
>> given state of repo.
>>
>
> exactly, that would fair.
>

this is your concern for libvirt but, i am concerned about these three
specific files. we do have SuSE copyright notice on these files but i think
other parties might have done a lot more work on these files that SuSE ever
did. that is probably clear from git blame(or whatever people have been
directing me to towards).

it looks sensible that if these parties are not allowed to copyright the
code, SuSE copyright is not exactly valid on these files.


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

[libvirt] [PATCH 0/1] update copyright notice

2019-02-22 Thread David Kiarie
this updates the patch to use a full legal name on the copyright notice.

David Kiarie (1):
  src/xenconfig: update copyright notice

 src/xenconfig/xen_xl.c | 1 +
 src/xenconfig/xen_xl.h | 1 +
 tests/xlconfigtest.c   | 1 +
 3 files changed, 3 insertions(+)

-- 
2.20.1

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


[libvirt] [PATCH 1/1] src/xenconfig: update copyright notice

2019-02-22 Thread David Kiarie
Signed-off-by: David Kiarie 
---
 src/xenconfig/xen_xl.c | 1 +
 src/xenconfig/xen_xl.h | 1 +
 tests/xlconfigtest.c   | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index accfc3a..2796749 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -2,6 +2,7 @@
  * xen_xl.c: Xen XL parsing functions
  *
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (C) 2014 David Kiarie Kahurani
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
index e519186..e347ad2 100644
--- a/src/xenconfig/xen_xl.h
+++ b/src/xenconfig/xen_xl.h
@@ -2,6 +2,7 @@
  * xen_xl.h: Xen XL parsing functions
  *
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (c) 2014 David Kiarie Kahurani
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index b1eb8a0..492bda2 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2007, 2010-2011, 2014 Red Hat, Inc.
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (C) 2014 David Kiarie Kahurani
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
-- 
2.20.1

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


Re: [libvirt] [PATCH 1/1] src/xenconfig: update copyright notice

2019-02-22 Thread David Kiarie
>
> >   *
> >   * This library is free software; you can redistribute it and/or
> >   * modify it under the terms of the GNU Lesser General Public
>
> This is fine, assuming you're still happy to have this version
> committed - we don't want to re-visit this for a 3rd third.
>

i don't think you'll have to.


>
>   Reviewed-by: Daniel P. Berrangé 
>
> Regards,
> Daniel
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 1/1] src/xenconfig: update copyright notice

2019-02-22 Thread David Kiarie
On Fri, Feb 22, 2019 at 2:19 PM Daniel P. Berrangé 
wrote:

> On Fri, Feb 22, 2019 at 12:36:36PM +0300, David Kiarie wrote:
> > Signed-off-by: David Kiarie 
> > ---
> >  src/xenconfig/xen_xl.c | 1 +
> >  src/xenconfig/xen_xl.h | 1 +
> >  tests/xlconfigtest.c   | 1 +
> >  3 files changed, 3 insertions(+)
> >
> > diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> > index accfc3a..64a5ddf 100644
> > --- a/src/xenconfig/xen_xl.c
> > +++ b/src/xenconfig/xen_xl.c
> > @@ -2,6 +2,7 @@
> >   * xen_xl.c: Xen XL parsing functions
> >   *
> >   * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
> > + * Copyright (C) 2014 Kahurani
>
> Using only half a name is not appropriate for copyright statements.
> They should be the full legal name at a minimum. An email address
> is preferreable to avoid ambiguity, but not required.
>

thanks.

i will update that.


>
> Regards,
> Daniel
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/1] update copyright notice

2019-02-22 Thread David Kiarie
On Fri, Feb 22, 2019 at 2:03 PM Daniel P. Berrangé 
wrote:

> On Fri, Feb 22, 2019 at 11:42:04AM +0300, David Kiarie wrote:
> > On Fri, Feb 22, 2019 at 11:09 AM Jiri Denemark 
> wrote:
> >
> > > On Fri, Feb 22, 2019 at 08:50:55 +0100, Peter Krempa wrote:
> > > > On Thu, Feb 21, 2019 at 21:44:34 +0300, David Kiarie wrote:
> > > > > it looks sensible that the copyright notice on the affected files
> in
> > > > > updated as in this patch so as to also cover another party who
> hugely
> > > > > participated in writing the code.
> > > >
> > > > I must point out that you specifically asked us to remove your name
> > > > from the files:
> > > >
> > > > https://www.redhat.com/archives/libvir-list/2018-May/msg00382.html
> > > >
> > > > Which was fulfilled after the discussion in the thread above by:
> > > >
> > > > https://www.redhat.com/archives/libvir-list/2018-May/msg00483.html
> > > >
> > > > And now lives in the repo as:
> > > >
> > > > commit d894e49292ae5135b6a9f44a634b5cfca4376f19
> > > > Author: David Kiarie 
> > > > Date:   Tue May 8 15:40:00 2018 +0300
> > > >
> > > > xenconfig: remove my name and email from files
> > > >
> > > >
> > > > Did you change your mind?
> > >
> >
> > yes, i will actually share the copyright, if possible.
>
> Note that you already own the copyright on any code you contributed,
> regardless of whether any Copyright line exists in the files. The only
> way you loose coyright ownership is by explicitly assigning it to
> another person / organization.  This is why the majority of patches
> never bother to add any copyright lines.
>

the copyright notice you have on these files, especially the file xen_xl.c
does not respect other parties who participated in the writing the code.


>
> > i think an email is personal enough that it shouldn't appear on copyright
> > notice just like i can't have my phone number on the copyright
> declaration.
>
> Your email is public regardless because every mail on this mailing list
> is public, and every git commit to libvirt is public, and every release
> of libvirt contains a AUTHORS file which includes every name + email
> address. IOW your email address in the source header makes no difference,
> it is already widely publicised.
>

i do not want my email on the source header as someone grabbed it elsewhere
and it didn't end well.

i'd rather someone digs into the commits if they want my email, next time
not just finds an issue in a file, quickly grabs the email and directs the
complain to me.


>
> Regards,
> Daniel
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/1] update copyright notice

2019-02-22 Thread David Kiarie
>
> > as you can see, this request was fulfilled within minutes, mostly because
> > Daniel is bitter that i tried to use a pseudonym on the code but he
> > strangely has nothing to say to say this time round.
>
> I think that any attempt to convert this conversation to personal matters
> involving feelings and emotions is unacceptable on any kind of technical
> mailing
> list both open source or closed source. I'm sure you can understand that
> people
> have different working hours from different time zones and have many
> pressing
> issues originating from dozens of mailing lists to focus on to keep our
> open
> source mission rolling. We are very serious about open source (every
> project
> should for that matter) and this *should* not become a playground arguing
> about
> authorships.
>

i don't find anything exactly relevant to this issue in whatever you have
written.


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

Re: [libvirt] [PATCH 0/1] update copyright notice

2019-02-22 Thread David Kiarie
>
> > > >
> > > >
> > > > Did you change your mind?
> > >
> >
> > yes, i will actually share the copyright, if possible.
>
> Given our previous experience I'm worried that you might change your
> mind again.
>
> I'd like you to pledge that it's your final decision and you will
> not attempt to delete it again after some time.
>

what previous experience? this is the second time we're discussing this
issue. this issue was never sorted in the very first place. i could also
claim that it doesn't look like you're up to solving the issue.

one year is not exactly "after some time".


> > > Moreover, you removed 'Author: Kiarie Kahurani' lines while you want to
> > > add your name into a Copyright line now. Only SUSE was mentioned as the
> > > copyright holder when you created the files. This makes me think you
> > > might have contributed this as part of your contract with SUSE in which
> > > case you are most likely not the copyright holder (even though you
> > > didn't use a @suse.com email, but that's not rare some people just
> keep
> > > using their personal email).
> > >
> >
> > i did this as part of GSoC. there was no contract.
>
> I'm not entirely sure, but we might want to ask the SuSE folks whether
> they agree.
>

i guess you can do that. my mentor was jim, he's around libvirt a lot.


>
> > i think an email is personal enough that it shouldn't appear on copyright
> > notice just like i can't have my phone number on the copyright
> declaration.
>
> As we've pointed out when you wanted to delete your name in the first
> place, most of the people looking at the code will be able to figure out
> the commit that added your name here and that commit does show your
> e-mail address.
>

i'd say this is okay but i don't see the problem with me sharing the
copyright.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/1] update copyright notice

2019-02-22 Thread David Kiarie
On Fri, Feb 22, 2019 at 11:42 AM David Kiarie 
wrote:

>
>
> On Fri, Feb 22, 2019 at 11:09 AM Jiri Denemark 
> wrote:
>
>> On Fri, Feb 22, 2019 at 08:50:55 +0100, Peter Krempa wrote:
>> > On Thu, Feb 21, 2019 at 21:44:34 +0300, David Kiarie wrote:
>> > > it looks sensible that the copyright notice on the affected files in
>> > > updated as in this patch so as to also cover another party who hugely
>> > > participated in writing the code.
>> >
>> > I must point out that you specifically asked us to remove your name
>> > from the files:
>> >
>> > https://www.redhat.com/archives/libvir-list/2018-May/msg00382.html
>> >
>> > Which was fulfilled after the discussion in the thread above by:
>> >
>> > https://www.redhat.com/archives/libvir-list/2018-May/msg00483.html
>
>
as you can see, this request was fulfilled within minutes, mostly because
Daniel is bitter that i tried to use a pseudonym on the code but he
strangely has nothing to say to say this time round.


>
>> >
>> > And now lives in the repo as:
>> >
>> > commit d894e49292ae5135b6a9f44a634b5cfca4376f19
>> > Author: David Kiarie 
>> > Date:   Tue May 8 15:40:00 2018 +0300
>> >
>> > xenconfig: remove my name and email from files
>> >
>> >
>> > Did you change your mind?
>>
>
> yes, i will actually share the copyright, if possible.
>
>
>>
>> Moreover, you removed 'Author: Kiarie Kahurani' lines while you want to
>> add your name into a Copyright line now. Only SUSE was mentioned as the
>> copyright holder when you created the files. This makes me think you
>> might have contributed this as part of your contract with SUSE in which
>> case you are most likely not the copyright holder (even though you
>> didn't use a @suse.com email, but that's not rare some people just keep
>> using their personal email).
>>
>
> i did this as part of GSoC. there was no contract.
>
> i think an email is personal enough that it shouldn't appear on copyright
> notice just like i can't have my phone number on the copyright declaration.
>
>
>>
>> Jirka
>>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 0/1] update copyright notice

2019-02-22 Thread David Kiarie
On Fri, Feb 22, 2019 at 11:09 AM Jiri Denemark  wrote:

> On Fri, Feb 22, 2019 at 08:50:55 +0100, Peter Krempa wrote:
> > On Thu, Feb 21, 2019 at 21:44:34 +0300, David Kiarie wrote:
> > > it looks sensible that the copyright notice on the affected files in
> > > updated as in this patch so as to also cover another party who hugely
> > > participated in writing the code.
> >
> > I must point out that you specifically asked us to remove your name
> > from the files:
> >
> > https://www.redhat.com/archives/libvir-list/2018-May/msg00382.html
> >
> > Which was fulfilled after the discussion in the thread above by:
> >
> > https://www.redhat.com/archives/libvir-list/2018-May/msg00483.html
> >
> > And now lives in the repo as:
> >
> > commit d894e49292ae5135b6a9f44a634b5cfca4376f19
> > Author: David Kiarie 
> > Date:   Tue May 8 15:40:00 2018 +0300
> >
> > xenconfig: remove my name and email from files
> >
> >
> > Did you change your mind?
>

yes, i will actually share the copyright, if possible.


>
> Moreover, you removed 'Author: Kiarie Kahurani' lines while you want to
> add your name into a Copyright line now. Only SUSE was mentioned as the
> copyright holder when you created the files. This makes me think you
> might have contributed this as part of your contract with SUSE in which
> case you are most likely not the copyright holder (even though you
> didn't use a @suse.com email, but that's not rare some people just keep
> using their personal email).
>

i did this as part of GSoC. there was no contract.

i think an email is personal enough that it shouldn't appear on copyright
notice just like i can't have my phone number on the copyright declaration.


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

[libvirt] [PATCH 1/1] src/xenconfig: update copyright notice

2019-02-21 Thread David Kiarie
Signed-off-by: David Kiarie 
---
 src/xenconfig/xen_xl.c | 1 +
 src/xenconfig/xen_xl.h | 1 +
 tests/xlconfigtest.c   | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index accfc3a..8029579 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -2,6 +2,7 @@
  * xen_xl.c: Xen XL parsing functions
  *
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (C) 2014 Kahurani Kiarie
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
index e519186..20b9f3d 100644
--- a/src/xenconfig/xen_xl.h
+++ b/src/xenconfig/xen_xl.h
@@ -2,6 +2,7 @@
  * xen_xl.h: Xen XL parsing functions
  *
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (c) 2014 Kahurani Kiarie
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index b1eb8a0..158d793 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2007, 2010-2011, 2014 Red Hat, Inc.
  * Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+ * Copyright (C) Kahurani Kiarie
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
-- 
2.20.1

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


[libvirt] [PATCH 0/1] update copyright notice

2019-02-21 Thread David Kiarie
it looks sensible that the copyright notice on the affected files in
updated as in this patch so as to also cover another party who hugely
participated in writing the code.


David Kiarie (1):
  src/xenconfig: update copyright notice

 src/xenconfig/xen_xl.c | 1 +
 src/xenconfig/xen_xl.h | 1 +
 tests/xlconfigtest.c   | 1 +
 3 files changed, 3 insertions(+)

-- 
2.20.1

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


Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-10 Thread David Kiarie
On Wed, May 9, 2018 at 5:27 PM, Oneko <kawaiii.nekom...@gmail.com> wrote:

>
>
> On Wed, May 9, 2018 at 3:24 PM, Michal Privoznik <mpriv...@redhat.com>
> wrote:
>
>> On 05/09/2018 01:51 PM, David Kiarie wrote:
>> > On Wed, May 9, 2018 at 2:29 PM, David Kiarie <davidkiar...@gmail.com>
>> wrote:
>> >
>> >>
>> >>
>> >> On Wed, May 9, 2018 at 1:56 PM, John Ferlan <jfer...@redhat.com>
>> wrote:
>> >>
>> >>> [...]
>> >>>
>> >>>
>> >>>> > >> Suse copyright notice has been on this file since the day
>> this
>> >>>> file got
>> >>>> > >> merged. To be honest, I did most of the original work so why
>> >>>> should Suse
>> >>>> > >> copyright appear here while me doesn't ?
>> >>>> > >>
>> >>>> > >
>> >>>> > > Contrary to the fact that most libvirt developers work for a
>> >>>> company, this
>> >>>> > > was mostly independent work.
>> >>>> > >
>> >>>> >
>> >>>> > And I totally don't have a problem with Suse copyrighting the
>> file
>> >>>> but why
>> >>>> > can't I do the same ?
>> >>>>
>> >>>
>> >>> Sooo... without GSOC and SUSE's support through their employee Jim
>> >>> Fehlig would you have written that code on your own and tried to have
>> it
>> >>> included in libvirt? I would think SUSE has a stake in the written
>> code
>> >>> as their resource(s) were being used. Yes, they benefit from it, but
>> so
>> >>> did you as you can point to that code as being authored by you
>
>
> What SUSE resource ?
>
>
>> .
>> >>>
>> >>>
>> >> I did this project in 2014 - to be honest, at the time, at least, most
>> >> student were evaluated on merit.
>> >>
>> >
>> > GSoC is just a totally wasted project since Carols left :-(
>>
>> I'm not going to get into authorship discussion, enough has been said.
>> But being org admin for libvirt since 2013 I've been dealing with both
>> Carol and Stephanie and frankly both of them are awesome and try/tried
>> their best. At every Mentor summit we have a discussion what went well
>> and what we can do better. They collect ideas and put them in practice.
>>
>> And despite your comments I think GSoC has been a great success for
>> libvirt too. We have students coming back, students who stay after
>> program ends and contribute afterwards, students whose code is still
>> used (I just used wireshark dissector the other day).
>
>
I respect your opinion but that wouldn't mean my work is there for for Suse
corporation to copyright.

I will assume my pseudonym as my legal name(that is if Kenyan laws don't
allow one to copyright work on a pseudonym) and I will copyright this code
on the name.


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

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 5:09 PM, Fabian Freyer <
fabian.fre...@physik.tu-berlin.de> wrote:

> On Wed, May 09, 2018 at 02:29:35PM +0300, David Kiarie wrote:
> > We don't have a new company here. We have an almost four year old cat.
>
> IANAL, but I think there's a precedent [1] for this, where at least a US
> court
> ruled that "Specifically, the Copyright Office will not register works
> produced
> by 'nature, animals, or plants' including, by specific example, a
> 'photograph
> taken by a monkey.'". I think it would be difficult for your cat to
> claim copyright.
>

Fortunately on unfortunately, I don't live in the US.


>
> (sorry for adding to the noise...)
>
> [1] Naruto et al v. David Slater -
> https://cases.justia.com/federal/district-courts/california/candce/3:
> 2015cv04324/291324/45/0.pdf?ts=1454149106
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 2:29 PM, David Kiarie <davidkiar...@gmail.com> wrote:

>
>
> On Wed, May 9, 2018 at 1:56 PM, John Ferlan <jfer...@redhat.com> wrote:
>
>> [...]
>>
>>
>> > > >> Suse copyright notice has been on this file since the day this
>> > file got
>> > > >> merged. To be honest, I did most of the original work so why
>> > should Suse
>> > > >> copyright appear here while me doesn't ?
>> > > >>
>> > > >
>> > > > Contrary to the fact that most libvirt developers work for a
>> > company, this
>> > > > was mostly independent work.
>> > > >
>> > >
>> > > And I totally don't have a problem with Suse copyrighting the file
>> > but why
>> > > can't I do the same ?
>> >
>>
>> Sooo... without GSOC and SUSE's support through their employee Jim
>> Fehlig would you have written that code on your own and tried to have it
>> included in libvirt? I would think SUSE has a stake in the written code
>> as their resource(s) were being used. Yes, they benefit from it, but so
>> did you as you can point to that code as being authored by you.
>>
>>
> I did this project in 2014 - to be honest, at the time, at least, most
> student were evaluated on merit.
>

GSoC is just a totally wasted project since Carols left :-(


>
>
>> I don't think anyone is indicating you didn't write the code. Using a
>> pseudonym is not allowed as part of the project's policy.
>>
>> > You can have Copyright line on any file you made non-trivial
>> > contributions
>> > too. It is upto the person contributing patches to add Copyright
>> line if
>> > they wish to. The Suse copyright is there simply because their patch
>> > author chose to add it when they contributed to that file.
>> >
>> > > Or, would you rather I use the pseudonym 'Oneko Ltd'  instead of
>> just
>> > > 'Oneko' ?
>> >
>> > Copyright lines need to use legal real names, or company name, not
>> > pseudonyms.
>> >
>> >
>> > In which case you mean that if I write a patch copyrighting these file
>> > on the company name 'Oneko and sons'  you will merge that patch ?
>> >
>> >
>>
>> INAL, but altering a copyright after the fact to include a "new" company
>> name that was either not involved in the authorship of the code or not a
>> company at the time of authorship could result in legal issues. Does
>> SUSE decide/desire to release their copyright claim to the new company?
>> Does the new company stand to gain something by the copyright claim?
>>
>
> We don't have a new company here. We have an almost four year old cat.
>
>
>>
>> John
>>
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 1:56 PM, John Ferlan  wrote:

> [...]
>
>
> > > >> Suse copyright notice has been on this file since the day this
> > file got
> > > >> merged. To be honest, I did most of the original work so why
> > should Suse
> > > >> copyright appear here while me doesn't ?
> > > >>
> > > >
> > > > Contrary to the fact that most libvirt developers work for a
> > company, this
> > > > was mostly independent work.
> > > >
> > >
> > > And I totally don't have a problem with Suse copyrighting the file
> > but why
> > > can't I do the same ?
> >
>
> Sooo... without GSOC and SUSE's support through their employee Jim
> Fehlig would you have written that code on your own and tried to have it
> included in libvirt? I would think SUSE has a stake in the written code
> as their resource(s) were being used. Yes, they benefit from it, but so
> did you as you can point to that code as being authored by you.
>
>
I did this project in 2014 - to be honest, at the time, at least, most
student were evaluated on merit.


> I don't think anyone is indicating you didn't write the code. Using a
> pseudonym is not allowed as part of the project's policy.
>
> > You can have Copyright line on any file you made non-trivial
> > contributions
> > too. It is upto the person contributing patches to add Copyright
> line if
> > they wish to. The Suse copyright is there simply because their patch
> > author chose to add it when they contributed to that file.
> >
> > > Or, would you rather I use the pseudonym 'Oneko Ltd'  instead of
> just
> > > 'Oneko' ?
> >
> > Copyright lines need to use legal real names, or company name, not
> > pseudonyms.
> >
> >
> > In which case you mean that if I write a patch copyrighting these file
> > on the company name 'Oneko and sons'  you will merge that patch ?
> >
> >
>
> INAL, but altering a copyright after the fact to include a "new" company
> name that was either not involved in the authorship of the code or not a
> company at the time of authorship could result in legal issues. Does
> SUSE decide/desire to release their copyright claim to the new company?
> Does the new company stand to gain something by the copyright claim?
>

We don't have a new company here. We have an almost four year old cat.


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

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 2:14 PM, David Kiarie <davidkiar...@gmail.com> wrote:

>
>
> On Wed, May 9, 2018 at 2:10 PM, David Kiarie <davidkiar...@gmail.com>
> wrote:
>
>>
>>
>> On Wed, May 9, 2018 at 2:08 PM, Daniel P. Berrangé <berra...@redhat.com>
>> wrote:
>>
>>> On Wed, May 09, 2018 at 02:05:54PM +0300, David Kiarie wrote:
>>> > On Wed, May 9, 2018 at 2:01 PM, Daniel P. Berrangé <
>>> berra...@redhat.com>
>>> > wrote:
>>> >
>>> > > On Wed, May 09, 2018 at 01:47:26PM +0300, David Kiarie wrote:
>>> > > > On Wed, May 9, 2018 at 1:43 PM, Daniel P. Berrangé <
>>> berra...@redhat.com>
>>> > > > wrote:
>>> > > >
>>> > > > > On Wed, May 09, 2018 at 01:36:35PM +0300, David Kiarie wrote:
>>> > > > > > On Wed, May 9, 2018 at 1:18 PM, David Kiarie <
>>> davidkiar...@gmail.com
>>> > > >
>>> > > > > wrote:
>>> > > > > >
>>> > > > > > >
>>> > > > > > >
>>> > > > > > > On Wed, May 9, 2018 at 1:15 PM, David Kiarie <
>>> > > davidkiar...@gmail.com>
>>> > > > > > > wrote:
>>> > > > > > >
>>> > > > > > >>
>>> > > > > > >>
>>> > > > > > >> On Wed, May 9, 2018 at 12:02 PM, Daniel P. Berrangé <
>>> > > > > berra...@redhat.com>
>>> > > > > > >> wrote:
>>> > > > > > >>
>>> > > > > > >>> On Wed, May 09, 2018 at 10:38:59AM +0200, Peter Krempa
>>> wrote:
>>> > > > > > >>> > On Wed, May 09, 2018 at 08:51:01 +0100, Daniel Berrange
>>> wrote:
>>> > > > > > >>> > > On Wed, May 09, 2018 at 09:14:29AM +0300, David Kiarie
>>> wrote:
>>> > > > > > >>> > > >
>>> > > > > > >>> > > > This is okay but this definitely wrong. And it does
>>> indeed
>>> > > > > sound
>>> > > > > > >>> wrong. And
>>> > > > > > >>> > > > it will always sound wrong.
>>> > > > > > >>> > > >
>>> > > > > > >>> > > > Being involved in a GSoC project is not about
>>> > > contributions.
>>> > > > > And
>>> > > > > > >>> also
>>> > > > > > >>> > > > considering the scale of our project(some of the
>>> code even
>>> > > > > never
>>> > > > > > >>> got
>>> > > > > > >>> > > > merged). There was a lot of research, design,
>>> planning,
>>> > > > > > >>> implementation,
>>> > > > > > >>> > > > review and finally the code got merged.
>>> > > > > > >>> > > >
>>> > > > > > >>> > > > I should at least be able to copyright the file. I
>>> mean,
>>> > > Jim
>>> > > > > was
>>> > > > > > >>> my mentor,
>>> > > > > > >>> > > > I did most of the work but his company copyright is
>>> right
>>> > > at
>>> > > > > the
>>> > > > > > >>> top of the
>>> > > > > > >>> > > > file - Does this sound okay to you ?
>>> > > > > > >>> > >
>>> > > > > > >>> > > You own copyright on any contributions you make,
>>> regardless
>>> > > of
>>> > > > > what
>>> > > > > > >>> any
>>> > > > > > >>> > > Copyright statement at the top of the file says. Just
>>> like
>>> > > the
>>> > > > > Author
>>> > > > > > >>> > > lines in file headers, these Copyright lines in source
>>> files
>>> > > are
>>> > > > > at
>>> > > > > > >>> best
>>> > > > > > >>> > &

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 2:10 PM, David Kiarie <davidkiar...@gmail.com> wrote:

>
>
> On Wed, May 9, 2018 at 2:08 PM, Daniel P. Berrangé <berra...@redhat.com>
> wrote:
>
>> On Wed, May 09, 2018 at 02:05:54PM +0300, David Kiarie wrote:
>> > On Wed, May 9, 2018 at 2:01 PM, Daniel P. Berrangé <berra...@redhat.com
>> >
>> > wrote:
>> >
>> > > On Wed, May 09, 2018 at 01:47:26PM +0300, David Kiarie wrote:
>> > > > On Wed, May 9, 2018 at 1:43 PM, Daniel P. Berrangé <
>> berra...@redhat.com>
>> > > > wrote:
>> > > >
>> > > > > On Wed, May 09, 2018 at 01:36:35PM +0300, David Kiarie wrote:
>> > > > > > On Wed, May 9, 2018 at 1:18 PM, David Kiarie <
>> davidkiar...@gmail.com
>> > > >
>> > > > > wrote:
>> > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > > On Wed, May 9, 2018 at 1:15 PM, David Kiarie <
>> > > davidkiar...@gmail.com>
>> > > > > > > wrote:
>> > > > > > >
>> > > > > > >>
>> > > > > > >>
>> > > > > > >> On Wed, May 9, 2018 at 12:02 PM, Daniel P. Berrangé <
>> > > > > berra...@redhat.com>
>> > > > > > >> wrote:
>> > > > > > >>
>> > > > > > >>> On Wed, May 09, 2018 at 10:38:59AM +0200, Peter Krempa
>> wrote:
>> > > > > > >>> > On Wed, May 09, 2018 at 08:51:01 +0100, Daniel Berrange
>> wrote:
>> > > > > > >>> > > On Wed, May 09, 2018 at 09:14:29AM +0300, David Kiarie
>> wrote:
>> > > > > > >>> > > >
>> > > > > > >>> > > > This is okay but this definitely wrong. And it does
>> indeed
>> > > > > sound
>> > > > > > >>> wrong. And
>> > > > > > >>> > > > it will always sound wrong.
>> > > > > > >>> > > >
>> > > > > > >>> > > > Being involved in a GSoC project is not about
>> > > contributions.
>> > > > > And
>> > > > > > >>> also
>> > > > > > >>> > > > considering the scale of our project(some of the code
>> even
>> > > > > never
>> > > > > > >>> got
>> > > > > > >>> > > > merged). There was a lot of research, design,
>> planning,
>> > > > > > >>> implementation,
>> > > > > > >>> > > > review and finally the code got merged.
>> > > > > > >>> > > >
>> > > > > > >>> > > > I should at least be able to copyright the file. I
>> mean,
>> > > Jim
>> > > > > was
>> > > > > > >>> my mentor,
>> > > > > > >>> > > > I did most of the work but his company copyright is
>> right
>> > > at
>> > > > > the
>> > > > > > >>> top of the
>> > > > > > >>> > > > file - Does this sound okay to you ?
>> > > > > > >>> > >
>> > > > > > >>> > > You own copyright on any contributions you make,
>> regardless
>> > > of
>> > > > > what
>> > > > > > >>> any
>> > > > > > >>> > > Copyright statement at the top of the file says. Just
>> like
>> > > the
>> > > > > Author
>> > > > > > >>> > > lines in file headers, these Copyright lines in source
>> files
>> > > are
>> > > > > at
>> > > > > > >>> best
>> > > > > > >>> > > outdated and incomplete. Anyone who wishes to identify
>> the
>> > > > > copyright
>> > > > > > >>> > > ownership has no choice but to look at the git history
>> which
>> > > > > records
>> > > > > > >>> > > exactly who wrote what.
>> > > > > > >>> >
>> > > > > > >>

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 2:08 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Wed, May 09, 2018 at 02:05:54PM +0300, David Kiarie wrote:
> > On Wed, May 9, 2018 at 2:01 PM, Daniel P. Berrangé <berra...@redhat.com>
> > wrote:
> >
> > > On Wed, May 09, 2018 at 01:47:26PM +0300, David Kiarie wrote:
> > > > On Wed, May 9, 2018 at 1:43 PM, Daniel P. Berrangé <
> berra...@redhat.com>
> > > > wrote:
> > > >
> > > > > On Wed, May 09, 2018 at 01:36:35PM +0300, David Kiarie wrote:
> > > > > > On Wed, May 9, 2018 at 1:18 PM, David Kiarie <
> davidkiar...@gmail.com
> > > >
> > > > > wrote:
> > > > > >
> > > > > > >
> > > > > > >
> > > > > > > On Wed, May 9, 2018 at 1:15 PM, David Kiarie <
> > > davidkiar...@gmail.com>
> > > > > > > wrote:
> > > > > > >
> > > > > > >>
> > > > > > >>
> > > > > > >> On Wed, May 9, 2018 at 12:02 PM, Daniel P. Berrangé <
> > > > > berra...@redhat.com>
> > > > > > >> wrote:
> > > > > > >>
> > > > > > >>> On Wed, May 09, 2018 at 10:38:59AM +0200, Peter Krempa wrote:
> > > > > > >>> > On Wed, May 09, 2018 at 08:51:01 +0100, Daniel Berrange
> wrote:
> > > > > > >>> > > On Wed, May 09, 2018 at 09:14:29AM +0300, David Kiarie
> wrote:
> > > > > > >>> > > >
> > > > > > >>> > > > This is okay but this definitely wrong. And it does
> indeed
> > > > > sound
> > > > > > >>> wrong. And
> > > > > > >>> > > > it will always sound wrong.
> > > > > > >>> > > >
> > > > > > >>> > > > Being involved in a GSoC project is not about
> > > contributions.
> > > > > And
> > > > > > >>> also
> > > > > > >>> > > > considering the scale of our project(some of the code
> even
> > > > > never
> > > > > > >>> got
> > > > > > >>> > > > merged). There was a lot of research, design, planning,
> > > > > > >>> implementation,
> > > > > > >>> > > > review and finally the code got merged.
> > > > > > >>> > > >
> > > > > > >>> > > > I should at least be able to copyright the file. I
> mean,
> > > Jim
> > > > > was
> > > > > > >>> my mentor,
> > > > > > >>> > > > I did most of the work but his company copyright is
> right
> > > at
> > > > > the
> > > > > > >>> top of the
> > > > > > >>> > > > file - Does this sound okay to you ?
> > > > > > >>> > >
> > > > > > >>> > > You own copyright on any contributions you make,
> regardless
> > > of
> > > > > what
> > > > > > >>> any
> > > > > > >>> > > Copyright statement at the top of the file says. Just
> like
> > > the
> > > > > Author
> > > > > > >>> > > lines in file headers, these Copyright lines in source
> files
> > > are
> > > > > at
> > > > > > >>> best
> > > > > > >>> > > outdated and incomplete. Anyone who wishes to identify
> the
> > > > > copyright
> > > > > > >>> > > ownership has no choice but to look at the git history
> which
> > > > > records
> > > > > > >>> > > exactly who wrote what.
> > > > > > >>> >
> > > > > > >>> > Soo, can we also delete the "Copyright ..." lines from the
> top
> > > of
> > > > > the
> > > > > > >>> > license statement? That's a cleanup which I'll gladly do.
> > > > > > >>>
> > > > > > >>> No, you can not delete other people's Copyright lines - they
> are
> > > > > > >>> considered
> > > > > > >>&g

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 2:01 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Wed, May 09, 2018 at 01:47:26PM +0300, David Kiarie wrote:
> > On Wed, May 9, 2018 at 1:43 PM, Daniel P. Berrangé <berra...@redhat.com>
> > wrote:
> >
> > > On Wed, May 09, 2018 at 01:36:35PM +0300, David Kiarie wrote:
> > > > On Wed, May 9, 2018 at 1:18 PM, David Kiarie <davidkiar...@gmail.com
> >
> > > wrote:
> > > >
> > > > >
> > > > >
> > > > > On Wed, May 9, 2018 at 1:15 PM, David Kiarie <
> davidkiar...@gmail.com>
> > > > > wrote:
> > > > >
> > > > >>
> > > > >>
> > > > >> On Wed, May 9, 2018 at 12:02 PM, Daniel P. Berrangé <
> > > berra...@redhat.com>
> > > > >> wrote:
> > > > >>
> > > > >>> On Wed, May 09, 2018 at 10:38:59AM +0200, Peter Krempa wrote:
> > > > >>> > On Wed, May 09, 2018 at 08:51:01 +0100, Daniel Berrange wrote:
> > > > >>> > > On Wed, May 09, 2018 at 09:14:29AM +0300, David Kiarie wrote:
> > > > >>> > > >
> > > > >>> > > > This is okay but this definitely wrong. And it does indeed
> > > sound
> > > > >>> wrong. And
> > > > >>> > > > it will always sound wrong.
> > > > >>> > > >
> > > > >>> > > > Being involved in a GSoC project is not about
> contributions.
> > > And
> > > > >>> also
> > > > >>> > > > considering the scale of our project(some of the code even
> > > never
> > > > >>> got
> > > > >>> > > > merged). There was a lot of research, design, planning,
> > > > >>> implementation,
> > > > >>> > > > review and finally the code got merged.
> > > > >>> > > >
> > > > >>> > > > I should at least be able to copyright the file. I mean,
> Jim
> > > was
> > > > >>> my mentor,
> > > > >>> > > > I did most of the work but his company copyright is right
> at
> > > the
> > > > >>> top of the
> > > > >>> > > > file - Does this sound okay to you ?
> > > > >>> > >
> > > > >>> > > You own copyright on any contributions you make, regardless
> of
> > > what
> > > > >>> any
> > > > >>> > > Copyright statement at the top of the file says. Just like
> the
> > > Author
> > > > >>> > > lines in file headers, these Copyright lines in source files
> are
> > > at
> > > > >>> best
> > > > >>> > > outdated and incomplete. Anyone who wishes to identify the
> > > copyright
> > > > >>> > > ownership has no choice but to look at the git history which
> > > records
> > > > >>> > > exactly who wrote what.
> > > > >>> >
> > > > >>> > Soo, can we also delete the "Copyright ..." lines from the top
> of
> > > the
> > > > >>> > license statement? That's a cleanup which I'll gladly do.
> > > > >>>
> > > > >>> No, you can not delete other people's Copyright lines - they are
> > > > >>> considered
> > > > >>> part of the license notice so can only be altered by the
> copyright
> > > > >>> holder.
> > > > >>>
> > > > >>
> > > > >> Suse copyright notice has been on this file since the day this
> file
> > > got
> > > > >> merged. To be honest, I did most of the original work so why
> should
> > > Suse
> > > > >> copyright appear here while me doesn't ?
> > > > >>
> > > > >
> > > > > Contrary to the fact that most libvirt developers work for a
> company,
> > > this
> > > > > was mostly independent work.
> > > > >
> > > >
> > > > And I totally don't have a problem with Suse copyrighting the file
> but
> > > why
> > > > can't I do the same ?
> > >
> > > You can have Copyright line on any file you made non-trivial
> contributions
> > > too. It is upto the person contributing patches to add Copyright line
> if
> > > they wish to. The Suse copyright is there simply because their patch
> > > author chose to add it when they contributed to that file.
> > >
> > > > Or, would you rather I use the pseudonym 'Oneko Ltd'  instead of just
> > > > 'Oneko' ?
> > >
> > > Copyright lines need to use legal real names, or company name, not
> > > pseudonyms.
> >
> > In which case you mean that if I write a patch copyrighting these file on
> > the company name 'Oneko and sons'  you will merge that patch ?
>
> Depends on whether that company owns the copyright or not. Copyright is
> owned by the individual who creates the work, unless a contract of
> employment requires them to assign copyright to the company instead.
> So unless you did your GSoC work under such a contract with that
> company, it would be inappropriate to list them.


But, the individual who created the work was a cat.

Okay, I could copyright this on my name and cat email - does that sound
okay ?


>


> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 1:43 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Wed, May 09, 2018 at 01:36:35PM +0300, David Kiarie wrote:
> > On Wed, May 9, 2018 at 1:18 PM, David Kiarie <davidkiar...@gmail.com>
> wrote:
> >
> > >
> > >
> > > On Wed, May 9, 2018 at 1:15 PM, David Kiarie <davidkiar...@gmail.com>
> > > wrote:
> > >
> > >>
> > >>
> > >> On Wed, May 9, 2018 at 12:02 PM, Daniel P. Berrangé <
> berra...@redhat.com>
> > >> wrote:
> > >>
> > >>> On Wed, May 09, 2018 at 10:38:59AM +0200, Peter Krempa wrote:
> > >>> > On Wed, May 09, 2018 at 08:51:01 +0100, Daniel Berrange wrote:
> > >>> > > On Wed, May 09, 2018 at 09:14:29AM +0300, David Kiarie wrote:
> > >>> > > >
> > >>> > > > This is okay but this definitely wrong. And it does indeed
> sound
> > >>> wrong. And
> > >>> > > > it will always sound wrong.
> > >>> > > >
> > >>> > > > Being involved in a GSoC project is not about contributions.
> And
> > >>> also
> > >>> > > > considering the scale of our project(some of the code even
> never
> > >>> got
> > >>> > > > merged). There was a lot of research, design, planning,
> > >>> implementation,
> > >>> > > > review and finally the code got merged.
> > >>> > > >
> > >>> > > > I should at least be able to copyright the file. I mean, Jim
> was
> > >>> my mentor,
> > >>> > > > I did most of the work but his company copyright is right at
> the
> > >>> top of the
> > >>> > > > file - Does this sound okay to you ?
> > >>> > >
> > >>> > > You own copyright on any contributions you make, regardless of
> what
> > >>> any
> > >>> > > Copyright statement at the top of the file says. Just like the
> Author
> > >>> > > lines in file headers, these Copyright lines in source files are
> at
> > >>> best
> > >>> > > outdated and incomplete. Anyone who wishes to identify the
> copyright
> > >>> > > ownership has no choice but to look at the git history which
> records
> > >>> > > exactly who wrote what.
> > >>> >
> > >>> > Soo, can we also delete the "Copyright ..." lines from the top of
> the
> > >>> > license statement? That's a cleanup which I'll gladly do.
> > >>>
> > >>> No, you can not delete other people's Copyright lines - they are
> > >>> considered
> > >>> part of the license notice so can only be altered by the copyright
> > >>> holder.
> > >>>
> > >>
> > >> Suse copyright notice has been on this file since the day this file
> got
> > >> merged. To be honest, I did most of the original work so why should
> Suse
> > >> copyright appear here while me doesn't ?
> > >>
> > >
> > > Contrary to the fact that most libvirt developers work for a company,
> this
> > > was mostly independent work.
> > >
> >
> > And I totally don't have a problem with Suse copyrighting the file but
> why
> > can't I do the same ?
>
> You can have Copyright line on any file you made non-trivial contributions
> too. It is upto the person contributing patches to add Copyright line if
> they wish to. The Suse copyright is there simply because their patch
> author chose to add it when they contributed to that file.
>
> > Or, would you rather I use the pseudonym 'Oneko Ltd'  instead of just
> > 'Oneko' ?
>
> Copyright lines need to use legal real names, or company name, not
> pseudonyms.
>

In which case you mean that if I write a patch copyrighting these file on
the company name 'Oneko and sons'  you will merge that patch ?


> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 1:18 PM, David Kiarie <davidkiar...@gmail.com> wrote:

>
>
> On Wed, May 9, 2018 at 1:15 PM, David Kiarie <davidkiar...@gmail.com>
> wrote:
>
>>
>>
>> On Wed, May 9, 2018 at 12:02 PM, Daniel P. Berrangé <berra...@redhat.com>
>> wrote:
>>
>>> On Wed, May 09, 2018 at 10:38:59AM +0200, Peter Krempa wrote:
>>> > On Wed, May 09, 2018 at 08:51:01 +0100, Daniel Berrange wrote:
>>> > > On Wed, May 09, 2018 at 09:14:29AM +0300, David Kiarie wrote:
>>> > > >
>>> > > > This is okay but this definitely wrong. And it does indeed sound
>>> wrong. And
>>> > > > it will always sound wrong.
>>> > > >
>>> > > > Being involved in a GSoC project is not about contributions. And
>>> also
>>> > > > considering the scale of our project(some of the code even never
>>> got
>>> > > > merged). There was a lot of research, design, planning,
>>> implementation,
>>> > > > review and finally the code got merged.
>>> > > >
>>> > > > I should at least be able to copyright the file. I mean, Jim was
>>> my mentor,
>>> > > > I did most of the work but his company copyright is right at the
>>> top of the
>>> > > > file - Does this sound okay to you ?
>>> > >
>>> > > You own copyright on any contributions you make, regardless of what
>>> any
>>> > > Copyright statement at the top of the file says. Just like the Author
>>> > > lines in file headers, these Copyright lines in source files are at
>>> best
>>> > > outdated and incomplete. Anyone who wishes to identify the copyright
>>> > > ownership has no choice but to look at the git history which records
>>> > > exactly who wrote what.
>>> >
>>> > Soo, can we also delete the "Copyright ..." lines from the top of the
>>> > license statement? That's a cleanup which I'll gladly do.
>>>
>>> No, you can not delete other people's Copyright lines - they are
>>> considered
>>> part of the license notice so can only be altered by the copyright
>>> holder.
>>>
>>
>> Suse copyright notice has been on this file since the day this file got
>> merged. To be honest, I did most of the original work so why should Suse
>> copyright appear here while me doesn't ?
>>
>
> Contrary to the fact that most libvirt developers work for a company, this
> was mostly independent work.
>

And I totally don't have a problem with Suse copyrighting the file but why
can't I do the same ?

Or, would you rather I use the pseudonym 'Oneko Ltd'  instead of just
'Oneko' ?


>
>>
>>
>>>
>>> The Author lines are not part of the license notice so that's free to be
>>> modified or removed.
>>>
>>> Regards,
>>> Daniel
>>> --
>>> |: https://berrange.com  -o-https://www.flickr.com/photos/
>>> dberrange :|
>>> |: https://libvirt.org -o-
>>> https://fstop138.berrange.com :|
>>> |: https://entangle-photo.org-o-https://www.instagram.com/dber
>>> range :|
>>>
>>
>>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 1:15 PM, David Kiarie <davidkiar...@gmail.com> wrote:

>
>
> On Wed, May 9, 2018 at 12:02 PM, Daniel P. Berrangé <berra...@redhat.com>
> wrote:
>
>> On Wed, May 09, 2018 at 10:38:59AM +0200, Peter Krempa wrote:
>> > On Wed, May 09, 2018 at 08:51:01 +0100, Daniel Berrange wrote:
>> > > On Wed, May 09, 2018 at 09:14:29AM +0300, David Kiarie wrote:
>> > > >
>> > > > This is okay but this definitely wrong. And it does indeed sound
>> wrong. And
>> > > > it will always sound wrong.
>> > > >
>> > > > Being involved in a GSoC project is not about contributions. And
>> also
>> > > > considering the scale of our project(some of the code even never got
>> > > > merged). There was a lot of research, design, planning,
>> implementation,
>> > > > review and finally the code got merged.
>> > > >
>> > > > I should at least be able to copyright the file. I mean, Jim was my
>> mentor,
>> > > > I did most of the work but his company copyright is right at the
>> top of the
>> > > > file - Does this sound okay to you ?
>> > >
>> > > You own copyright on any contributions you make, regardless of what
>> any
>> > > Copyright statement at the top of the file says. Just like the Author
>> > > lines in file headers, these Copyright lines in source files are at
>> best
>> > > outdated and incomplete. Anyone who wishes to identify the copyright
>> > > ownership has no choice but to look at the git history which records
>> > > exactly who wrote what.
>> >
>> > Soo, can we also delete the "Copyright ..." lines from the top of the
>> > license statement? That's a cleanup which I'll gladly do.
>>
>> No, you can not delete other people's Copyright lines - they are
>> considered
>> part of the license notice so can only be altered by the copyright holder.
>>
>
> Suse copyright notice has been on this file since the day this file got
> merged. To be honest, I did most of the original work so why should Suse
> copyright appear here while me doesn't ?
>

Contrary to the fact that most libvirt developers work for a company, this
was mostly independent work.


>
>
>>
>> The Author lines are not part of the license notice so that's free to be
>> modified or removed.
>>
>> Regards,
>> Daniel
>> --
>> |: https://berrange.com  -o-https://www.flickr.com/photos/
>> dberrange :|
>> |: https://libvirt.org -o-
>> https://fstop138.berrange.com :|
>> |: https://entangle-photo.org-o-https://www.instagram.com/dber
>> range :|
>>
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Wed, May 9, 2018 at 12:02 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Wed, May 09, 2018 at 10:38:59AM +0200, Peter Krempa wrote:
> > On Wed, May 09, 2018 at 08:51:01 +0100, Daniel Berrange wrote:
> > > On Wed, May 09, 2018 at 09:14:29AM +0300, David Kiarie wrote:
> > > >
> > > > This is okay but this definitely wrong. And it does indeed sound
> wrong. And
> > > > it will always sound wrong.
> > > >
> > > > Being involved in a GSoC project is not about contributions. And also
> > > > considering the scale of our project(some of the code even never got
> > > > merged). There was a lot of research, design, planning,
> implementation,
> > > > review and finally the code got merged.
> > > >
> > > > I should at least be able to copyright the file. I mean, Jim was my
> mentor,
> > > > I did most of the work but his company copyright is right at the top
> of the
> > > > file - Does this sound okay to you ?
> > >
> > > You own copyright on any contributions you make, regardless of what any
> > > Copyright statement at the top of the file says. Just like the Author
> > > lines in file headers, these Copyright lines in source files are at
> best
> > > outdated and incomplete. Anyone who wishes to identify the copyright
> > > ownership has no choice but to look at the git history which records
> > > exactly who wrote what.
> >
> > Soo, can we also delete the "Copyright ..." lines from the top of the
> > license statement? That's a cleanup which I'll gladly do.
>
> No, you can not delete other people's Copyright lines - they are considered
> part of the license notice so can only be altered by the copyright holder.
>

Suse copyright notice has been on this file since the day this file got
merged. To be honest, I did most of the original work so why should Suse
copyright appear here while me doesn't ?


>
> The Author lines are not part of the license notice so that's free to be
> modified or removed.
>
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-09 Thread David Kiarie
On Tue, May 8, 2018 at 6:09 PM, Jim Fehlig <jfeh...@suse.com> wrote:

> On 05/08/2018 03:22 AM, David Kiarie wrote:
>
>>
>>
>> On Tue, May 8, 2018 at 2:11 AM, Jim Fehlig <jfeh...@suse.com > jfeh...@suse.com>> wrote:
>>
>> On 05/07/2018 08:57 AM, David Kiarie wrote:
>>
>>
>>
>> On Mon, May 7, 2018 at 5:55 PM, David Kiarie <
>> davidkiar...@gmail.com
>> <mailto:davidkiar...@gmail.com> <mailto:davidkiar...@gmail.com
>> <mailto:davidkiar...@gmail.com>>> wrote:
>>
>>
>>
>>  On Mon, May 7, 2018 at 10:29 AM, Peter Krempa <
>> pkre...@redhat.com
>> <mailto:pkre...@redhat.com>
>>  <mailto:pkre...@redhat.com <mailto:pkre...@redhat.com>>>
>> wrote:
>>
>>  On Sat, May 05, 2018 at 12:17:05 +0300, David Kiarie
>> wrote:
>>  > On Sat, May 5, 2018 at 12:15 PM, David Kiarie
>> <davidkiar...@gmail.com <mailto:davidkiar...@gmail.com>
>> <mailto:davidkiar...@gmail.com <mailto:davidkiar...@gmail.com>>>
>>  > wrote:
>>  > > > Replace references to my name and email
>> with a
>> pseudonym
>>  > >
>>  > > Sorry, I just want my real name and email
>> off these
>> files and I keep making
>>  > silly mistakes.
>>
>>  How about just deleting them? We don't really support
>> using
>> pseudonyms.
>>
>>
>>  Why is that ? With a person reason I don't want my name of
>> these
>> files. I
>>  wrote the files and it took me a lot of work.
>>
>>  I can still prove I wrote this code with the above email if
>> anyone
>> wants me
>>  to as I still work as a developer.
>>
>>
>> I initally requested to have my name removed from the files but
>> apparently I hadn't signed off the patch so it was rejected.
>>
>>
>> You could have simply replied to the mail requesting a SOB and one of
>> us
>> would have added it your patch and pushed it.
>>
>> One month later, I figured it might be a bad idea to just give up
>> all
>> the work I had done and opted to keep track of it.
>>
>>
>> I think that is a wise choice, in which case you should leave the
>> authorship
>> as is :-).
>>
>>
>> I do have a good reason as to why I would like to remove my name from
>> these files which I will not bother explaining. And I actually do want my
>> name removed from these files.
>>
>
> Understood. We could have pushed the first version of your patch if it had
> a SOB. Presence of a SOB is enforced by a commit hook, so the patch
> couldn't be pushed without it. That wasn't enforced when you were working
> on the project. Apologies for not making that clearer at the beginning of
> this thread, saving everyone some time.
>
> Removing my name on the other hand means I give up on something which I
>> painstakingly worked on for almost one year.
>>
>
> As Daniel already mentioned, git contains a better history of your
> contributions. Interaction with the project is also recorded in the mail
> list archives.
>

This is okay but this definitely wrong. And it does indeed sound wrong. And
it will always sound wrong.

Being involved in a GSoC project is not about contributions. And also
considering the scale of our project(some of the code even never got
merged). There was a lot of research, design, planning, implementation,
review and finally the code got merged.

I should at least be able to copyright the file. I mean, Jim was my mentor,
I did most of the work but his company copyright is right at the top of the
file - Does this sound okay to you ?


> Regards,
> Jim
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: remove my name and email from files

2018-05-08 Thread David Kiarie
On Tue, May 8, 2018 at 3:45 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Tue, May 08, 2018 at 03:40:00PM +0300, David Kiarie wrote:
> > Remove my name and email from these files
> >
> > Signed-off-by: David Kiarie <davidkiar...@gmail.com>
> > ---
> >  src/xenconfig/xen_xl.c | 1 -
> >  src/xenconfig/xen_xl.h | 1 -
> >  tests/xlconfigtest.c   | 1 -
> >  3 files changed, 3 deletions(-)
> >
> > diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> > index 35d52f8a..f0d9177c 100644
> > --- a/src/xenconfig/xen_xl.c
> > +++ b/src/xenconfig/xen_xl.c
> > @@ -17,7 +17,6 @@
> >   * License along with this library.  If not, see
> >   * <http://www.gnu.org/licenses/>.
> >   *
> > - * Author: Kiarie Kahurani <davidkiar...@gmail.com>
> >   * Author: Jim Fehlig <jfeh...@suse.com>
> >   */
> >
> > diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
> > index 68f332ac..588d8d11 100644
> > --- a/src/xenconfig/xen_xl.h
> > +++ b/src/xenconfig/xen_xl.h
> > @@ -17,7 +17,6 @@
> >   * License along with this library.  If not, see
> >   * <http://www.gnu.org/licenses/>.
> >   *
> > - * Author: Kiarie Kahurani<davidkiar...@gmail.com>
> >   */
> >
> >  #ifndef __VIR_XEN_XL_H__
> > diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
> > index 39f51e2d..36f7699f 100644
> > --- a/tests/xlconfigtest.c
> > +++ b/tests/xlconfigtest.c
> > @@ -19,7 +19,6 @@
> >   * <http://www.gnu.org/licenses/>.
> >   *
> >   * Author: Daniel P. Berrange <berra...@redhat.com>
> > - * Author: Kiarie Kahurani <davidkiar...@gmail.com>
> >   *
> >   */
>
> Reviewed-by: Daniel P. Berrangé <berra...@redhat.com>
>
> Will push to git shortly.
>

Thanks!


>
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] xenconfig: remove my name and email from files

2018-05-08 Thread David Kiarie
Remove my name and email from these files

Signed-off-by: David Kiarie <davidkiar...@gmail.com>
---
 src/xenconfig/xen_xl.c | 1 -
 src/xenconfig/xen_xl.h | 1 -
 tests/xlconfigtest.c   | 1 -
 3 files changed, 3 deletions(-)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 35d52f8a..f0d9177c 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -17,7 +17,6 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *
- * Author: Kiarie Kahurani <davidkiar...@gmail.com>
  * Author: Jim Fehlig <jfeh...@suse.com>
  */
 
diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
index 68f332ac..588d8d11 100644
--- a/src/xenconfig/xen_xl.h
+++ b/src/xenconfig/xen_xl.h
@@ -17,7 +17,6 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *
- * Author: Kiarie Kahurani<davidkiar...@gmail.com>
  */
 
 #ifndef __VIR_XEN_XL_H__
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 39f51e2d..36f7699f 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -19,7 +19,6 @@
  * <http://www.gnu.org/licenses/>.
  *
  * Author: Daniel P. Berrange <berra...@redhat.com>
- * Author: Kiarie Kahurani <davidkiar...@gmail.com>
  *
  */
 
-- 
2.17.0

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


Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-08 Thread David Kiarie
On Tue, May 8, 2018 at 2:21 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Mon, May 07, 2018 at 05:55:51PM +0300, David Kiarie wrote:
> > On Mon, May 7, 2018 at 10:29 AM, Peter Krempa <pkre...@redhat.com>
> wrote:
> >
> > > On Sat, May 05, 2018 at 12:17:05 +0300, David Kiarie wrote:
> > > > On Sat, May 5, 2018 at 12:15 PM, David Kiarie <
> davidkiar...@gmail.com>
> > > > wrote:
> > > >
> > > > > Replace references to my name and email with a pseudonym
> > > > >
> > > >
> > > > Sorry, I just want my real name and email off these files and I keep
> > > making
> > > > silly mistakes.
> > >
> > > How about just deleting them? We don't really support using pseudonyms.
> > >
> >
> > Why is that ? With a person reason I don't want my name of these files. I
> > wrote the files and it took me a lot of work.
> >
> > I can still prove I wrote this code with the above email if anyone wants
> me
> > to as I still work as a developer.
>
> FWIW, the Author lines are largely irrelevant when looking at who authored
> code, they are at best incomplete, and at worst outright misleading, so we
> tend to recommend people not to pay attention to them. The GIT history
> contains the true accurate authorship information and your name is still
> recorded there, so the fact that you did the work would not be lost even
> without the Author line present.
>

Aiming to be an independent developer and already working on that (I am
actually not formally employed at the moment), this would definitely be a
huge part of my portifolio and I did actually do quite a bit of work on the
code on those files.

I'm not sure what to do either so I just sent both patches.


> If anything I would suggst we could bulk remove them from all code since
> because of their incomplete & misleading nature, but that's a larger
> can of worms.
>
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-08 Thread David Kiarie
Replace references to my name and email with a pseudonym

Signed-off-by: David Kiarie <davidkiar...@gmail.com>
---
 src/xenconfig/xen_xl.c | 2 +-
 src/xenconfig/xen_xl.h | 2 +-
 tests/xlconfigtest.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 35d52f8a..0343a73c 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -17,7 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *
- * Author: Kiarie Kahurani <davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@gmail.com>
  * Author: Jim Fehlig <jfeh...@suse.com>
  */
 
diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
index 68f332ac..4ce13f05 100644
--- a/src/xenconfig/xen_xl.h
+++ b/src/xenconfig/xen_xl.h
@@ -17,7 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *
- * Author: Kiarie Kahurani<davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@gmail.com>
  */
 
 #ifndef __VIR_XEN_XL_H__
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 39f51e2d..1bbc0b72 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -19,7 +19,7 @@
  * <http://www.gnu.org/licenses/>.
  *
  * Author: Daniel P. Berrange <berra...@redhat.com>
- * Author: Kiarie Kahurani <davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@gmail.com>
  *
  */
 
-- 
2.17.0

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


Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-08 Thread David Kiarie
On Tue, May 8, 2018 at 12:22 PM, David Kiarie <davidkiar...@gmail.com>
wrote:

>
>
> On Tue, May 8, 2018 at 2:11 AM, Jim Fehlig <jfeh...@suse.com> wrote:
>
>> On 05/07/2018 08:57 AM, David Kiarie wrote:
>>
>>>
>>>
>>> On Mon, May 7, 2018 at 5:55 PM, David Kiarie <davidkiar...@gmail.com
>>> <mailto:davidkiar...@gmail.com>> wrote:
>>>
>>>
>>>
>>> On Mon, May 7, 2018 at 10:29 AM, Peter Krempa <pkre...@redhat.com
>>> <mailto:pkre...@redhat.com>> wrote:
>>>
>>> On Sat, May 05, 2018 at 12:17:05 +0300, David Kiarie wrote:
>>> > On Sat, May 5, 2018 at 12:15 PM, David Kiarie <
>>> davidkiar...@gmail.com <mailto:davidkiar...@gmail.com>>
>>> > wrote:
>>> > > > Replace references to my name and email with a
>>> pseudonym
>>> > >
>>> > > Sorry, I just want my real name and email off these
>>> files and I keep making
>>> > silly mistakes.
>>>
>>> How about just deleting them? We don't really support using
>>> pseudonyms.
>>>
>>>
>>> Why is that ? With a person reason I don't want my name of these
>>> files. I
>>> wrote the files and it took me a lot of work.
>>>
>>> I can still prove I wrote this code with the above email if anyone
>>> wants me
>>> to as I still work as a developer.
>>>
>>>
>>> I initally requested to have my name removed from the files but
>>> apparently I hadn't signed off the patch so it was rejected.
>>>
>>
>> You could have simply replied to the mail requesting a SOB and one of us
>> would have added it your patch and pushed it.
>>
>> One month later, I figured it might be a bad idea to just give up all the
>>> work I had done and opted to keep track of it.
>>>
>>
>> I think that is a wise choice, in which case you should leave the
>> authorship as is :-).
>>
>
> I do have a good reason as to why I would like to remove my name from
> these files which I will not bother explaining. And I actually do want my
> name removed from these files.
>
> Removing my name on the other hand means I give up on something which I
> painstakingly worked on for almost one year.
>
> I went for another choice but apparently someone suggested that they don't
> allow pseudonmyns on files and that's just synonymous with me asking you to
> remove my work from from the file.
>

It's just quite unbelieve-able that I am a black person, I trying to build
a career as a software developer and having a lot of problems with people
online - which is irrevant.

I wrote this code as part of GSoC - which is *not* a job and that means I
own the code I wrote and a bunch of professionals are busy making my life
even more difficult.

I need someone to either give me a reason as to why this patch will not be
merged or may be just clearly state that you will not merging this patch. I
don't need any suggestions.


>
>

>
>>
>> Regards,
>> Jim
>>
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-08 Thread David Kiarie
On Tue, May 8, 2018 at 2:11 AM, Jim Fehlig <jfeh...@suse.com> wrote:

> On 05/07/2018 08:57 AM, David Kiarie wrote:
>
>>
>>
>> On Mon, May 7, 2018 at 5:55 PM, David Kiarie <davidkiar...@gmail.com
>> <mailto:davidkiar...@gmail.com>> wrote:
>>
>>
>>
>> On Mon, May 7, 2018 at 10:29 AM, Peter Krempa <pkre...@redhat.com
>> <mailto:pkre...@redhat.com>> wrote:
>>
>> On Sat, May 05, 2018 at 12:17:05 +0300, David Kiarie wrote:
>> > On Sat, May 5, 2018 at 12:15 PM, David Kiarie <
>> davidkiar...@gmail.com <mailto:davidkiar...@gmail.com>>
>> > wrote:
>> > > > Replace references to my name and email with a
>> pseudonym
>> > >
>> > > Sorry, I just want my real name and email off these
>> files and I keep making
>> > silly mistakes.
>>
>> How about just deleting them? We don't really support using
>> pseudonyms.
>>
>>
>> Why is that ? With a person reason I don't want my name of these
>> files. I
>> wrote the files and it took me a lot of work.
>>
>> I can still prove I wrote this code with the above email if anyone
>> wants me
>> to as I still work as a developer.
>>
>>
>> I initally requested to have my name removed from the files but
>> apparently I hadn't signed off the patch so it was rejected.
>>
>
> You could have simply replied to the mail requesting a SOB and one of us
> would have added it your patch and pushed it.
>
> One month later, I figured it might be a bad idea to just give up all the
>> work I had done and opted to keep track of it.
>>
>
> I think that is a wise choice, in which case you should leave the
> authorship as is :-).
>

I do have a good reason as to why I would like to remove my name from these
files which I will not bother explaining. And I actually do want my name
removed from these files.

Removing my name on the other hand means I give up on something which I
painstakingly worked on for almost one year.

I went for another choice but apparently someone suggested that they don't
allow pseudonmyns on files and that's just synonymous with me asking you to
remove my work from from the file.


>
> Regards,
> Jim
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-07 Thread David Kiarie
On Mon, May 7, 2018 at 5:55 PM, David Kiarie <davidkiar...@gmail.com> wrote:

>
>
> On Mon, May 7, 2018 at 10:29 AM, Peter Krempa <pkre...@redhat.com> wrote:
>
>> On Sat, May 05, 2018 at 12:17:05 +0300, David Kiarie wrote:
>> > On Sat, May 5, 2018 at 12:15 PM, David Kiarie <davidkiar...@gmail.com>
>> > wrote:
>> >
>> > > Replace references to my name and email with a pseudonym
>> > >
>> >
>> > Sorry, I just want my real name and email off these files and I keep
>> making
>> > silly mistakes.
>>
>> How about just deleting them? We don't really support using pseudonyms.
>>
>
> Why is that ? With a person reason I don't want my name of these files. I
> wrote the files and it took me a lot of work.
>
> I can still prove I wrote this code with the above email if anyone wants
> me to as I still work as a developer.
>

I initally requested to have my name removed from the files but apparently
I hadn't signed off the patch so it was rejected.

One month later, I figured it might be a bad idea to just give up all the
work I had done and opted to keep track of it.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-07 Thread David Kiarie
On Mon, May 7, 2018 at 10:29 AM, Peter Krempa <pkre...@redhat.com> wrote:

> On Sat, May 05, 2018 at 12:17:05 +0300, David Kiarie wrote:
> > On Sat, May 5, 2018 at 12:15 PM, David Kiarie <davidkiar...@gmail.com>
> > wrote:
> >
> > > Replace references to my name and email with a pseudonym
> > >
> >
> > Sorry, I just want my real name and email off these files and I keep
> making
> > silly mistakes.
>
> How about just deleting them? We don't really support using pseudonyms.
>

Why is that ? With a person reason I don't want my name of these files. I
wrote the files and it took me a lot of work.

I can still prove I wrote this code with the above email if anyone wants me
to as I still work as a developer.
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-05 Thread David Kiarie
On Sat, May 5, 2018 at 12:15 PM, David Kiarie <davidkiar...@gmail.com>
wrote:

> Replace references to my name and email with a pseudonym
>

Sorry, I just want my real name and email off these files and I keep making
silly mistakes.


>
> Signed-off-by: David Kiarie <davidkiar...@gmail.com>
> ---
>  src/xenconfig/xen_xl.c | 2 +-
>  src/xenconfig/xen_xl.h | 2 +-
>  tests/xlconfigtest.c   | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> index 35d52f8a..0343a73c 100644
> --- a/src/xenconfig/xen_xl.c
> +++ b/src/xenconfig/xen_xl.c
> @@ -17,7 +17,7 @@
>   * License along with this library.  If not, see
>   * <http://www.gnu.org/licenses/>.
>   *
> - * Author: Kiarie Kahurani <davidkiar...@gmail.com>
> + * Author: Oneko <kawaiii.nekom...@gmail.com>
>   * Author: Jim Fehlig <jfeh...@suse.com>
>   */
>
> diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
> index 68f332ac..4ce13f05 100644
> --- a/src/xenconfig/xen_xl.h
> +++ b/src/xenconfig/xen_xl.h
> @@ -17,7 +17,7 @@
>   * License along with this library.  If not, see
>   * <http://www.gnu.org/licenses/>.
>   *
> - * Author: Kiarie Kahurani<davidkiar...@gmail.com>
> + * Author: Oneko <kawaiii.nekom...@gmail.com>
>   */
>
>  #ifndef __VIR_XEN_XL_H__
> diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
> index 39f51e2d..1bbc0b72 100644
> --- a/tests/xlconfigtest.c
> +++ b/tests/xlconfigtest.c
> @@ -19,7 +19,7 @@
>   * <http://www.gnu.org/licenses/>.
>   *
>   * Author: Daniel P. Berrange <berra...@redhat.com>
> - * Author: Kiarie Kahurani <davidkiar...@gmail.com>
> + * Author: Oneko <kawaiii.nekom...@gmail.com>
>   *
>   */
>
> --
> 2.17.0
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-05 Thread David Kiarie
Replace references to my name and email with a pseudonym

Signed-off-by: David Kiarie <davidkiar...@gmail.com>
---
 src/xenconfig/xen_xl.c | 2 +-
 src/xenconfig/xen_xl.h | 2 +-
 tests/xlconfigtest.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 35d52f8a..0343a73c 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -17,7 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *
- * Author: Kiarie Kahurani <davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@gmail.com>
  * Author: Jim Fehlig <jfeh...@suse.com>
  */
 
diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
index 68f332ac..4ce13f05 100644
--- a/src/xenconfig/xen_xl.h
+++ b/src/xenconfig/xen_xl.h
@@ -17,7 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *
- * Author: Kiarie Kahurani<davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@gmail.com>
  */
 
 #ifndef __VIR_XEN_XL_H__
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 39f51e2d..1bbc0b72 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -19,7 +19,7 @@
  * <http://www.gnu.org/licenses/>.
  *
  * Author: Daniel P. Berrange <berra...@redhat.com>
- * Author: Kiarie Kahurani <davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@gmail.com>
  *
  */
 
-- 
2.17.0

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


[libvirt] [PATCH] xenconfig: Remove references to my name and email

2018-05-05 Thread David Kiarie
Replace references to my name and email with a pseudonym

Signed-off-by: David Kiarie <davidkiar...@gmail.com>
---
 src/xenconfig/xen_xl.c | 2 +-
 src/xenconfig/xen_xl.h | 2 +-
 tests/xlconfigtest.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 35d52f8a..b383560d 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -17,7 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *
- * Author: Kiarie Kahurani <davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@mail.com>
  * Author: Jim Fehlig <jfeh...@suse.com>
  */
 
diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
index 68f332ac..4ce13f05 100644
--- a/src/xenconfig/xen_xl.h
+++ b/src/xenconfig/xen_xl.h
@@ -17,7 +17,7 @@
  * License along with this library.  If not, see
  * <http://www.gnu.org/licenses/>.
  *
- * Author: Kiarie Kahurani<davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@gmail.com>
  */
 
 #ifndef __VIR_XEN_XL_H__
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 39f51e2d..1bbc0b72 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -19,7 +19,7 @@
  * <http://www.gnu.org/licenses/>.
  *
  * Author: Daniel P. Berrange <berra...@redhat.com>
- * Author: Kiarie Kahurani <davidkiar...@gmail.com>
+ * Author: Oneko <kawaiii.nekom...@gmail.com>
  *
  */
 
-- 
2.17.0

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


Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 7:52 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Wed, Mar 28, 2018 at 07:49:09PM +0300, David Kiarie wrote:
> > On Wed, Mar 28, 2018 at 7:46 PM, David Kiarie <davidkiar...@gmail.com>
> > wrote:
> >
> > >
> > >
> > > On Wed, Mar 28, 2018 at 7:43 PM, Daniel P. Berrangé <
> berra...@redhat.com>
> > > wrote:
> > >
> > >> On Wed, Mar 28, 2018 at 07:33:11PM +0300, David Kiarie wrote:
> > >> > On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé <
> > >> berra...@redhat.com>
> > >> > wrote:
> > >> >
> > >> > > On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> > >> > > > I'd like to snip my name and email from these files
> > >> > >
> > >> > > Any particular reason why ?
> > >> > >
> > >> > >
> > >> > Yes, I do have a particular reason why but it's not very relevant
> around
> > >> > here.
> > >>
> > >> NB, patches require a  Signed-off-by line to be commited, so can you
> > >> resend with that.
> > >>
> > >
> > > I'm just angry about some internet idiot who might use my name to
> track me
> > > around.
> > >
> > >
> > >>
> > >> >
> > >> > > > ---
> > >> > > >  src/xenconfig/xen_xl.c | 1 -
> > >> > > >  src/xenconfig/xen_xl.h | 1 -
> > >> > > >  2 files changed, 2 deletions(-)
> > >> > >
> > >> > > It is also mentioned in test/xlconfigtest.c.
> > >>
> > >> And presumably you want to remove from this file too ?
> > >>
> > >
> > > I'm just confused. Not so sure he's smart enough to figure that out.
> > >
> >
> > Okay, shall I redo this patch or would you be kind enough to do it ?
>
> You'll need to resend, and also add a Signed-off-by line so that we can
> commit it.
>

What ? You mean my patch didn't have a Signed-off-by line  ?!

It's long since I did git.


> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 7:46 PM, David Kiarie <davidkiar...@gmail.com>
wrote:

>
>
> On Wed, Mar 28, 2018 at 7:43 PM, Daniel P. Berrangé <berra...@redhat.com>
> wrote:
>
>> On Wed, Mar 28, 2018 at 07:33:11PM +0300, David Kiarie wrote:
>> > On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé <
>> berra...@redhat.com>
>> > wrote:
>> >
>> > > On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
>> > > > I'd like to snip my name and email from these files
>> > >
>> > > Any particular reason why ?
>> > >
>> > >
>> > Yes, I do have a particular reason why but it's not very relevant around
>> > here.
>>
>> NB, patches require a  Signed-off-by line to be commited, so can you
>> resend with that.
>>
>
> I'm just angry about some internet idiot who might use my name to track me
> around.
>
>
>>
>> >
>> > > > ---
>> > > >  src/xenconfig/xen_xl.c | 1 -
>> > > >  src/xenconfig/xen_xl.h | 1 -
>> > > >  2 files changed, 2 deletions(-)
>> > >
>> > > It is also mentioned in test/xlconfigtest.c.
>>
>> And presumably you want to remove from this file too ?
>>
>
> I'm just confused. Not so sure he's smart enough to figure that out.
>

Okay, shall I redo this patch or would you be kind enough to do it ?


>
>
>>
>> Regards,
>> Daniel
>> --
>> |: https://berrange.com  -o-https://www.flickr.com/photos/
>> dberrange :|
>> |: https://libvirt.org -o-
>> https://fstop138.berrange.com :|
>> |: https://entangle-photo.org-o-https://www.instagram.com/dber
>> range :|
>>
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 7:33 PM, David Kiarie <davidkiar...@gmail.com>
wrote:

>
>
> On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé <berra...@redhat.com>
> wrote:
>
>> On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
>> > I'd like to snip my name and email from these files
>>
>> Any particular reason why ?
>>
>>
> Yes, I do have a particular reason why but it's not very relevant around
> here.
>
>> > ---
>> >  src/xenconfig/xen_xl.c | 1 -
>> >  src/xenconfig/xen_xl.h | 1 -
>> >  2 files changed, 2 deletions(-)
>>
>> It is also mentioned in test/xlconfigtest.c.
>>
>> NB, your name & email are still recorded in git history and email
>> archives for eternity
>>
>> Your name, but not email, is also mentioned in the news files,
>> and that file isn't one we'd want to remove since its relevant
>> historical record.
>>
>>
> I prefectly understand that.
>

*perfectly, that is ;-)


>
>
>> >
>> > diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
>> > index e1ec8e7..a3f8af1 100644
>> > --- a/src/xenconfig/xen_xl.c
>> > +++ b/src/xenconfig/xen_xl.c
>> > @@ -17,7 +17,6 @@
>> >   * License along with this library.  If not, see
>> >   * <http://www.gnu.org/licenses/>.
>> >   *
>> > - * Author: Kiarie Kahurani <davidkiar...@gmail.com>
>> >   * Author: Jim Fehlig <jfeh...@suse.com>
>> >   */
>> >
>> > diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
>> > index dd96326..8342f53 100644
>> > --- a/src/xenconfig/xen_xl.h
>> > +++ b/src/xenconfig/xen_xl.h
>> > @@ -17,7 +17,6 @@
>> >   * License along with this library.  If not, see
>> >   * <http://www.gnu.org/licenses/>.
>> >   *
>> > - * Author: Kiarie Kahurani<davidkiar...@gmail.com>
>> >   */
>> >
>> >  #ifndef __VIR_XEN_XL_H__
>> > --
>> > 2.16.2
>> >
>>
>> Regards,
>> Daniel
>> --
>> |: https://berrange.com  -o-https://www.flickr.com/photos/
>> dberrange :|
>> |: https://libvirt.org -o-
>> https://fstop138.berrange.com :|
>> |: https://entangle-photo.org-o-https://www.instagram.com/dber
>> range :|
>>
>
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> > I'd like to snip my name and email from these files
>
> Any particular reason why ?
>
>
Yes, I do have a particular reason why but it's not very relevant around
here.

> > ---
> >  src/xenconfig/xen_xl.c | 1 -
> >  src/xenconfig/xen_xl.h | 1 -
> >  2 files changed, 2 deletions(-)
>
> It is also mentioned in test/xlconfigtest.c.
>
> NB, your name & email are still recorded in git history and email
> archives for eternity
>
> Your name, but not email, is also mentioned in the news files,
> and that file isn't one we'd want to remove since its relevant
> historical record.
>
>
I prefectly understand that.


> >
> > diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
> > index e1ec8e7..a3f8af1 100644
> > --- a/src/xenconfig/xen_xl.c
> > +++ b/src/xenconfig/xen_xl.c
> > @@ -17,7 +17,6 @@
> >   * License along with this library.  If not, see
> >   * <http://www.gnu.org/licenses/>.
> >   *
> > - * Author: Kiarie Kahurani <davidkiar...@gmail.com>
> >   * Author: Jim Fehlig <jfeh...@suse.com>
> >   */
> >
> > diff --git a/src/xenconfig/xen_xl.h b/src/xenconfig/xen_xl.h
> > index dd96326..8342f53 100644
> > --- a/src/xenconfig/xen_xl.h
> > +++ b/src/xenconfig/xen_xl.h
> > @@ -17,7 +17,6 @@
> >   * License along with this library.  If not, see
> >   * <http://www.gnu.org/licenses/>.
> >   *
> > - * Author: Kiarie Kahurani<davidkiar...@gmail.com>
> >   */
> >
> >  #ifndef __VIR_XEN_XL_H__
> > --
> > 2.16.2
> >
>
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] snip my name and email

2018-03-28 Thread David Kiarie
On Wed, Mar 28, 2018 at 7:43 PM, Daniel P. Berrangé <berra...@redhat.com>
wrote:

> On Wed, Mar 28, 2018 at 07:33:11PM +0300, David Kiarie wrote:
> > On Wed, Mar 28, 2018 at 5:32 PM, Daniel P. Berrangé <berra...@redhat.com
> >
> > wrote:
> >
> > > On Mon, Mar 26, 2018 at 10:29:06AM +0300, David Kiarie wrote:
> > > > I'd like to snip my name and email from these files
> > >
> > > Any particular reason why ?
> > >
> > >
> > Yes, I do have a particular reason why but it's not very relevant around
> > here.
>
> NB, patches require a  Signed-off-by line to be commited, so can you
> resend with that.
>

I'm just angry about some internet idiot who might use my name to track me
around.


>
> >
> > > > ---
> > > >  src/xenconfig/xen_xl.c | 1 -
> > > >  src/xenconfig/xen_xl.h | 1 -
> > > >  2 files changed, 2 deletions(-)
> > >
> > > It is also mentioned in test/xlconfigtest.c.
>
> And presumably you want to remove from this file too ?
>

I'm just confused. Not so sure he's smart enough to figure that out.


>
> Regards,
> Daniel
> --
> |: https://berrange.com  -o-https://www.flickr.com/photos/
> dberrange :|
> |: https://libvirt.org -o-
> https://fstop138.berrange.com :|
> |: https://entangle-photo.org-o-https://www.instagram.com/
> dberrange :|
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH V3 2/4] src/xenconfig: Xen-xl parser

2015-01-06 Thread David kiarie
On Sun, Jan 4, 2015 at 9:00 PM, Jim Fehlig jfeh...@suse.com wrote:

 Michal Privoznik wrote:
  On 16.12.2014 05:30, Jim Fehlig wrote:
  diff --git a/src/xenconfig/xen_xl_disk.l b/src/xenconfig/xen_xl_disk.l
  new file mode 100644
  index 000..164aa32
  --- /dev/null
  +++ b/src/xenconfig/xen_xl_disk.l
  @@ -0,0 +1,256 @@
  +/*
  + * xen_xl_disk.l - parser for disk specification strings
  + *
  + * Copyright (C) 2011  Citrix Ltd.
  + * Author Ian Jackson ian.jack...@eu.citrix.com
  + *
  + * This program is free software; you can redistribute it and/or modify
  + * it under the terms of the GNU Lesser General Public License as
 published
  + * by the Free Software Foundation; version 2.1 only. with the special
  + * exception on linking described in file LICENSE.
  + *
  + * This program is distributed in the hope that it will be useful,
  + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  + * GNU Lesser General Public License for more details.
  + */
  +
  +/*
  + * Parsing the old xm/xend/xl-4.1 disk specs is a tricky problem,
  + * because the target string might in theory contain , which is the
  + * delimiter we use for stripping off things on the RHS, and :,
  + * which is the delimiter we use for stripping off things on the LHS.
  + *
  + * In this parser we do not support such target strings in the old
  + * syntax; if the target string has to contain , or : the new
  + * syntax's target= should be used.
  + */
  +%{
  +# include config.h
  +
  +# include stdio.h
  +
  +# include viralloc.h
  +# include virstoragefile.h
 
 
  With this, you need to -I$(LIBXML_CFLAGS), otherwise you'll get an
 compile error:
 
CC   xenconfig/libvirt_xenxldiskparser_la-xen_xl_disk.lo
  In file included from ../src/util/virstoragefile.h:29:0,
   from xenconfig/xen_xl_disk.l:34:
  ../src/util/virstorageencryption.h:30:26: fatal error: libxml/tree.h: No
 such file or directory
   # include libxml/tree.h
^
 
  However, that alone is not enough:
  make[3]: Entering directory '/home/zippy/work/libvirt/libvirt.git/src'
CC   xenconfig/libvirt_xenxldiskparser_la-xen_xl_disk.lo
  xenconfig/xen_xl_disk.c: In function 'yy_fatal_error':
  xenconfig/xen_xl_disk.c:2143:58: error: unused parameter 'yyscanner'
 [-Werror=unused-parameter]
   static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
^
  xenconfig/xen_xl_disk.c: In function 'xl_disk_alloc':
  xenconfig/xen_xl_disk.c:2471:49: error: unused parameter 'yyscanner'
 [-Werror=unused-parameter]
   void *xl_disk_alloc (yy_size_t  size , yyscan_t yyscanner)
   ^
  xenconfig/xen_xl_disk.c: In function 'xl_disk_realloc':
  xenconfig/xen_xl_disk.c:2476:64: error: unused parameter 'yyscanner'
 [-Werror=unused-parameter]
   void *xl_disk_realloc  (void * ptr, yy_size_t  size , yyscan_t
 yyscanner)
  ^
  xenconfig/xen_xl_disk.c: In function 'xl_disk_free':
  xenconfig/xen_xl_disk.c:2488:42: error: unused parameter 'yyscanner'
 [-Werror=unused-parameter]
   void xl_disk_free (void * ptr , yyscan_t yyscanner)
^
  cc1: all warnings being treated as errors
 

 Odd that I didn't see these errors in my test builds...

  So we are aiming at this diff:
 
  diff --git a/src/Makefile.am b/src/Makefile.am
  index 3eb9a18..8ccc273 100644
  --- a/src/Makefile.am
  +++ b/src/Makefile.am
  @@ -1074,7 +1074,7 @@ if WITH_XENCONFIG
   # Add the generated object to its own library to control CFLAGS
   noinst_LTLIBRARIES += libvirt_xenxldiskparser.la
   libvirt_xenxldiskparser_la_CFLAGS = \
  -   -I$(top_srcdir)/src/conf
  +   -I$(top_srcdir)/src/conf $(AM_CFLAGS)
 -Wno-unused-parameter
   libvirt_xenxldiskparser_la_SOURCES = \
  $(XENXLDISKPARSER_SOURCES)
 
 
  ACK with that squashed in.
 

 I've added your change and pushed the series.  Thanks for the review!

 David, thank you for working on this, and your patience while we sorted
 out the flex/autotools integration :-).


Well, that was close - close is fun :D



 Regards,
 Jim


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

Re: [libvirt] [PATCH V2 2/4] src/xenconfig: Xen-xl parser

2014-10-02 Thread David kiarie
Hmm, any  consensus on this?

On Fri, Sep 12, 2014 at 4:17 PM, Eric Blake ebl...@redhat.com wrote:
 On 09/11/2014 06:14 PM, Jim Fehlig wrote:

 But also as mentioned before, I can't figure out how to convince
 automake to tell flex to generate the header file as well as the .c file.

 Eric, do you have any experience with automake and flex? The following
 thread makes it sound as though automake supports flex's
 '--header-file=' option, but I can't find any hint on how to make it work

 http://lists.gnu.org/archive/html/bug-automake/2012-08/msg00069.html


 Quick reply here to acknowledge that you're waiting on me, although a
 more detailed reply may take me a few days...

 I haven't personally written a makefile with flex, but know that
 coreutils is such a project, so I plan to research how it gets things to
 work.

 --
 Eric Blake   eblake redhat com+1-919-301-3266
 Libvirt virtualization library http://libvirt.org


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


Re: [libvirt] [PATCH V2 2/4] src/xenconfig: Xen-xl parser

2014-09-12 Thread David Kiarie
On Thu, Sep 11, 2014 at 06:14:12PM -0600, Jim Fehlig wrote:
 Kiarie Kahurani wrote:
  Introduce a xen xl parser

 
 [...]
 
 
  diff --git a/configure.ac b/configure.ac
  index f93c6c2..0daf411 100644
  --- a/configure.ac
  +++ b/configure.ac
  @@ -2177,6 +2177,13 @@ if test -z $PERL; then
AC_MSG_ERROR([Failed to find perl.])
   fi
   
  +AC_PROG_LEX
  +if test x$LEX != xflex; then
  +LEX=$SHELL $missing_dir/missing flex
  +AC_SUBST([LEX_OUPTUT_ROOT], [lex.yy])
  +AC_SUBST([LEXLIB], [''])
  +fi
  +

 
 As mentioned previously, I think you only need AM_PROG_FLEX here. I
 peeked at the macro in aclocal.m4 and it looks to handle the missing
 flex case.
 
   AC_ARG_WITH([test-suite],
   [AS_HELP_STRING([--with-test-suite],
  [build test suite by default @:@default=check@:@])],
  diff --git a/src/Makefile.am b/src/Makefile.am
  index 46e411e..52c7f1a 100644
  --- a/src/Makefile.am
  +++ b/src/Makefile.am
  @@ -35,7 +35,6 @@ INCLUDES =-I../gnulib/lib 
  \
  $(GETTEXT_CPPFLAGS)
   
   AM_CFLAGS =$(LIBXML_CFLAGS)\
  -   $(WARN_CFLAGS)  \
  $(LOCK_CHECKING_CFLAGS) \
  $(WIN32_EXTRA_CFLAGS)   \
  $(COVERAGE_CFLAGS)
  @@ -964,11 +963,25 @@ CPU_SOURCES = 
  \
   VMX_SOURCES =  \
  vmx/vmx.c vmx/vmx.h
   
  +XENCONFIG_GENERATED =   \
  +   xenconfig/libxlu_disk_l.c   \
  +xenconfig/libxlu_disk_l.h
  +
  +$(XENCONFIG_GENERATED): $(srcdir)/xenconfig/libxlu_disk_l.l \
  +   $(srcdir)/xenconfig/libxlu_disk_i.h Makefile.am
  +   $(AM_V_GEN)$(LEX) --outfile=$(srcdir)/xenconfig/libxlu_disk_l.c 
 \
  +   --header-file=$(srcdir)/xenconfig/libxlu_disk_l.h \
  +   $(srcdir)/xenconfig/libxlu_disk_l.l
  +
  +CLEANFILES += $(XENCONFIG_GENERATED)
  +
   XENCONFIG_SOURCES =\
  xenconfig/xenxs_private.h   \
  -   xenconfig/xen_common.c xenconfig/xen_common.h   \
  -   xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h   \
  -   xenconfig/xen_xm.c xenconfig/xen_xm.h
  +   xenconfig/xen_common.c xenconfig/xen_common.h  \
  +   xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h\
  +   xenconfig/xen_xm.c xenconfig/xen_xm.h   \
  +   xenconfig/xen_xl.c xenconfig/xen_xl.h   \

  + $(XENCONFIG_GENERATED)
 
 Same comment as before. According to the automake documentation this
 should be done with
 
 BUILT_SOURCES += xenconfig/libxlu_disk_l.h xenconfig/libxlu_disk_l.c
 
 XENCONFIG_SOURCES = \
 xenconfig/xenxs_private.h \
 xenconfig/xen_common.c xenconfig/xen_common.h \
 xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \
 xenconfig/xen_xm.c xenconfig/xen_xm.h \
 xenconfig/xen_xl.c xenconfig/xen_xl.h \
 xenconfig/libxlu_disk_l.l
 
 But also as mentioned before, I can't figure out how to convince
 automake to tell flex to generate the header file as well as the .c file.
 
 Eric, do you have any experience with automake and flex? The following
 thread makes it sound as though automake supports flex's
 '--header-file=' option, but I can't find any hint on how to make it work
 
 http://lists.gnu.org/archive/html/bug-automake/2012-08/msg00069.html

Am not sure this approach is going to work.

I have two problems here

  The flex generated file has used parameters so the flags used to
  compile it should be different from those used to compile the other
  files

  With your approach flex will generate a file named lex.xlu_disk_yy.la
  which apparently does not form a valid library name(below)

I want to compile xenconfig sources separately from the flex generated
file(so as to handle the separate flags). With separate flags I am
getting rid of all the warnings when compiling the flex file since they
are mostly useless as its almost impossible to edit the file manually
with every compile. I want to follow my earlier approach so as to force 
flex to generate a file with a suitable name(then generate a suitable
.la file from it)

 
 Regards,
 Jim
 
 
   
   pkgdata_DATA = cpu/cpu_map.xml
   
  diff --git a/src/libvirt_xenconfig.syms b/src/libvirt_xenconfig.syms
  index 6541685..3e2e5d6 100644
  --- a/src/libvirt_xenconfig.syms
  +++ b/src/libvirt_xenconfig.syms
  @@ -16,6 +16,10 @@ xenParseSxprChar;
   xenParseSxprSound;
   xenParseSxprString;
   
  +#xenconfig/xen_xl.h
  +xenFormatXL;
  +xenParseXL;
  +
   # xenconfig/xen_xm.h
   xenFormatXM;
   xenParseXM;
  diff --git a/src/xenconfig/libxlu_disk_i.h b/src/xenconfig/libxlu_disk_i.h
  new file mode 100644
  index 000..911ea42
  --- /dev/null
  +++ 

Re: [libvirt] [PATCH V2 0/4] Xen-xl parser

2014-09-11 Thread David kiarie
Aah, just noticed the tests are not working

On Thu, Sep 11, 2014 at 7:10 AM, Kiarie Kahurani davidkiar...@gmail.com wrote:
 Kiarie Kahurani (4):
   src/xenconfig: Export helper functions
   src/xenconfig: Xen-xl parser
   src/xenconfig: Introduce xen-xl on virsh command line
   tests: Tests for the xen-xl parser

  configure.ac |   7 +
  src/Makefile.am  |  21 +-
  src/libvirt_xenconfig.syms   |   4 +
  src/libxl/libxl_driver.c |  46 +++-
  src/xenconfig/libxlu_disk_i.h|  28 ++
  src/xenconfig/libxlu_disk_l.l| 259 +++
  src/xenconfig/xen_common.c   | 147 +--
  src/xenconfig/xen_common.h   |  24 +-
  src/xenconfig/xen_xl.c   | 479 
 +++
  src/xenconfig/xen_xl.h   |  29 +++
  tests/Makefile.am|   9 +-
  tests/testutilsxen.c |  50 
  tests/testutilsxen.h |   9 +-
  tests/xlconfigdata/test-new-disk.cfg |  27 ++
  tests/xlconfigdata/test-new-disk.xml |  45 
  tests/xlconfigdata/test-spice.cfg|  32 +++
  tests/xlconfigdata/test-spice.xml|  45 
  tests/xlconfigtest.c | 224 
  18 files changed, 1389 insertions(+), 96 deletions(-)
  create mode 100644 src/xenconfig/libxlu_disk_i.h
  create mode 100644 src/xenconfig/libxlu_disk_l.l
  create mode 100644 src/xenconfig/xen_xl.c
  create mode 100644 src/xenconfig/xen_xl.h
  create mode 100644 tests/xlconfigdata/test-new-disk.cfg
  create mode 100644 tests/xlconfigdata/test-new-disk.xml
  create mode 100644 tests/xlconfigdata/test-spice.cfg
  create mode 100644 tests/xlconfigdata/test-spice.xml
  create mode 100644 tests/xlconfigtest.c

  Changes in V1

 -introduced flex for xl disk format parsing

  Changes in V2

 -changed ot use AC_PROG_LEX in configure.ac
 -got rid of unused data files

  Not done

-compile the generated file using global compiler
flags as it has unused parameters

 --
 1.8.4.5


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


[libvirt] Libvirtd not initializing after 65b7d553

2014-08-21 Thread David Kiarie

For some I cannot be able able to use virsh after 65b7d553.

Libvirtd initializes without errors but I guess something is going 
unreported 

$libvirtd -d 
  2014-08-21 09:29:22.748+: 468: info : libvirt version: 1.2.8
  2014-08-21 09:29:22.748+: 468: warning : virGetHostname:665 :
getaddrinfo failed for 'linux-xzc4': Name or service not known

$ps aux | grep libvirtd 
  root   471  0.0  0.1 375692 10268 ?SLl  12:29   0:00
  libvirtd -d
  root   570  0.0  0.0  10520   928 pts/0S+   12:30   0:00 grep
  --color=auto libvirtd

$virsh nodeinfo 
  error: failed to connect to the hypervisor
  error: no valid connection
  error: An error occurred, but the cause is unknown

$libvirtd -vvv 
  2014-08-21 09:31:12.549+: 584: info : libvirt version: 1.2.8
  2014-08-21 09:31:12.549+: 584: warning : virGetHostname:665 :
  getaddrinfo failed for 'linux-xzc4': Name or service not known
  2014-08-21 09:31:12.919+: 596: info : libvirt version: 1.2.8
  2014-08-21 09:31:12.919+: 596: warning : virQEMUCapsInit:976 :
  Failed to query host NUMA topology, disabling NUMA capabilities
  2014-08-21 09:31:12.920+: 596: warning : virQEMUCapsInit:980 :
  Failed to get host CPU
  2014-08-21 09:31:12.978+: 596: warning : virLXCDriverCapsInit:82 :
  Failed to query host NUMA topology, disabling NUMA capabilities
  2014-08-21 09:31:12.979+: 596: warning : umlCapsInit:70 : Failed to
  query host NUMA topology, disabling NUMA capabilities

I have no idea whether this is related to my system or the commit but
libvirt master before that commit work perfectly with me.

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


Re: [libvirt] Libvirtd not initializing after 65b7d553

2014-08-21 Thread David kiarie
Ooh forgot to say that this happens on a Xen system

On Thu, Aug 21, 2014 at 12:36 PM, David Kiarie davidkiar...@gmail.com wrote:

 For some I cannot be able able to use virsh after 65b7d553.

 Libvirtd initializes without errors but I guess something is going
 unreported

 $libvirtd -d
   2014-08-21 09:29:22.748+: 468: info : libvirt version: 1.2.8
   2014-08-21 09:29:22.748+: 468: warning : virGetHostname:665 :
 getaddrinfo failed for 'linux-xzc4': Name or service not known

 $ps aux | grep libvirtd
   root   471  0.0  0.1 375692 10268 ?SLl  12:29   0:00
   libvirtd -d
   root   570  0.0  0.0  10520   928 pts/0S+   12:30   0:00 grep
   --color=auto libvirtd

 $virsh nodeinfo
   error: failed to connect to the hypervisor
   error: no valid connection
   error: An error occurred, but the cause is unknown

 $libvirtd -vvv
   2014-08-21 09:31:12.549+: 584: info : libvirt version: 1.2.8
   2014-08-21 09:31:12.549+: 584: warning : virGetHostname:665 :
   getaddrinfo failed for 'linux-xzc4': Name or service not known
   2014-08-21 09:31:12.919+: 596: info : libvirt version: 1.2.8
   2014-08-21 09:31:12.919+: 596: warning : virQEMUCapsInit:976 :
   Failed to query host NUMA topology, disabling NUMA capabilities
   2014-08-21 09:31:12.920+: 596: warning : virQEMUCapsInit:980 :
   Failed to get host CPU
   2014-08-21 09:31:12.978+: 596: warning : virLXCDriverCapsInit:82 :
   Failed to query host NUMA topology, disabling NUMA capabilities
   2014-08-21 09:31:12.979+: 596: warning : umlCapsInit:70 : Failed to
   query host NUMA topology, disabling NUMA capabilities

 I have no idea whether this is related to my system or the commit but
 libvirt master before that commit work perfectly with me.

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


Re: [libvirt] Libvirtd not initializing after 65b7d553

2014-08-21 Thread David kiarie
$virsh -c xen:/// nodeinfo

CPU model:   x86_64
CPU(s):  8
CPU frequency:   3392 MHz
CPU socket(s):   1
Core(s) per socket:  4
Thread(s) per core:  2
NUMA cell(s):1
Memory size: 8275524 KiB

Works

On Thu, Aug 21, 2014 at 12:53 PM, Daniel P. Berrange
berra...@redhat.com wrote:
 On Thu, Aug 21, 2014 at 11:48:15AM +0200, Michal Privoznik wrote:
 On 21.08.2014 11:40, David kiarie wrote:
 Ooh forgot to say that this happens on a Xen system
 
 On Thu, Aug 21, 2014 at 12:36 PM, David Kiarie davidkiar...@gmail.com 
 wrote:
 
 For some I cannot be able able to use virsh after 65b7d553.
 
 Libvirtd initializes without errors but I guess something is going
 unreported
 
 $libvirtd -d
2014-08-21 09:29:22.748+: 468: info : libvirt version: 1.2.8
2014-08-21 09:29:22.748+: 468: warning : virGetHostname:665 :
  getaddrinfo failed for 'linux-xzc4': Name or service not known
 
 $ps aux | grep libvirtd
root   471  0.0  0.1 375692 10268 ?SLl  12:29   0:00
libvirtd -d
root   570  0.0  0.0  10520   928 pts/0S+   12:30   0:00 grep
--color=auto libvirtd
 
 $virsh nodeinfo
error: failed to connect to the hypervisor
error: no valid connection
error: An error occurred, but the cause is unknown

 Since vbox registers first, you may be connecting to different URI than you
 think.

 Hmm, that change isn't good. We shouldn't change the priority ordering
 of the hypervisor drivers - when I suggested reordering vbox driver, I
 only meant that the storage  network driver parts of vbox be placed
 first - not that the hypervisor part should be raised in priority.

 Regards,
 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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH V5 04/12] src/xenxs: Refactor code formating virtual time config

2014-08-14 Thread David Kiarie
On Wed, Aug 13, 2014 at 05:15:58PM -0600, Jim Fehlig wrote:
 Kiarie Kahurani wrote:
  introduce function
xenFormatXMTimeOffset(virConfPtr conf,);
  which formats time config instead
 
  Signed-off-by: Kiarie Kahurani davidkiar...@gmail.com
  ---
   src/xenxs/xen_xm.c | 153 
  -
   1 file changed, 82 insertions(+), 71 deletions(-)
 
  diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
  index ad70b5a..b17574d 100644
  --- a/src/xenxs/xen_xm.c
  +++ b/src/xenxs/xen_xm.c
  @@ -1704,6 +1704,86 @@ xenFormatXMMem(virConfPtr conf, virDomainDefPtr def)
   }
   
   
  +static int
  +xenFormatXMTimeOffset(virConfPtr conf, virDomainDefPtr def,
  +  int xendConfigVersion)

 
 If function name + params exceeds 80 columns, common practice is each
 param after the first on a separate line. E.g.
 
 xenFormatTimeOffset(virConfPtr conf,
 virDomainDefPtr def,
 int xendConfigVersion)
 {
 ...
 
  +{
  +int vmlocaltime;
  +if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {

 
 Preferred style is a blank line after local variable declaration.
 
 ACK otherwise. I'll fixup these nits before pushing.
 
 Regards,
 Jim

BTW in the tests data I see configs like 
  clock offset = 'utc' adjustment = 'reset'
while if am not wrong the code in xen_xm.c explicity rejects such
config 

   unsupported clock adjustment = 'reset' 

 

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


Re: [libvirt] [PATCH V5 08/12] src/xenxs: Refactor code formating CPU features config

2014-08-14 Thread David Kiarie
On Wed, Aug 13, 2014 at 05:35:52PM -0600, Jim Fehlig wrote:
 Kiarie Kahurani wrote:
  introduce functions
xenFormatXMCPUFeatures(virConfPtr conf, ..);
  which formats CPU features config instead
 
  Signed-off-by: Kiarie Kahurani davidkiar...@gmail.com
  ---
   src/xenxs/xen_xm.c | 118 
  -
   tests/xmconfigdata/test-escape-paths.cfg   |   6 +-
   tests/xmconfigdata/test-fullvirt-force-hpet.cfg|   6 +-
   tests/xmconfigdata/test-fullvirt-force-nohpet.cfg  |   6 +-
   tests/xmconfigdata/test-fullvirt-localtime.cfg |   6 +-
   tests/xmconfigdata/test-fullvirt-net-ioemu.cfg |   6 +-
   tests/xmconfigdata/test-fullvirt-net-netfront.cfg  |   6 +-
   tests/xmconfigdata/test-fullvirt-new-cdrom.cfg |   6 +-
   tests/xmconfigdata/test-fullvirt-old-cdrom.cfg |   6 +-
   tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg  |   6 +-
   .../test-fullvirt-serial-dev-2-ports.cfg   |   6 +-
   .../test-fullvirt-serial-dev-2nd-port.cfg  |   6 +-
   tests/xmconfigdata/test-fullvirt-serial-file.cfg   |   6 +-
   tests/xmconfigdata/test-fullvirt-serial-null.cfg   |   6 +-
   tests/xmconfigdata/test-fullvirt-serial-pipe.cfg   |   6 +-
   tests/xmconfigdata/test-fullvirt-serial-pty.cfg|   6 +-
   tests/xmconfigdata/test-fullvirt-serial-stdio.cfg  |   6 +-
   .../test-fullvirt-serial-tcp-telnet.cfg|   6 +-
   tests/xmconfigdata/test-fullvirt-serial-tcp.cfg|   6 +-
   tests/xmconfigdata/test-fullvirt-serial-udp.cfg|   6 +-
   tests/xmconfigdata/test-fullvirt-serial-unix.cfg   |   6 +-
   tests/xmconfigdata/test-fullvirt-sound.cfg |   6 +-
   tests/xmconfigdata/test-fullvirt-usbmouse.cfg  |   6 +-
   tests/xmconfigdata/test-fullvirt-usbtablet.cfg |   6 +-
   tests/xmconfigdata/test-fullvirt-utc.cfg   |   6 +-
   tests/xmconfigdata/test-no-source-cdrom.cfg|   6 +-
   tests/xmconfigdata/test-pci-devs.cfg   |   6 +-
   27 files changed, 146 insertions(+), 128 deletions(-)
 
  diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
  index 2c381f8..a856698 100644
  --- a/src/xenxs/xen_xm.c
  +++ b/src/xenxs/xen_xm.c
  @@ -1950,6 +1950,73 @@ xenFormatXMDomainDisks(virConfPtr conf, 
  virDomainDefPtr def,
   virConfFreeValue(diskVal);
   return -1;
   }
  +
  +
  +static int
  +xenFormatXMCPUFeatures(virConfPtr conf, virDomainDefPtr def,
  +   int xendConfigVersion)
  +{
  +char *cpus = NULL;
  +size_t i;
  +
  +if (xenXMConfigSetInt(conf, vcpus, def-maxvcpus)  0)
  +return -1;
  +/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
  +   either 32, or 64 on a platform where long is big enough.  */
  +if (def-vcpus  def-maxvcpus 
  +xenXMConfigSetInt(conf, vcpu_avail, (1UL  def-vcpus) - 1)  0)
  +return -1;
  +
  +if ((def-cpumask != NULL) 
  +((cpus = virBitmapFormat(def-cpumask)) == NULL)) {
  +return -1;
  +}
  +
  +if (cpus 
  +xenXMConfigSetString(conf, cpus, cpus)  0)
  +return -1;
  +
  +VIR_FREE(cpus);

 
 I'd consider these to be allocation-related, as opposed to features.
 I've changed the patch a bit to introduce xenFormatXMCPUAllocation and
 xenFormatXMCPUFeatures.
 
  +if (STREQ(def-os.type, hvm)) {
  +if (xenXMConfigSetInt(conf, pae,
  +  (def-features[VIR_DOMAIN_FEATURE_PAE] ==
  +   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
  +return -1;
  +
  +if (xenXMConfigSetInt(conf, acpi,
  +  (def-features[VIR_DOMAIN_FEATURE_ACPI] ==
  +   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
  +return -1;
  +
  +if (xenXMConfigSetInt(conf, apic,
  +  (def-features[VIR_DOMAIN_FEATURE_APIC] ==
  +   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
  +return -1;
  +
  +if (xendConfigVersion = XEND_CONFIG_VERSION_3_0_4) {
  +if (xenXMConfigSetInt(conf, hap,
  +  (def-features[VIR_DOMAIN_FEATURE_HAP] ==
  +   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
  +return -1;
  +
  +if (xenXMConfigSetInt(conf, viridian,
  +  
  (def-features[VIR_DOMAIN_FEATURE_VIRIDIAN] ==
  +   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
  +return -1;
  +}
  +
  +for (i = 0; i  def-clock.ntimers; i++) {
  +if (def-clock.timers[i]-name == VIR_DOMAIN_TIMER_NAME_HPET 
  +def-clock.timers[i]-present != -1 
  +xenXMConfigSetInt(conf, hpet, 
  def-clock.timers[i]-present)  0)
  +return -1;
  +}
  +}
  +
  +return 0;
  +}
  +
  +
   /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
  

Re: [libvirt] [PATCH V5 09/12] src/xenxs: Refactor code formating OS config

2014-08-14 Thread David Kiarie
On Thu, Aug 14, 2014 at 12:15:32AM -0600, Jim Fehlig wrote:
 Kiarie Kahurani wrote:
  introduce function
 xenFormatXMOS(virConfPtr conf,);

 
 I split this into three functions:
 
 - xenFormatXMEmulator
 - xenFormatXMCDROM
 - xenFormatXMOS
 
 Formating of emulator and cdrom can be different between xm and xl, and
 we may want to account for that in the near future.
 
  which formats OS config instead
 
  Signed-off-by: Kiarie Kahurani davidkiar...@gmail.com
  ---
   src/xenxs/xen_xm.c | 95 
  --
   tests/xmconfigdata/test-escape-paths.cfg   |  2 +-
   tests/xmconfigdata/test-fullvirt-force-hpet.cfg|  2 +-
   tests/xmconfigdata/test-fullvirt-force-nohpet.cfg  |  2 +-
   tests/xmconfigdata/test-fullvirt-localtime.cfg |  2 +-
   tests/xmconfigdata/test-fullvirt-net-ioemu.cfg |  2 +-
   tests/xmconfigdata/test-fullvirt-net-netfront.cfg  |  2 +-
   tests/xmconfigdata/test-fullvirt-new-cdrom.cfg |  2 +-
   tests/xmconfigdata/test-fullvirt-old-cdrom.cfg |  2 +-
   tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg  |  2 +-
   .../test-fullvirt-serial-dev-2-ports.cfg   |  2 +-
   .../test-fullvirt-serial-dev-2nd-port.cfg  |  2 +-
   tests/xmconfigdata/test-fullvirt-serial-file.cfg   |  2 +-
   tests/xmconfigdata/test-fullvirt-serial-null.cfg   |  2 +-
   tests/xmconfigdata/test-fullvirt-serial-pipe.cfg   |  2 +-
   tests/xmconfigdata/test-fullvirt-serial-pty.cfg|  2 +-
   tests/xmconfigdata/test-fullvirt-serial-stdio.cfg  |  2 +-
   .../test-fullvirt-serial-tcp-telnet.cfg|  2 +-
   tests/xmconfigdata/test-fullvirt-serial-tcp.cfg|  2 +-
   tests/xmconfigdata/test-fullvirt-serial-udp.cfg|  2 +-
   tests/xmconfigdata/test-fullvirt-serial-unix.cfg   |  2 +-
   tests/xmconfigdata/test-fullvirt-sound.cfg |  2 +-
   tests/xmconfigdata/test-fullvirt-usbmouse.cfg  |  2 +-
   tests/xmconfigdata/test-fullvirt-usbtablet.cfg |  2 +-
   tests/xmconfigdata/test-fullvirt-utc.cfg   |  2 +-
   tests/xmconfigdata/test-no-source-cdrom.cfg|  2 +-
   tests/xmconfigdata/test-pci-devs.cfg   |  2 +-

 
 Avoids changing all the test data files too. Simplified patch below.
 
 BTW, I got interrupted during my earlier review, so will push shortly
 had changed to will push tomorrow :-).
 
 Regards,
 Jim
 

 From 76824b192ecac2d9f19406c11446b616ca96e9d4 Mon Sep 17 00:00:00 2001
 From: Kiarie Kahurani davidkiar...@gmail.com
 Date: Tue, 12 Aug 2014 00:21:32 +0300
 Subject: [PATCH 08/11] src/xenxs: Refactor code formating OS config
 
 introduce functions
xenFormatXMEmulator(virConfPtr conf,);
xenFormatXMCDROM(virConfPtr conf, ...);
xenFormatXMOS(virConfPtr conf,);
 which formats OS and associated config instead
 
 Signed-off-by: Kiarie Kahurani davidkiar...@gmail.com
 Signed-off-by: Jim Fehlig jfeh...@suse.com
 ---
  src/xenxs/xen_xm.c | 161 
 +
  1 file changed, 101 insertions(+), 60 deletions(-)
 
 diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
 index 432fee2..72ae913 100644
 --- a/src/xenxs/xen_xm.c
 +++ b/src/xenxs/xen_xm.c
 @@ -2021,42 +2021,57 @@ xenFormatXMCPUFeatures(virConfPtr conf,
  }
  
  
 -/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
 -   either 32, or 64 on a platform where long is big enough.  */
 -verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
 +static int
 +xenFormatXMEmulator(virConfPtr conf, virDomainDefPtr def)
 +{
 +if (def-emulator 
 +xenXMConfigSetString(conf, device_model, def-emulator)  0)
 +return -1;
  
 -virConfPtr
 -xenFormatXM(virConnectPtr conn,
 -virDomainDefPtr def,
 -int xendConfigVersion)
 +return 0;
 +}
 +
 +
 +static int
 +xenFormatXMCDROM(virConfPtr conf,
 + virDomainDefPtr def,
 + int xendConfigVersion)
  {
 -virConfPtr conf = NULL;
 -int hvm = 0;
  size_t i;
 -virConfValuePtr netVal = NULL;
 -
 -if (!(conf = virConfNew()))
 -goto cleanup;
  
 -if (xenFormatXMGeneralMeta(conf, def)  0)
 -goto cleanup;
 +if (STREQ(def-os.type, hvm)) {
 +if (xendConfigVersion == XEND_CONFIG_VERSION_3_0_2) {
 +for (i = 0; i  def-ndisks; i++) {
 +if (def-disks[i]-device == VIR_DOMAIN_DISK_DEVICE_CDROM 
 +def-disks[i]-dst 
 +STREQ(def-disks[i]-dst, hdc) 
 +virDomainDiskGetSource(def-disks[i])) {
 +if (xenXMConfigSetString(conf, cdrom,
 + 
 virDomainDiskGetSource(def-disks[i]))  0)
 +return -1;
 +break;
 +}
 +}
 +}
 +}
  
 -if (xenFormatXMMem(conf, def)  0)
 -goto cleanup;
 +return 0;
 +}
  
 -if (xenFormatXMCPUAllocation(conf, def)  0)
 -goto 

[libvirt] Initializing qemu driver

2014-08-12 Thread David kiarie
Hi there,

I get this errors trying to intialialize libvirtd

$libvirtd -vvv
2014-08-12 21:57:47.887+: 6449: info : libvirt version: 1.2.8
2014-08-12 21:57:47.887+: 6449: warning : virGetHostname:665 :
getaddrinfo failed for 'linux-xzc4': Name or service not known
2014-08-12 21:57:48.034+: 6461: info : libvirt version: 1.2.8
2014-08-12 21:57:48.034+: 6461: error :
virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse
/proc/meminfo
2014-08-12 21:57:48.034+: 6461: error : virStateInitialize:749 :
Initialization of QEMU state driver failed: internal error: Unable to
parse /proc/meminfo
2014-08-12 21:57:48.034+: 6461: error : daemonRunStateInit:922 :
Driver state initialization failed

Is someone else experiencing the same thing?

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


Re: [libvirt] Initializing qemu driver

2014-08-12 Thread David kiarie
Ooh got something on the list, I build without qemu as I only care about Xen.

On Wed, Aug 13, 2014 at 1:00 AM, David kiarie davidkiar...@gmail.com wrote:
 Hi there,

 I get this errors trying to intialialize libvirtd

 $libvirtd -vvv
 2014-08-12 21:57:47.887+: 6449: info : libvirt version: 1.2.8
 2014-08-12 21:57:47.887+: 6449: warning : virGetHostname:665 :
 getaddrinfo failed for 'linux-xzc4': Name or service not known
 2014-08-12 21:57:48.034+: 6461: info : libvirt version: 1.2.8
 2014-08-12 21:57:48.034+: 6461: error :
 virFileGetDefaultHugepageSize:2958 : internal error: Unable to parse
 /proc/meminfo
 2014-08-12 21:57:48.034+: 6461: error : virStateInitialize:749 :
 Initialization of QEMU state driver failed: internal error: Unable to
 parse /proc/meminfo
 2014-08-12 21:57:48.034+: 6461: error : daemonRunStateInit:922 :
 Driver state initialization failed

 Is someone else experiencing the same thing?

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


Re: [libvirt] [PATCH V5 01/12] src/xenxs: Export code for reuse

2014-08-11 Thread David kiarie
On Tue, Aug 12, 2014 at 12:21 AM, Kiarie Kahurani
davidkiar...@gmail.com wrote:
 wrap code tagged for resuse into one function and export it

 Signed-off-by: Kiarie Kahurani davidkiar...@gmail.com
 ---
  src/xenxs/xen_xm.c | 73 
 +++---
  src/xenxs/xen_xm.h |  2 ++
  2 files changed, 44 insertions(+), 31 deletions(-)

 diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
 index f70b395..8238026 100644
 --- a/src/xenxs/xen_xm.c
 +++ b/src/xenxs/xen_xm.c
 @@ -1263,59 +1263,70 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
  }


 -/*
 - * Turn a config record into a lump of XML describing the
 - * domain, suitable for later feeding for virDomainCreateXML
 - */
 -virDomainDefPtr
 -xenParseXM(virConfPtr conf, int xendConfigVersion,
 -   virCapsPtr caps)
 +int
 +xenParseConfigCommon(virConfPtr conf, virDomainDefPtr def,
 + virCapsPtr caps, int xendConfigVersion)
  {
 -virDomainDefPtr def = NULL;
 -
 -if (VIR_ALLOC(def)  0)
 -return NULL;
 -
 -def-virtType = VIR_DOMAIN_VIRT_XEN;
 -def-id = -1;

  if (xenParseXMGeneralMeta(conf, def, caps)  0)
 -goto cleanup;
 +return -1;

  if (xenParseXMOS(conf, def)  0)
 -goto cleanup;
 +return -1;

  if (xenParseXMMem(conf, def)  0)
 -goto cleanup;
 +return -1;
 +
 +if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
 +return -1;

  if (xenParseXMEventsActions(conf, def)  0)
 -goto cleanup;
 +return -1;
 +
 +if (xenParseXMPCI(conf, def)  0)
 +return -1;

  if (xenParseXMCPUFeatures(conf, def)  0)
 -goto cleanup;
 +return -1;

 -if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
 -goto cleanup;
 +if (xenParseXMEmulatedDevices(conf, def)  0)
 +return -1;

 -if (xenParseXMDisk(conf, def, xendConfigVersion)  0)
 -goto cleanup;
 +if (xenParseXMCharDev(conf, def)  0)
 +return -1;
 +
 +if (xenParseXMVfb(conf, def, xendConfigVersion)  0)
 +return -1;

  if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
 -goto cleanup;
 +return -1;

I guess this should come of too; its already taken care of by xenParseXMOS.


  if (xenParseXMVif(conf, def)  0)
 -goto cleanup;
 +return -1;

 -if (xenParseXMPCI(conf, def)  0)
 -goto cleanup;
 +return 0;
 +}

 -if (xenParseXMEmulatedDevices(conf, def)  0)
 -goto cleanup;
 +/*
 + * Turn a config record into a lump of XML describing the
 + * domain, suitable for later feeding for virDomainCreateXML
 + */
 +virDomainDefPtr
 +xenParseXM(virConfPtr conf, int xendConfigVersion,
 +   virCapsPtr caps)
 +{
 +virDomainDefPtr def = NULL;

 -if (xenParseXMVfb(conf, def, xendConfigVersion)  0)
 +if (VIR_ALLOC(def)  0)
 +return NULL;
 +
 +def-virtType = VIR_DOMAIN_VIRT_XEN;
 +def-id = -1;
 +
 +if (xenParseConfigCommon(conf, def, caps, xendConfigVersion)  0)
  goto cleanup;

 -if (xenParseXMCharDev(conf, def)  0)
 +if (xenParseXMDisk(conf, def, xendConfigVersion)  0)
  goto cleanup;

  return def;
 diff --git a/src/xenxs/xen_xm.h b/src/xenxs/xen_xm.h
 index 629a4b3..261ba1f 100644
 --- a/src/xenxs/xen_xm.h
 +++ b/src/xenxs/xen_xm.h
 @@ -35,5 +35,7 @@ virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr 
 def,

  virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion,
 virCapsPtr caps);
 +int xenParseConfigCommon(virConfPtr conf, virDomainDefPtr def,
 + virCapsPtr caps, int xendConfigVersion);

  #endif /* __VIR_XEN_XM_H__ */
 --
 1.8.4.5


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


Re: [libvirt] [PATCH 12/24] src/xenxs: Refactor code parsing OS config

2014-08-09 Thread David Kiarie
On Fri, Aug 08, 2014 at 03:50:44PM -0600, Jim Fehlig wrote:
 Kiarie Kahurani wrote:
  introduce function
xenParseXMOS(virConfPtr conf,...);
  which parses the OS config instead
 
  signed-off-by: Kiarie Kahurani davidkiar...@gmail.com
  Signed-off-by: Kiarie Kahurani davidkiar...@gmail.com
  ---
   src/xenxs/xen_xm.c | 80 
  ++
   1 file changed, 50 insertions(+), 30 deletions(-)
 
  diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
  index 32c6d8c..b21d794 100644
  --- a/src/xenxs/xen_xm.c
  +++ b/src/xenxs/xen_xm.c
  @@ -1176,33 +1176,26 @@ xenParseXMGeneralMeta(virConfPtr conf, 
  virDomainDefPtr def,
   
   return 0;
   }
  -/*
  - * Turn a config record into a lump of XML describing the
  - * domain, suitable for later feeding for virDomainCreateXML
  - */
  -virDomainDefPtr
  -xenParseXM(virConfPtr conf, int xendConfigVersion,
  -   virCapsPtr caps)
  -{
  -virDomainDefPtr def = NULL;
  -size_t i;
   
  -if (VIR_ALLOC(def)  0)
  -return NULL;
  -
  -def-virtType = VIR_DOMAIN_VIRT_XEN;
  -def-id = -1;
   
  -if (xenParseXMGeneralMeta(conf, def, caps)  0)
  -goto cleanup;
  +static int
  +xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
  +{
  +size_t i;
   
   if (STREQ(def-os.type, hvm)) {
   const char *boot;
  +if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator) 
   0)
  +return -1;
  +
  +if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator) 
   0)
  +return -1;

 
 Opps, copy and paste one time too many.  This should also be outside the
 'if (hvm)', as it was originally.
 
 ACK otherwise.  I've fixed this up and pushed 1-12.  The rest will have
 to wait until next week.  Thanks!
 
 Regards,
 Jim
 
  +
   if (xenXMConfigCopyString(conf, kernel, def-os.loader)  0)
  -goto cleanup;
  +return -1;
   
   if (xenXMConfigGetString(conf, boot, boot, c)  0)
  -goto cleanup;
  +return -1;
   
   for (i = 0; i  VIR_DOMAIN_BOOT_LAST  boot[i]; i++) {
   switch (*boot) {
  @@ -1226,28 +1219,58 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
   const char *extra, *root;
   
   if (xenXMConfigCopyStringOpt(conf, bootloader, 
  def-os.bootloader)  0)
  -goto cleanup;
  +return -1;
  +
   if (xenXMConfigCopyStringOpt(conf, bootargs, 
  def-os.bootloaderArgs)  0)
  -goto cleanup;
  +return -1;
   
   if (xenXMConfigCopyStringOpt(conf, kernel, def-os.kernel)  0)
  -goto cleanup;
  +return -1;
  +
   if (xenXMConfigCopyStringOpt(conf, ramdisk, def-os.initrd)  0)
  -goto cleanup;
  +return -1;
  +
   if (xenXMConfigGetString(conf, extra, extra, NULL)  0)
  -goto cleanup;
  +return -1;
  +
   if (xenXMConfigGetString(conf, root, root, NULL)  0)
  -goto cleanup;
  +return -1;
   
   if (root) {
   if (virAsprintf(def-os.cmdline, root=%s %s, root, extra)  
  0)
  -goto cleanup;
  +return -1;
  +
   } else {
   if (VIR_STRDUP(def-os.cmdline, extra)  0)
  -goto cleanup;
  +return -1;
  +
   }
   }
   
  +return 0;
  +}
  +/*
  + * Turn a config record into a lump of XML describing the
  + * domain, suitable for later feeding for virDomainCreateXML
  + */
  +virDomainDefPtr
  +xenParseXM(virConfPtr conf, int xendConfigVersion,
  +   virCapsPtr caps)
  +{
  +virDomainDefPtr def = NULL;
  +
  +if (VIR_ALLOC(def)  0)
  +return NULL;
  +
  +def-virtType = VIR_DOMAIN_VIRT_XEN;
  +def-id = -1;
  +
  +if (xenParseXMGeneralMeta(conf, def, caps)  0)
  +goto cleanup;
  +
  +if (xenParseXMOS(conf, def)  0)
  +goto cleanup;
  +
   if (xenParseXMMem(conf, def)  0)
   goto cleanup;
   
  @@ -1263,9 +1286,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
   if (xenParseXMDisk(conf, def, xendConfigVersion)  0)
   goto cleanup;
   
  -if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
  -goto cleanup;
  -
   if (xenParseXMVif(conf, def)  0)
   goto cleanup;
   
   

Thanks for fixing *sooo* much crap.

What can I say, I thought git commit and not git send-email signs of
the patches and hence would not resign my patches :( and again didn't
check the patches after sending 

David.

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


[libvirt] [PATCH V3 00/24] xen_xm parsing code refactor

2014-08-06 Thread David Kiarie
Kiarie Kahurani (24):
  src/xenxs:Refactor code parsing memory config
  src/xenxs:Refactor code parsing virtual time config
  src/xenxs:Refactor code parsing event actions
  src/xenxs:Refactor code parsing PCI config
  src/xenxs:Refactor code parsing CPU features
  src/xenxs:Refactor code parsing xm disk config
  src/xenxs:Refactor code parsing Vfb config
  src/xenxs:Refactor code parsing Char devices config
  src/xenxs:Refactor code parsing Vif config
  src/xenxs:Refactor code parsing emulated hardware config
  src/xenxs:Refactor code parsing general config
  src/xenxs:Refactor code parsing OS config
  src/xenxs:Export code for reuse
  src/xenxs:Refactor code formating general VM config
  src/xenxs:Refactor code formating memory config
  src/xenxs:Refactor code formating virtual time config
  src/xenxs:Refactor code formating event actions config
  src/xenxs:Refactor code formating Char devices config
  src/xenxs:Refactor code formating xm disk config
  src/xenxs:Refactor code formating CPU features config
  src/xenxs:Refactor code formating OS config
  src/xenxs:Refactor code formating Vfb config
  src/xenxs:Refactor code formating emulated devices config
  src/xenxs:Export code

 src/xenxs/xen_xm.c | 2217 +++-
 src/xenxs/xen_xm.h |4 +
 tests/xmconfigdata/test-escape-paths.cfg   |   12 +-
 tests/xmconfigdata/test-fullvirt-force-hpet.cfg|   10 +-
 tests/xmconfigdata/test-fullvirt-force-nohpet.cfg  |   10 +-
 tests/xmconfigdata/test-fullvirt-localtime.cfg |   10 +-
 tests/xmconfigdata/test-fullvirt-net-ioemu.cfg |   10 +-
 tests/xmconfigdata/test-fullvirt-net-netfront.cfg  |   10 +-
 tests/xmconfigdata/test-fullvirt-new-cdrom.cfg |   10 +-
 tests/xmconfigdata/test-fullvirt-old-cdrom.cfg |   10 +-
 tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg  |   10 +-
 .../test-fullvirt-serial-dev-2-ports.cfg   |   10 +-
 .../test-fullvirt-serial-dev-2nd-port.cfg  |   10 +-
 tests/xmconfigdata/test-fullvirt-serial-file.cfg   |   10 +-
 tests/xmconfigdata/test-fullvirt-serial-null.cfg   |   10 +-
 tests/xmconfigdata/test-fullvirt-serial-pipe.cfg   |   10 +-
 tests/xmconfigdata/test-fullvirt-serial-pty.cfg|   10 +-
 tests/xmconfigdata/test-fullvirt-serial-stdio.cfg  |   10 +-
 .../test-fullvirt-serial-tcp-telnet.cfg|   10 +-
 tests/xmconfigdata/test-fullvirt-serial-tcp.cfg|   10 +-
 tests/xmconfigdata/test-fullvirt-serial-udp.cfg|   10 +-
 tests/xmconfigdata/test-fullvirt-serial-unix.cfg   |   10 +-
 tests/xmconfigdata/test-fullvirt-sound.cfg |   12 +-
 tests/xmconfigdata/test-fullvirt-usbmouse.cfg  |   10 +-
 tests/xmconfigdata/test-fullvirt-usbtablet.cfg |   10 +-
 tests/xmconfigdata/test-fullvirt-utc.cfg   |   10 +-
 tests/xmconfigdata/test-no-source-cdrom.cfg|   10 +-
 tests/xmconfigdata/test-paravirt-net-e1000.cfg |2 +-
 tests/xmconfigdata/test-paravirt-net-vifname.cfg   |2 +-
 .../test-paravirt-new-pvfb-vncdisplay.cfg  |2 +-
 tests/xmconfigdata/test-paravirt-new-pvfb.cfg  |2 +-
 .../test-paravirt-old-pvfb-vncdisplay.cfg  |2 +-
 tests/xmconfigdata/test-paravirt-old-pvfb.cfg  |2 +-
 tests/xmconfigdata/test-paravirt-vcpu.cfg  |2 +-
 tests/xmconfigdata/test-pci-devs.cfg   |   10 +-
 35 files changed, 1416 insertions(+), 1083 deletions(-)

V3 of series refactoring xen_xm.c code for reuse in the xen-xl parser.

Changes since V2
 -Formating fixes
 -reused Vif formating and parsing code

-- 
1.8.4.5

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


[libvirt] [PATCH V3 06/24] src/xenxs:Refactor code parsing xm disk config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMDisk(virConfPtr conf, );
which parses xm disk config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 322 -
 1 file changed, 168 insertions(+), 154 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index e75842f..f4bb37d 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -500,136 +500,15 @@ xenParseXMCPUFeatures(virConfPtr conf, virDomainDefPtr 
def)
 }
 
 
-#define MAX_VFB 1024
-
-/*
- * Turn a config record into a lump of XML describing the
- * domain, suitable for later feeding for virDomainCreateXML
- */
-virDomainDefPtr
-xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
+static int
+xenParseXMDisk(virConfPtr conf, virDomainDefPtr def,
+   int xendConfigVersion)
 {
-const char *str;
-int hvm = 0;
-int val;
-virConfValuePtr list;
-virDomainDefPtr def = NULL;
+const char *str = NULL;
 virDomainDiskDefPtr disk = NULL;
-virDomainNetDefPtr net = NULL;
-virDomainGraphicsDefPtr graphics = NULL;
-size_t i;
-const char *defaultMachine;
-char *script = NULL;
-char *listenAddr = NULL;
-
-if (VIR_ALLOC(def)  0)
-return NULL;
-
-def-virtType = VIR_DOMAIN_VIRT_XEN;
-def-id = -1;
-
-if (xenXMConfigCopyString(conf, name, def-name)  0)
-goto cleanup;
-if (xenXMConfigGetUUID(conf, uuid, def-uuid)  0)
-goto cleanup;
-
-
-if ((xenXMConfigGetString(conf, builder, str, linux) == 0) 
-STREQ(str, hvm))
-hvm = 1;
-
-if (VIR_STRDUP(def-os.type, hvm ? hvm : xen)  0)
-goto cleanup;
-
-def-os.arch =
-virCapabilitiesDefaultGuestArch(caps,
-def-os.type,
-
virDomainVirtTypeToString(def-virtType));
-if (!def-os.arch) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(no supported architecture for os type '%s'),
-   def-os.type);
-goto cleanup;
-}
-
-defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
-def-os.type,
-def-os.arch,
-
virDomainVirtTypeToString(def-virtType));
-if (defaultMachine != NULL) {
-if (VIR_STRDUP(def-os.machine, defaultMachine)  0)
-goto cleanup;
-}
-
-if (hvm) {
-const char *boot;
-if (xenXMConfigCopyString(conf, kernel, def-os.loader)  0)
-goto cleanup;
-
-if (xenXMConfigGetString(conf, boot, boot, c)  0)
-goto cleanup;
-
-for (i = 0; i  VIR_DOMAIN_BOOT_LAST  boot[i]; i++) {
-switch (*boot) {
-case 'a':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_FLOPPY;
-break;
-case 'd':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_CDROM;
-break;
-case 'n':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_NET;
-break;
-case 'c':
-default:
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_DISK;
-break;
-}
-def-os.nBootDevs++;
-}
-} else {
-const char *extra, *root;
-
-if (xenXMConfigCopyStringOpt(conf, bootloader, def-os.bootloader) 
 0)
-goto cleanup;
-if (xenXMConfigCopyStringOpt(conf, bootargs, 
def-os.bootloaderArgs)  0)
-goto cleanup;
-
-if (xenXMConfigCopyStringOpt(conf, kernel, def-os.kernel)  0)
-goto cleanup;
-if (xenXMConfigCopyStringOpt(conf, ramdisk, def-os.initrd)  0)
-goto cleanup;
-if (xenXMConfigGetString(conf, extra, extra, NULL)  0)
-goto cleanup;
-if (xenXMConfigGetString(conf, root, root, NULL)  0)
-goto cleanup;
-
-if (root) {
-if (virAsprintf(def-os.cmdline, root=%s %s, root, extra)  0)
-goto cleanup;
-} else {
-if (VIR_STRDUP(def-os.cmdline, extra)  0)
-goto cleanup;
-}
-}
-
-if (xenParseXMMem(conf, def)  0)
-goto cleanup;
+int hvm = STREQ(def-os.type, hvm);
+virConfValuePtr list = virConfGetValue(conf, disk);
 
-if (xenParseXMEventsActions(conf, def)  0)
-goto cleanup;
-
-if (xenParseXMCPUFeatures(conf, def)  0)
-goto cleanup;
-
-if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
-goto cleanup;
-
-if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
-goto cleanup;
-
-list = virConfGetValue(conf, disk);
 if (list  list-type == VIR_CONF_LIST) {
 list = list-list;
 while (list) {
@@ -641,9 +520,8 @@ 

[libvirt] [PATCH V3 03/24] src/xenxs:Refactor code parsing event actions

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMEventActions(virConfPtr conf,)
which parses events leading to certain actions

signed-off-by: David Kiariedavidkia...@gmail.com
---
 src/xenxs/xen_xm.c | 61 +-
 1 file changed, 37 insertions(+), 24 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 0e0cf90..ecc8f52 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -299,6 +299,42 @@ xenParseXMTimeOffset(virConfPtr conf, virDomainDefPtr def,
 }
 
 
+static int
+xenParseXMEventsActions(virConfPtr conf, virDomainDefPtr def)
+{
+const char *str = NULL;
+
+if (xenXMConfigGetString(conf, on_poweroff, str, destroy)  0)
+return -1;
+
+if ((def-onPoweroff = virDomainLifecycleTypeFromString(str))  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected value %s for on_poweroff), str);
+return -1;
+}
+
+if (xenXMConfigGetString(conf, on_reboot, str, restart)  0)
+return -1;
+
+if ((def-onReboot = virDomainLifecycleTypeFromString(str))  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected value %s for on_reboot), str);
+return -1;
+}
+
+if (xenXMConfigGetString(conf, on_crash, str, restart)  0)
+return -1;
+
+if ((def-onCrash = virDomainLifecycleCrashTypeFromString(str))  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected value %s for on_crash), str);
+return -1;
+}
+
+return 0;
+}
+
+
 #define MAX_VFB 1024
 
 /*
@@ -431,31 +467,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 if (str  (virBitmapParse(str, 0, def-cpumask, 4096)  0))
 goto cleanup;
 
-if (xenXMConfigGetString(conf, on_poweroff, str, destroy)  0)
+if (xenParseXMEventsActions(conf, def)  0)
 goto cleanup;
-if ((def-onPoweroff = virDomainLifecycleTypeFromString(str))  0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected value %s for on_poweroff), str);
-goto cleanup;
-}
-
-if (xenXMConfigGetString(conf, on_reboot, str, restart)  0)
-goto cleanup;
-if ((def-onReboot = virDomainLifecycleTypeFromString(str))  0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected value %s for on_reboot), str);
-goto cleanup;
-}
-
-if (xenXMConfigGetString(conf, on_crash, str, restart)  0)
-goto cleanup;
-if ((def-onCrash = virDomainLifecycleCrashTypeFromString(str))  0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected value %s for on_crash), str);
-goto cleanup;
-}
-
-
 
 if (hvm) {
 if (xenXMConfigGetBool(conf, pae, val, 0)  0)
-- 
1.8.4.5

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


[libvirt] [PATCH V3 02/24] src/xenxs:Refactor code parsing virtual time config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
xenParseXMTimeOffset(virConfPtr conf,...);
which parses time offset config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 71 +-
 1 file changed, 43 insertions(+), 28 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 443e6da..0e0cf90 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -259,7 +259,48 @@ xenParseXMMem(virConfPtr conf, virDomainDefPtr def)
 }
 
 
+static int
+xenParseXMTimeOffset(virConfPtr conf, virDomainDefPtr def,
+ int xendConfigVersion)
+{
+int vmlocaltime;
+
+if (xenXMConfigGetBool(conf, localtime, vmlocaltime, 0)  0)
+return -1;
+
+if (STREQ(def-os.type, hvm)) {
+/* only managed HVM domains since 3.1.0 have persistent rtc_timeoffset 
*/
+if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {
+if (vmlocaltime)
+def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
+else
+def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
+def-clock.data.utc_reset = true;
+} else {
+unsigned long rtc_timeoffset;
+def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_VARIABLE;
+if (xenXMConfigGetULong(conf, rtc_timeoffset, rtc_timeoffset, 
0)  0)
+return -1;
+
+def-clock.data.variable.adjustment = (int)rtc_timeoffset;
+def-clock.data.variable.basis = vmlocaltime ?
+VIR_DOMAIN_CLOCK_BASIS_LOCALTIME :
+VIR_DOMAIN_CLOCK_BASIS_UTC;
+}
+} else {
+/* PV domains do not have an emulated RTC and the offset is fixed. */
+def-clock.offset = vmlocaltime ?
+VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME :
+VIR_DOMAIN_CLOCK_OFFSET_UTC;
+def-clock.data.utc_reset = true;
+} /* !hvm */
+
+return 0;
+}
+
+
 #define MAX_VFB 1024
+
 /*
  * Turn a config record into a lump of XML describing the
  * domain, suitable for later feeding for virDomainCreateXML
@@ -279,7 +320,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virDomainHostdevDefPtr hostdev = NULL;
 size_t i;
 const char *defaultMachine;
-int vmlocaltime = 0;
 unsigned long count;
 char *script = NULL;
 char *listenAddr = NULL;
@@ -456,34 +496,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 def-clock.timers[0] = timer;
 }
 }
-if (xenXMConfigGetBool(conf, localtime, vmlocaltime, 0)  0)
-goto cleanup;
 
-if (hvm) {
-/* only managed HVM domains since 3.1.0 have persistent rtc_timeoffset 
*/
-if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {
-if (vmlocaltime)
-def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
-else
-def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
-def-clock.data.utc_reset = true;
-} else {
-unsigned long rtc_timeoffset;
-def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_VARIABLE;
-if (xenXMConfigGetULong(conf, rtc_timeoffset, rtc_timeoffset, 
0)  0)
-goto cleanup;
-def-clock.data.variable.adjustment = (int)rtc_timeoffset;
-def-clock.data.variable.basis = vmlocaltime ?
-VIR_DOMAIN_CLOCK_BASIS_LOCALTIME :
-VIR_DOMAIN_CLOCK_BASIS_UTC;
-}
-} else {
-/* PV domains do not have an emulated RTC and the offset is fixed. */
-def-clock.offset = vmlocaltime ?
-VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME :
-VIR_DOMAIN_CLOCK_OFFSET_UTC;
-def-clock.data.utc_reset = true;
-} /* !hvm */
+if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
+goto cleanup;
 
 if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
 goto cleanup;
-- 
1.8.4.5

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


[libvirt] [PATCH V3 01/24] src/xenxs:Refactor code parsing memory config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMMem(virConfPtr conf,.);
which parses memory config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 83 +-
 1 file changed, 45 insertions(+), 38 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 4461654..443e6da 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -40,11 +40,9 @@
 #include virstoragefile.h
 #include virstring.h
 
-/* Convenience method to grab a long int from the config file object */
-static int xenXMConfigGetBool(virConfPtr conf,
-  const char *name,
-  int *value,
-  int def)
+/* Convenience method to grab a int from the config file object */
+static int
+xenXMConfigGetBool(virConfPtr conf, const char *name, int *value, int def)
 {
 virConfValuePtr val;
 
@@ -67,11 +65,10 @@ static int xenXMConfigGetBool(virConfPtr conf,
 }
 
 
-/* Convenience method to grab a int from the config file object */
-static int xenXMConfigGetULong(virConfPtr conf,
-   const char *name,
-   unsigned long *value,
-   unsigned long def)
+/* Convenience method to grab a long int from the config file object */
+static int
+xenXMConfigGetULong(virConfPtr conf, const char *name, unsigned long *value,
+unsigned long def)
 {
 virConfValuePtr val;
 
@@ -99,10 +96,9 @@ static int xenXMConfigGetULong(virConfPtr conf,
 
 
 /* Convenience method to grab a int from the config file object */
-static int xenXMConfigGetULongLong(virConfPtr conf,
-   const char *name,
-   unsigned long long *value,
-   unsigned long long def)
+static int
+xenXMConfigGetULongLong(virConfPtr conf, const char *name,
+unsigned long long *value, unsigned long long def)
 {
 virConfValuePtr val;
 
@@ -130,10 +126,9 @@ static int xenXMConfigGetULongLong(virConfPtr conf,
 
 
 /* Convenience method to grab a string from the config file object */
-static int xenXMConfigGetString(virConfPtr conf,
-const char *name,
-const char **value,
-const char *def)
+static int
+xenXMConfigGetString(virConfPtr conf, const char *name, const char **value,
+ const char *def)
 {
 virConfValuePtr val;
 
@@ -155,10 +150,10 @@ static int xenXMConfigGetString(virConfPtr conf,
 return 0;
 }
 
-static int xenXMConfigCopyStringInternal(virConfPtr conf,
- const char *name,
- char **value,
- int allowMissing)
+
+static int
+xenXMConfigCopyStringInternal(virConfPtr conf, const char *name, char **value,
+  int allowMissing)
 {
 virConfValuePtr val;
 
@@ -188,15 +183,16 @@ static int xenXMConfigCopyStringInternal(virConfPtr conf,
 }
 
 
-static int xenXMConfigCopyString(virConfPtr conf,
- const char *name,
- char **value) {
+static int
+xenXMConfigCopyString(virConfPtr conf, const char *name, char **value)
+{
 return xenXMConfigCopyStringInternal(conf, name, value, 0);
 }
 
-static int xenXMConfigCopyStringOpt(virConfPtr conf,
-const char *name,
-char **value) {
+
+static int
+xenXMConfigCopyStringOpt(virConfPtr conf, const char *name, char **value)
+{
 return xenXMConfigCopyStringInternal(conf, name, value, 1);
 }
 
@@ -244,6 +240,25 @@ xenXMConfigGetUUID(virConfPtr conf, const char *name, 
unsigned char *uuid)
 return 0;
 }
 
+
+static int
+xenParseXMMem(virConfPtr conf, virDomainDefPtr def)
+{
+if (xenXMConfigGetULongLong(conf, memory, def-mem.cur_balloon,
+MIN_XEN_GUEST_SIZE * 2)  0)
+return -1;
+
+if (xenXMConfigGetULongLong(conf, maxmem, def-mem.max_balloon,
+def-mem.cur_balloon)  0)
+return -1;
+
+def-mem.cur_balloon *= 1024;
+def-mem.max_balloon *= 1024;
+
+return 0;
+}
+
+
 #define MAX_VFB 1024
 /*
  * Turn a config record into a lump of XML describing the
@@ -251,7 +266,7 @@ xenXMConfigGetUUID(virConfPtr conf, const char *name, 
unsigned char *uuid)
  */
 virDomainDefPtr
 xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
+   virCapsPtr caps)
 {
 const char *str;
 int hvm = 0;
@@ -360,17 +375,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 }
 }
 
-if (xenXMConfigGetULongLong(conf, memory, def-mem.cur_balloon,
-MIN_XEN_GUEST_SIZE * 2)  

[libvirt] [PATCH V3 04/24] src/xenxs:Refactor code parsing PCI config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce funtion
   xenParseXMPCI(virConfPtr conf, );
which parses PCI config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 185 +++--
 1 file changed, 95 insertions(+), 90 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index ecc8f52..8cc892b 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -335,6 +335,99 @@ xenParseXMEventsActions(virConfPtr conf, virDomainDefPtr 
def)
 }
 
 
+static int
+xenParseXMPCI(virConfPtr conf, virDomainDefPtr def)
+{
+virConfValuePtr list = virConfGetValue(conf, pci);
+virDomainHostdevDefPtr hostdev = NULL;
+
+if (list  list-type == VIR_CONF_LIST) {
+list = list-list;
+while (list) {
+char domain[5];
+char bus[3];
+char slot[3];
+char func[2];
+char *key, *nextkey;
+int domainID;
+int busID;
+int slotID;
+int funcID;
+
+domain[0] = bus[0] = slot[0] = func[0] = '\0';
+
+if ((list-type != VIR_CONF_STRING) || (list-str == NULL))
+goto skippci;
+/* pci=[':00:1b.0',':00:13.0'] */
+if (!(key = list-str))
+goto skippci;
+if (!(nextkey = strchr(key, ':')))
+goto skippci;
+if (virStrncpy(domain, key, (nextkey - key), sizeof(domain)) == 
NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Domain %s too big for destination), key);
+goto skippci;
+}
+
+key = nextkey + 1;
+if (!(nextkey = strchr(key, ':')))
+goto skippci;
+if (virStrncpy(bus, key, (nextkey - key), sizeof(bus)) == NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Bus %s too big for destination), key);
+goto skippci;
+}
+
+key = nextkey + 1;
+if (!(nextkey = strchr(key, '.')))
+goto skippci;
+if (virStrncpy(slot, key, (nextkey - key), sizeof(slot)) == NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Slot %s too big for destination), key);
+goto skippci;
+}
+
+key = nextkey + 1;
+if (strlen(key) != 1)
+goto skippci;
+if (virStrncpy(func, key, 1, sizeof(func)) == NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Function %s too big for destination), key);
+goto skippci;
+}
+
+if (virStrToLong_i(domain, NULL, 16, domainID)  0)
+goto skippci;
+if (virStrToLong_i(bus, NULL, 16, busID)  0)
+goto skippci;
+if (virStrToLong_i(slot, NULL, 16, slotID)  0)
+goto skippci;
+if (virStrToLong_i(func, NULL, 16, funcID)  0)
+goto skippci;
+if (!(hostdev = virDomainHostdevDefAlloc()))
+   return -1;
+
+hostdev-managed = false;
+hostdev-source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
+hostdev-source.subsys.u.pci.addr.domain = domainID;
+hostdev-source.subsys.u.pci.addr.bus = busID;
+hostdev-source.subsys.u.pci.addr.slot = slotID;
+hostdev-source.subsys.u.pci.addr.function = funcID;
+
+if (VIR_APPEND_ELEMENT(def-hostdevs, def-nhostdevs, hostdev)  
0) {
+virDomainHostdevDefFree(hostdev);
+return -1;
+}
+
+skippci:
+list = list-next;
+}
+}
+
+return 0;
+}
+
+
 #define MAX_VFB 1024
 
 /*
@@ -353,7 +446,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virDomainDiskDefPtr disk = NULL;
 virDomainNetDefPtr net = NULL;
 virDomainGraphicsDefPtr graphics = NULL;
-virDomainHostdevDefPtr hostdev = NULL;
 size_t i;
 const char *defaultMachine;
 unsigned long count;
@@ -837,95 +929,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 }
 }
 
-list = virConfGetValue(conf, pci);
-if (list  list-type == VIR_CONF_LIST) {
-list = list-list;
-while (list) {
-char domain[5];
-char bus[3];
-char slot[3];
-char func[2];
-char *key, *nextkey;
-int domainID;
-int busID;
-int slotID;
-int funcID;
-
-domain[0] = bus[0] = slot[0] = func[0] = '\0';
-
-if ((list-type != VIR_CONF_STRING) || (list-str == NULL))
-goto skippci;
-
-/* pci=[':00:1b.0',':00:13.0'] */
-if (!(key = list-str))
-goto skippci;
-if (!(nextkey = 

[libvirt] [PATCH V3 05/24] src/xenxs:Refactor code parsing CPU features

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMCPUFeatures(virConfPtr conf,.);
which parses CPU features instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 127 +++--
 1 file changed, 74 insertions(+), 53 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 8cc892b..e75842f 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -428,6 +428,78 @@ xenParseXMPCI(virConfPtr conf, virDomainDefPtr def)
 }
 
 
+static int
+xenParseXMCPUFeatures(virConfPtr conf, virDomainDefPtr def)
+{
+unsigned long count = 0;
+const char *str = NULL;
+int val = 0;
+
+if (xenXMConfigGetULong(conf, vcpus, count, 1)  0 ||
+MAX_VIRT_CPUS  count)
+return -1;
+
+def-maxvcpus = count;
+if (xenXMConfigGetULong(conf, vcpu_avail, count, -1)  0)
+return -1;
+
+def-vcpus = MIN(count_one_bits_l(count), def-maxvcpus);
+if (xenXMConfigGetString(conf, cpus, str, NULL)  0)
+return -1;
+
+if (str  (virBitmapParse(str, 0, def-cpumask, 4096)  0))
+return -1;
+
+if (STREQ(def-os.type, hvm)) {
+if (xenXMConfigGetBool(conf, pae, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_PAE] = VIR_TRISTATE_SWITCH_ON;
+if (xenXMConfigGetBool(conf, acpi, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ON;
+if (xenXMConfigGetBool(conf, apic, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_APIC] = VIR_TRISTATE_SWITCH_ON;
+if (xenXMConfigGetBool(conf, hap, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_HAP] = VIR_TRISTATE_SWITCH_ON;
+if (xenXMConfigGetBool(conf, viridian, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_VIRIDIAN] = 
VIR_TRISTATE_SWITCH_ON;
+
+if (xenXMConfigGetBool(conf, hpet, val, -1)  0)
+return -1;
+
+else if (val != -1) {
+virDomainTimerDefPtr timer;
+
+if (VIR_ALLOC_N(def-clock.timers, 1)  0 ||
+VIR_ALLOC(timer)  0)
+return -1;
+
+timer-name = VIR_DOMAIN_TIMER_NAME_HPET;
+timer-present = val;
+timer-tickpolicy = -1;
+
+def-clock.ntimers = 1;
+def-clock.timers[0] = timer;
+}
+}
+
+return 0;
+}
+
+
 #define MAX_VFB 1024
 
 /*
@@ -448,7 +520,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virDomainGraphicsDefPtr graphics = NULL;
 size_t i;
 const char *defaultMachine;
-unsigned long count;
 char *script = NULL;
 char *listenAddr = NULL;
 
@@ -546,61 +617,11 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 if (xenParseXMMem(conf, def)  0)
 goto cleanup;
 
-if (xenXMConfigGetULong(conf, vcpus, count, 1)  0 ||
-MAX_VIRT_CPUS  count)
-goto cleanup;
-def-maxvcpus = count;
-if (xenXMConfigGetULong(conf, vcpu_avail, count, -1)  0)
-goto cleanup;
-def-vcpus = MIN(count_one_bits_l(count), def-maxvcpus);
-
-if (xenXMConfigGetString(conf, cpus, str, NULL)  0)
-goto cleanup;
-if (str  (virBitmapParse(str, 0, def-cpumask, 4096)  0))
-goto cleanup;
-
 if (xenParseXMEventsActions(conf, def)  0)
 goto cleanup;
 
-if (hvm) {
-if (xenXMConfigGetBool(conf, pae, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_PAE] = VIR_TRISTATE_SWITCH_ON;
-if (xenXMConfigGetBool(conf, acpi, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_ACPI] = VIR_TRISTATE_SWITCH_ON;
-if (xenXMConfigGetBool(conf, apic, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_APIC] = VIR_TRISTATE_SWITCH_ON;
-if (xenXMConfigGetBool(conf, hap, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_HAP] = VIR_TRISTATE_SWITCH_ON;
-if (xenXMConfigGetBool(conf, viridian, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_VIRIDIAN] = 
VIR_TRISTATE_SWITCH_ON;
-
-if (xenXMConfigGetBool(conf, hpet, val, -1)  0)
-goto cleanup;
-else if (val != -1) {
-virDomainTimerDefPtr timer;
-
-if (VIR_ALLOC_N(def-clock.timers, 1)  0 ||
-VIR_ALLOC(timer)  0)
-goto cleanup;
-
-timer-name = VIR_DOMAIN_TIMER_NAME_HPET;
-timer-present = val;
-timer-tickpolicy = -1;
-
-def-clock.ntimers = 1;
-def-clock.timers[0] = 

[libvirt] [PATCH V3 10/24] src/xenxs:Refactor code parsing emulated hardware config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
   xenParseXMEmulatedHardware(virConfPtr conf,.);
which parses emulated devices config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 82 --
 1 file changed, 48 insertions(+), 34 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 73efa5f..9eabfa4 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1085,6 +1085,52 @@ xenParseXMVif(virConfPtr conf, virDomainDefPtr def)
 VIR_FREE(script);
 return -1;
 }
+
+
+static int
+xenParseXMEmulatedDevices(virConfPtr conf, virDomainDefPtr def)
+{
+const char *str;
+
+if (STREQ(def-os.type, hvm)) {
+if (xenXMConfigGetString(conf, soundhw, str, NULL)  0)
+return -1;
+
+if (str 
+xenParseSxprSound(def, str)  0)
+return -1;
+
+if (xenXMConfigGetString(conf, usbdevice, str, NULL)  0)
+return -1;
+
+if (str 
+(STREQ(str, tablet) ||
+ STREQ(str, mouse) ||
+ STREQ(str, keyboard))) {
+virDomainInputDefPtr input;
+if (VIR_ALLOC(input)  0)
+return -1;
+
+input-bus = VIR_DOMAIN_INPUT_BUS_USB;
+if (STREQ(str, mouse))
+input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
+else if (STREQ(str, tablet))
+input-type = VIR_DOMAIN_INPUT_TYPE_TABLET;
+else if (STREQ(str, keyboard))
+input-type = VIR_DOMAIN_INPUT_TYPE_KBD;
+if (VIR_ALLOC_N(def-inputs, 1)  0) {
+virDomainInputDefFree(input);
+return -1;
+
+}
+def-inputs[0] = input;
+def-ninputs = 1;
+}
+}
+
+return 0;
+}
+
 /*
  * Turn a config record into a lump of XML describing the
  * domain, suitable for later feeding for virDomainCreateXML
@@ -1214,31 +1260,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 if (xenParseXMPCI(conf, def)  0)
 goto cleanup;
 
-if (hvm) {
-if (xenXMConfigGetString(conf, usbdevice, str, NULL)  0)
-goto cleanup;
-if (str 
-(STREQ(str, tablet) ||
- STREQ(str, mouse) ||
- STREQ(str, keyboard))) {
-virDomainInputDefPtr input;
-if (VIR_ALLOC(input)  0)
-goto cleanup;
-input-bus = VIR_DOMAIN_INPUT_BUS_USB;
-if (STREQ(str, mouse))
-input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
-else if (STREQ(str, tablet))
-input-type = VIR_DOMAIN_INPUT_TYPE_TABLET;
-else if (STREQ(str, keyboard))
-input-type = VIR_DOMAIN_INPUT_TYPE_KBD;
-if (VIR_ALLOC_N(def-inputs, 1)  0) {
-virDomainInputDefFree(input);
-goto cleanup;
-}
-def-inputs[0] = input;
-def-ninputs = 1;
-}
-}
+if (xenParseXMEmulatedDevices(conf, def)  0)
+goto cleanup;
 
 if (xenParseXMVfb(conf, def, xendConfigVersion)  0)
 goto cleanup;
@@ -1246,15 +1269,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 if (xenParseXMCharDev(conf, def)  0)
 goto cleanup;
 
-if (hvm) {
-if (xenXMConfigGetString(conf, soundhw, str, NULL)  0)
-goto cleanup;
-
-if (str 
-xenParseSxprSound(def, str)  0)
-goto cleanup;
-}
-
 return def;
 
  cleanup:
-- 
1.8.4.5

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


[libvirt] [PATCH V3 12/24] src/xenxs:Refactor code parsing OS config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMOS(virConfPtr conf,...);
which parses the OS config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 80 ++
 1 file changed, 50 insertions(+), 30 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 32c6d8c..b21d794 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1176,33 +1176,26 @@ xenParseXMGeneralMeta(virConfPtr conf, virDomainDefPtr 
def,
 
 return 0;
 }
-/*
- * Turn a config record into a lump of XML describing the
- * domain, suitable for later feeding for virDomainCreateXML
- */
-virDomainDefPtr
-xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
-{
-virDomainDefPtr def = NULL;
-size_t i;
 
-if (VIR_ALLOC(def)  0)
-return NULL;
-
-def-virtType = VIR_DOMAIN_VIRT_XEN;
-def-id = -1;
 
-if (xenParseXMGeneralMeta(conf, def, caps)  0)
-goto cleanup;
+static int
+xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
+{
+size_t i;
 
 if (STREQ(def-os.type, hvm)) {
 const char *boot;
+if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
+return -1;
+
+if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
+return -1;
+
 if (xenXMConfigCopyString(conf, kernel, def-os.loader)  0)
-goto cleanup;
+return -1;
 
 if (xenXMConfigGetString(conf, boot, boot, c)  0)
-goto cleanup;
+return -1;
 
 for (i = 0; i  VIR_DOMAIN_BOOT_LAST  boot[i]; i++) {
 switch (*boot) {
@@ -1226,28 +1219,58 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 const char *extra, *root;
 
 if (xenXMConfigCopyStringOpt(conf, bootloader, def-os.bootloader) 
 0)
-goto cleanup;
+return -1;
+
 if (xenXMConfigCopyStringOpt(conf, bootargs, 
def-os.bootloaderArgs)  0)
-goto cleanup;
+return -1;
 
 if (xenXMConfigCopyStringOpt(conf, kernel, def-os.kernel)  0)
-goto cleanup;
+return -1;
+
 if (xenXMConfigCopyStringOpt(conf, ramdisk, def-os.initrd)  0)
-goto cleanup;
+return -1;
+
 if (xenXMConfigGetString(conf, extra, extra, NULL)  0)
-goto cleanup;
+return -1;
+
 if (xenXMConfigGetString(conf, root, root, NULL)  0)
-goto cleanup;
+return -1;
 
 if (root) {
 if (virAsprintf(def-os.cmdline, root=%s %s, root, extra)  0)
-goto cleanup;
+return -1;
+
 } else {
 if (VIR_STRDUP(def-os.cmdline, extra)  0)
-goto cleanup;
+return -1;
+
 }
 }
 
+return 0;
+}
+/*
+ * Turn a config record into a lump of XML describing the
+ * domain, suitable for later feeding for virDomainCreateXML
+ */
+virDomainDefPtr
+xenParseXM(virConfPtr conf, int xendConfigVersion,
+   virCapsPtr caps)
+{
+virDomainDefPtr def = NULL;
+
+if (VIR_ALLOC(def)  0)
+return NULL;
+
+def-virtType = VIR_DOMAIN_VIRT_XEN;
+def-id = -1;
+
+if (xenParseXMGeneralMeta(conf, def, caps)  0)
+goto cleanup;
+
+if (xenParseXMOS(conf, def)  0)
+goto cleanup;
+
 if (xenParseXMMem(conf, def)  0)
 goto cleanup;
 
@@ -1263,9 +1286,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 if (xenParseXMDisk(conf, def, xendConfigVersion)  0)
 goto cleanup;
 
-if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
-goto cleanup;
-
 if (xenParseXMVif(conf, def)  0)
 goto cleanup;
 
-- 
1.8.4.5

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


[libvirt] [PATCH V3 13/24] src/xenxs:Export code for reuse

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

wrap code tagged for resuse into onef function and export it

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 71 --
 src/xenxs/xen_xm.h |  2 ++
 2 files changed, 44 insertions(+), 29 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index b21d794..aa943ca 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1249,56 +1249,69 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
 
 return 0;
 }
-/*
- * Turn a config record into a lump of XML describing the
- * domain, suitable for later feeding for virDomainCreateXML
- */
-virDomainDefPtr
-xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
-{
-virDomainDefPtr def = NULL;
 
-if (VIR_ALLOC(def)  0)
-return NULL;
 
-def-virtType = VIR_DOMAIN_VIRT_XEN;
-def-id = -1;
+int
+xenParseConfigCommon(virConfPtr conf, virDomainDefPtr def,
+ virCapsPtr caps, int xendConfigVersion)
+{
 
 if (xenParseXMGeneralMeta(conf, def, caps)  0)
-goto cleanup;
+return -1;
 
 if (xenParseXMOS(conf, def)  0)
-goto cleanup;
+return -1;
 
 if (xenParseXMMem(conf, def)  0)
-goto cleanup;
+return -1;
+
+if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
+return -1;
 
 if (xenParseXMEventsActions(conf, def)  0)
-goto cleanup;
+return -1;
+
+if (xenParseXMPCI(conf, def)  0)
+return -1;
 
 if (xenParseXMCPUFeatures(conf, def)  0)
-goto cleanup;
+return -1;
 
-if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
-goto cleanup;
+if (xenParseXMEmulatedDevices(conf, def)  0)
+return -1;
 
-if (xenParseXMDisk(conf, def, xendConfigVersion)  0)
-goto cleanup;
+if (xenParseXMCharDev(conf, def)  0)
+return -1;
+
+if (xenParseXMVfb(conf, def, xendConfigVersion)  0)
+return -1;
 
 if (xenParseXMVif(conf, def)  0)
-goto cleanup;
+return -1;
 
-if (xenParseXMPCI(conf, def)  0)
-goto cleanup;
+return 0;
+}
 
-if (xenParseXMEmulatedDevices(conf, def)  0)
-goto cleanup;
+/*
+ * Turn a config record into a lump of XML describing the
+ * domain, suitable for later feeding for virDomainCreateXML
+ */
+virDomainDefPtr
+xenParseXM(virConfPtr conf, int xendConfigVersion,
+   virCapsPtr caps)
+{
+virDomainDefPtr def = NULL;
 
-if (xenParseXMVfb(conf, def, xendConfigVersion)  0)
+if (VIR_ALLOC(def)  0)
+return NULL;
+
+def-virtType = VIR_DOMAIN_VIRT_XEN;
+def-id = -1;
+
+if (xenParseConfigCommon(conf, def, caps, xendConfigVersion)  0)
 goto cleanup;
 
-if (xenParseXMCharDev(conf, def)  0)
+if (xenParseXMDisk(conf, def, xendConfigVersion)  0)
 goto cleanup;
 
 return def;
diff --git a/src/xenxs/xen_xm.h b/src/xenxs/xen_xm.h
index 629a4b3..5292396 100644
--- a/src/xenxs/xen_xm.h
+++ b/src/xenxs/xen_xm.h
@@ -35,5 +35,7 @@ virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr 
def,
 
 virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion,
virCapsPtr caps);
+int xenParseConfigCommon(virConfPtr conf, virDomainDefPtr def, 
+ virCapsPtr caps, int xendConfigVersion);
 
 #endif /* __VIR_XEN_XM_H__ */
-- 
1.8.4.5

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


[libvirt] [PATCH V3 08/24] src/xenxs:Refactor code parsing Char devices config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMCharDev(virConfPtr conf,.);
which parses Char devices config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 174 -
 1 file changed, 93 insertions(+), 81 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 228e0a2..628cef6 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -843,6 +843,97 @@ xenParseXMVfb(virConfPtr conf, virDomainDefPtr def,
 return -1;
 }
 
+
+static int
+xenParseXMCharDev(virConfPtr conf, virDomainDefPtr def)
+{
+const char *str;
+virConfValuePtr value = NULL;
+virDomainChrDefPtr chr = NULL;
+
+if (STREQ(def-os.type, hvm)) {
+if (xenXMConfigGetString(conf, parallel, str, NULL)  0)
+goto cleanup;
+if (str  STRNEQ(str, none) 
+!(chr = xenParseSxprChar(str, NULL)))
+goto cleanup;
+if (chr) {
+if (VIR_ALLOC_N(def-parallels, 1)  0) {
+goto cleanup;
+}
+
+chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
+chr-target.port = 0;
+def-parallels[0] = chr;
+def-nparallels++;
+chr = NULL;
+}
+
+/* Try to get the list of values to support multiple serial ports */
+value = virConfGetValue(conf, serial);
+if (value  value-type == VIR_CONF_LIST) {
+int portnum = -1;
+
+value = value-list;
+while (value) {
+char *port = NULL;
+
+if ((value-type != VIR_CONF_STRING) || (value-str == NULL))
+goto cleanup;
+port = value-str;
+portnum++;
+if (STREQ(port, none)) {
+value = value-next;
+continue;
+}
+
+if (!(chr = xenParseSxprChar(port, NULL)))
+goto cleanup;
+chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
+chr-target.port = portnum;
+if (VIR_APPEND_ELEMENT(def-serials, def-nserials, chr)  0) {
+goto cleanup;
+}
+
+value = value-next;
+}
+} else {
+/* If domain is not using multiple serial ports we parse data old 
way */
+if (xenXMConfigGetString(conf, serial, str, NULL)  0)
+goto cleanup;
+if (str  STRNEQ(str, none) 
+!(chr = xenParseSxprChar(str, NULL)))
+goto cleanup;
+if (chr) {
+if (VIR_ALLOC_N(def-serials, 1)  0) {
+virDomainChrDefFree(chr);
+goto cleanup;
+}
+chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
+chr-target.port = 0;
+def-serials[0] = chr;
+def-nserials++;
+}
+}
+} else {
+if (VIR_ALLOC_N(def-consoles, 1)  0)
+goto cleanup;
+def-nconsoles = 1;
+if (!(def-consoles[0] = xenParseSxprChar(pty, NULL)))
+goto cleanup;
+def-consoles[0]-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
+def-consoles[0]-target.port = 0;
+def-consoles[0]-targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
+}
+
+return 0;
+
+ cleanup:
+virDomainChrDefFree(chr);
+return -1;
+}
+
+
 /*
  * Turn a config record into a lump of XML describing the
  * domain, suitable for later feeding for virDomainCreateXML
@@ -1145,87 +1236,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 if (xenParseXMVfb(conf, def, xendConfigVersion)  0)
 goto cleanup;
 
-if (hvm) {
-virDomainChrDefPtr chr = NULL;
-
-if (xenXMConfigGetString(conf, parallel, str, NULL)  0)
-goto cleanup;
-if (str  STRNEQ(str, none) 
-!(chr = xenParseSxprChar(str, NULL)))
-goto cleanup;
-
-if (chr) {
-if (VIR_ALLOC_N(def-parallels, 1)  0) {
-virDomainChrDefFree(chr);
-goto cleanup;
-}
-chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
-chr-target.port = 0;
-def-parallels[0] = chr;
-def-nparallels++;
-chr = NULL;
-}
-
-/* Try to get the list of values to support multiple serial ports */
-list = virConfGetValue(conf, serial);
-if (list  list-type == VIR_CONF_LIST) {
-int portnum = -1;
-
-list = list-list;
-while (list) {
-char *port = NULL;
-
-if ((list-type != VIR_CONF_STRING) || (list-str == NULL))
-goto cleanup;
-
-port = list-str;
-portnum++;
-if (STREQ(port, none)) {
-list = 

[libvirt] [PATCH V3 18/24] src/xenxs:Refactor code formating Char devices config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
   xenFormatXMCharDev(virConfPtr conf,);
which formats Char devices config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 163 ++---
 1 file changed, 91 insertions(+), 72 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index c3e7cde..6752b27 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1804,6 +1804,94 @@ xenFormatXMEventActions(virConfPtr conf, virDomainDefPtr 
def)
 
 return 0;
 }
+
+
+static int
+xenFormatXMCharDev(virConfPtr conf, virDomainDefPtr def)
+{
+size_t i;
+
+if (STREQ(def-os.type, hvm)) {
+if (def-nparallels) {
+virBuffer buf = VIR_BUFFER_INITIALIZER;
+char *str;
+int ret;
+
+ret = xenFormatSxprChr(def-parallels[0], buf);
+str = virBufferContentAndReset(buf);
+if (ret == 0)
+ret = xenXMConfigSetString(conf, parallel, str);
+VIR_FREE(str);
+if (ret  0)
+return -1;
+
+} else {
+if (xenXMConfigSetString(conf, parallel, none)  0)
+return -1;
+}
+
+if (def-nserials) {
+if ((def-nserials == 1)  (def-serials[0]-target.port == 0)) {
+virBuffer buf = VIR_BUFFER_INITIALIZER;
+char *str;
+int ret;
+
+ret = xenFormatSxprChr(def-serials[0], buf);
+str = virBufferContentAndReset(buf);
+if (ret == 0)
+ret = xenXMConfigSetString(conf, serial, str);
+VIR_FREE(str);
+if (ret  0)
+return -1;
+
+} else {
+size_t j = 0;
+int maxport = -1, port;
+virConfValuePtr serialVal = NULL;
+
+if (VIR_ALLOC(serialVal)  0)
+return -1;
+
+serialVal-type = VIR_CONF_LIST;
+serialVal-list = NULL;
+
+for (i = 0; i  def-nserials; i++)
+if (def-serials[i]-target.port  maxport)
+maxport = def-serials[i]-target.port;
+
+for (port = 0; port = maxport; port++) {
+virDomainChrDefPtr chr = NULL;
+for (j = 0; j  def-nserials; j++) {
+if (def-serials[j]-target.port == port) {
+chr = def-serials[j];
+break;
+}
+}
+
+if (xenFormatXMSerial(serialVal, chr)  0) {
+VIR_FREE(serialVal);
+return -1;
+}
+}
+
+if (serialVal-list != NULL) {
+int ret = virConfSetValue(conf, serial, serialVal);
+serialVal = NULL;
+if (ret  0)
+return -1;
+}
+VIR_FREE(serialVal);
+}
+} else {
+if (xenXMConfigSetString(conf, serial, none)  0)
+return -1;
+}
+}
+
+return 0;
+}
+
+
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
@@ -2134,79 +,10 @@ xenFormatXM(virConnectPtr conn,
 if (xenFormatXMPCI(conf, def)  0)
 goto cleanup;
 
-if (hvm) {
-if (def-nparallels) {
-virBuffer buf = VIR_BUFFER_INITIALIZER;
-char *str;
-int ret;
-
-ret = xenFormatSxprChr(def-parallels[0], buf);
-str = virBufferContentAndReset(buf);
-if (ret == 0)
-ret = xenXMConfigSetString(conf, parallel, str);
-VIR_FREE(str);
-if (ret  0)
-goto cleanup;
-} else {
-if (xenXMConfigSetString(conf, parallel, none)  0)
-goto cleanup;
-}
-
-if (def-nserials) {
-if ((def-nserials == 1)  (def-serials[0]-target.port == 0)) {
-virBuffer buf = VIR_BUFFER_INITIALIZER;
-char *str;
-int ret;
-
-ret = xenFormatSxprChr(def-serials[0], buf);
-str = virBufferContentAndReset(buf);
-if (ret == 0)
-ret = xenXMConfigSetString(conf, serial, str);
-VIR_FREE(str);
-if (ret  0)
-goto cleanup;
-} else {
-size_t j = 0;
-int maxport = -1, port;
-virConfValuePtr serialVal = NULL;
-
-if (VIR_ALLOC(serialVal)  0)
-goto cleanup;
-serialVal-type = VIR_CONF_LIST;
-serialVal-list = NULL;

[libvirt] [PATCH V3 15/24] src/xenxs:Refactor code formating memory config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce fucntion
   xenFormatXMMem(virConfPtr conf,...);
which parses memory config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 24 ++--
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 08d26e5..350aeeb 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1672,6 +1672,23 @@ xenFormatXMGeneralMeta(virConfPtr conf, virDomainDefPtr 
def)
 
 return 0;
 }
+
+
+static int
+xenFormatXMMem(virConfPtr conf, virDomainDefPtr def)
+{
+if (xenXMConfigSetInt(conf, maxmem,
+  VIR_DIV_UP(def-mem.max_balloon, 1024))  0)
+return -1;
+
+if (xenXMConfigSetInt(conf, memory,
+  VIR_DIV_UP(def-mem.cur_balloon, 1024))  0)
+return -1;
+
+return 0;
+}
+
+
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
@@ -1695,12 +1712,7 @@ xenFormatXM(virConnectPtr conn,
 if (xenFormatXMGeneralMeta(conf, def)  0)
 goto cleanup;
 
-if (xenXMConfigSetInt(conf, maxmem,
-  VIR_DIV_UP(def-mem.max_balloon, 1024))  0)
-goto cleanup;
-
-if (xenXMConfigSetInt(conf, memory,
-  VIR_DIV_UP(def-mem.cur_balloon, 1024))  0)
+if (xenFormatXMMem(conf, def)  0)
 goto cleanup;
 
 if (xenXMConfigSetInt(conf, vcpus, def-maxvcpus)  0)
-- 
1.8.4.5

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


[libvirt] [PATCH V3 19/24] src/xenxs:Refactor code formating xm disk config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenFormatXMDomainDisks(virConfPtr conf,.);
which formats domain disks config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 72 +-
 1 file changed, 44 insertions(+), 28 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 6752b27..5a585ce 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1892,6 +1892,49 @@ xenFormatXMCharDev(virConfPtr conf, virDomainDefPtr def)
 }
 
 
+static int
+xenFormatXMDomainDisks(virConfPtr conf, virDomainDefPtr def,
+   int xendConfigVersion)
+{
+virConfValuePtr diskVal = NULL;
+size_t i = 0;
+int hvm = STREQ(def-os.type, hvm);
+
+if (VIR_ALLOC(diskVal)  0)
+goto cleanup;
+
+diskVal-type = VIR_CONF_LIST;
+diskVal-list = NULL;
+
+for (i = 0; i  def-ndisks; i++) {
+if (xendConfigVersion == XEND_CONFIG_VERSION_3_0_2 
+def-disks[i]-device == VIR_DOMAIN_DISK_DEVICE_CDROM 
+def-disks[i]-dst 
+STREQ(def-disks[i]-dst, hdc)) {
+continue;
+}
+
+if (def-disks[i]-device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
+continue;
+
+if (xenFormatXMDisk(diskVal, def-disks[i],
+hvm, xendConfigVersion)  0)
+goto cleanup;
+}
+
+if (diskVal-list != NULL) {
+int ret = virConfSetValue(conf, disk, diskVal);
+diskVal = NULL;
+if (ret  0)
+goto cleanup;
+}
+
+return 0;
+
+ cleanup:
+virConfFreeValue(diskVal);
+return -1;
+}
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
@@ -1905,7 +1948,6 @@ xenFormatXM(virConnectPtr conn,
 int hvm = 0;
 size_t i;
 char *cpus = NULL;
-virConfValuePtr diskVal = NULL;
 virConfValuePtr netVal = NULL;
 
 if (!(conf = virConfNew()))
@@ -2173,33 +2215,8 @@ xenFormatXM(virConnectPtr conn,
 }
 }
 
-/* analyze of the devices */
-if (VIR_ALLOC(diskVal)  0)
+if (xenFormatXMDomainDisks(conf, def, xendConfigVersion)  0)
 goto cleanup;
-diskVal-type = VIR_CONF_LIST;
-diskVal-list = NULL;
-
-for (i = 0; i  def-ndisks; i++) {
-if (xendConfigVersion == XEND_CONFIG_VERSION_3_0_2 
-def-disks[i]-device == VIR_DOMAIN_DISK_DEVICE_CDROM 
-def-disks[i]-dst 
-STREQ(def-disks[i]-dst, hdc)) {
-continue;
-}
-if (def-disks[i]-device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
-continue;
-
-if (xenFormatXMDisk(diskVal, def-disks[i],
-hvm, xendConfigVersion)  0)
-goto cleanup;
-}
-if (diskVal-list != NULL) {
-int ret = virConfSetValue(conf, disk, diskVal);
-diskVal = NULL;
-if (ret  0)
-goto cleanup;
-}
-VIR_FREE(diskVal);
 
 if (VIR_ALLOC(netVal)  0)
 goto cleanup;
@@ -2243,7 +2260,6 @@ xenFormatXM(virConnectPtr conn,
 return conf;
 
  cleanup:
-virConfFreeValue(diskVal);
 virConfFreeValue(netVal);
 VIR_FREE(cpus);
 if (conf)
-- 
1.8.4.5

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


[libvirt] [PATCH V3 20/24] src/xenxs:Refactor code formating CPU features config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce functions
  xenFormatXMCPUFeatures(virConfPtr conf, ..);
which formats CPU features config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 118 -
 tests/xmconfigdata/test-escape-paths.cfg   |   6 +-
 tests/xmconfigdata/test-fullvirt-force-hpet.cfg|   6 +-
 tests/xmconfigdata/test-fullvirt-force-nohpet.cfg  |   6 +-
 tests/xmconfigdata/test-fullvirt-localtime.cfg |   6 +-
 tests/xmconfigdata/test-fullvirt-net-ioemu.cfg |   6 +-
 tests/xmconfigdata/test-fullvirt-net-netfront.cfg  |   6 +-
 tests/xmconfigdata/test-fullvirt-new-cdrom.cfg |   6 +-
 tests/xmconfigdata/test-fullvirt-old-cdrom.cfg |   6 +-
 tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg  |   6 +-
 .../test-fullvirt-serial-dev-2-ports.cfg   |   6 +-
 .../test-fullvirt-serial-dev-2nd-port.cfg  |   6 +-
 tests/xmconfigdata/test-fullvirt-serial-file.cfg   |   6 +-
 tests/xmconfigdata/test-fullvirt-serial-null.cfg   |   6 +-
 tests/xmconfigdata/test-fullvirt-serial-pipe.cfg   |   6 +-
 tests/xmconfigdata/test-fullvirt-serial-pty.cfg|   6 +-
 tests/xmconfigdata/test-fullvirt-serial-stdio.cfg  |   6 +-
 .../test-fullvirt-serial-tcp-telnet.cfg|   6 +-
 tests/xmconfigdata/test-fullvirt-serial-tcp.cfg|   6 +-
 tests/xmconfigdata/test-fullvirt-serial-udp.cfg|   6 +-
 tests/xmconfigdata/test-fullvirt-serial-unix.cfg   |   6 +-
 tests/xmconfigdata/test-fullvirt-sound.cfg |   6 +-
 tests/xmconfigdata/test-fullvirt-usbmouse.cfg  |   6 +-
 tests/xmconfigdata/test-fullvirt-usbtablet.cfg |   6 +-
 tests/xmconfigdata/test-fullvirt-utc.cfg   |   6 +-
 tests/xmconfigdata/test-no-source-cdrom.cfg|   6 +-
 tests/xmconfigdata/test-pci-devs.cfg   |   6 +-
 27 files changed, 146 insertions(+), 128 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 5a585ce..6bd04ba 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1935,6 +1935,73 @@ xenFormatXMDomainDisks(virConfPtr conf, virDomainDefPtr 
def,
 virConfFreeValue(diskVal);
 return -1;
 }
+
+
+static int
+xenFormatXMCPUFeatures(virConfPtr conf, virDomainDefPtr def,
+   int xendConfigVersion)
+{
+char *cpus = NULL;
+size_t i;
+
+if (xenXMConfigSetInt(conf, vcpus, def-maxvcpus)  0)
+return -1;
+/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
+   either 32, or 64 on a platform where long is big enough.  */
+if (def-vcpus  def-maxvcpus 
+xenXMConfigSetInt(conf, vcpu_avail, (1UL  def-vcpus) - 1)  0)
+return -1;
+
+if ((def-cpumask != NULL) 
+((cpus = virBitmapFormat(def-cpumask)) == NULL)) {
+return -1;
+}
+
+if (cpus 
+xenXMConfigSetString(conf, cpus, cpus)  0)
+return -1;
+
+VIR_FREE(cpus);
+if (STREQ(def-os.type, hvm)) {
+if (xenXMConfigSetInt(conf, pae,
+  (def-features[VIR_DOMAIN_FEATURE_PAE] ==
+   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
+return -1;
+
+if (xenXMConfigSetInt(conf, acpi,
+  (def-features[VIR_DOMAIN_FEATURE_ACPI] ==
+   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
+return -1;
+
+if (xenXMConfigSetInt(conf, apic,
+  (def-features[VIR_DOMAIN_FEATURE_APIC] ==
+   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
+return -1;
+
+if (xendConfigVersion = XEND_CONFIG_VERSION_3_0_4) {
+if (xenXMConfigSetInt(conf, hap,
+  (def-features[VIR_DOMAIN_FEATURE_HAP] ==
+   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
+return -1;
+
+if (xenXMConfigSetInt(conf, viridian,
+  (def-features[VIR_DOMAIN_FEATURE_VIRIDIAN] 
==
+   VIR_TRISTATE_SWITCH_ON) ? 1 : 0)  0)
+return -1;
+}
+
+for (i = 0; i  def-clock.ntimers; i++) {
+if (def-clock.timers[i]-name == VIR_DOMAIN_TIMER_NAME_HPET 
+def-clock.timers[i]-present != -1 
+xenXMConfigSetInt(conf, hpet, def-clock.timers[i]-present) 
 0)
+return -1;
+}
+}
+
+return 0;
+}
+
+
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
@@ -1959,24 +2026,9 @@ xenFormatXM(virConnectPtr conn,
 if (xenFormatXMMem(conf, def)  0)
 goto cleanup;
 
-if (xenXMConfigSetInt(conf, vcpus, def-maxvcpus)  0)
-goto cleanup;
-/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
-   either 32, or 64 on a platform where long is big enough.  

[libvirt] [PATCH V3 07/24] src/xenxs:Refactor code parsing Vfb config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
 xenParseXMVfb(virConfPtr conf,..);
which parses Vfb config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 301 +++--
 1 file changed, 155 insertions(+), 146 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index f4bb37d..228e0a2 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -40,6 +40,7 @@
 #include virstoragefile.h
 #include virstring.h
 
+#define MAX_VFB 1024
 /* Convenience method to grab a int from the config file object */
 static int
 xenXMConfigGetBool(virConfPtr conf, const char *name, int *value, int def)
@@ -689,7 +690,158 @@ xenParseXMDisk(virConfPtr conf, virDomainDefPtr def,
 
 return 0;
 }
-#define MAX_VFB 1024
+
+
+static int
+xenParseXMVfb(virConfPtr conf, virDomainDefPtr def,
+  int xendConfigVersion)
+{
+int val;
+char *listenAddr = NULL;
+int hvm = STREQ(def-os.type, hvm);
+virConfValuePtr list;
+virDomainGraphicsDefPtr graphics = NULL;
+
+if (hvm || xendConfigVersion  XEND_CONFIG_VERSION_3_0_4) {
+if (xenXMConfigGetBool(conf, vnc, val, 0)  0)
+goto cleanup;
+if (val) {
+if (VIR_ALLOC(graphics)  0)
+goto cleanup;
+graphics-type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
+if (xenXMConfigGetBool(conf, vncunused, val, 1)  0)
+goto cleanup;
+graphics-data.vnc.autoport = val ? 1 : 0;
+if (!graphics-data.vnc.autoport) {
+unsigned long vncdisplay;
+if (xenXMConfigGetULong(conf, vncdisplay, vncdisplay, 0)  
0)
+goto cleanup;
+graphics-data.vnc.port = (int)vncdisplay + 5900;
+}
+
+if (xenXMConfigCopyStringOpt(conf, vnclisten, listenAddr)  0)
+goto cleanup;
+if (listenAddr 
+virDomainGraphicsListenSetAddress(graphics, 0, listenAddr,
+  -1, true)  0) {
+   goto cleanup;
+}
+
+VIR_FREE(listenAddr);
+if (xenXMConfigCopyStringOpt(conf, vncpasswd, 
graphics-data.vnc.auth.passwd)  0)
+goto cleanup;
+if (xenXMConfigCopyStringOpt(conf, keymap, 
graphics-data.vnc.keymap)  0)
+goto cleanup;
+if (VIR_ALLOC_N(def-graphics, 1)  0)
+goto cleanup;
+def-graphics[0] = graphics;
+def-ngraphics = 1;
+graphics = NULL;
+} else {
+if (xenXMConfigGetBool(conf, sdl, val, 0)  0)
+goto cleanup;
+if (val) {
+if (VIR_ALLOC(graphics)  0)
+goto cleanup;
+graphics-type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
+if (xenXMConfigCopyStringOpt(conf, display, 
graphics-data.sdl.display)  0)
+goto cleanup;
+if (xenXMConfigCopyStringOpt(conf, xauthority, 
graphics-data.sdl.xauth)  0)
+goto cleanup;
+if (VIR_ALLOC_N(def-graphics, 1)  0)
+goto cleanup;
+def-graphics[0] = graphics;
+def-ngraphics = 1;
+graphics = NULL;
+}
+}
+}
+
+if (!hvm  def-graphics == NULL) { /* New PV guests use this format */
+list = virConfGetValue(conf, vfb);
+if (list  list-type == VIR_CONF_LIST 
+list-list  list-list-type == VIR_CONF_STRING 
+list-list-str) {
+char vfb[MAX_VFB];
+char *key = vfb;
+
+if (virStrcpyStatic(vfb, list-list-str) == NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(VFB %s too big for destination),
+   list-list-str);
+goto cleanup;
+}
+
+if (VIR_ALLOC(graphics)  0)
+goto cleanup;
+if (strstr(key, type=sdl))
+graphics-type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
+else
+graphics-type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
+while (key) {
+char *nextkey = strchr(key, ',');
+char *end = nextkey;
+if (nextkey) {
+*end = '\0';
+nextkey++;
+}
+
+if (!strchr(key, '='))
+break;
+if (graphics-type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+if (STRPREFIX(key, vncunused=)) {
+if (STREQ(key + 10, 1))
+graphics-data.vnc.autoport = true;
+} else if (STRPREFIX(key, vnclisten=)) {
+if (virDomainGraphicsListenSetAddress(graphics, 0, 
key+10,
+ 

[libvirt] [PATCH V3 14/24] src/xenxs:Refactor code formating general VM config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenFormatXMGeneralMeta(virConfPtr conf,..);
which parses uuid and name instead

signed-off-by:David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 53 -
 1 file changed, 32 insertions(+), 21 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index aa943ca..08d26e5 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1322,8 +1322,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 }
 
 
-static
-int xenXMConfigSetInt(virConfPtr conf, const char *setting, long long l)
+static int
+xenXMConfigSetInt(virConfPtr conf, const char *setting, long long l)
 {
 virConfValuePtr value = NULL;
 
@@ -1445,8 +1445,10 @@ xenFormatXMDisk(virConfValuePtr list,
 return -1;
 }
 
-static int xenFormatXMSerial(virConfValuePtr list,
- virDomainChrDefPtr serial)
+
+static int
+xenFormatXMSerial(virConfValuePtr list,
+  virDomainChrDefPtr serial)
 {
 virBuffer buf = VIR_BUFFER_INITIALIZER;
 virConfValuePtr val, tmp;
@@ -1482,10 +1484,12 @@ static int xenFormatXMSerial(virConfValuePtr list,
 return -1;
 }
 
-static int xenFormatXMNet(virConnectPtr conn,
-  virConfValuePtr list,
-  virDomainNetDefPtr net,
-  int hvm, int xendConfigVersion)
+
+static int
+xenFormatXMNet(virConnectPtr conn,
+   virConfValuePtr list,
+   virDomainNetDefPtr net,
+   int hvm, int xendConfigVersion)
 {
 virBuffer buf = VIR_BUFFER_INITIALIZER;
 virConfValuePtr val, tmp;
@@ -1587,10 +1591,8 @@ static int xenFormatXMNet(virConnectPtr conn,
 }
 
 
-
 static int
-xenFormatXMPCI(virConfPtr conf,
-   virDomainDefPtr def)
+xenFormatXMPCI(virConfPtr conf, virDomainDefPtr def)
 {
 
 virConfValuePtr pciVal = NULL;
@@ -1656,32 +1658,41 @@ xenFormatXMPCI(virConfPtr conf,
 }
 
 
+static int
+xenFormatXMGeneralMeta(virConfPtr conf, virDomainDefPtr def)
+{
+char uuid[VIR_UUID_STRING_BUFLEN];
+
+if (xenXMConfigSetString(conf, name, def-name)  0)
+return -1;
+
+virUUIDFormat(def-uuid, uuid);
+if (xenXMConfigSetString(conf, uuid, uuid)  0)
+return -1;
+
+return 0;
+}
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
 
-virConfPtr xenFormatXM(virConnectPtr conn,
-   virDomainDefPtr def,
-   int xendConfigVersion)
+virConfPtr
+xenFormatXM(virConnectPtr conn,
+virDomainDefPtr def,
+int xendConfigVersion)
 {
 virConfPtr conf = NULL;
 int hvm = 0, vmlocaltime = 0;
 size_t i;
 char *cpus = NULL;
 const char *lifecycle;
-char uuid[VIR_UUID_STRING_BUFLEN];
 virConfValuePtr diskVal = NULL;
 virConfValuePtr netVal = NULL;
 
 if (!(conf = virConfNew()))
 goto cleanup;
 
-
-if (xenXMConfigSetString(conf, name, def-name)  0)
-goto cleanup;
-
-virUUIDFormat(def-uuid, uuid);
-if (xenXMConfigSetString(conf, uuid, uuid)  0)
+if (xenFormatXMGeneralMeta(conf, def)  0)
 goto cleanup;
 
 if (xenXMConfigSetInt(conf, maxmem,
-- 
1.8.4.5

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


[libvirt] [PATCH V3 17/24] src/xenxs:Refactor code formating event actions config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
   xenFormatXMEventActions(virConfPtr conf,.);
which formats event actions instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 63 +++---
 1 file changed, 36 insertions(+), 27 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 5f092dc..c3e7cde 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1769,6 +1769,41 @@ xenFormatXMTimeOffset(virConfPtr conf, virDomainDefPtr 
def,
 
 return 0;
 }
+
+
+static int
+xenFormatXMEventActions(virConfPtr conf, virDomainDefPtr def)
+{
+const char *lifecycle = NULL;
+
+if (!(lifecycle = virDomainLifecycleTypeToString(def-onPoweroff))) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected lifecycle action %d), def-onPoweroff);
+return -1;
+}
+if (xenXMConfigSetString(conf, on_poweroff, lifecycle)  0)
+return -1;
+
+
+if (!(lifecycle = virDomainLifecycleTypeToString(def-onReboot))) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected lifecycle action %d), def-onReboot);
+return -1;
+}
+if (xenXMConfigSetString(conf, on_reboot, lifecycle)  0)
+return -1;
+
+
+if (!(lifecycle = virDomainLifecycleCrashTypeToString(def-onCrash))) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected lifecycle action %d), def-onCrash);
+return -1;
+}
+if (xenXMConfigSetString(conf, on_crash, lifecycle)  0)
+return -1;
+
+return 0;
+}
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
@@ -1782,7 +1817,6 @@ xenFormatXM(virConnectPtr conn,
 int hvm = 0;
 size_t i;
 char *cpus = NULL;
-const char *lifecycle;
 virConfValuePtr diskVal = NULL;
 virConfValuePtr netVal = NULL;
 
@@ -1921,33 +1955,8 @@ xenFormatXM(virConnectPtr conn,
 if (xenFormatXMTimeOffset(conf, def, xendConfigVersion)  0)
 goto cleanup;
 
-if (!(lifecycle = virDomainLifecycleTypeToString(def-onPoweroff))) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected lifecycle action %d), def-onPoweroff);
-goto cleanup;
-}
-if (xenXMConfigSetString(conf, on_poweroff, lifecycle)  0)
-goto cleanup;
-
-
-if (!(lifecycle = virDomainLifecycleTypeToString(def-onReboot))) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected lifecycle action %d), def-onReboot);
+if (xenFormatXMEventActions(conf, def)  0)
 goto cleanup;
-}
-if (xenXMConfigSetString(conf, on_reboot, lifecycle)  0)
-goto cleanup;
-
-
-if (!(lifecycle = virDomainLifecycleCrashTypeToString(def-onCrash))) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected lifecycle action %d), def-onCrash);
-goto cleanup;
-}
-if (xenXMConfigSetString(conf, on_crash, lifecycle)  0)
-goto cleanup;
-
-
 
 if (hvm) {
 if (def-emulator 
-- 
1.8.4.5

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


[libvirt] [PATCH V3 21/24] src/xenxs:Refactor code formating OS config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
   xenFormatXMOS(virConfPtr conf,);
which formats OS config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 95 --
 tests/xmconfigdata/test-escape-paths.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-force-hpet.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-force-nohpet.cfg  |  2 +-
 tests/xmconfigdata/test-fullvirt-localtime.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-net-ioemu.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-net-netfront.cfg  |  2 +-
 tests/xmconfigdata/test-fullvirt-new-cdrom.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-old-cdrom.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg  |  2 +-
 .../test-fullvirt-serial-dev-2-ports.cfg   |  2 +-
 .../test-fullvirt-serial-dev-2nd-port.cfg  |  2 +-
 tests/xmconfigdata/test-fullvirt-serial-file.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-serial-null.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-serial-pipe.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-serial-pty.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-serial-stdio.cfg  |  2 +-
 .../test-fullvirt-serial-tcp-telnet.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-serial-tcp.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-serial-udp.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-serial-unix.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-sound.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-usbmouse.cfg  |  2 +-
 tests/xmconfigdata/test-fullvirt-usbtablet.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-utc.cfg   |  2 +-
 tests/xmconfigdata/test-no-source-cdrom.cfg|  2 +-
 tests/xmconfigdata/test-pci-devs.cfg   |  2 +-
 27 files changed, 80 insertions(+), 67 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 6bd04ba..9db159d 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -2002,43 +2002,20 @@ xenFormatXMCPUFeatures(virConfPtr conf, virDomainDefPtr 
def,
 }
 
 
-/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
-   either 32, or 64 on a platform where long is big enough.  */
-verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
-
-virConfPtr
-xenFormatXM(virConnectPtr conn,
-virDomainDefPtr def,
-int xendConfigVersion)
+static int
+xenFormatXMOS(virConfPtr conf, virDomainDefPtr def,
+  int xendConfigVersion)
 {
-virConfPtr conf = NULL;
-int hvm = 0;
 size_t i;
-char *cpus = NULL;
-virConfValuePtr netVal = NULL;
-
-if (!(conf = virConfNew()))
-goto cleanup;
-
-if (xenFormatXMGeneralMeta(conf, def)  0)
-goto cleanup;
-
-if (xenFormatXMMem(conf, def)  0)
-goto cleanup;
 
-if (xenFormatXMCPUFeatures(conf, def, xendConfigVersion)  0)
-goto cleanup;
-
-hvm = STREQ(def-os.type, hvm) ? 1 : 0;
-
-if (hvm) {
+if (STREQ(def-os.type, hvm)) {
 char boot[VIR_DOMAIN_BOOT_LAST+1];
 if (xenXMConfigSetString(conf, builder, hvm)  0)
-goto cleanup;
+return -1;
 
 if (def-os.loader 
 xenXMConfigSetString(conf, kernel, def-os.loader)  0)
-goto cleanup;
+return -1;
 
 for (i = 0; i  def-os.nBootDevs; i++) {
 switch (def-os.bootDevs[i]) {
@@ -2065,7 +2042,7 @@ xenFormatXM(virConnectPtr conn,
 }
 
 if (xenXMConfigSetString(conf, boot, boot)  0)
-goto cleanup;
+return -1;
 
 if (xendConfigVersion == XEND_CONFIG_VERSION_3_0_2) {
 for (i = 0; i  def-ndisks; i++) {
@@ -2075,31 +2052,72 @@ xenFormatXM(virConnectPtr conn,
 virDomainDiskGetSource(def-disks[i])) {
 if (xenXMConfigSetString(conf, cdrom,
  
virDomainDiskGetSource(def-disks[i]))  0)
-goto cleanup;
+return -1;
+
 break;
 }
 }
 }
 
+if (def-emulator 
+xenXMConfigSetString(conf, device_model, def-emulator)  0)
+return -1;
 /* XXX floppy disks */
 } else {
 if (def-os.bootloader 
 xenXMConfigSetString(conf, bootloader, def-os.bootloader)  0)
-goto cleanup;
+return -1;
+
 if (def-os.bootloaderArgs 
 xenXMConfigSetString(conf, bootargs, def-os.bootloaderArgs)  0)
-goto cleanup;
+return -1;
+
 if (def-os.kernel 
 xenXMConfigSetString(conf, kernel, def-os.kernel)  0)
-goto cleanup;
+return -1;
+
 if (def-os.initrd 
 xenXMConfigSetString(conf, ramdisk, def-os.initrd)  0)
-goto cleanup;
+return -1;
+
 if (def-os.cmdline 
 xenXMConfigSetString(conf, extra, 

[libvirt] [PATCH V3 09/24] src/xenxs:Refactor code parsing Vif config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMVif(virConfPtr conf,);
which parses Vfb config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 283 +++--
 1 file changed, 143 insertions(+), 140 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 628cef6..73efa5f 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -934,134 +934,13 @@ xenParseXMCharDev(virConfPtr conf, virDomainDefPtr def)
 }
 
 
-/*
- * Turn a config record into a lump of XML describing the
- * domain, suitable for later feeding for virDomainCreateXML
- */
-virDomainDefPtr
-xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
+static int
+xenParseXMVif(virConfPtr conf, virDomainDefPtr def)
 {
-const char *str;
-int hvm = 0;
-virConfValuePtr list;
-virDomainDefPtr def = NULL;
-virDomainDiskDefPtr disk = NULL;
-virDomainNetDefPtr net = NULL;
-size_t i;
-const char *defaultMachine;
 char *script = NULL;
+virDomainNetDefPtr net = NULL;
+virConfValuePtr list = virConfGetValue(conf, vif);
 
-if (VIR_ALLOC(def)  0)
-return NULL;
-
-def-virtType = VIR_DOMAIN_VIRT_XEN;
-def-id = -1;
-
-if (xenXMConfigCopyString(conf, name, def-name)  0)
-goto cleanup;
-if (xenXMConfigGetUUID(conf, uuid, def-uuid)  0)
-goto cleanup;
-
-
-if ((xenXMConfigGetString(conf, builder, str, linux) == 0) 
-STREQ(str, hvm))
-hvm = 1;
-
-if (VIR_STRDUP(def-os.type, hvm ? hvm : xen)  0)
-goto cleanup;
-
-def-os.arch =
-virCapabilitiesDefaultGuestArch(caps,
-def-os.type,
-
virDomainVirtTypeToString(def-virtType));
-if (!def-os.arch) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(no supported architecture for os type '%s'),
-   def-os.type);
-goto cleanup;
-}
-
-defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
-def-os.type,
-def-os.arch,
-
virDomainVirtTypeToString(def-virtType));
-if (defaultMachine != NULL) {
-if (VIR_STRDUP(def-os.machine, defaultMachine)  0)
-goto cleanup;
-}
-
-if (hvm) {
-const char *boot;
-if (xenXMConfigCopyString(conf, kernel, def-os.loader)  0)
-goto cleanup;
-
-if (xenXMConfigGetString(conf, boot, boot, c)  0)
-goto cleanup;
-
-for (i = 0; i  VIR_DOMAIN_BOOT_LAST  boot[i]; i++) {
-switch (*boot) {
-case 'a':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_FLOPPY;
-break;
-case 'd':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_CDROM;
-break;
-case 'n':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_NET;
-break;
-case 'c':
-default:
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_DISK;
-break;
-}
-def-os.nBootDevs++;
-}
-} else {
-const char *extra, *root;
-
-if (xenXMConfigCopyStringOpt(conf, bootloader, def-os.bootloader) 
 0)
-goto cleanup;
-if (xenXMConfigCopyStringOpt(conf, bootargs, 
def-os.bootloaderArgs)  0)
-goto cleanup;
-
-if (xenXMConfigCopyStringOpt(conf, kernel, def-os.kernel)  0)
-goto cleanup;
-if (xenXMConfigCopyStringOpt(conf, ramdisk, def-os.initrd)  0)
-goto cleanup;
-if (xenXMConfigGetString(conf, extra, extra, NULL)  0)
-goto cleanup;
-if (xenXMConfigGetString(conf, root, root, NULL)  0)
-goto cleanup;
-
-if (root) {
-if (virAsprintf(def-os.cmdline, root=%s %s, root, extra)  0)
-goto cleanup;
-} else {
-if (VIR_STRDUP(def-os.cmdline, extra)  0)
-goto cleanup;
-}
-}
-
-if (xenParseXMMem(conf, def)  0)
-goto cleanup;
-
-if (xenParseXMEventsActions(conf, def)  0)
-goto cleanup;
-
-if (xenParseXMCPUFeatures(conf, def)  0)
-goto cleanup;
-
-if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
-goto cleanup;
-
-if (xenParseXMDisk(conf, def, xendConfigVersion)  0)
-goto cleanup;
-
-if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
-goto cleanup;
-
-list = virConfGetValue(conf, vif);
 if (list  list-type == VIR_CONF_LIST) {
 list = list-list;
 while (list) {
@@ -1082,7 +961,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 
 if ((list-type != VIR_CONF_STRING) || (list-str == NULL))
   

[libvirt] [PATCH V3 22/24] src/xenxs:Refactor code formating Vfb config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
   xenFormatXMVfb(virConfPtr conf,.);
which formats Vfb config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 171 ++---
 1 file changed, 97 insertions(+), 74 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 9db159d..bf5a23a 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -2087,108 +2087,65 @@ xenFormatXMOS(virConfPtr conf, virDomainDefPtr def,
 
 return 0;
 }
-/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
-   either 32, or 64 on a platform where long is big enough.  */
-verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
-
-virConfPtr
-xenFormatXM(virConnectPtr conn,
-virDomainDefPtr def,
-int xendConfigVersion)
-{
-virConfPtr conf = NULL;
-int hvm = 0;
-size_t i;
-virConfValuePtr netVal = NULL;
-
-if (!(conf = virConfNew()))
-goto cleanup;
-
-if (xenFormatXMGeneralMeta(conf, def)  0)
-goto cleanup;
-
-if (xenFormatXMMem(conf, def)  0)
-goto cleanup;
-
-if (xenFormatXMCPUFeatures(conf, def, xendConfigVersion)  0)
-goto cleanup;
-
-hvm = STREQ(def-os.type, hvm);
 
-if (xenFormatXMOS(conf, def, xendConfigVersion)  0)
-goto cleanup;
-
-if (xenFormatXMTimeOffset(conf, def, xendConfigVersion)  0)
-goto cleanup;
 
-if (xenFormatXMEventActions(conf, def)  0)
-goto cleanup;
-
-if (hvm) {
-for (i = 0; i  def-ninputs; i++) {
-if (def-inputs[i]-bus == VIR_DOMAIN_INPUT_BUS_USB) {
-if (xenXMConfigSetInt(conf, usb, 1)  0)
-goto cleanup;
-switch (def-inputs[i]-type) {
-case VIR_DOMAIN_INPUT_TYPE_MOUSE:
-if (xenXMConfigSetString(conf, usbdevice, mouse)  
0)
-goto cleanup;
-break;
-case VIR_DOMAIN_INPUT_TYPE_TABLET:
-if (xenXMConfigSetString(conf, usbdevice, tablet) 
 0)
-goto cleanup;
-break;
-case VIR_DOMAIN_INPUT_TYPE_KBD:
-if (xenXMConfigSetString(conf, usbdevice, 
keyboard)  0)
-goto cleanup;
-break;
-}
-break;
-}
-}
-}
+static int
+xenFormatXMVfb(virConfPtr conf, virDomainDefPtr def,
+   int xendConfigVersion)
+{
+int hvm = STREQ(def-os.type, hvm);
 
 if (def-ngraphics == 1) {
 if (hvm || (xendConfigVersion  XEND_CONFIG_MIN_VERS_PVFB_NEWCONF)) {
 if (def-graphics[0]-type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
 if (xenXMConfigSetInt(conf, sdl, 1)  0)
-goto cleanup;
+return -1;
+
 if (xenXMConfigSetInt(conf, vnc, 0)  0)
-goto cleanup;
+return -1;
+
 if (def-graphics[0]-data.sdl.display 
 xenXMConfigSetString(conf, display,
  def-graphics[0]-data.sdl.display)  0)
-goto cleanup;
+return -1;
+
 if (def-graphics[0]-data.sdl.xauth 
 xenXMConfigSetString(conf, xauthority,
  def-graphics[0]-data.sdl.xauth)  0)
-goto cleanup;
+return -1;
+
 } else {
 const char *listenAddr;
 
 if (xenXMConfigSetInt(conf, sdl, 0)  0)
-goto cleanup;
+return -1;
+
 if (xenXMConfigSetInt(conf, vnc, 1)  0)
-goto cleanup;
+return -1;
+
 if (xenXMConfigSetInt(conf, vncunused,
   def-graphics[0]-data.vnc.autoport ? 1 : 0)  0)
-goto cleanup;
+return -1;
+
 if (!def-graphics[0]-data.vnc.autoport 
 xenXMConfigSetInt(conf, vncdisplay,
   def-graphics[0]-data.vnc.port - 5900)  0)
-goto cleanup;
+return -1;
+
 listenAddr = 
virDomainGraphicsListenGetAddress(def-graphics[0], 0);
 if (listenAddr 
 xenXMConfigSetString(conf, vnclisten, listenAddr)  0)
-goto cleanup;
+return -1;
+
 if (def-graphics[0]-data.vnc.auth.passwd 
 xenXMConfigSetString(conf, vncpasswd,
 
def-graphics[0]-data.vnc.auth.passwd)  0)
-goto cleanup;
+return -1;
+
 if (def-graphics[0]-data.vnc.keymap 
 

[libvirt] [PATCH V3 23/24] src/xenxs:Refactor code formating emulated devices config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenFormatXMEmulatedHardware(virConfPtr conf,);
which  formats emulated hardware config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 150 +
 tests/xmconfigdata/test-escape-paths.cfg   |   2 +-
 tests/xmconfigdata/test-fullvirt-sound.cfg |   2 +-
 3 files changed, 92 insertions(+), 62 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index bf5a23a..071802d 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -2206,6 +2206,93 @@ xenFormatXMVfb(virConfPtr conf, virDomainDefPtr def,
 
 return 0;
 }
+
+
+static int
+xenFormatXMVif(virConfPtr conf, virConnectPtr conn,
+   virDomainDefPtr def, int xendConfigVersion)
+{
+   virConfValuePtr netVal = NULL;
+   size_t i;
+   int hvm = STREQ(def-os.type, hvm);
+
+   if (VIR_ALLOC(netVal)  0)
+goto cleanup;
+netVal-type = VIR_CONF_LIST;
+netVal-list = NULL;
+
+for (i = 0; i  def-nnets; i++) {
+if (xenFormatXMNet(conn, netVal, def-nets[i],
+   hvm, xendConfigVersion)  0)
+   goto cleanup;
+}
+
+if (netVal-list != NULL) {
+int ret = virConfSetValue(conf, vif, netVal);
+netVal = NULL;
+if (ret  0)
+goto cleanup;
+}
+
+VIR_FREE(netVal);
+return 0;
+
+ cleanup:
+virConfFreeValue(netVal);
+return -1;
+}
+
+
+static int
+xenFormatXMEmulatedHardware(virConfPtr conf, virDomainDefPtr def)
+{
+size_t i;
+
+if (STREQ(def-os.type, hvm)) {
+if (def-sounds) {
+virBuffer buf = VIR_BUFFER_INITIALIZER;
+char *str = NULL;
+int ret = xenFormatSxprSound(def, buf);
+str = virBufferContentAndReset(buf);
+if (ret == 0)
+ret = xenXMConfigSetString(conf, soundhw, str);
+
+VIR_FREE(str);
+if (ret  0)
+return -1;
+}
+
+for (i = 0; i  def-ninputs; i++) {
+if (def-inputs[i]-bus == VIR_DOMAIN_INPUT_BUS_USB) {
+if (xenXMConfigSetInt(conf, usb, 1)  0)
+return -1;
+
+switch (def-inputs[i]-type) {
+case VIR_DOMAIN_INPUT_TYPE_MOUSE:
+if (xenXMConfigSetString(conf, usbdevice, mouse)  
0)
+return -1;
+
+break;
+case VIR_DOMAIN_INPUT_TYPE_TABLET:
+if (xenXMConfigSetString(conf, usbdevice, tablet) 
 0)
+return -1;
+
+break;
+case VIR_DOMAIN_INPUT_TYPE_KBD:
+if (xenXMConfigSetString(conf, usbdevice, 
keyboard)  0)
+return -1;
+
+break;
+}
+break;
+}
+}
+}
+
+return 0;
+}
+
+
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
@@ -2216,9 +2303,6 @@ xenFormatXM(virConnectPtr conn,
 int xendConfigVersion)
 {
 virConfPtr conf = NULL;
-int hvm = 0;
-size_t i;
-virConfValuePtr netVal = NULL;
 
 if (!(conf = virConfNew()))
 goto cleanup;
@@ -2232,8 +2316,6 @@ xenFormatXM(virConnectPtr conn,
 if (xenFormatXMCPUFeatures(conf, def, xendConfigVersion)  0)
 goto cleanup;
 
-hvm = STREQ(def-os.type, hvm);
-
 if (xenFormatXMOS(conf, def, xendConfigVersion)  0)
 goto cleanup;
 
@@ -2243,29 +2325,8 @@ xenFormatXM(virConnectPtr conn,
 if (xenFormatXMEventActions(conf, def)  0)
 goto cleanup;
 
-if (hvm) {
-for (i = 0; i  def-ninputs; i++) {
-if (def-inputs[i]-bus == VIR_DOMAIN_INPUT_BUS_USB) {
-if (xenXMConfigSetInt(conf, usb, 1)  0)
-goto cleanup;
-switch (def-inputs[i]-type) {
-case VIR_DOMAIN_INPUT_TYPE_MOUSE:
-if (xenXMConfigSetString(conf, usbdevice, mouse)  
0)
-goto cleanup;
-break;
-case VIR_DOMAIN_INPUT_TYPE_TABLET:
-if (xenXMConfigSetString(conf, usbdevice, tablet) 
 0)
-goto cleanup;
-break;
-case VIR_DOMAIN_INPUT_TYPE_KBD:
-if (xenXMConfigSetString(conf, usbdevice, 
keyboard)  0)
-goto cleanup;
-break;
-}
-break;
-}
-}
-}
+if (xenFormatXMEmulatedHardware(conf, def)  0)
+goto cleanup;
 
 if (xenFormatXMVfb(conf, def, xendConfigVersion)  0)
 goto cleanup;
@@ -2273,23 +2334,8 @@ xenFormatXM(virConnectPtr 

[libvirt] [PATCH V3 16/24] src/xenxs:Refactor code formating virtual time config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenFormatXMTimeOffset(virConfPtr conf,);
which formats time config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 153 -
 1 file changed, 82 insertions(+), 71 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 350aeeb..5f092dc 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1689,6 +1689,86 @@ xenFormatXMMem(virConfPtr conf, virDomainDefPtr def)
 }
 
 
+static int
+xenFormatXMTimeOffset(virConfPtr conf, virDomainDefPtr def,
+  int xendConfigVersion)
+{
+int vmlocaltime;
+if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {
+/* 3.1: UTC and LOCALTIME */
+switch (def-clock.offset) {
+case VIR_DOMAIN_CLOCK_OFFSET_UTC:
+vmlocaltime = 0;
+break;
+case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
+vmlocaltime = 1;
+break;
+default:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _(unsupported clock offset='%s'),
+   
virDomainClockOffsetTypeToString(def-clock.offset));
+return -1;
+}
+
+} else {
+if (STREQ(def-os.type, hvm)) {
+/* =3.1 HV: VARIABLE */
+int rtc_timeoffset;
+switch (def-clock.offset) {
+case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE:
+vmlocaltime = (int)def-clock.data.variable.basis;
+rtc_timeoffset = def-clock.data.variable.adjustment;
+break;
+case VIR_DOMAIN_CLOCK_OFFSET_UTC:
+if (def-clock.data.utc_reset) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s,
+   _(unsupported clock adjustment='reset'));
+return -1;
+}
+vmlocaltime = 0;
+rtc_timeoffset = 0;
+break;
+case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
+if (def-clock.data.utc_reset) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s,
+   _(unsupported clock adjustment='reset'));
+return -1;
+}
+vmlocaltime = 1;
+rtc_timeoffset = 0;
+break;
+default:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _(unsupported clock offset='%s'),
+   
virDomainClockOffsetTypeToString(def-clock.offset));
+return -1;
+}
+if (xenXMConfigSetInt(conf, rtc_timeoffset, rtc_timeoffset)  0)
+return -1;
+
+} else {
+/* =3.1 PV: UTC and LOCALTIME */
+switch (def-clock.offset) {
+case VIR_DOMAIN_CLOCK_OFFSET_UTC:
+vmlocaltime = 0;
+break;
+case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
+vmlocaltime = 1;
+break;
+default:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _(unsupported clock offset='%s'),
+   
virDomainClockOffsetTypeToString(def-clock.offset));
+return -1;
+}
+} /* !hvm */
+}
+
+if (xenXMConfigSetInt(conf, localtime, vmlocaltime)  0)
+return -1;
+
+return 0;
+}
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
@@ -1699,7 +1779,7 @@ xenFormatXM(virConnectPtr conn,
 int xendConfigVersion)
 {
 virConfPtr conf = NULL;
-int hvm = 0, vmlocaltime = 0;
+int hvm = 0;
 size_t i;
 char *cpus = NULL;
 const char *lifecycle;
@@ -1838,78 +1918,9 @@ xenFormatXM(virConnectPtr conn,
 goto cleanup;
 } /* !hvm */
 
-
-if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {
-/* 3.1: UTC and LOCALTIME */
-switch (def-clock.offset) {
-case VIR_DOMAIN_CLOCK_OFFSET_UTC:
-vmlocaltime = 0;
-break;
-case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
-vmlocaltime = 1;
-break;
-default:
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _(unsupported clock offset='%s'),
-   
virDomainClockOffsetTypeToString(def-clock.offset));
-goto cleanup;
-}
-} else {
-if (hvm) {
-/* =3.1 HV: VARIABLE */
-int rtc_timeoffset;
-switch (def-clock.offset) {
-case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE:
-vmlocaltime = (int)def-clock.data.variable.basis;
-rtc_timeoffset = def-clock.data.variable.adjustment;
-  

[libvirt] [PATCH V3 24/24] src/xenxs:Export code

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

export code for reuse and some formating fix

signed-off-by:David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 59 +-
 src/xenxs/xen_xm.h |  4 +-
 tests/xmconfigdata/test-escape-paths.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-force-hpet.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-force-nohpet.cfg  |  2 +-
 tests/xmconfigdata/test-fullvirt-localtime.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-net-ioemu.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-net-netfront.cfg  |  2 +-
 tests/xmconfigdata/test-fullvirt-new-cdrom.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-old-cdrom.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg  |  2 +-
 .../test-fullvirt-serial-dev-2-ports.cfg   |  2 +-
 .../test-fullvirt-serial-dev-2nd-port.cfg  |  2 +-
 tests/xmconfigdata/test-fullvirt-serial-file.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-serial-null.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-serial-pipe.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-serial-pty.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-serial-stdio.cfg  |  2 +-
 .../test-fullvirt-serial-tcp-telnet.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-serial-tcp.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-serial-udp.cfg|  2 +-
 tests/xmconfigdata/test-fullvirt-serial-unix.cfg   |  2 +-
 tests/xmconfigdata/test-fullvirt-sound.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-usbmouse.cfg  |  2 +-
 tests/xmconfigdata/test-fullvirt-usbtablet.cfg |  2 +-
 tests/xmconfigdata/test-fullvirt-utc.cfg   |  2 +-
 tests/xmconfigdata/test-no-source-cdrom.cfg|  2 +-
 tests/xmconfigdata/test-paravirt-net-e1000.cfg |  2 +-
 tests/xmconfigdata/test-paravirt-net-vifname.cfg   |  2 +-
 .../test-paravirt-new-pvfb-vncdisplay.cfg  |  2 +-
 tests/xmconfigdata/test-paravirt-new-pvfb.cfg  |  2 +-
 .../test-paravirt-old-pvfb-vncdisplay.cfg  |  2 +-
 tests/xmconfigdata/test-paravirt-old-pvfb.cfg  |  2 +-
 tests/xmconfigdata/test-paravirt-vcpu.cfg  |  2 +-
 tests/xmconfigdata/test-pci-devs.cfg   |  2 +-
 35 files changed, 70 insertions(+), 59 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 071802d..215dfdc 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -2293,54 +2293,63 @@ xenFormatXMEmulatedHardware(virConfPtr conf, 
virDomainDefPtr def)
 }
 
 
-/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
-   either 32, or 64 on a platform where long is big enough.  */
-verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
-
-virConfPtr
-xenFormatXM(virConnectPtr conn,
-virDomainDefPtr def,
-int xendConfigVersion)
+int xenFormatConfigCommon(virConfPtr conf, virDomainDefPtr def,
+  virConnectPtr conn, int xendConfigVersion)
 {
-virConfPtr conf = NULL;
-
-if (!(conf = virConfNew()))
-goto cleanup;
 
 if (xenFormatXMGeneralMeta(conf, def)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMMem(conf, def)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMCPUFeatures(conf, def, xendConfigVersion)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMOS(conf, def, xendConfigVersion)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMTimeOffset(conf, def, xendConfigVersion)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMEventActions(conf, def)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMEmulatedHardware(conf, def)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMVfb(conf, def, xendConfigVersion)  0)
-goto cleanup;
-
-if (xenFormatXMDomainDisks(conf, def, xendConfigVersion)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMVif(conf, conn, def, xendConfigVersion)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMPCI(conf, def)  0)
-goto cleanup;
+return -1;
 
 if (xenFormatXMCharDev(conf, def)  0)
+return -1;
+
+return 0;
+}
+/* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
+   either 32, or 64 on a platform where long is big enough.  */
+verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
+
+virConfPtr
+xenFormatXM(virConnectPtr conn,
+virDomainDefPtr def,
+int xendConfigVersion)
+{
+virConfPtr conf = NULL;
+
+if (!(conf = virConfNew()))
+goto cleanup;
+
+if (xenFormatConfigCommon(conf, def, conn, xendConfigVersion)  0)
+goto cleanup;
+
+if (xenFormatXMDomainDisks(conf, def, xendConfigVersion)  0)
 goto cleanup;
 
 return conf;
diff --git a/src/xenxs/xen_xm.h b/src/xenxs/xen_xm.h
index 5292396..c48fa41 100644
--- a/src/xenxs/xen_xm.h
+++ b/src/xenxs/xen_xm.h
@@ -35,7 +35,9 @@ virConfPtr 

[libvirt] [PATCH V3 11/24] src/xenxs:Refactor code parsing general config

2014-08-06 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
   xenParseXMGeneralMeta(virConfPtr conf, ...);
which parses general metadata instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 58 --
 1 file changed, 35 insertions(+), 23 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 9eabfa4..32c6d8c 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1131,38 +1131,28 @@ xenParseXMEmulatedDevices(virConfPtr conf, 
virDomainDefPtr def)
 return 0;
 }
 
-/*
- * Turn a config record into a lump of XML describing the
- * domain, suitable for later feeding for virDomainCreateXML
- */
-virDomainDefPtr
-xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
+
+static int
+xenParseXMGeneralMeta(virConfPtr conf, virDomainDefPtr def,
+  virCapsPtr caps)
 {
+
+const char *defaultMachine;
 const char *str;
 int hvm = 0;
-virDomainDefPtr def = NULL;
-size_t i;
-const char *defaultMachine;
-
-if (VIR_ALLOC(def)  0)
-return NULL;
-
-def-virtType = VIR_DOMAIN_VIRT_XEN;
-def-id = -1;
 
 if (xenXMConfigCopyString(conf, name, def-name)  0)
-goto cleanup;
-if (xenXMConfigGetUUID(conf, uuid, def-uuid)  0)
-goto cleanup;
+return -1;
 
+if (xenXMConfigGetUUID(conf, uuid, def-uuid)  0)
+return -1;
 
 if ((xenXMConfigGetString(conf, builder, str, linux) == 0) 
 STREQ(str, hvm))
 hvm = 1;
 
 if (VIR_STRDUP(def-os.type, hvm ? hvm : xen)  0)
-goto cleanup;
+return -1;
 
 def-os.arch =
 virCapabilitiesDefaultGuestArch(caps,
@@ -1172,7 +1162,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(no supported architecture for os type '%s'),
def-os.type);
-goto cleanup;
+return -1;
 }
 
 defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
@@ -1181,10 +1171,32 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 
virDomainVirtTypeToString(def-virtType));
 if (defaultMachine != NULL) {
 if (VIR_STRDUP(def-os.machine, defaultMachine)  0)
-goto cleanup;
+return -1;
 }
 
-if (hvm) {
+return 0;
+}
+/*
+ * Turn a config record into a lump of XML describing the
+ * domain, suitable for later feeding for virDomainCreateXML
+ */
+virDomainDefPtr
+xenParseXM(virConfPtr conf, int xendConfigVersion,
+   virCapsPtr caps)
+{
+virDomainDefPtr def = NULL;
+size_t i;
+
+if (VIR_ALLOC(def)  0)
+return NULL;
+
+def-virtType = VIR_DOMAIN_VIRT_XEN;
+def-id = -1;
+
+if (xenParseXMGeneralMeta(conf, def, caps)  0)
+goto cleanup;
+
+if (STREQ(def-os.type, hvm)) {
 const char *boot;
 if (xenXMConfigCopyString(conf, kernel, def-os.loader)  0)
 goto cleanup;
-- 
1.8.4.5

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


[libvirt] [PATCH v2 00/25] Refactor the xm parser

2014-07-26 Thread David Kiarie
Kiarie Kahurani (25):
  src/xenxs:Refactor code parsing memory config
  src/xenxs:Refactor code parsing event actions config
  src/xenxs:Refactor code parsing virtual time controls config
  src/xenxs:Refactor code parsing PCI devices config
  src/xenxs:Refactor code parsing CPU features config
  src/xenxs:Refactor code parsing disk config
  src/xenxs:Refactor code parsing Vfb config
  src/xenxs:Refactor code parsing OS related config
  src/xenxs:Refactor code parsing Char device related config
  src/xenxs:Refactor code parsing Vif
  src/xenxs:Refactor code parsing emulated hardware config
  src/xenxs:Refactor code parsing general config
  src/xenxs:Organise functions to avoid duplication
  src/xenxs:Refactor code formating general config
  src/xenxs:Refactor code formating memory config
  src/xenxs:Reafactor code formating virtual time config
  src/xenxs:Refactor code formating event actions config
  src/xenxs:Refactor code formating Vif config
  src/xenxs:Refactor code formating Vfb config
  src/xenxs:Refactor code formating CPU config and features
  src/xenxs:Refactor code formating disk list
  src/xenxs:Refactor code formating emulated devices config
  src/xenxs:Refactor char devices formating code
  src/xenxs:Refactor code formating OS config
  src/xenxs:Export code to be reused

 src/xenxs/xen_xm.c | 2009 
 src/xenxs/xen_xm.h |6 +-
 tests/xmconfigdata/test-escape-paths.cfg   |   14 +-
 tests/xmconfigdata/test-fullvirt-force-hpet.cfg|   12 +-
 tests/xmconfigdata/test-fullvirt-force-nohpet.cfg  |   12 +-
 tests/xmconfigdata/test-fullvirt-localtime.cfg |   12 +-
 tests/xmconfigdata/test-fullvirt-net-ioemu.cfg |   12 +-
 tests/xmconfigdata/test-fullvirt-net-netfront.cfg  |   12 +-
 tests/xmconfigdata/test-fullvirt-new-cdrom.cfg |   12 +-
 tests/xmconfigdata/test-fullvirt-old-cdrom.cfg |   12 +-
 tests/xmconfigdata/test-fullvirt-parallel-tcp.cfg  |   12 +-
 .../test-fullvirt-serial-dev-2-ports.cfg   |   12 +-
 .../test-fullvirt-serial-dev-2nd-port.cfg  |   12 +-
 tests/xmconfigdata/test-fullvirt-serial-file.cfg   |   12 +-
 tests/xmconfigdata/test-fullvirt-serial-null.cfg   |   12 +-
 tests/xmconfigdata/test-fullvirt-serial-pipe.cfg   |   12 +-
 tests/xmconfigdata/test-fullvirt-serial-pty.cfg|   12 +-
 tests/xmconfigdata/test-fullvirt-serial-stdio.cfg  |   12 +-
 .../test-fullvirt-serial-tcp-telnet.cfg|   12 +-
 tests/xmconfigdata/test-fullvirt-serial-tcp.cfg|   12 +-
 tests/xmconfigdata/test-fullvirt-serial-udp.cfg|   12 +-
 tests/xmconfigdata/test-fullvirt-serial-unix.cfg   |   12 +-
 tests/xmconfigdata/test-fullvirt-sound.cfg |   14 +-
 tests/xmconfigdata/test-fullvirt-usbmouse.cfg  |   12 +-
 tests/xmconfigdata/test-fullvirt-usbtablet.cfg |   12 +-
 tests/xmconfigdata/test-fullvirt-utc.cfg   |   12 +-
 tests/xmconfigdata/test-no-source-cdrom.cfg|   12 +-
 tests/xmconfigdata/test-pci-devs.cfg   |   12 +-
 28 files changed, 1326 insertions(+), 1005 deletions(-)

This patches try to refactor the code for the xen-xm parser since 
much of the code can be reused when writing the xen-xl parser.

changes since Prepost
   I have finished refactoring all the code
   Fixed numerous memory leaks
   I have also changed the layout of the tests since they depend
   on the layout of the code which I have changed

I would also like to hear some comment on what configs I should 
support in the new xen-xl parser.

Regards,
David

-- 
1.8.4.5

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


[libvirt] [PATCH v2 02/25] src/xenxs:Refactor code parsing event actions config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

Introduce function
 xenParseXMEventActions(virConfPtr conf,..);
which parses events config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 65 +++---
 1 file changed, 38 insertions(+), 27 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 5e26e5e..d0a166d 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -266,6 +266,42 @@ int xenParseXMMem(virConfPtr conf, virDomainDefPtr def)
  * Turn a config record into a lump of XML describing the
  * domain, suitable for later feeding for virDomainCreateXML
  */
+static
+int xenParseXMEventsActions(virConfPtr conf, virDomainDefPtr def)
+{
+const char *str;
+
+if (xenXMConfigGetString(conf, on_poweroff, str, destroy)  0)
+return -1;
+
+if ((def-onPoweroff = virDomainLifecycleTypeFromString(str))  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected value %s for on_poweroff), str);
+return -1;
+}
+
+if (xenXMConfigGetString(conf, on_reboot, str, restart)  0)
+return -1;
+
+if ((def-onReboot = virDomainLifecycleTypeFromString(str))  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected value %s for on_reboot), str);
+return -1;
+}
+
+if (xenXMConfigGetString(conf, on_crash, str, restart)  0)
+return -1;
+
+if ((def-onCrash = virDomainLifecycleCrashTypeFromString(str))  0) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(unexpected value %s for on_crash), str);
+return -1;
+}
+
+return 0;
+}
+
+
 virDomainDefPtr
 xenParseXM(virConfPtr conf, int xendConfigVersion,
virCapsPtr caps)
@@ -379,6 +415,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 
 if (xenParseXMMem(conf, def)  0)
 goto cleanup;
+if (xenParseXMEventsActions(conf, def)  0)
+goto cleanup;
 if (xenXMConfigGetULong(conf, vcpus, count, 1)  0 ||
 MAX_VIRT_CPUS  count)
 goto cleanup;
@@ -391,33 +429,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 goto cleanup;
 if (str  (virBitmapParse(str, 0, def-cpumask, 4096)  0))
 goto cleanup;
-
-if (xenXMConfigGetString(conf, on_poweroff, str, destroy)  0)
-goto cleanup;
-if ((def-onPoweroff = virDomainLifecycleTypeFromString(str))  0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected value %s for on_poweroff), str);
-goto cleanup;
-}
-
-if (xenXMConfigGetString(conf, on_reboot, str, restart)  0)
-goto cleanup;
-if ((def-onReboot = virDomainLifecycleTypeFromString(str))  0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected value %s for on_reboot), str);
-goto cleanup;
-}
-
-if (xenXMConfigGetString(conf, on_crash, str, restart)  0)
-goto cleanup;
-if ((def-onCrash = virDomainLifecycleCrashTypeFromString(str))  0) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(unexpected value %s for on_crash), str);
-goto cleanup;
-}
-
-
-
 if (hvm) {
 if (xenXMConfigGetBool(conf, pae, val, 0)  0)
 goto cleanup;
-- 
1.8.4.5

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


[libvirt] [PATCH v2 03/25] src/xenxs:Refactor code parsing virtual time controls config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

Introduce function
 xenParseXMTimeOffset(virConfPtr conf,..);
which parses virtual config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 73 --
 1 file changed, 44 insertions(+), 29 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index d0a166d..c816198 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -266,6 +266,48 @@ int xenParseXMMem(virConfPtr conf, virDomainDefPtr def)
  * Turn a config record into a lump of XML describing the
  * domain, suitable for later feeding for virDomainCreateXML
  */
+
+
+static
+int xenParseXMTimeOffset(virConfPtr conf, virDomainDefPtr def,
+ int xendConfigVersion)
+{
+int vmlocaltime;
+
+if (xenXMConfigGetBool(conf, localtime, vmlocaltime, 0)  0)
+return -1;
+
+if (STREQ(def-os.type, hvm)) {
+/* only managed HVM domains since 3.1.0 have persistent rtc_timeoffset 
*/
+if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {
+if (vmlocaltime)
+def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
+else
+def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
+def-clock.data.utc_reset = true;
+} else {
+unsigned long rtc_timeoffset;
+def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_VARIABLE;
+if (xenXMConfigGetULong(conf, rtc_timeoffset, rtc_timeoffset, 
0)  0)
+return -1;
+
+def-clock.data.variable.adjustment = (int)rtc_timeoffset;
+def-clock.data.variable.basis = vmlocaltime ?
+VIR_DOMAIN_CLOCK_BASIS_LOCALTIME :
+VIR_DOMAIN_CLOCK_BASIS_UTC;
+}
+} else {
+/* PV domains do not have an emulated RTC and the offset is fixed. */
+def-clock.offset = vmlocaltime ?
+VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME :
+VIR_DOMAIN_CLOCK_OFFSET_UTC;
+def-clock.data.utc_reset = true;
+} /* !hvm */
+
+return 0;
+}
+
+
 static
 int xenParseXMEventsActions(virConfPtr conf, virDomainDefPtr def)
 {
@@ -317,7 +359,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virDomainHostdevDefPtr hostdev = NULL;
 size_t i;
 const char *defaultMachine;
-int vmlocaltime = 0;
 unsigned long count;
 char *script = NULL;
 char *listenAddr = NULL;
@@ -468,35 +509,9 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 def-clock.timers[0] = timer;
 }
 }
-if (xenXMConfigGetBool(conf, localtime, vmlocaltime, 0)  0)
-goto cleanup;
-
-if (hvm) {
-/* only managed HVM domains since 3.1.0 have persistent rtc_timeoffset 
*/
-if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {
-if (vmlocaltime)
-def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
-else
-def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_UTC;
-def-clock.data.utc_reset = true;
-} else {
-unsigned long rtc_timeoffset;
-def-clock.offset = VIR_DOMAIN_CLOCK_OFFSET_VARIABLE;
-if (xenXMConfigGetULong(conf, rtc_timeoffset, rtc_timeoffset, 
0)  0)
-goto cleanup;
-def-clock.data.variable.adjustment = (int)rtc_timeoffset;
-def-clock.data.variable.basis = vmlocaltime ?
-VIR_DOMAIN_CLOCK_BASIS_LOCALTIME :
-VIR_DOMAIN_CLOCK_BASIS_UTC;
-}
-} else {
-/* PV domains do not have an emulated RTC and the offset is fixed. */
-def-clock.offset = vmlocaltime ?
-VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME :
-VIR_DOMAIN_CLOCK_OFFSET_UTC;
-def-clock.data.utc_reset = true;
-} /* !hvm */
 
+if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
+goto cleanup;
 if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
 goto cleanup;
 
-- 
1.8.4.5

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


[libvirt] [PATCH v2 01/25] src/xenxs:Refactor code parsing memory config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

Introduce function
 xenParseXMMem(virConfPtr conf,..);
which parses memory config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index f6492b5..5e26e5e 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -244,6 +244,23 @@ xenXMConfigGetUUID(virConfPtr conf, const char *name, 
unsigned char *uuid)
 return 0;
 }
 
+
+static
+int xenParseXMMem(virConfPtr conf, virDomainDefPtr def)
+{
+if (xenXMConfigGetULongLong(conf, memory, def-mem.cur_balloon,
+MIN_XEN_GUEST_SIZE * 2)  0)
+return -1;
+
+if (xenXMConfigGetULongLong(conf, maxmem, def-mem.max_balloon,
+def-mem.cur_balloon)  0)
+return -1;
+
+def-mem.cur_balloon *= 1024;
+def-mem.max_balloon *= 1024;
+
+return 0;
+}
 #define MAX_VFB 1024
 /*
  * Turn a config record into a lump of XML describing the
@@ -360,17 +377,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 }
 }
 
-if (xenXMConfigGetULongLong(conf, memory, def-mem.cur_balloon,
-MIN_XEN_GUEST_SIZE * 2)  0)
+if (xenParseXMMem(conf, def)  0)
 goto cleanup;
-
-if (xenXMConfigGetULongLong(conf, maxmem, def-mem.max_balloon,
-def-mem.cur_balloon)  0)
-goto cleanup;
-
-def-mem.cur_balloon *= 1024;
-def-mem.max_balloon *= 1024;
-
 if (xenXMConfigGetULong(conf, vcpus, count, 1)  0 ||
 MAX_VIRT_CPUS  count)
 goto cleanup;
-- 
1.8.4.5

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


[libvirt] [PATCH v2 14/25] src/xenxs:Refactor code formating general config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
 xenFormatXMGeneralMeta(virConfPtr conf, ...);
which formats UUID and name instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 289f0ad..ae474a4 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1655,6 +1655,20 @@ xenFormatXMPCI(virConfPtr conf,
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
either 32, or 64 on a platform where long is big enough.  */
 verify(MAX_VIRT_CPUS = sizeof(1UL) * CHAR_BIT);
+static
+int xenFormatXMGeneralMeta(virConfPtr conf, virDomainDefPtr def)
+{
+char uuid[VIR_UUID_STRING_BUFLEN];
+
+if (xenXMConfigSetString(conf, name, def-name)  0)
+return -1;
+
+virUUIDFormat(def-uuid, uuid);
+if (xenXMConfigSetString(conf, uuid, uuid)  0)
+return -1;
+
+return 0;
+}
 
 virConfPtr xenFormatXM(virConnectPtr conn,
virDomainDefPtr def,
@@ -1665,21 +1679,13 @@ virConfPtr xenFormatXM(virConnectPtr conn,
 size_t i;
 char *cpus = NULL;
 const char *lifecycle;
-char uuid[VIR_UUID_STRING_BUFLEN];
 virConfValuePtr diskVal = NULL;
 virConfValuePtr netVal = NULL;
 
 if (!(conf = virConfNew()))
 goto cleanup;
-
-
-if (xenXMConfigSetString(conf, name, def-name)  0)
+if (xenFormatXMGeneralMeta(conf, def)  0)
 goto cleanup;
-
-virUUIDFormat(def-uuid, uuid);
-if (xenXMConfigSetString(conf, uuid, uuid)  0)
-goto cleanup;
-
 if (xenXMConfigSetInt(conf, maxmem,
   VIR_DIV_UP(def-mem.max_balloon, 1024))  0)
 goto cleanup;
-- 
1.8.4.5

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


[libvirt] [PATCH v2 10/25] src/xenxs:Refactor code parsing Vif

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMVif(virConfPtr conf, ...)
which parses char Vif config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 161 -
 1 file changed, 86 insertions(+), 75 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 48b68fb..e6a1b7d 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1011,73 +1011,13 @@ int xenParseXMCharDev(virConfPtr conf, virDomainDefPtr 
def)
 }
 
 
-virDomainDefPtr
-xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
+static
+int xenParseXMVif(virConfPtr conf, virDomainDefPtr def)
 {
-const char *str;
-int hvm = 0;
-virConfValuePtr list;
-virDomainDefPtr def = NULL;
-virDomainDiskDefPtr disk = NULL;
-virDomainNetDefPtr net = NULL;
-const char *defaultMachine;
 char *script = NULL;
+virDomainNetDefPtr net = NULL;
+virConfValuePtr list = virConfGetValue(conf, vif);
 
-if (VIR_ALLOC(def)  0)
-return NULL;
-
-def-virtType = VIR_DOMAIN_VIRT_XEN;
-def-id = -1;
-
-if (xenXMConfigCopyString(conf, name, def-name)  0)
-goto cleanup;
-if (xenXMConfigGetUUID(conf, uuid, def-uuid)  0)
-goto cleanup;
-
-
-if ((xenXMConfigGetString(conf, builder, str, linux) == 0) 
-STREQ(str, hvm))
-hvm = 1;
-
-if (VIR_STRDUP(def-os.type, hvm ? hvm : xen)  0)
-goto cleanup;
-
-def-os.arch =
-virCapabilitiesDefaultGuestArch(caps,
-def-os.type,
-
virDomainVirtTypeToString(def-virtType));
-if (!def-os.arch) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(no supported architecture for os type '%s'),
-   def-os.type);
-goto cleanup;
-}
-
-defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
-def-os.type,
-def-os.arch,
-
virDomainVirtTypeToString(def-virtType));
-if (defaultMachine != NULL) {
-if (VIR_STRDUP(def-os.machine, defaultMachine)  0)
-goto cleanup;
-}
-
-if (xenParseXMOS(conf, def)  0)
-goto cleanup;
-if (xenParseXMMem(conf, def)  0)
-goto cleanup;
-if (xenParseXMEventsActions(conf, def)  0)
-goto cleanup;
-if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
-goto cleanup;
-if (xenParseXMCPUFeatures(conf, def)  0)
-goto cleanup;
-if (xenParseXMDisk(conf, def, xendConfigVersion)  0)
-goto cleanup;
-if (xenParseXMVfb(conf, def, xendConfigVersion)  0)
-goto cleanup;
-list = virConfGetValue(conf, vif);
 if (list  list-type == VIR_CONF_LIST) {
 list = list-list;
 while (list) {
@@ -1098,7 +1038,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 
 if ((list-type != VIR_CONF_STRING) || (list-str == NULL))
 goto skipnic;
-
 key = list-str;
 while (key) {
 char *data;
@@ -1107,7 +1046,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 if (!(data = strchr(key, '=')))
 goto skipnic;
 data++;
-
 if (STRPREFIX(key, mac=)) {
 int len = nextkey ? (nextkey - data) : sizeof(mac) - 1;
 if (virStrncpy(mac, data, len, sizeof(mac)) == NULL) {
@@ -1133,14 +1071,16 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 int len = nextkey ? (nextkey - data) : sizeof(model) - 1;
 if (virStrncpy(model, data, len, sizeof(model)) == NULL) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(Model %s too big for destination), 
data);
+   _(Model %s too big for destination),
+   data);
 goto skipnic;
 }
 } else if (STRPREFIX(key, type=)) {
 int len = nextkey ? (nextkey - data) : sizeof(type) - 1;
 if (virStrncpy(type, data, len, sizeof(type)) == NULL) {
 virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(Type %s too big for destination), 
data);
+   _(Type %s too big for destination),
+   data);
 goto skipnic;
 }
 } else if (STRPREFIX(key, vifname=)) {
@@ -1155,7 +1095,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 int len = nextkey ? (nextkey - data) : sizeof(ip) - 1;
   

[libvirt] [PATCH v2 06/25] src/xenxs:Refactor code parsing disk config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

Introduce function
 xenParseXMDisk(virConfPtr conf,..);
which parses XM disk config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 302 -
 1 file changed, 157 insertions(+), 145 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 66d7b44..2c36c1b 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -507,126 +507,15 @@ int xenParseXMCPUFeatures(virConfPtr conf, 
virDomainDefPtr def)
 }
 
 
-virDomainDefPtr
-xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
+static
+int xenParseXMDisk(virConfPtr conf, virDomainDefPtr def,
+   int xendConfigVersion)
 {
-const char *str;
-int hvm = 0;
-int val;
-virConfValuePtr list;
-virDomainDefPtr def = NULL;
+const char *str = NULL;
 virDomainDiskDefPtr disk = NULL;
-virDomainNetDefPtr net = NULL;
-virDomainGraphicsDefPtr graphics = NULL;
-size_t i;
-const char *defaultMachine;
-char *script = NULL;
-char *listenAddr = NULL;
-
-if (VIR_ALLOC(def)  0)
-return NULL;
-
-def-virtType = VIR_DOMAIN_VIRT_XEN;
-def-id = -1;
-
-if (xenXMConfigCopyString(conf, name, def-name)  0)
-goto cleanup;
-if (xenXMConfigGetUUID(conf, uuid, def-uuid)  0)
-goto cleanup;
-
-
-if ((xenXMConfigGetString(conf, builder, str, linux) == 0) 
-STREQ(str, hvm))
-hvm = 1;
-
-if (VIR_STRDUP(def-os.type, hvm ? hvm : xen)  0)
-goto cleanup;
-
-def-os.arch =
-virCapabilitiesDefaultGuestArch(caps,
-def-os.type,
-
virDomainVirtTypeToString(def-virtType));
-if (!def-os.arch) {
-virReportError(VIR_ERR_INTERNAL_ERROR,
-   _(no supported architecture for os type '%s'),
-   def-os.type);
-goto cleanup;
-}
-
-defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
-def-os.type,
-def-os.arch,
-
virDomainVirtTypeToString(def-virtType));
-if (defaultMachine != NULL) {
-if (VIR_STRDUP(def-os.machine, defaultMachine)  0)
-goto cleanup;
-}
-
-if (hvm) {
-const char *boot;
-if (xenXMConfigCopyString(conf, kernel, def-os.loader)  0)
-goto cleanup;
-
-if (xenXMConfigGetString(conf, boot, boot, c)  0)
-goto cleanup;
-
-for (i = 0; i  VIR_DOMAIN_BOOT_LAST  boot[i]; i++) {
-switch (*boot) {
-case 'a':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_FLOPPY;
-break;
-case 'd':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_CDROM;
-break;
-case 'n':
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_NET;
-break;
-case 'c':
-default:
-def-os.bootDevs[i] = VIR_DOMAIN_BOOT_DISK;
-break;
-}
-def-os.nBootDevs++;
-}
-} else {
-const char *extra, *root;
-
-if (xenXMConfigCopyStringOpt(conf, bootloader, def-os.bootloader) 
 0)
-goto cleanup;
-if (xenXMConfigCopyStringOpt(conf, bootargs, 
def-os.bootloaderArgs)  0)
-goto cleanup;
-
-if (xenXMConfigCopyStringOpt(conf, kernel, def-os.kernel)  0)
-goto cleanup;
-if (xenXMConfigCopyStringOpt(conf, ramdisk, def-os.initrd)  0)
-goto cleanup;
-if (xenXMConfigGetString(conf, extra, extra, NULL)  0)
-goto cleanup;
-if (xenXMConfigGetString(conf, root, root, NULL)  0)
-goto cleanup;
-
-if (root) {
-if (virAsprintf(def-os.cmdline, root=%s %s, root, extra)  0)
-goto cleanup;
-} else {
-if (VIR_STRDUP(def-os.cmdline, extra)  0)
-goto cleanup;
-}
-}
-
-if (xenParseXMMem(conf, def)  0)
-goto cleanup;
-if (xenParseXMEventsActions(conf, def)  0)
-goto cleanup;
-if (xenParseXMTimeOffset(conf, def, xendConfigVersion)  0)
-goto cleanup;
-if (xenParseXMCPUFeatures(conf, def)  0)
-goto cleanup;
-if (xenXMConfigCopyStringOpt(conf, device_model, def-emulator)  0)
-goto cleanup;
+int hvm = STREQ(def-os.type, hvm);
+virConfValuePtr list = virConfGetValue(conf, disk);
 
-list = virConfGetValue(conf, disk);
 if (list  list-type == VIR_CONF_LIST) {
 list = list-list;
 while (list) {
@@ -638,9 +527,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 if ((list-type != VIR_CONF_STRING) || (list-str == NULL))
 goto skipdisk;
   

[libvirt] [PATCH v2 07/25] src/xenxs:Refactor code parsing Vfb config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMVfb(virConfPtr conf,...)
which parses Vfb config

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 296 -
 1 file changed, 154 insertions(+), 142 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 2c36c1b..38434be 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -695,6 +695,158 @@ int xenParseXMDisk(virConfPtr conf, virDomainDefPtr def,
 return 0;
 }
 
+static
+int xenParseXMVfb(virConfPtr conf, virDomainDefPtr def,
+  int xendConfigVersion)
+{
+int val;
+char *listenAddr = NULL;
+//const char *str = NULL;
+int hvm = STREQ(def-os.type, hvm);
+virConfValuePtr list;
+virDomainGraphicsDefPtr graphics = NULL;
+
+if (hvm || xendConfigVersion  XEND_CONFIG_VERSION_3_0_4) {
+if (xenXMConfigGetBool(conf, vnc, val, 0)  0)
+goto cleanup;
+if (val) {
+if (VIR_ALLOC(graphics)  0)
+goto cleanup;
+graphics-type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
+if (xenXMConfigGetBool(conf, vncunused, val, 1)  0)
+goto cleanup;
+graphics-data.vnc.autoport = val ? 1 : 0;
+if (!graphics-data.vnc.autoport) {
+unsigned long vncdisplay;
+if (xenXMConfigGetULong(conf, vncdisplay, vncdisplay, 0)  
0)
+goto cleanup;
+graphics-data.vnc.port = (int)vncdisplay + 5900;
+}
+
+if (xenXMConfigCopyStringOpt(conf, vnclisten, listenAddr)  0)
+goto cleanup;
+if (listenAddr 
+virDomainGraphicsListenSetAddress(graphics, 0, listenAddr,
+  -1, true)  0) {
+   goto cleanup;
+}
+
+VIR_FREE(listenAddr);
+if (xenXMConfigCopyStringOpt(conf, vncpasswd, 
graphics-data.vnc.auth.passwd)  0)
+goto cleanup;
+if (xenXMConfigCopyStringOpt(conf, keymap, 
graphics-data.vnc.keymap)  0)
+goto cleanup;
+if (VIR_ALLOC_N(def-graphics, 1)  0)
+goto cleanup;
+def-graphics[0] = graphics;
+def-ngraphics = 1;
+graphics = NULL;
+} else {
+if (xenXMConfigGetBool(conf, sdl, val, 0)  0)
+goto cleanup;
+if (val) {
+if (VIR_ALLOC(graphics)  0)
+goto cleanup;
+graphics-type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
+if (xenXMConfigCopyStringOpt(conf, display, 
graphics-data.sdl.display)  0)
+goto cleanup;
+if (xenXMConfigCopyStringOpt(conf, xauthority, 
graphics-data.sdl.xauth)  0)
+goto cleanup;
+if (VIR_ALLOC_N(def-graphics, 1)  0)
+goto cleanup;
+def-graphics[0] = graphics;
+def-ngraphics = 1;
+graphics = NULL;
+}
+}
+}
+
+if (!hvm  def-graphics == NULL) { /* New PV guests use this format */
+list = virConfGetValue(conf, vfb);
+if (list  list-type == VIR_CONF_LIST 
+list-list  list-list-type == VIR_CONF_STRING 
+list-list-str) {
+char vfb[MAX_VFB];
+char *key = vfb;
+
+if (virStrcpyStatic(vfb, list-list-str) == NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(VFB %s too big for destination),
+   list-list-str);
+goto cleanup;
+}
+
+if (VIR_ALLOC(graphics)  0)
+goto cleanup;
+if (strstr(key, type=sdl))
+graphics-type = VIR_DOMAIN_GRAPHICS_TYPE_SDL;
+else
+graphics-type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
+while (key) {
+char *nextkey = strchr(key, ',');
+char *end = nextkey;
+if (nextkey) {
+*end = '\0';
+nextkey++;
+}
+
+if (!strchr(key, '='))
+break;
+if (graphics-type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
+if (STRPREFIX(key, vncunused=)) {
+if (STREQ(key + 10, 1))
+graphics-data.vnc.autoport = true;
+} else if (STRPREFIX(key, vnclisten=)) {
+if (virDomainGraphicsListenSetAddress(graphics, 0, 
key+10,
+  -1, true)  0)
+goto cleanup;
+} else if (STRPREFIX(key, vncpasswd=)) {
+if (VIR_STRDUP(graphics-data.vnc.auth.passwd, key + 
10)  0)
+goto 

[libvirt] [PATCH v2 09/25] src/xenxs:Refactor code parsing Char device related config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMCharDev(virConfPtr conf,...)
which parses char devices config instead
and also got rid of some unused variables
signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 176 -
 1 file changed, 92 insertions(+), 84 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 62c7e62..48b68fb 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -921,6 +921,96 @@ int xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
 }
 
 
+static
+int xenParseXMCharDev(virConfPtr conf, virDomainDefPtr def)
+{
+const char *str;
+virConfValuePtr value = NULL;
+virDomainChrDefPtr chr = NULL;
+
+if (STREQ(def-os.type, hvm)) {
+if (xenXMConfigGetString(conf, parallel, str, NULL)  0)
+goto cleanup;
+if (str  STRNEQ(str, none) 
+!(chr = xenParseSxprChar(str, NULL)))
+goto cleanup;
+if (chr) {
+if (VIR_ALLOC_N(def-parallels, 1)  0) {
+goto cleanup;
+}
+
+chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
+chr-target.port = 0;
+def-parallels[0] = chr;
+def-nparallels++;
+chr = NULL;
+}
+
+/* Try to get the list of values to support multiple serial ports */
+value = virConfGetValue(conf, serial);
+if (value  value-type == VIR_CONF_LIST) {
+int portnum = -1;
+
+value = value-list;
+while (value) {
+char *port = NULL;
+
+if ((value-type != VIR_CONF_STRING) || (value-str == NULL))
+goto cleanup;
+port = value-str;
+portnum++;
+if (STREQ(port, none)) {
+value = value-next;
+continue;
+}
+
+if (!(chr = xenParseSxprChar(port, NULL)))
+goto cleanup;
+chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
+chr-target.port = portnum;
+if (VIR_APPEND_ELEMENT(def-serials, def-nserials, chr)  0) {
+goto cleanup;
+}
+
+value = value-next;
+}
+} else {
+/* If domain is not using multiple serial ports we parse data old 
way */
+if (xenXMConfigGetString(conf, serial, str, NULL)  0)
+goto cleanup;
+if (str  STRNEQ(str, none) 
+!(chr = xenParseSxprChar(str, NULL)))
+goto cleanup;
+if (chr) {
+if (VIR_ALLOC_N(def-serials, 1)  0) {
+virDomainChrDefFree(chr);
+goto cleanup;
+}
+chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
+chr-target.port = 0;
+def-serials[0] = chr;
+def-nserials++;
+}
+}
+} else {
+if (VIR_ALLOC_N(def-consoles, 1)  0)
+goto cleanup;
+def-nconsoles = 1;
+if (!(def-consoles[0] = xenParseSxprChar(pty, NULL)))
+goto cleanup;
+def-consoles[0]-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE;
+def-consoles[0]-target.port = 0;
+def-consoles[0]-targetType = VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
+}
+
+return 0;
+
+ cleanup:
+virDomainChrDefFree(chr);
+return -1;
+}
+
+
 virDomainDefPtr
 xenParseXM(virConfPtr conf, int xendConfigVersion,
virCapsPtr caps)
@@ -933,7 +1023,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virDomainNetDefPtr net = NULL;
 const char *defaultMachine;
 char *script = NULL;
-char *listenAddr = NULL;
 
 if (VIR_ALLOC(def)  0)
 return NULL;
@@ -1159,88 +1248,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 }
 }
 
-if (hvm) {
-virDomainChrDefPtr chr = NULL;
-
-if (xenXMConfigGetString(conf, parallel, str, NULL)  0)
-goto cleanup;
-if (str  STRNEQ(str, none) 
-!(chr = xenParseSxprChar(str, NULL)))
-goto cleanup;
-
-if (chr) {
-if (VIR_ALLOC_N(def-parallels, 1)  0) {
-virDomainChrDefFree(chr);
-goto cleanup;
-}
-chr-deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL;
-chr-target.port = 0;
-def-parallels[0] = chr;
-def-nparallels++;
-chr = NULL;
-}
-
-/* Try to get the list of values to support multiple serial ports */
-list = virConfGetValue(conf, serial);
-if (list  list-type == VIR_CONF_LIST) {
-int portnum = -1;
-
-list = list-list;
-while (list) {
-char *port = NULL;
-
-if ((list-type != VIR_CONF_STRING) 

[libvirt] [PATCH v2 15/25] src/xenxs:Refactor code formating memory config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
 xenFormatXMMem(virConfPtr conf, ...);
which formats mem and max-mem instead.This could be joined into
XenFormatXMGeneralMeta but I separated them for consistency

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index ae474a4..78dc949 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1670,6 +1670,22 @@ int xenFormatXMGeneralMeta(virConfPtr conf, 
virDomainDefPtr def)
 return 0;
 }
 
+
+static
+int xenFormatXMMem(virConfPtr conf, virDomainDefPtr def)
+{
+if (xenXMConfigSetInt(conf, maxmem,
+  VIR_DIV_UP(def-mem.max_balloon, 1024))  0)
+return -1;
+
+if (xenXMConfigSetInt(conf, memory,
+  VIR_DIV_UP(def-mem.cur_balloon, 1024))  0)
+return -1;
+
+return 0;
+}
+
+
 virConfPtr xenFormatXM(virConnectPtr conn,
virDomainDefPtr def,
int xendConfigVersion)
@@ -1686,14 +1702,8 @@ virConfPtr xenFormatXM(virConnectPtr conn,
 goto cleanup;
 if (xenFormatXMGeneralMeta(conf, def)  0)
 goto cleanup;
-if (xenXMConfigSetInt(conf, maxmem,
-  VIR_DIV_UP(def-mem.max_balloon, 1024))  0)
+if (xenFormatXMMem(conf, def)  0)
 goto cleanup;
-
-if (xenXMConfigSetInt(conf, memory,
-  VIR_DIV_UP(def-mem.cur_balloon, 1024))  0)
-goto cleanup;
-
 if (xenXMConfigSetInt(conf, vcpus, def-maxvcpus)  0)
 goto cleanup;
 /* Computing the vcpu_avail bitmask works because MAX_VIRT_CPUS is
-- 
1.8.4.5

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


[libvirt] [PATCH v2 12/25] src/xenxs:Refactor code parsing general config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMGeneralMeta(virConfPtr conf,..)
which parses features like hvm= ?, builder and sets
the default machine type incase its not specified

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 43 ---
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 5959892..157d7d3 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1209,30 +1209,28 @@ int xenParseXMEmulatedDevices(virConfPtr conf, 
virDomainDefPtr def)
 }
 
 
-virDomainDefPtr
-xenParseXM(virConfPtr conf, int xendConfigVersion,
-   virCapsPtr caps)
+static
+int xenParseXMGeneralMeta(virConfPtr conf, virDomainDefPtr def,
+  virCapsPtr caps)
 {
+
+const char *defaultMachine;
 const char *str;
 int hvm = 0;
-virDomainDefPtr def = NULL;
-const char *defaultMachine;
-
-if (VIR_ALLOC(def)  0)
-return NULL;
 
-def-virtType = VIR_DOMAIN_VIRT_XEN;
-def-id = -1;
 if (xenXMConfigCopyString(conf, name, def-name)  0)
-goto cleanup;
+return -1;
+
 if (xenXMConfigGetUUID(conf, uuid, def-uuid)  0)
-goto cleanup;
+return -1;
+
 if ((xenXMConfigGetString(conf, builder, str, linux) == 0) 
 STREQ(str, hvm))
 hvm = 1;
 
 if (VIR_STRDUP(def-os.type, hvm ? hvm : xen)  0)
-goto cleanup;
+return -1;
+
 def-os.arch =
 virCapabilitiesDefaultGuestArch(caps,
 def-os.type,
@@ -1241,7 +1239,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virReportError(VIR_ERR_INTERNAL_ERROR,
_(no supported architecture for os type '%s'),
def-os.type);
-goto cleanup;
+return -1;
 }
 
 defaultMachine = virCapabilitiesDefaultGuestMachine(caps,
@@ -1250,9 +1248,24 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 
virDomainVirtTypeToString(def-virtType));
 if (defaultMachine != NULL) {
 if (VIR_STRDUP(def-os.machine, defaultMachine)  0)
-goto cleanup;
+return -1;
 }
 
+return 0;
+}
+virDomainDefPtr
+xenParseXM(virConfPtr conf, int xendConfigVersion,
+   virCapsPtr caps)
+{
+virDomainDefPtr def = NULL;
+
+if (VIR_ALLOC(def)  0)
+return NULL;
+
+def-virtType = VIR_DOMAIN_VIRT_XEN;
+def-id = -1;
+if (xenParseXMGeneralMeta(conf, def, caps)  0)
+goto cleanup;
 if (xenParseXMOS(conf, def)  0)
 goto cleanup;
 if (xenParseXMMem(conf, def)  0)
-- 
1.8.4.5

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


[libvirt] [PATCH v2 04/25] src/xenxs:Refactor code parsing PCI devices config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

Introduce function
 xenParseXMPCI(virConfPtr conf,..);
which parses PCI config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 185 +++--
 1 file changed, 94 insertions(+), 91 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index c816198..2fb3a4c 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -344,6 +344,98 @@ int xenParseXMEventsActions(virConfPtr conf, 
virDomainDefPtr def)
 }
 
 
+static
+int xenParseXMPCI(virConfPtr conf, virDomainDefPtr def)
+{
+virConfValuePtr list = virConfGetValue(conf, pci);
+virDomainHostdevDefPtr hostdev = NULL;
+if (list  list-type == VIR_CONF_LIST) {
+list = list-list;
+while (list) {
+char domain[5];
+char bus[3];
+char slot[3];
+char func[2];
+char *key, *nextkey;
+int domainID;
+int busID;
+int slotID;
+int funcID;
+
+domain[0] = bus[0] = slot[0] = func[0] = '\0';
+
+if ((list-type != VIR_CONF_STRING) || (list-str == NULL))
+goto skippci;
+/* pci=[':00:1b.0',':00:13.0'] */
+if (!(key = list-str))
+goto skippci;
+if (!(nextkey = strchr(key, ':')))
+goto skippci;
+if (virStrncpy(domain, key, (nextkey - key), sizeof(domain)) == 
NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Domain %s too big for destination), key);
+goto skippci;
+}
+
+key = nextkey + 1;
+if (!(nextkey = strchr(key, ':')))
+goto skippci;
+if (virStrncpy(bus, key, (nextkey - key), sizeof(bus)) == NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Bus %s too big for destination), key);
+goto skippci;
+}
+
+key = nextkey + 1;
+if (!(nextkey = strchr(key, '.')))
+goto skippci;
+if (virStrncpy(slot, key, (nextkey - key), sizeof(slot)) == NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Slot %s too big for destination), key);
+goto skippci;
+}
+
+key = nextkey + 1;
+if (strlen(key) != 1)
+goto skippci;
+if (virStrncpy(func, key, 1, sizeof(func)) == NULL) {
+virReportError(VIR_ERR_INTERNAL_ERROR,
+   _(Function %s too big for destination), key);
+goto skippci;
+}
+
+if (virStrToLong_i(domain, NULL, 16, domainID)  0)
+goto skippci;
+if (virStrToLong_i(bus, NULL, 16, busID)  0)
+goto skippci;
+if (virStrToLong_i(slot, NULL, 16, slotID)  0)
+goto skippci;
+if (virStrToLong_i(func, NULL, 16, funcID)  0)
+goto skippci;
+if (!(hostdev = virDomainHostdevDefAlloc()))
+   return -1;
+
+hostdev-managed = false;
+hostdev-source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
+hostdev-source.subsys.u.pci.addr.domain = domainID;
+hostdev-source.subsys.u.pci.addr.bus = busID;
+hostdev-source.subsys.u.pci.addr.slot = slotID;
+hostdev-source.subsys.u.pci.addr.function = funcID;
+
+if (VIR_APPEND_ELEMENT(def-hostdevs, def-nhostdevs, hostdev)  
0) {
+virDomainHostdevDefFree(hostdev);
+return -1;
+}
+
+skippci:
+list = list-next;
+}
+}
+
+return 0;
+}
+
+
 virDomainDefPtr
 xenParseXM(virConfPtr conf, int xendConfigVersion,
virCapsPtr caps)
@@ -356,7 +448,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virDomainDiskDefPtr disk = NULL;
 virDomainNetDefPtr net = NULL;
 virDomainGraphicsDefPtr graphics = NULL;
-virDomainHostdevDefPtr hostdev = NULL;
 size_t i;
 const char *defaultMachine;
 unsigned long count;
@@ -836,96 +927,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 }
 }
 
-list = virConfGetValue(conf, pci);
-if (list  list-type == VIR_CONF_LIST) {
-list = list-list;
-while (list) {
-char domain[5];
-char bus[3];
-char slot[3];
-char func[2];
-char *key, *nextkey;
-int domainID;
-int busID;
-int slotID;
-int funcID;
-
-domain[0] = bus[0] = slot[0] = func[0] = '\0';
-
-if ((list-type != VIR_CONF_STRING) || (list-str == NULL))
-goto skippci;
-
-/* pci=[':00:1b.0',':00:13.0'] */
-if 

[libvirt] [PATCH v2 05/25] src/xenxs:Refactor code parsing CPU features config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

Introduce function
 xenParseXMPCI(virConfPtr conf,..);
which parses CPU Features and allocation config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 126 +++--
 1 file changed, 73 insertions(+), 53 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 2fb3a4c..66d7b44 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -436,6 +436,77 @@ int xenParseXMPCI(virConfPtr conf, virDomainDefPtr def)
 }
 
 
+static
+int xenParseXMCPUFeatures(virConfPtr conf, virDomainDefPtr def)
+{
+unsigned long count;
+const char *str;
+int val;
+
+if (xenXMConfigGetULong(conf, vcpus, count, 1)  0 ||
+MAX_VIRT_CPUS  count)
+return -1;
+
+def-maxvcpus = count;
+if (xenXMConfigGetULong(conf, vcpu_avail, count, -1)  0)
+return -1;
+
+def-vcpus = MIN(count_one_bits_l(count), def-maxvcpus);
+if (xenXMConfigGetString(conf, cpus, str, NULL)  0)
+return -1;
+
+if (str  (virBitmapParse(str, 0, def-cpumask, 4096)  0))
+return -1;
+
+if (STREQ(def-os.type, hvm)) {
+if (xenXMConfigGetBool(conf, pae, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_PAE] = 
VIR_DOMAIN_FEATURE_STATE_ON;
+if (xenXMConfigGetBool(conf, acpi, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_ACPI] = 
VIR_DOMAIN_FEATURE_STATE_ON;
+if (xenXMConfigGetBool(conf, apic, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_APIC] = 
VIR_DOMAIN_FEATURE_STATE_ON;
+if (xenXMConfigGetBool(conf, hap, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_HAP] = 
VIR_DOMAIN_FEATURE_STATE_ON;
+if (xenXMConfigGetBool(conf, viridian, val, 0)  0)
+return -1;
+
+else if (val)
+def-features[VIR_DOMAIN_FEATURE_VIRIDIAN] = 
VIR_DOMAIN_FEATURE_STATE_ON;
+if (xenXMConfigGetBool(conf, hpet, val, -1)  0)
+return -1;
+
+else if (val != -1) {
+virDomainTimerDefPtr timer;
+
+if (VIR_ALLOC_N(def-clock.timers, 1)  0 ||
+VIR_ALLOC(timer)  0)
+return -1;
+
+timer-name = VIR_DOMAIN_TIMER_NAME_HPET;
+timer-present = val;
+timer-tickpolicy = -1;
+
+def-clock.ntimers = 1;
+def-clock.timers[0] = timer;
+}
+}
+
+return 0;
+}
+
+
 virDomainDefPtr
 xenParseXM(virConfPtr conf, int xendConfigVersion,
virCapsPtr caps)
@@ -450,7 +521,6 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 virDomainGraphicsDefPtr graphics = NULL;
 size_t i;
 const char *defaultMachine;
-unsigned long count;
 char *script = NULL;
 char *listenAddr = NULL;
 
@@ -549,60 +619,10 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 goto cleanup;
 if (xenParseXMEventsActions(conf, def)  0)
 goto cleanup;
-if (xenXMConfigGetULong(conf, vcpus, count, 1)  0 ||
-MAX_VIRT_CPUS  count)
-goto cleanup;
-def-maxvcpus = count;
-if (xenXMConfigGetULong(conf, vcpu_avail, count, -1)  0)
-goto cleanup;
-def-vcpus = MIN(count_one_bits_l(count), def-maxvcpus);
-
-if (xenXMConfigGetString(conf, cpus, str, NULL)  0)
-goto cleanup;
-if (str  (virBitmapParse(str, 0, def-cpumask, 4096)  0))
-goto cleanup;
-if (hvm) {
-if (xenXMConfigGetBool(conf, pae, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_PAE] = 
VIR_DOMAIN_FEATURE_STATE_ON;
-if (xenXMConfigGetBool(conf, acpi, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_ACPI] = 
VIR_DOMAIN_FEATURE_STATE_ON;
-if (xenXMConfigGetBool(conf, apic, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_APIC] = 
VIR_DOMAIN_FEATURE_STATE_ON;
-if (xenXMConfigGetBool(conf, hap, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_HAP] = 
VIR_DOMAIN_FEATURE_STATE_ON;
-if (xenXMConfigGetBool(conf, viridian, val, 0)  0)
-goto cleanup;
-else if (val)
-def-features[VIR_DOMAIN_FEATURE_VIRIDIAN] = 
VIR_DOMAIN_FEATURE_STATE_ON;
-
-if (xenXMConfigGetBool(conf, hpet, val, -1)  0)
-goto cleanup;
-else if (val != -1) {
-virDomainTimerDefPtr timer;
-
-if (VIR_ALLOC_N(def-clock.timers, 1)  0 ||
-VIR_ALLOC(timer)  0)
-goto cleanup;
-
-timer-name = VIR_DOMAIN_TIMER_NAME_HPET;
-timer-present = val;
-

[libvirt] [PATCH v2 11/25] src/xenxs:Refactor code parsing emulated hardware config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenParseXMEmulatedDevices(virConfPtr conf,...)
which parses the emulated hardware instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 93 +++---
 1 file changed, 47 insertions(+), 46 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index e6a1b7d..5959892 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1164,6 +1164,51 @@ int xenParseXMVif(virConfPtr conf, virDomainDefPtr def)
 }
 
 
+static
+int xenParseXMEmulatedDevices(virConfPtr conf, virDomainDefPtr def)
+{
+const char *str;
+
+if (STREQ(def-os.type, hvm)) {
+if (xenXMConfigGetString(conf, soundhw, str, NULL)  0)
+return -1;
+
+if (str 
+xenParseSxprSound(def, str)  0)
+return -1;
+
+if (xenXMConfigGetString(conf, usbdevice, str, NULL)  0)
+return -1;
+
+if (str 
+(STREQ(str, tablet) ||
+ STREQ(str, mouse) ||
+ STREQ(str, keyboard))) {
+virDomainInputDefPtr input;
+if (VIR_ALLOC(input)  0)
+return -1;
+
+input-bus = VIR_DOMAIN_INPUT_BUS_USB;
+if (STREQ(str, mouse))
+input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
+else if (STREQ(str, tablet))
+input-type = VIR_DOMAIN_INPUT_TYPE_TABLET;
+else if (STREQ(str, keyboard))
+input-type = VIR_DOMAIN_INPUT_TYPE_KBD;
+if (VIR_ALLOC_N(def-inputs, 1)  0) {
+virDomainInputDefFree(input);
+return -1;
+
+}
+def-inputs[0] = input;
+def-ninputs = 1;
+}
+}
+
+return 0;
+}
+
+
 virDomainDefPtr
 xenParseXM(virConfPtr conf, int xendConfigVersion,
virCapsPtr caps)
@@ -1171,30 +1216,23 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 const char *str;
 int hvm = 0;
 virDomainDefPtr def = NULL;
-virDomainDiskDefPtr disk = NULL;
-virDomainNetDefPtr net = NULL;
 const char *defaultMachine;
-char *script = NULL;
 
 if (VIR_ALLOC(def)  0)
 return NULL;
 
 def-virtType = VIR_DOMAIN_VIRT_XEN;
 def-id = -1;
-
 if (xenXMConfigCopyString(conf, name, def-name)  0)
 goto cleanup;
 if (xenXMConfigGetUUID(conf, uuid, def-uuid)  0)
 goto cleanup;
-
-
 if ((xenXMConfigGetString(conf, builder, str, linux) == 0) 
 STREQ(str, hvm))
 hvm = 1;
 
 if (VIR_STRDUP(def-os.type, hvm ? hvm : xen)  0)
 goto cleanup;
-
 def-os.arch =
 virCapabilitiesDefaultGuestArch(caps,
 def-os.type,
@@ -1233,51 +1271,14 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
 goto cleanup;
 if (xenParseXMPCI(conf, def)  0)
 goto cleanup;
-if (hvm) {
-if (xenXMConfigGetString(conf, usbdevice, str, NULL)  0)
-goto cleanup;
-if (str 
-(STREQ(str, tablet) ||
- STREQ(str, mouse) ||
- STREQ(str, keyboard))) {
-virDomainInputDefPtr input;
-if (VIR_ALLOC(input)  0)
-goto cleanup;
-input-bus = VIR_DOMAIN_INPUT_BUS_USB;
-if (STREQ(str, mouse))
-input-type = VIR_DOMAIN_INPUT_TYPE_MOUSE;
-else if (STREQ(str, tablet))
-input-type = VIR_DOMAIN_INPUT_TYPE_TABLET;
-else if (STREQ(str, keyboard))
-input-type = VIR_DOMAIN_INPUT_TYPE_KBD;
-if (VIR_ALLOC_N(def-inputs, 1)  0) {
-virDomainInputDefFree(input);
-goto cleanup;
-}
-def-inputs[0] = input;
-def-ninputs = 1;
-}
-}
-
+if (xenParseXMEmulatedDevices(conf, def)  0)
+goto cleanup;
 if (xenParseXMCharDev(conf, def)  0)
 goto cleanup;
-if (hvm) {
-if (xenXMConfigGetString(conf, soundhw, str, NULL)  0)
-goto cleanup;
-
-if (str 
-xenParseSxprSound(def, str)  0)
-goto cleanup;
-}
-
-VIR_FREE(script);
 return def;
 
  cleanup:
-virDomainNetDefFree(net);
-virDomainDiskDefFree(disk);
 virDomainDefFree(def);
-VIR_FREE(script);
 return NULL;
 }
 
-- 
1.8.4.5

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


[libvirt] [PATCH v2 16/25] src/xenxs:Reafactor code formating virtual time config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
  xenFormatXMTimeOffset(virConfPtr conf, ...);
which formats time offset config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 156 -
 1 file changed, 84 insertions(+), 72 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 78dc949..9d868d7 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1686,12 +1686,94 @@ int xenFormatXMMem(virConfPtr conf, virDomainDefPtr def)
 }
 
 
+static
+int xenFormatXMTimeOffset(virConfPtr conf, virDomainDefPtr def,
+  int xendConfigVersion)
+{
+int vmlocaltime;
+if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {
+/* 3.1: UTC and LOCALTIME */
+switch (def-clock.offset) {
+case VIR_DOMAIN_CLOCK_OFFSET_UTC:
+vmlocaltime = 0;
+break;
+case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
+vmlocaltime = 1;
+break;
+default:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _(unsupported clock offset='%s'),
+   
virDomainClockOffsetTypeToString(def-clock.offset));
+return -1;
+}
+
+} else {
+if (STREQ(def-os.type, hvm)) {
+/* =3.1 HV: VARIABLE */
+int rtc_timeoffset;
+switch (def-clock.offset) {
+case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE:
+vmlocaltime = (int)def-clock.data.variable.basis;
+rtc_timeoffset = def-clock.data.variable.adjustment;
+break;
+case VIR_DOMAIN_CLOCK_OFFSET_UTC:
+if (def-clock.data.utc_reset) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s,
+   _(unsupported clock adjustment='reset'));
+return -1;
+}
+vmlocaltime = 0;
+rtc_timeoffset = 0;
+break;
+case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
+if (def-clock.data.utc_reset) {
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED, %s,
+   _(unsupported clock adjustment='reset'));
+return -1;
+}
+vmlocaltime = 1;
+rtc_timeoffset = 0;
+break;
+default:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _(unsupported clock offset='%s'),
+   
virDomainClockOffsetTypeToString(def-clock.offset));
+return -1;
+}
+if (xenXMConfigSetInt(conf, rtc_timeoffset, rtc_timeoffset)  0)
+return -1;
+
+} else {
+/* =3.1 PV: UTC and LOCALTIME */
+switch (def-clock.offset) {
+case VIR_DOMAIN_CLOCK_OFFSET_UTC:
+vmlocaltime = 0;
+break;
+case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
+vmlocaltime = 1;
+break;
+default:
+virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+   _(unsupported clock offset='%s'),
+   
virDomainClockOffsetTypeToString(def-clock.offset));
+return -1;
+}
+} /* !hvm */
+}
+
+if (xenXMConfigSetInt(conf, localtime, vmlocaltime)  0)
+return -1;
+
+return 0;
+}
+
+
 virConfPtr xenFormatXM(virConnectPtr conn,
virDomainDefPtr def,
int xendConfigVersion)
 {
 virConfPtr conf = NULL;
-int hvm = 0, vmlocaltime = 0;
+int hvm = 0;
 size_t i;
 char *cpus = NULL;
 const char *lifecycle;
@@ -1827,78 +1909,8 @@ virConfPtr xenFormatXM(virConnectPtr conn,
 goto cleanup;
 } /* !hvm */
 
-
-if (xendConfigVersion  XEND_CONFIG_VERSION_3_1_0) {
-/* 3.1: UTC and LOCALTIME */
-switch (def-clock.offset) {
-case VIR_DOMAIN_CLOCK_OFFSET_UTC:
-vmlocaltime = 0;
-break;
-case VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME:
-vmlocaltime = 1;
-break;
-default:
-virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-   _(unsupported clock offset='%s'),
-   
virDomainClockOffsetTypeToString(def-clock.offset));
-goto cleanup;
-}
-} else {
-if (hvm) {
-/* =3.1 HV: VARIABLE */
-int rtc_timeoffset;
-switch (def-clock.offset) {
-case VIR_DOMAIN_CLOCK_OFFSET_VARIABLE:
-vmlocaltime = (int)def-clock.data.variable.basis;
-rtc_timeoffset = def-clock.data.variable.adjustment;
-break;
-case VIR_DOMAIN_CLOCK_OFFSET_UTC:
-

[libvirt] [PATCH v2 19/25] src/xenxs:Refactor code formating Vfb config

2014-07-26 Thread David Kiarie
From: Kiarie Kahurani davidkiar...@gmail.com

introduce function
 xenFormatXMVfb(virConfPtr conf, );
which formats Vfb config instead

signed-off-by: David Kiariedavidkiar...@gmail.com
---
 src/xenxs/xen_xm.c | 218 +
 1 file changed, 119 insertions(+), 99 deletions(-)

diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 9a6a827..22552bd 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1838,6 +1838,123 @@ int xenFormatXMVif(virConfPtr conf, virConnectPtr conn,
 }
 
 
+static
+int xenFormatXMVfb(virConfPtr conf, virDomainDefPtr def,
+   int xendConfigVersion)
+{
+int hvm = STREQ(def-os.type, hvm);
+
+if (def-ngraphics == 1) {
+if (hvm || (xendConfigVersion  XEND_CONFIG_MIN_VERS_PVFB_NEWCONF)) {
+if (def-graphics[0]-type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
+if (xenXMConfigSetInt(conf, sdl, 1)  0)
+return -1;
+
+if (xenXMConfigSetInt(conf, vnc, 0)  0)
+return -1;
+
+if (def-graphics[0]-data.sdl.display 
+xenXMConfigSetString(conf, display,
+ def-graphics[0]-data.sdl.display)  0)
+return -1;
+
+if (def-graphics[0]-data.sdl.xauth 
+xenXMConfigSetString(conf, xauthority,
+ def-graphics[0]-data.sdl.xauth)  0)
+return -1;
+
+} else {
+const char *listenAddr;
+
+if (xenXMConfigSetInt(conf, sdl, 0)  0)
+return -1;
+
+if (xenXMConfigSetInt(conf, vnc, 1)  0)
+return -1;
+
+if (xenXMConfigSetInt(conf, vncunused,
+  def-graphics[0]-data.vnc.autoport ? 1 : 0)  0)
+return -1;
+
+if (!def-graphics[0]-data.vnc.autoport 
+xenXMConfigSetInt(conf, vncdisplay,
+  def-graphics[0]-data.vnc.port - 5900)  0)
+return -1;
+
+listenAddr = 
virDomainGraphicsListenGetAddress(def-graphics[0], 0);
+if (listenAddr 
+xenXMConfigSetString(conf, vnclisten, listenAddr)  0)
+return -1;
+
+if (def-graphics[0]-data.vnc.auth.passwd 
+xenXMConfigSetString(conf, vncpasswd,
+
def-graphics[0]-data.vnc.auth.passwd)  0)
+return -1;
+
+if (def-graphics[0]-data.vnc.keymap 
+xenXMConfigSetString(conf, keymap,
+def-graphics[0]-data.vnc.keymap)  0)
+return -1;
+}
+} else {
+virConfValuePtr vfb, disp;
+char *vfbstr = NULL;
+virBuffer buf = VIR_BUFFER_INITIALIZER;
+if (def-graphics[0]-type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
+virBufferAddLit(buf, type=sdl);
+if (def-graphics[0]-data.sdl.display)
+virBufferAsprintf(buf, ,display=%s,
+  def-graphics[0]-data.sdl.display);
+if (def-graphics[0]-data.sdl.xauth)
+virBufferAsprintf(buf, ,xauthority=%s,
+  def-graphics[0]-data.sdl.xauth);
+} else {
+const char *listenAddr
+= virDomainGraphicsListenGetAddress(def-graphics[0], 0);
+
+virBufferAddLit(buf, type=vnc);
+virBufferAsprintf(buf, ,vncunused=%d,
+  def-graphics[0]-data.vnc.autoport ? 1 : 0);
+if (!def-graphics[0]-data.vnc.autoport)
+virBufferAsprintf(buf, ,vncdisplay=%d,
+  def-graphics[0]-data.vnc.port - 5900);
+if (listenAddr)
+virBufferAsprintf(buf, ,vnclisten=%s, listenAddr);
+if (def-graphics[0]-data.vnc.auth.passwd)
+virBufferAsprintf(buf, ,vncpasswd=%s,
+  def-graphics[0]-data.vnc.auth.passwd);
+if (def-graphics[0]-data.vnc.keymap)
+virBufferAsprintf(buf, ,keymap=%s,
+  def-graphics[0]-data.vnc.keymap);
+}
+
+if (virBufferCheckError(buf)  0)
+return -1;
+
+vfbstr = virBufferContentAndReset(buf);
+if (VIR_ALLOC(vfb)  0) {
+VIR_FREE(vfbstr);
+return -1;
+}
+
+if (VIR_ALLOC(disp)  0) {
+VIR_FREE(vfb);
+VIR_FREE(vfbstr);
+return -1;
+}
+
+vfb-type = VIR_CONF_LIST;
+vfb-list = disp;
+

  1   2   >