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)
def GetMigrationStatus(self, instance): """Get the migration status As MigrateInstance for Xen is still blocking, if this method is called it means that MigrateInstance has completed successfully. So we can safely assume that the migration was successful and notify this fact to the client. @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)
def setUp(self): super(TestLUInstanceMigrate, self).setUp() self.snode = self.cfg.AddNewNode() hv_info = ("bootid", [{ "type": constants.ST_LVM_VG, "storage_free": 10000 }], ({"memory_free": 10000}, )) self.rpc.call_node_info.return_value = \ self.RpcResultsBuilder() \ .AddSuccessfulNode(self.master, hv_info) \ .AddSuccessfulNode(self.snode, hv_info) \ .Build() self.rpc.call_blockdev_find.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, objects.BlockDevStatus()) self.rpc.call_migration_info.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, True) self.rpc.call_accept_instance.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.snode, True) self.rpc.call_instance_migrate.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, True) self.rpc.call_instance_get_migration_status.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, objects.MigrationStatus()) self.rpc.call_instance_finalize_migration_dst.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.snode, True) self.rpc.call_instance_finalize_migration_src.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, True) self.inst = self.cfg.AddNewInstance(disk_template=constants.DT_DRBD8, admin_state=constants.ADMINST_UP, secondary_node=self.snode) self.op = opcodes.OpInstanceMigrate(instance_name=self.inst.name)
def _ResetRPC(self): hv_info = ("bootid", [{ "type": constants.ST_LVM_VG, "storage_free": 10000 }], ({"memory_free": 10000}, )) self.rpc.call_node_info.return_value = \ self.RpcResultsBuilder() \ .AddSuccessfulNode(self.master, hv_info) \ .AddSuccessfulNode(self.snode, hv_info) \ .Build() self.rpc.call_blockdev_find.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, objects.BlockDevStatus()) self.rpc.call_migration_info.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, True) self.rpc.call_accept_instance.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.snode, True) self.rpc.call_instance_migrate.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, True) self.rpc.call_instance_get_migration_status.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, objects.MigrationStatus()) self.rpc.call_instance_start_postcopy.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, True) self.rpc.call_instance_finalize_migration_dst.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.snode, True) self.rpc.call_instance_finalize_migration_src.return_value = \ self.RpcResultsBuilder() \ .CreateSuccessfulNodeResult(self.master, True)
def _buildMigrationStatusResponse(self, **kwargs): return self.RpcResultsBuilder().CreateSuccessfulNodeResult( self.master, objects.MigrationStatus(**kwargs) )