On Mon, Jan 17, 2011 at 6:42 PM, Apollon Oikonomopoulos
<[email protected]> wrote:
> Resubmitted, with proper exception types
> --
> 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 <[email protected]>
LGTM with:
diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py
index 5684a87..3e9e025 100644
--- a/lib/hypervisor/hv_kvm.py
+++ b/lib/hypervisor/hv_kvm.py
@@ -34,7 +34,6 @@ import pwd
import struct
import fcntl
import shutil
-from cStringIO import StringIO
from ganeti import utils
from ganeti import constants
@@ -994,8 +993,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
try:
tap = utils.ReadFile(self._InstanceNICFile(instance.name, nic_seq))
except EnvironmentError, err:
- logging.warning("Failed to find host interface for %s NIC #%d: %s" %
- (instance.name, nic_seq, str(err)))
+ logging.warning("Failed to find host interface for %s NIC #%d: %s",
+ instance.name, nic_seq, str(err))
continue
try:
self._ConfigureNIC(instance, nic_seq, nic, tap)
Thanks,
Guido