Merge pull request #39 from hub-cap/use_uuid
Fixing the queues to use uuid.
This commit is contained in:
commit
d5a3a4e737
@ -57,9 +57,13 @@ if __name__ == '__main__':
|
||||
conf_loc = '%s/%s' % (config.Config.get('here'), 'conf.d/guest_info')
|
||||
config.Config.append_to_config_values('reddwarf-guestagent',
|
||||
{'config_file': conf_loc}, None)
|
||||
# Now do the same for the /etc/guest_info file
|
||||
# that is injected into the VM
|
||||
config.Config.append_to_config_values('reddwarf-guestagent',
|
||||
{'config_file': '/etc/guest_info'}, None)
|
||||
db_api.configure_db(conf)
|
||||
server = service.Service.create(binary='reddwarf-guestagent',
|
||||
host=socket.gethostname())
|
||||
host=config.Config.get('guest_id'))
|
||||
service.serve(server)
|
||||
service.wait()
|
||||
except RuntimeError as error:
|
||||
|
@ -39,9 +39,7 @@ class API(object):
|
||||
|
||||
def _get_routing_key(self, context, id):
|
||||
"""Create the routing key based on the container id"""
|
||||
# TODO(hub-cap): make this work in a real environment with
|
||||
# more than one guest
|
||||
return "guestagent.ubuntu"
|
||||
return "guestagent.%s" % id
|
||||
|
||||
def create_user(self, context, id, users):
|
||||
"""Make an asynchronous call to create a new database user"""
|
||||
@ -125,8 +123,7 @@ class API(object):
|
||||
rpc.cast_with_consumer(context, self._get_routing_key(context, id),
|
||||
{"method": "prepare",
|
||||
"args": {"databases": databases,
|
||||
"memory_mb": memory_mb,
|
||||
"uuid": id}
|
||||
"memory_mb": memory_mb}
|
||||
})
|
||||
|
||||
def restart(self, context, id):
|
||||
|
@ -256,7 +256,7 @@ class DBaaSAgent(object):
|
||||
LOG.debug("result = " + str(result))
|
||||
return result.rowcount != 0
|
||||
|
||||
def prepare(self, databases, memory_mb, uuid):
|
||||
def prepare(self, databases, memory_mb):
|
||||
"""Makes ready DBAAS on a Guest container."""
|
||||
global PREPARING
|
||||
PREPARING = True
|
||||
@ -267,10 +267,6 @@ class DBaaSAgent(object):
|
||||
preparer.prepare()
|
||||
self.create_database(databases)
|
||||
PREPARING = False
|
||||
# Writing the UUID to the guest agent guest_info file
|
||||
conf_loc = '%s/%s' % (config.Config.get('here'), 'conf.d/guest_info')
|
||||
config.Config.write_config_values('reddwarf-guestagent',
|
||||
{'config_file': conf_loc}, None, guest_id=uuid)
|
||||
|
||||
def update_status(self):
|
||||
"""Update the status of the MySQL service"""
|
||||
|
@ -121,13 +121,15 @@ class Instance(object):
|
||||
|
||||
@classmethod
|
||||
def create(cls, context, name, flavor_ref, image_id):
|
||||
client = create_nova_client(context)
|
||||
server = client.servers.create(name, image_id, flavor_ref)
|
||||
LOG.debug("Created new compute instance %s." % server.id)
|
||||
db_info = DBInstance.create(name=name,
|
||||
compute_instance_id=server.id,
|
||||
task_status=InstanceTasks.BUILDING)
|
||||
LOG.debug("Created new Reddwarf instance %s..." % db_info.id)
|
||||
client = create_nova_client(context)
|
||||
server = client.servers.create(name, image_id, flavor_ref,
|
||||
files={"/etc/guest_info":"guest_id=%s" % db_info.id})
|
||||
LOG.debug("Created new compute instance %s." % server.id)
|
||||
db_info.compute_instance_id = server.id
|
||||
db_info.save()
|
||||
service_status = InstanceServiceStatus.create(instance_id=db_info.id,
|
||||
status=ServiceStatuses.NEW)
|
||||
# Now wait for the response from the create to do additional work
|
||||
|
Loading…
Reference in New Issue
Block a user