LUInstanceSetParams: Convert to generic algorithm for NIC/disk changes
LUInstanceSetParams: Convert to generic algorithm for NIC/disk changes

Unfortunately this got a bit messier than I intended, but then again it
cleans up a lot of messy code with heaps of local variables
(“this_nic_override”) and LU attributes (“nic_pnew”, “nic_pinst”). Most
of these variables were index by a number, or one of the
constants.DDM_* constants.

This patch moves the code for adding/modifying/removing a NIC/disk to
dedicated, small functions. The previously added generic algorithm for
applying changes to containers is then used to actually change the
instance's network interfaces or disks based on the requested
modifications. The LU now supports adding/removing disks/NICs in
arbitrary positions.

The compuation of all network interface changes has been moved to
CheckPrereq, so that its result can be used for hooks. For this to work
without side-effects, the NIC objects need to be copied (only done if
there are actual changes).

The command line utility still needs to be updated.

Signed-off-by: Michael Hanselmann <68b67885ff74281219b4a4be33cc20fd45078d7c@google.com>
Reviewed-by: Iustin Pop <acf83a5274f31a43af6b914614365999469c1a31@google.com>

mbakke/ganeti,grnet/snf-ganeti,apyrgio/ganeti,grnet/snf-ganeti,apyrgio/snf-ganeti,leshchevds/ganeti,yiannist/ganeti,dimara/ganeti,ganeti/ganeti,andir/ganeti,mbakke/ganeti,leshchevds/ganeti,apyrgio/snf-ganeti,ganeti/ganeti,ganeti-github-testing/ganeti-test-1,yiannist/ganeti,onponomarev/ganeti,apyrgio/ganeti,andir/ganeti,ganeti-github-testing/ganeti-test-1,bitemyapp/ganeti,bitemyapp/ganeti,mbakke/ganeti,andir/ganeti,yiannist/ganeti,ganeti/ganeti,leshchevds/ganeti,dimara/ganeti,onponomarev/ganeti