← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1445863] Re: Unable to pass the parameter hostname to nova-api, when creating an instance.

 

Cleanup
=======

This bug report has the status "Incomplete" since more than 30 days
and it looks like that there are no open reviews for it. To keep
the bug list sane, I close this bug with "won't fix". This does not
mean that it is not a valid bug report, it's more to acknowledge that
no progress can be expected here anymore. You are still free to push a
new patch for this bug. If you could reproduce it on the current master
code or on a maintained stable branch, please switch it to "Confirmed".

** Changed in: nova
       Status: Incomplete => Won't Fix

** Changed in: nova
     Assignee: javeme (javaloveme) => (unassigned)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1445863

Title:
  Unable to pass the parameter hostname to nova-api, when creating an
  instance.

Status in OpenStack Compute (nova):
  Won't Fix

Bug description:
  When we create an instance, it's unable to pass the parameter hostname to nova-api.
  Now, we use display_name as hostname[1], but obviously this is not a good practice because they are independent, In addition, hostname must conform to RFC 952, RFC 1123 specification, but the display name is not necessary.
  So we need to pass hostname from the Rest API, and set it into the instance.

  change method API.create()  [nova/compute/api.py]
      def create(self, context, instance_type,
                 image_href, kernel_id=None, ramdisk_id=None,
                 min_count=None, max_count=None,
                 display_name=None, display_description=None,
                 key_name=None, key_data=None, security_group=None,
                 availability_zone=None, user_data=None, metadata=None,
                 injected_files=None, admin_password=None,
                 block_device_mapping=None, access_ip_v4=None,
                 access_ip_v6=None, requested_networks=None, config_drive=None,
                 auto_disk_config=None, scheduler_hints=None, legacy_bdm=True,
                 shutdown_terminate=False, check_server_group_quota=False)
  into:
      def create(self, context, instance_type,
                 image_href, kernel_id=None, ramdisk_id=None,
                 min_count=None, max_count=None,
                 display_name=None, display_description=None,
                 key_name=None, key_data=None, security_group=None,
                 availability_zone=None, user_data=None, metadata=None,
                 injected_files=None, admin_password=None,
                 block_device_mapping=None, access_ip_v4=None,
                 access_ip_v6=None, requested_networks=None, config_drive=None,
                 auto_disk_config=None, scheduler_hints=None, legacy_bdm=True,
                 shutdown_terminate=False, check_server_group_quota=False,
                 hostname=None)

  ps.
  [1] nova/compute/api.py class API._populate_instance_for_create():
      def _populate_instance_names(self, instance, num_instances):
          """Populate instance display_name and hostname."""
          display_name = instance.get('display_name')
          if instance.obj_attr_is_set('hostname'):
              hostname = instance.get('hostname')
          else:
              hostname = None

          if display_name is None:
              display_name = self._default_display_name(instance.uuid)
              instance.display_name = display_name

          if hostname is None and num_instances == 1:
              # NOTE(russellb) In the multi-instance case, we're going to
              # overwrite the display_name using the
              # multi_instance_display_name_template.  We need the default
              # display_name set so that it can be used in the template, though.
              # Only set the hostname here if we're only creating one instance.
              # Otherwise, it will be built after the template based
              # display_name.
              hostname = display_name
              instance.hostname = utils.sanitize_hostname(hostname)

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1445863/+subscriptions


References