cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$bad_disk,g"| sed "s,</devices>,<disk type='file' device='disk'><source file='$disk2'/><target dev='hda' bus='ide'/></disk></devices>,g" > "$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1</disk>,g" > "$test_xml"
testme "1""-c with malformed xml""-c -u $valid_uuid""$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,<type arch='x86_64' machine='pc'>hvm</type>,,g" > "$test_xml"
testme "1""-c with no os.type""-c -u $valid_uuid""$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,<type arch='x86_64' machine='pc'>hvm</type>,<type>hvm</type>,g" > "$test_xml"
testme "1""-c with no architecture""-c -u $valid_uuid""$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,hvm</type>,hvm_invalid</type>,g" > "$test_xml"
testme "1""-c with invalid hvm""-c -u $valid_uuid""$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,</disk>,</disk><disk type='file' device='disk'><source file='$disk2'/><target dev='hdb' bus='ide'/></disk>,g" > "$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,</disk>,</disk><hostdev mode='subsystem' type='usb'><source><address bus='002' device='004'/></source></hostdev>,g" > "$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,</disk>,</disk><hostdev mode='subsystem' type='pci'><source><address bus='0x00' slot='0x19' function='0x0'/></source></hostdev>,g" > "$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,</devices>,<disk type='block' device='cdrom'><target dev='hdc' bus='ide'/><readonly/></disk></devices>,g" > "$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,</devices>,<serial type='file'><source path='$tmpdir/serial.log'/><target port='0'/></serial></devices>,g" > "$test_xml"
testme "0""serial""-r -u $valid_uuid""$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,</devices>,<serial type='pty'><target port='0'/></serial></devices>,g" > "$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"
testme "0""console""-r -u $valid_uuid""$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,</devices>,<console type='pty'><target port='0'/></console></devices>,g" > "$test_xml"
cat "$template_xml"| sed "s,###UUID###,$uuid,g"| sed "s,###DISK###,$disk1,g"| sed "s,<graphics*,<graphics type='sdl' display=':0.0' xauth='/home/myself/.Xauthority'/>,g" > "$test_xml"