def __init__(self): if self._instance is not None: raise RuntimeError("Cannot instantiate twice.") self.status = rd_models.InstanceServiceStatus( instance_id=CONF.guest_id, status=rd_instance.ServiceStatuses.NEW) self.restart_mode = False
def _create_iss(self): new_id = utils.generate_uuid() iss = t_models.InstanceServiceStatus(id=new_id, instance_id=self.instance_id, status=ServiceStatuses.NEW) iss.save() return new_id
def _create_instance(self): self.context = TroveContext(is_admin=True) self.tenant_id = 999 self.db_info = DBInstance.create( id="inst-id-1", name="instance", flavor_id=1, datastore_version_id=test_config.dbaas_datastore_version_id, tenant_id=self.tenant_id, volume_size=None, task_status=InstanceTasks.NONE) self.server = self.mock.CreateMock(Server) self.instance = imodels.Instance( self.context, self.db_info, self.server, datastore_status=imodels.InstanceServiceStatus( tr_instance.ServiceStatuses.RUNNING))