LGTM, thanks On Tue, Mar 31, 2015 at 3:16 PM, 'Klaus Aehlig' via ganeti-devel < [email protected]> wrote:
> > > commit 84460d5a8a059e4d5d96b58b854f3bfd267f007a > Merge: 5705bba a56d29a > Author: Klaus Aehlig <[email protected]> > Date: Tue Mar 31 15:10:44 2015 +0200 > > Merge branch 'stable-2.11' into stable-2.12 > > * stable-2.11 > (no changes) > > * stable-2.10 > Fixed typos > Pass correct params in move-instance > In CanTieredAlloc test set IPolicy > Make genInstanceMaybeBiggerThanNode honor policy lower bound > Also export a null ISpec > Support instance generation within ranges > Add a function to leave the list monad > > Conflicts: > tools/move-instance > Resolution: > manually apply 6f918cb2c97 to version on 2.12 > > diff --cc tools/move-instance > index 087fd3f,4450758..728b3bf > --- a/tools/move-instance > +++ b/tools/move-instance > @@@ -490,58 -454,18 +490,58 @@@ class MoveDestExecutor(object) > > logging.info("Creating instance %s in remote-import mode", > mrt.move.dest_instance_name) > - job_id = self._CreateInstance(dest_client, > mrt.move.dest_instance_name, > - mrt.move.dest_pnode, > mrt.move.dest_snode, > - mrt.move.compress, > - mrt.move.dest_iallocator, > - mrt.move.dest_disk_template, > - mrt.src_instinfo, mrt.src_expinfo, > - mrt.move.hvparams, mrt.move.beparams, > - mrt.move.osparams, mrt.move.nics) > - mrt.PollJob(dest_client, job_id, > - remote_import_fn=compat.partial(self._SetImportInfo, > mrt)) > - > - logging.info("Import successful") > + > + # Depending on whether opportunistic tries are enabled, we may have > to > + # make multiple creation attempts > + creation_attempts = [True] * mrt.move.opportunistic_tries > + > + # But the last one is never opportunistic, and will block until > completion > + # or failure > + creation_attempts.append(False) > + > + # Initiate the RNG for the variations > + random.seed() > + > + for is_attempt_opportunistic in creation_attempts: > + job_id = self._CreateInstance(dest_client, > mrt.move.dest_instance_name, > + mrt.move.dest_pnode, > mrt.move.dest_snode, > + mrt.move.compress, > + mrt.move.dest_iallocator, > + mrt.move.dest_disk_template, > + mrt.src_instinfo, mrt.src_expinfo, > + mrt.move.hvparams, mrt.move.beparams, > - mrt.move.beparams, mrt.move.nics, > ++ mrt.move.osparams, mrt.move.nics, > + is_attempt_opportunistic > + ) > + > + try: > + # The completion of this block signifies that the import has been > + # completed successfullly > + mrt.PollJob(dest_client, job_id, > + remote_import_fn=compat.partial(self._SetImportInfo, > mrt)) > + logging.info("Import successful") > + return > + except errors.OpPrereqError, err: > + # Any exception in the non-opportunistic creation is to be > passed on, > + # as well as exceptions apart from resources temporarily > unavailable > + if not is_attempt_opportunistic or \ > + err.args[1] != rapi.client.ECODE_TEMP_NORES: > + raise > + > + delay_to_use = MoveDestExecutor._VaryDelay(mrt) > + logging.info("Opportunistic attempt unsuccessful, waiting %.2f > seconds" > + " before another creation attempt is made", > + delay_to_use) > + time.sleep(delay_to_use) > + > + @staticmethod > + def _VaryDelay(mrt): > + """ Varies the opportunistic delay by a small amount. > + > + """ > + MAX_VARIATION = 0.15 > + variation_factor = (1.0 + random.uniform(-MAX_VARIATION, > MAX_VARIATION)) > + return mrt.move.opportunistic_delay * variation_factor > > @staticmethod > def _SetImportInfo(mrt, impinfo): > > -- > Klaus Aehlig > Google Germany GmbH, Dienerstr. 12, 80331 Muenchen > Registergericht und -nummer: Hamburg, HRB 86891 > Sitz der Gesellschaft: Hamburg > Geschaeftsfuehrer: Graham Law, Christine Elizabeth Flores > Hrvoje Ribicic Ganeti Engineering 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 Steuernummer: 48/725/00206 Umsatzsteueridentifikationsnummer: DE813741370
