+ def FinalizeMigrationSource(self, instance, success, live):
+ """Finalize the instance migration on the source node.
+
+ @type instance: L{objects.Instance}
+ @param instance: the instance that was migrated
+ @type success: bool
+ @param success: whether the migration succeeded or not
+ @type live: bool
+ @param live: whether the user requested a live migration or not
+
+ """
+ pass
+
+ def GetMigrationStatus(self, instance):
+ """Get the migration status
+
+ @type instance: L{objects.Instance}
+ @param instance: the instance that is being migrated
+ @rtype: L{objects.MigrationStatus}
+ @return: the status of the current migration (one of
+ L{constants.HV_MIGRATION_VALID_STATUSES}), plus any additional
+ progress info that can be retrieved from the hypervisor
+
+ """
+ raise NotImplementedError
+
+ def _InstanceStartupMemory(self, instance):
+ """Get the correct startup memory for an instance
+
+ This function calculates how much memory an instance should be started
+ with, making sure it's a value between the minimum and the maximum memory,
+ but also trying to use no more than the current free memory on the node.
+
+ @type instance: L{objects.Instance}
+ @param instance: the instance that is being started
+ @rtype: integer
+ @return: memory the instance should be started with
+
+ """
+ free_memory = self.GetNodeInfo()["memory_free"]
+ max_start_mem = min(instance.beparams[constants.BE_MAXMEM], free_memory)
+ start_mem = max(instance.beparams[constants.BE_MINMEM], max_start_mem)
+ return start_mem
+