Re: [libvirt] [PATCH v4 1/2] qemu: add support for dtb option

2013-03-13 Thread Yin Olivia-R63875


> -Original Message-
> From: Eric Blake [mailto:ebl...@redhat.com]
> Sent: Thursday, March 14, 2013 6:48 AM
> To: Yin Olivia-R63875
> Cc: libvir-list@redhat.com
> Subject: Re: [libvirt] [PATCH v4 1/2] qemu: add support for dtb option
> 
> On 03/12/2013 10:35 PM, Olivia Yin wrote:
> > Signed-off-by: Olivia Yin 
> 
> Libvirt does not (currently) require Signed-off-by lines (but someday, we
> may decide to have a flag day where we declare that all future
> contributions follow the same developer certificate of origin as what the
> qemu and kernel projects currently use).  But if you are going to include
> one, it is typical to put it...
> 
> >
> > The "dtb" option sets the filename for the device tree.
> > If without this option support, "-dtb file" will be converted into
> >  in domain XML file.
> > For example, '-dtb /media/ram/test.dtb' will be converted into
> >   
> > 
> > 
> >   
> >
> > This is not very friendly.
> > This patchset add special  tag like  and  which
> > is easier for user to write domain XML file.
> >   
> > hvm
> > /media/ram/uImage
> > /media/ram/ramdisk
> > /media/ram/test.dtb
> > root=/dev/ram rw console=ttyS0,115200
> >   
> 
> ...here, at the bottom of the commit message.
> 
> > ---
> >  src/qemu/qemu_capabilities.c |6 
> >  src/qemu/qemu_capabilities.h |1 +
> >  src/qemu/qemu_command.c  |6 
> >  tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
> >  tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28
> ++
> >  tests/qemuxml2argvtest.c |2 +
> >  6 files changed, 44 insertions(+), 0 deletions(-)  create mode 100644
> > tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
> >  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
> 
> Even after applying patch 2/2 and fixing the RNG to accept the new machine
> type of your new .xml file, this patch fails 'make check'
> because you forgot to update existing tests:

Yes, I need also add testQemuAddPPCGuest() in tests/testutilsqemu.c.

> 259) QEMU XML-2-ARGV ppc-dtb
> ... libvirt: Domain Config error : internal error No guest options
> available for arch 'ppc'
> FAILED
> FAIL: qemuxml2argvtest
> 
> ...
> 17) QEMU Help String Parsing qemu-kvm-1.2.0 ... qemu-kvm-1.2.0: computed
> flags do not match: got 0x00106fb4bff2f1bffdeffd76fffdfd6e,
> expected 0x6fb4bff2f1bffdeffd76fffdfd6e
> Extra flag 132
> FAILED
> FAIL: qemuhelptest

Thanks for the detail information.
It needs add QEMU_CAPS_DTB flags in the newer versions.

> At this point, I gave up - it looks like you are the first person to
> attempt arch='ppc' in the testsuite, and that we haven't prepped the
> testsuite to handle this yet. 

I'll add testQemuAddPPCGuest() in tests/testutilsqemu.c which handle the 
testsuite for ppc arch.

 Can you please repost your patches, and this
> time ensure that 'make check' passes after each patch is applies?


I'll make sure pass 'make syntax-check' and 'make check' before post next 
version.


> Reorder things so that domain_conf is edited before the qemu files, and
> make sure the subject lines are accurate (2/2 was about XML and not QEMU,
> and only 1/2 added qemu support for the new XML).

OK.

  Also, don't forget Dan's
> comment to tweak the security managers to allow SELinux labeling of the dtb
> file.

The new patchset includes:
1/3  conf: support  tag in XML domain file
2/3  qemu: add dtb option supprt
3/3  selinux: deal with dtb file


Thanks a lot.

Best Regards,
Olivia
> --
> 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 v4 1/2] qemu: add support for dtb option

2013-03-13 Thread Eric Blake
On 03/12/2013 10:35 PM, Olivia Yin wrote:
> Signed-off-by: Olivia Yin 

Libvirt does not (currently) require Signed-off-by lines (but someday,
we may decide to have a flag day where we declare that all future
contributions follow the same developer certificate of origin as what
the qemu and kernel projects currently use).  But if you are going to
include one, it is typical to put it...

> 
> The "dtb" option sets the filename for the device tree.
> If without this option support, "-dtb file" will be converted into
>  in domain XML file.
> For example, '-dtb /media/ram/test.dtb' will be converted into
>   
> 
> 
>   
> 
> This is not very friendly.
> This patchset add special  tag like  and 
> which is easier for user to write domain XML file.
>   
> hvm
> /media/ram/uImage
> /media/ram/ramdisk
> /media/ram/test.dtb
> root=/dev/ram rw console=ttyS0,115200
>   

...here, at the bottom of the commit message.

> ---
>  src/qemu/qemu_capabilities.c |6 
>  src/qemu/qemu_capabilities.h |1 +
>  src/qemu/qemu_command.c  |6 
>  tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
>  tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 
> ++
>  tests/qemuxml2argvtest.c |2 +
>  6 files changed, 44 insertions(+), 0 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

Even after applying patch 2/2 and fixing the RNG to accept the new
machine type of your new .xml file, this patch fails 'make check'
because you forgot to update existing tests:

259) QEMU XML-2-ARGV ppc-dtb
... libvirt: Domain Config error : internal error No guest options
available for arch 'ppc'
FAILED
FAIL: qemuxml2argvtest

...
17) QEMU Help String Parsing qemu-kvm-1.2.0
... qemu-kvm-1.2.0: computed flags do not match: got
0x00106fb4bff2f1bffdeffd76fffdfd6e, expected
0x6fb4bff2f1bffdeffd76fffdfd6e
Extra flag 132
FAILED
FAIL: qemuhelptest

At this point, I gave up - it looks like you are the first person to
attempt arch='ppc' in the testsuite, and that we haven't prepped the
testsuite to handle this yet.  Can you please repost your patches, and
this time ensure that 'make check' passes after each patch is applies?
Reorder things so that domain_conf is edited before the qemu files, and
make sure the subject lines are accurate (2/2 was about XML and not
QEMU, and only 1/2 added qemu support for the new XML).  Also, don't
forget Dan's comment to tweak the security managers to allow SELinux
labeling of the dtb file.

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



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v4 1/2] qemu: add support for dtb option

2013-03-13 Thread Daniel P. Berrange
On Wed, Mar 13, 2013 at 12:35:54PM +0800, Olivia Yin wrote:
> Signed-off-by: Olivia Yin 
> 
> The "dtb" option sets the filename for the device tree.
> If without this option support, "-dtb file" will be converted into
>  in domain XML file.
> For example, '-dtb /media/ram/test.dtb' will be converted into
>   
> 
> 
>   
> 
> This is not very friendly.
> This patchset add special  tag like  and 
> which is easier for user to write domain XML file.
>   
> hvm
> /media/ram/uImage
> /media/ram/ramdisk
> /media/ram/test.dtb
> root=/dev/ram rw console=ttyS0,115200
>   
> ---
>  src/qemu/qemu_capabilities.c |6 
>  src/qemu/qemu_capabilities.h |1 +
>  src/qemu/qemu_command.c  |6 
>  tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
>  tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 
> ++
>  tests/qemuxml2argvtest.c |2 +
>  6 files changed, 44 insertions(+), 0 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

ACK


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


[libvirt] [PATCH v4 1/2] qemu: add support for dtb option

2013-03-12 Thread Olivia Yin
Signed-off-by: Olivia Yin 

The "dtb" option sets the filename for the device tree.
If without this option support, "-dtb file" will be converted into
 in domain XML file.
For example, '-dtb /media/ram/test.dtb' will be converted into
  


  

This is not very friendly.
This patchset add special  tag like  and 
which is easier for user to write domain XML file.
  
hvm
/media/ram/uImage
/media/ram/ramdisk
/media/ram/test.dtb
root=/dev/ram rw console=ttyS0,115200
  
---
 src/qemu/qemu_capabilities.c |6 
 src/qemu/qemu_capabilities.h |1 +
 src/qemu/qemu_command.c  |6 
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args |1 +
 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml  |   28 ++
 tests/qemuxml2argvtest.c |2 +
 6 files changed, 44 insertions(+), 0 deletions(-)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 40022c1..7bc1ebc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -210,6 +210,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
   "rng-random", /* 130 */
   "rng-egd",
+  "dtb",
 );
 
 struct _virQEMUCaps {
@@ -1177,6 +1178,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
 
 if (version >= 1002000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
+
+if (version >= 11000)
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
+
 return 0;
 }
 
@@ -2294,6 +2299,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_SECCOMP_SANDBOX);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_DTB);
 }
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a895867..f373285 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -171,6 +171,7 @@ enum virQEMUCapsFlags {
 QEMU_CAPS_OBJECT_RNG_RANDOM  = 130, /* the rng-random backend for
virtio rng */
 QEMU_CAPS_OBJECT_RNG_EGD = 131, /* EGD protocol daemon for rng */
+QEMU_CAPS_DTB= 132, /* -dtb available */
 
 QEMU_CAPS_LAST,   /* this must always be the last item */
 };
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 201fac1..1614f3e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5747,6 +5747,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 virCommandAddArgList(cmd, "-initrd", def->os.initrd, NULL);
 if (def->os.cmdline)
 virCommandAddArgList(cmd, "-append", def->os.cmdline, NULL);
+if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DTB) && def->os.dtb)
+virCommandAddArgList(cmd, "-dtb", def->os.dtb, NULL);
 } else {
 virCommandAddArgList(cmd, "-bootloader", def->os.bootloader, NULL);
 }
@@ -8922,6 +8924,10 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
 WANT_VALUE();
 if (!(def->os.cmdline = strdup(val)))
 goto no_memory;
+} else if (STREQ(arg, "-dtb")) {
+WANT_VALUE();
+if (!(def->os.dtb = strdup(val)))
+goto no_memory;
 } else if (STREQ(arg, "-boot")) {
 const char *token = NULL;
 WANT_VALUE();
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
new file mode 100644
index 000..99ee22c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.args
@@ -0,0 +1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test 
/usr/bin/qemu-system-ppc -M ppce500v2 -enable-kvm -m 256 -nographic -kernel 
/media/ram/uImage -initrd /media/ram/ramdisk -append "root=/dev/ram rw 
console=ttyS0,115200" -dtb /media/ram/test.dtb -serial pty
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml 
b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
new file mode 100644
index 000..3674621
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-ppc-dtb.xml
@@ -0,0 +1,28 @@
+
+  QEMUGuest1
+  49545eb3-75e1-2d0a-acdd-f0294406c99e
+  262144
+  262144
+  1
+  
+hvm
+/media/ram/uImage
+/media/ram/ramdisk
+root=/dev/ram rw console=ttyS0,115200
+/media/ram/test.dtb
+  
+  
+  destroy
+  restart
+  destroy
+  
+/usr/bin/qemu-system-ppc
+
+  
+
+
+  
+
+
+  
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 2354733..ef24be3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -889,6 +889,8 @@ mymain(void)
 DO_TEST("virtio-rng-egd", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,