def _inject_into_image(self, context, node, instance, network_info, injected_files=None, admin_password=None): """Inject last-mile configuration into instances image Much of this method is a hack around DHCP and cloud-init not working together with baremetal provisioning yet. """ partition = None if not instance["kernel_id"]: partition = "1" ssh_key = None if "key_data" in instance and instance["key_data"]: ssh_key = str(instance["key_data"]) if injected_files is None: injected_files = [] else: injected_files = list(injected_files) net_config = build_network_config(network_info) if instance["hostname"]: injected_files.append(("/etc/hostname", instance["hostname"])) LOG.debug("Injecting files into image for instance %(name)s", {"name": instance["name"]}) bm_utils.inject_into_image( image=get_image_file_path(instance), key=ssh_key, net=net_config, metadata=utils.instance_meta(instance), admin_password=admin_password, files=injected_files, partition=partition, )
def _inject_into_image(self, context, node, instance, network_info, injected_files=None, admin_password=None): """Inject last-mile configuration into instances image Much of this method is a hack around DHCP and cloud-init not working together with baremetal provisioning yet. """ # NOTE(deva): We assume that if we're not using a kernel, # then the target partition is the first partition partition = None if not instance['kernel_id']: partition = "1" ssh_key = None if 'key_data' in instance and instance['key_data']: ssh_key = str(instance['key_data']) if injected_files is None: injected_files = [] else: # NOTE(deva): copy so we dont modify the original injected_files = list(injected_files) net_config = build_network_config(network_info) if instance['hostname']: injected_files.append(('/etc/hostname', instance['hostname'])) LOG.debug( _("Injecting files into image for instance %(name)s") % {'name': instance['name']}) bm_utils.inject_into_image( image=get_image_file_path(instance), key=ssh_key, net=net_config, metadata=instance['metadata'], admin_password=admin_password, files=injected_files, partition=partition, )
def _inject_into_image(self, context, node, instance, network_info, injected_files=None, admin_password=None): """Inject last-mile configuration into instances image Much of this method is a hack around DHCP and cloud-init not working together with baremetal provisioning yet. """ partition = None if not instance['kernel_id']: partition = "1" ssh_key = None if 'key_data' in instance and instance['key_data']: ssh_key = str(instance['key_data']) if injected_files is None: injected_files = [] else: injected_files = list(injected_files) net_config = build_network_config(network_info) if instance['hostname']: injected_files.append(('/etc/hostname', instance['hostname'])) LOG.debug("Injecting files into image for instance %(name)s", {'name': instance['name']}) bm_utils.inject_into_image( image=get_image_file_path(instance), key=ssh_key, net=net_config, metadata=utils.instance_meta(instance), admin_password=admin_password, files=injected_files, partition=partition, )
def _inject_into_image(self, context, node, instance, network_info, injected_files=None, admin_password=None): """Inject last-mile configuration into instances image Much of this method is a hack around DHCP and cloud-init not working together with baremetal provisioning yet. """ # NOTE(deva): We assume that if we're not using a kernel, # then the target partition is the first partition partition = None if not instance['kernel_id']: partition = "1" ssh_key = None if 'key_data' in instance and instance['key_data']: ssh_key = str(instance['key_data']) if injected_files is None: injected_files = [] else: # NOTE(deva): copy so we dont modify the original injected_files = list(injected_files) net_config = build_network_config(network_info) if instance['hostname']: injected_files.append(('/etc/hostname', instance['hostname'])) LOG.debug(_("Injecting files into image for instance %(name)s") % {'name': instance['name']}) bm_utils.inject_into_image( image=get_image_file_path(instance), key=ssh_key, net=net_config, metadata=instance['metadata'], admin_password=admin_password, files=injected_files, partition=partition, )
def _inject_into_image(self, context, node, instance, network_info, injected_files=None, admin_password=None): """Inject last-mile configuration into instances image Much of this method is a hack around DHCP and cloud-init not working together with baremetal provisioning yet. """ # NOTE(deva): We assume that if we're not using a kernel, # then the target partition is the first partition partition = None if not instance["kernel_id"]: partition = "1" ssh_key = None if "key_data" in instance and instance["key_data"]: ssh_key = str(instance["key_data"]) if injected_files is None: injected_files = [] net_config = build_network_config(network_info) udev_rules = self._generate_udev_rules(context, node) injected_files.append(("/etc/udev/rules.d/70-persistent-net.rules", udev_rules)) if instance["hostname"]: injected_files.append(("/etc/hostname", instance["hostname"])) LOG.debug(_("Injecting files into image for instance %(name)s") % {"name": instance["name"]}) bm_utils.inject_into_image( image=get_image_file_path(instance), key=ssh_key, net=net_config, metadata=instance["metadata"], admin_password=admin_password, files=injected_files, partition=partition, )