+
+ @classmethod
+ def PowercycleNode(cls):
+ """Fake hypervisor powercycle, just a wrapper over Linux powercycle.
+
+ """
+ cls.LinuxPowercycle()
+
+ def AcceptInstance(self, instance, info, target):
+ """Prepare to accept an instance.
+
+ @type instance: L{objects.Instance}
+ @param instance: instance to be accepted
+ @type info: string
+ @param info: instance info, not used
+ @type target: string
+ @param target: target host (usually ip), on this node
+
+ """
+ if self._IsAlive(instance.name):
+ raise errors.HypervisorError("Can't accept instance, already running")
+
+ def MigrateInstance(self, instance, target, live):
+ """Migrate an instance.
+
+ @type instance: L{objects.Instance}
+ @param instance: the instance to be migrated
+ @type target: string
+ @param target: hostname (usually ip) of the target node
+ @type live: boolean
+ @param live: whether to do a live or non-live migration
+
+ """
+ logging.debug("Fake hypervisor migrating %s to %s (live=%s)",
+ instance, target, live)
+
+ def FinalizeMigrationDst(self, instance, info, success):
+ """Finalize the instance migration on the target node.
+
+ For the fake hv, this just marks the instance up.
+
+ @type instance: L{objects.Instance}
+ @param instance: instance whose migration is being finalized
+ @type info: string/data (opaque)
+ @param info: migration information, from the source node
+ @type success: boolean
+ @param success: whether the migration was a success or a failure
+
+ """
+ if success:
+ self._MarkUp(instance, self._InstanceStartupMemory(instance))
+ else:
+ # ensure it's down
+ self._MarkDown(instance.name)
+
+ def PostMigrationCleanup(self, instance):
+ """Clean-up after a migration.
+
+ To be executed on the source node.
+
+ @type instance: L{objects.Instance}
+ @param instance: the instance that was migrated
+
+ """
+ pass
+
+ 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
+
+ """
+ # pylint: disable=W0613
+ if success:
+ self._MarkDown(instance.name)
+
+ def GetMigrationStatus(self, instance):
+ """Get the migration status
+
+ The fake hypervisor migration always succeeds.
+
+ @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
+
+ """
+ return objects.MigrationStatus(status=constants.HV_MIGRATION_COMPLETED)