On 09/23/2010 09:08 AM, Daniel P. Berrange wrote:
On Mon, Aug 16, 2010 at 02:33:01PM -0500, Jamie Strandboge wrote:
>
> Hrmm. I always did it this. Maybe something changed and I missed it.
> Regardless, thanks for this feedback! :) Attached is an updated patch.
>
ACK
Pushed as-is. That leaves 3/4 which is still undergoing discussion.
However, I notice several useless uses of cat and extra invocations of
sed that can be collapsed (some before the patch, others introduced by
copy-n-paste within the patch):
+cat "$template_xml" | sed "s,###UUID###,$uuid,g"
| sed "s,###DISK###,$disk1,g" | sed "s,</devices>,<serial
type='dev'><source path='/dev/ttyS0'/><target
port='0'/></serial></devices>,g" > "$test_xml"
+testme "0" "serial (dev)" "-r -u $valid_uuid"
"$test_xml"
+
cat "$template_xml" | sed "s,###UUID###,$uuid,g" | sed
"s,###DISK###,$disk1,g" | sed "s,</devices>,<console
type='file'><source path='$tmpdir/console.log'/><target
port='0'/></console></devices>,g" > "$test_xml"
touch "$tmpdir/console.log"
Rather than wasting so many processes, it is more efficient to do:
sed "s,###UUID###,$uuid,g
s,###DISK###,$disk1,g
s,</devices>,<serial type='dev'><source
path='/dev/ttyS0'/><target
port='0'/></serial></devices>,g" <
"$template_xml" > "$test_xml"
Maybe it's worth a followup patch?
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org