KVM: Perform network configuration in Ganeti
authorApollon Oikonomopoulos <apollon@noc.grnet.gr>
Mon, 17 Jan 2011 18:42:51 +0000 (20:42 +0200)
committerGuido Trotter <ultrotter@google.com>
Tue, 18 Jan 2011 12:55:55 +0000 (12:55 +0000)
commit5d9bfd870aa8ac759eccaca8b45a70ae2c7bddc7
tree467945a09046bf9bd296236b1c898a4016fb647f
parent26916aadaea890866367561affa190c3291e1635
KVM: Perform network configuration in Ganeti

This patch introduces network configuration for KVM in Ganeti.

There are three problems with having KVM perform network configuration via ifup
scripts:
  a) Ganeti never gets to know the tap interface that is associated with an
     instance's NIC
  b) Migration of routed instances will cause network problems because the
     incoming KVM side configures the network as soon as it is spawned and not
     as soon as the migration finishes. This means that all routing
     configuration will be present in both, primary and secondary, nodes at the
     same time, possibly causing network disruption during the migration.
  c) We never get to know if the network configuration succeeded or not.

This patch moves network configuration from KVM to Ganeti, using KVM's ability
to receive already open tap devices as file descriptors.

_WriteNetScript is removed from hv_kvm.py, together with its unit tests.

Minor modifications are made to _ExecKVMRuntime to handle tap device
initialization. NIC <-> tap associations are stored under a new directory,
_ROOT_DIR/nic in a file-per-nic fashion.

The end-user semantics remain the same: The user can override the network
configuration by providing _KVM_NET_SCRIPT. If this is not present or
executable, the default constants.KVM_IFUP script is run.

Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
lib/hypervisor/hv_kvm.py
test/ganeti.hypervisor.hv_kvm_unittest.py