diff options
| author | Josh Kearney <josh@jk0.org> | 2011-09-13 19:57:40 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-09-13 19:57:40 +0000 |
| commit | 2f45e36060378048de0fec0cb1fa47da51f7a633 (patch) | |
| tree | 6a2849b8e26fb0370e03dca7a8c0fe5b6c801e80 | |
| parent | c3195f02cad33acc7c43030b0a7151cd8a439ef3 (diff) | |
| parent | 3f92fc99c23b0cc17f31ff9d988733abac98028a (diff) | |
| download | nova-2f45e36060378048de0fec0cb1fa47da51f7a633.tar.gz nova-2f45e36060378048de0fec0cb1fa47da51f7a633.tar.xz nova-2f45e36060378048de0fec0cb1fa47da51f7a633.zip | |
Inject hostname to xenstore upon creation.
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index fb9c602d9..15b942a82 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -253,6 +253,8 @@ class VMOps(object): self.create_vifs(vm_ref, instance, network_info) self.inject_network_info(instance, network_info, vm_ref) + self.inject_hostname(vm_ref, instance['hostname']) + return vm_ref def _attach_disks(self, instance, disk_image_type, vm_ref, first_vdi_ref, @@ -1158,6 +1160,12 @@ class VMOps(object): resp = self._make_plugin_call('agent', 'resetnetwork', instance, '', args, vm_ref) + def inject_hostname(self, vm_ref, hostname): + """Inject the hostname of the instance into the xenstore.""" + logging.debug(_("injecting hostname to xs for vm: |%s|"), vm_ref) + self._session.call_xenapi_request("VM.add_to_xenstore_data", + (vm_ref, "vm-data/hostname", hostname)) + def list_from_xenstore(self, vm, path): """ Runs the xenstore-ls command to get a listing of all records |
