Simply & unify console handling for libvirt drivers

Currently the libvirt.xml.template file contains the following
console definitions

        <!-- The order is significant here.  File must be defined first -->
        <serial type="file">
            <source path='${basepath}/console.log'/>
            <target port='1'/>
        </serial>

        <console type='pty' tty='/dev/pts/2'>
            <source path='/dev/pts/2'/>
            <target port='0'/>
        </console>

        <serial type='pty'>
            <source path='/dev/pts/2'/>
            <target port='0'/>
        </serial>

There are multiple things wrong with this

 - LXC and Xen guests don't honour the <serial> elements
 - The <console> element shouldn't have any <source> element
   of 'tty' attribute set when type=pty, since they are
   dynamically allocated
 - The <console> element will ignored if the <serial>
   element is set and the hypervisor supports this
 - It doesn't say why multiple serial elements are used
   or why the order is important. The reason is that
   the QEMU pty driver throws away data when no client
   is connected. This means we can't use it as a basis
   for the persistent log file. Instead we need two
   separate serial ports, the first of which is used for
   the logfile

In addition in the nova/virt/libvirt/connect.py class the
'get_console_output' method has separate special-case
handling for Xen and LXC despite the fact that both work
in the same way.

All this can be significantly simplified, to unify console
handling across all libvirt drivers. First replacing all
the existing XML with just

  #if $type == 'qemu'
        <serial type='file'>
            <source path='${basepath}/console.log'/>
        </serial>
        <serial type='pty'/>
  #else
        <console type='pty'/>
  #end if

This lets Xen/UML/LXC just use a regular PTY based console,
while special casing QEMU. It is minimal XML, letting
libvirt automatically fill in other attributes

In the code, the get_console_output method can remove the
explicit checks for Xen/LXC and instead be conditionalized
based on what the XML shows.

Finally calling out to 'virsh ttyiname' is pointless since
nova already has a connection to libvirt which can be used
to fetch the XML & extract the TTY path.

Change-Id: I6a966df4ea72e07dbc227683c4225670984fc507
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
fixup ldapdns default config

This results in cleaner sample configs
generated from the new generator tool

Change-Id: I2a8b7dd1ef3840cfb4e7e4ebcc416aaead2972ea
Add VDI chain cleanup script.

References bug 949477

Change-Id: I819d4ed56675a4ef4e46adca2978b433386e128d
Replaced use of webob.Request.str_GET

 * Changed webob.Request.str_GET => webob.Request.GET to
   ensure compatibility with WebOb >= 1.2.
 * Fixes bug 950478

Change-Id: I21d0d477340d31caa4c92fa76270a392b5eb2cca
Set 'dhcp_server' in _teardown_network_on_host.

Update _teardown_network_on_host so that it sets 'dhcp_server'
on network objects for compatability when using flat dhcp with
linux_net.

Fixes LP bug #951642. ('Network' object has no attribute 'dhcp_server')

Change-Id: I53ab99155ea6e4163c9eb0b28b765f962f99a2b1
Remove update lockmode from compute_node_get_by_host

Fixes bug #948066

This commit removes the usage of an update cursor so postgres
doesn't raise the error below
SELECT FOR UPDATE/SHARE cannot be applied to the nullable side of
an outer join

Change-Id: Ia1ede22df38d5f6a24372e0ad8ec25151ad195c7
Sub in InstanceLimitExceeded in overLimit message

Fixes bug 950768

Previously the error message in the 413 overLimit response returned
by the OS compute API was missing a parameter subsitution indicating
the actual quota that was breeched:

  'Quota exceeded: code=%(code)s'

This is now properly reported as:

  'Quota exceeded: code=InstanceLimitExceeded'

Also a potentially useful log message is no longer discarded.

Change-Id: I7e1f8b078329a6530bb7d7ea3b006ff578cdcdd3
Merge "Remove update lockmode from compute_node_get_by_host"
Merge "Sub in InstanceLimitExceeded in overLimit message"
Merge "fixup ldapdns default config"
Fix live-migration in multi_host network

 * call teardown after live migration
 * call update a second time after migration for dhcp
 * moves the instance state update into post_live_migrate
 * completes the fix for bug 939060
 * fixes bug 947326

Change-Id: I042567573b9bb46381c5447aa08e83cd1916b225
Merge "Set 'dhcp_server' in _teardown_network_on_host."
Merge "Replaced use of webob.Request.str_GET"
Import nova.exception so exception can be used

Change-Id: Id51e6763c73e5e705ae40c71c251d6a7198a74a6
Add a serializer for os-quota-sets/defaults.

This fixes bug 953182.

Change-Id: I273a1d3559a8218a0b1e1f3d973e55d079e92062
Merge "Add VDI chain cleanup script."
Merge "Add a serializer for os-quota-sets/defaults."
Merge "Simply & unify console handling for libvirt drivers"
Merge "Fix live-migration in multi_host network"
Sort results from describe_instances in EC2 API.

Fix bug 827619.

This bug pointed out that EC2 sorts the results of of describe_instances
by the launch time.  Make our implementation of the EC2 API behave the same
way.  Previously, instances coming out of the db API were sorted by the
key we wanted, but in the opposite order.  You can now specify both a
sort key and order.  The behavior is the same by default, but the EC2
API sets the parameter to do an ascending sort.

Change-Id: Ifd0bc79ad4c4c8c45809dbb1ac2dadf8abcfd4c3