On Fri, Dec 20, 2013 at 10:09 AM, Hrvoje Ribicic <[email protected]> wrote:
> The move-instance tool raises an exception when used with a cluster > running an earlier version of Ganeti. As the tool is meant to perform > inter-cluster moves, this situation could be encountered outside the > RAPI compatibility test. > > To handle it better, this patch makes the tool fail more gracefully, > outputting a more informative error message. > > Signed-off-by: Hrvoje Ribicic <[email protected]> > --- > tools/move-instance | 24 ++++++++++++++---------- > 1 file changed, 14 insertions(+), 10 deletions(-) > > diff --git a/tools/move-instance b/tools/move-instance > index c628715..7ff8c4b 100755 > --- a/tools/move-instance > +++ b/tools/move-instance > @@ -526,16 +526,20 @@ class MoveDestExecutor(object): > odisk[constants.IDISK_SPINDLES] = spindles > disks.append(odisk) > > - nics = [{ > - constants.INIC_IP: ip, > - constants.INIC_MAC: mac, > - constants.INIC_MODE: mode, > - constants.INIC_LINK: link, > - constants.INIC_VLAN: vlan, > - constants.INIC_NETWORK: network, > - constants.INIC_NAME: nic_name > - } for nic_name, _, ip, mac, mode, link, vlan, network, _ > - in instance["nics"]] > + try: > + nics = [{ > + constants.INIC_IP: ip, > + constants.INIC_MAC: mac, > + constants.INIC_MODE: mode, > + constants.INIC_LINK: link, > + constants.INIC_VLAN: vlan, > + constants.INIC_NETWORK: network, > + constants.INIC_NAME: nic_name > + } for nic_name, _, ip, mac, mode, link, vlan, network, _ > + in instance["nics"]] > + except ValueError: > + raise Error("Received NIC information does not match expected > format; " > + "Do the versions of this tool and the source cluster > match?") > > if len(override_nics) > len(nics): > raise Error("Can not create new NICs") > -- > 1.8.5.1 > > LGTM, thanks -- -- Helga Velroyen | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
