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