On Tue, Jul 06, 2010 at 05:58:31PM +0200, Michael Hanselmann wrote: > Am 6. Juli 2010 16:56 schrieb Iustin Pop <[email protected]>: > > Currently, the way to signal export failures is by the return value. > > This means that if a client doesn't check the values (e.g. burnin), any > > failure is being ignore. And this is what we've been doing forever in > > burning (not actually testing that the export is successful). > > > > This patch changes the behaviour of ExportInstance: it will abort with > > an exception for any error, and removes the custom handling from > > gnt-backup. This makes the behaviour consistent for any client (e.g. > > RAPI), and it prevents false positives. If, for a given instance, a > > subset of disks should not be backed up, the OS scripts should handle > > that case. > > --- > > lib/cmdlib.py | 18 ++++++++++++++---- > > scripts/gnt-backup | 22 ++-------------------- > > 2 files changed, 16 insertions(+), 24 deletions(-) > > > > diff --git a/lib/cmdlib.py b/lib/cmdlib.py > > index ae419c3..b32b85e 100644 > > --- a/lib/cmdlib.py > > +++ b/lib/cmdlib.py > > @@ -9506,12 +9506,22 @@ class LUExportInstance(LogicalUnit): > > feedback_fn("Deactivating disks for %s" % instance.name) > > _ShutdownInstanceDisks(self, instance) > > > > + if not (compat.all(dresults) and fin_resu): > > + failures = [] > > + if not fin_resu: > > + failures.append("export finalization") > > + if not compat.all(dresults): > > + fdsk = utils.CommaJoin(idx for (idx, dsk) in enumerate(dresults) > > + if not dsk) > > + failures.append("disk export: disk(s) %s" % fdsk) > > + > > + raise errors.OpExecError("Export failed, errors in %s" % > > + utils.CommaJoin(failures)) > > + > > + # At this point, the export was successful, we can cleanup/finish > > + > > # Remove instance if requested > > if self.op.remove_instance: > > - if not (compat.all(dresults) and fin_resu): > > - feedback_fn("Not removing instance %s as parts of the export > > failed" % > > - instance.name) > > - else: > > feedback_fn("Removing instance %s" % instance.name) > > Is it possible you have wrong indentation here?
Yep, thanks! iustin
