components/openstack/horizon/patches/17-add-boot-options.patch
changeset 6856 356aeea98c39
parent 5640 47302747b363
equal deleted inserted replaced
6855:ea44e7e0ca98 6856:356aeea98c39
     1 Patch to add kernel(8) and boot(8) options to horizon.
     1 Patch to add kernel(8) and boot(8) options to horizon.
     2 
     2 
     3 There are no plans to push this upstream.
     3 There are no plans to push this upstream.
     4 
     4 
     5 --- horizon-2015.1.2/openstack_dashboard/dashboards/project/instances/views.py.orig	2016-01-12 15:39:19.871734393 -0700
     5 --- horizon-9.0.1/openstack_dashboard/api/nova.py.~1~	2016-06-02 13:05:56.000000000 -0700
     6 +++ horizon-2015.1.2/openstack_dashboard/dashboards/project/instances/views.py	2016-01-14 13:36:28.185989955 -0700
     6 +++ horizon-9.0.1/openstack_dashboard/api/nova.py	2016-06-29 23:54:56.937162560 -0700
     7 @@ -21,6 +21,7 @@ Views for managing instances.
     7 @@ -741,6 +741,10 @@ def server_update(request, instance_id,
     8  """
       
     9  import logging
       
    10 
       
    11 +from django.conf import settings
       
    12  from django.core.urlresolvers import reverse
       
    13  from django.core.urlresolvers import reverse_lazy
       
    14  from django import http
       
    15 @@ -251,6 +252,14 @@ class UpdateView(workflows.WorkflowView)
       
    16          initial = super(UpdateView, self).get_initial()
       
    17          initial.update({'instance_id': self.kwargs['instance_id'],
       
    18                          'name': getattr(self.get_object(), 'name', '')})
       
    19 +        if getattr(settings, 'SOLARIS_BOOTARGS', True):
       
    20 +            metadata = getattr(self.get_object(), 'metadata', '')
       
    21 +            bootargs = metadata.get('bootargs')
       
    22 +            bootargs_persist = metadata.get(
       
    23 +                'bootargs_persist', 'False').lower() == 'true'
       
    24 +
       
    25 +            initial.update({'bootargs': bootargs,
       
    26 +                            'bootargs_persist': bootargs_persist})
       
    27          return initial
       
    28 
       
    29 
       
    30 --- horizon-2015.1.2/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py.orig	2016-02-08 15:35:17.142181350 -0600
       
    31 +++ horizon-2015.1.2/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py	2016-02-08 15:35:29.148388395 -0600
       
    32 @@ -22,6 +22,7 @@ import operator
       
    33 
       
    34  from oslo_utils import units
       
    35 
       
    36 +from django.conf import settings
       
    37  from django.template.defaultfilters import filesizeformat  # noqa
       
    38  from django.utils.text import normalize_newlines  # noqa
       
    39  from django.utils.translation import ugettext_lazy as _
       
    40 @@ -872,6 +873,14 @@ class LaunchInstance(workflows.Workflow)
       
    41              nics = self.set_network_port_profiles(request,
       
    42                                                    context['network_id'],
       
    43                                                    context['profile_id'])
       
    44 +        metadata = {}
       
    45 +        if getattr(settings, 'SOLARIS_BOOTARGS', True):
       
    46 +            bopts = context.get('boot_options').strip()
       
    47 +            if bopts:
       
    48 +                metadata = {
       
    49 +                    "bootargs": bopts,
       
    50 +                    "bootargs_persist": str(context.get('bootargs_persist'))
       
    51 +                }
       
    52 
       
    53          try:
       
    54              api.nova.server_create(request,
       
    55 @@ -888,7 +897,8 @@ class LaunchInstance(workflows.Workflow)
       
    56                                     instance_count=int(context['count']),
       
    57                                     admin_pass=context['admin_pass'],
       
    58                                     disk_config=context.get('disk_config'),
       
    59 -                                   config_drive=context.get('config_drive'))
       
    60 +                                   config_drive=context.get('config_drive'),
       
    61 +                                   meta=metadata)
       
    62              return True
       
    63          except Exception:
       
    64              if port_profiles_supported:
       
    65 --- horizon-2015.1.2/openstack_dashboard/api/nova.py.orig	2015-12-08 16:05:40.611921571 -0700
       
    66 +++ horizon-2015.1.2/openstack_dashboard/api/nova.py	2015-12-08 16:06:20.242257576 -0700
       
    67 @@ -661,6 +661,10 @@ def server_update(request, instance_id,
       
    68      return novaclient(request).servers.update(instance_id, name=name)
     8      return novaclient(request).servers.update(instance_id, name=name)
    69  
     9  
    70  
    10  
    71 +def server_set_meta(request, instance_id, metadata):
    11 +def server_set_meta(request, instance_id, metadata):
    72 +    return novaclient(request).servers.set_meta(instance_id, metadata=metadata)
    12 +    return novaclient(request).servers.set_meta(instance_id, metadata=metadata)
    73 +
    13 +
    74 +
    14 +
    75  def server_migrate(request, instance_id):
    15  def server_migrate(request, instance_id):
    76      novaclient(request).servers.migrate(instance_id)
    16      novaclient(request).servers.migrate(instance_id)
    77 
    17  
    78 --- horizon-2015.1.2/openstack_dashboard/dashboards/project/instances/tables.py.orig	2016-02-17 09:04:25.877390975 -0600
    18 --- horizon-9.0.1/openstack_dashboard/dashboards/project/instances/tables.py.~1~	2016-06-02 13:05:56.000000000 -0700
    79 +++ horizon-2015.1.2/openstack_dashboard/dashboards/project/instances/tables.py	2016-02-17 09:06:41.425616719 -0600
    19 +++ horizon-9.0.1/openstack_dashboard/dashboards/project/instances/tables.py	2016-06-29 23:54:56.938087190 -0700
    80 @@ -390,6 +390,14 @@ class EditInstance(policy.PolicyTargetMi
    20 @@ -459,6 +459,14 @@ class EditInstance(policy.PolicyTargetMi
    81          return not is_deleting(instance)
    21          return not is_deleting(instance)
    82  
    22  
    83  
    23  
    84 +class EditBootargs(EditInstance):
    24 +class EditBootargs(EditInstance):
    85 +    name = "edit_bootargs"
    25 +    name = "edit_bootargs"
    90 +
    30 +
    91 +
    31 +
    92  class EditInstanceSecurityGroups(EditInstance):
    32  class EditInstanceSecurityGroups(EditInstance):
    93      name = "edit_secgroups"
    33      name = "edit_secgroups"
    94      verbose_name = _("Edit Security Groups")
    34      verbose_name = _("Edit Security Groups")
    95 @@ -1065,3 +1073,7 @@ class InstancesTable(tables.DataTable):
    35 @@ -1213,3 +1221,7 @@ class InstancesTable(tables.DataTable):
    96                         ResizeLink, LockInstance, UnlockInstance,
    36                         ToggleShelve, ResizeLink, LockInstance, UnlockInstance,
    97                         SoftRebootInstance, RebootInstance,
    37                         SoftRebootInstance, RebootInstance,
    98                         StopInstance, RebuildInstance, TerminateInstance)
    38                         StopInstance, RebuildInstance, DeleteInstance)
    99 +        pos = row_actions.index(ConsoleLink)
    39 +        pos = row_actions.index(ConsoleLink)
   100 +        if getattr(settings, 'SOLARIS_BOOTARGS', True):
    40 +        if getattr(settings, 'SOLARIS_BOOTARGS', True):
   101 +            row_actions = (row_actions[:pos] + (EditBootargs,) +
    41 +            row_actions = (row_actions[:pos] + (EditBootargs,) +
   102 +                           row_actions[pos:])
    42 +                           row_actions[pos:])
       
    43 --- horizon-9.0.1/openstack_dashboard/dashboards/project/instances/views.py.~1~	2016-06-02 13:05:56.000000000 -0700
       
    44 +++ horizon-9.0.1/openstack_dashboard/dashboards/project/instances/views.py	2016-06-29 23:54:56.938661255 -0700
       
    45 @@ -255,6 +255,14 @@ class UpdateView(workflows.WorkflowView)
       
    46          initial = super(UpdateView, self).get_initial()
       
    47          initial.update({'instance_id': self.kwargs['instance_id'],
       
    48                          'name': getattr(self.get_object(), 'name', '')})
       
    49 +        if getattr(settings, 'SOLARIS_BOOTARGS', True):
       
    50 +            metadata = getattr(self.get_object(), 'metadata', '')
       
    51 +            bootargs = metadata.get('bootargs')
       
    52 +            bootargs_persist = metadata.get(
       
    53 +                'bootargs_persist', 'False').lower() == 'true'
       
    54 +
       
    55 +            initial.update({'bootargs': bootargs,
       
    56 +                            'bootargs_persist': bootargs_persist})
       
    57          return initial
       
    58  
       
    59  
       
    60 --- horizon-9.0.1/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py.~2~	2016-06-29 23:54:56.857026635 -0700
       
    61 +++ horizon-9.0.1/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py	2016-06-29 23:54:56.939484170 -0700
       
    62 @@ -23,6 +23,7 @@ import operator
       
    63  from oslo_utils import units
       
    64  import six
       
    65  
       
    66 +from django.conf import settings
       
    67  from django.template.defaultfilters import filesizeformat  # noqa
       
    68  from django.utils.text import normalize_newlines  # noqa
       
    69  from django.utils.translation import ugettext_lazy as _
       
    70 @@ -949,6 +950,14 @@ class LaunchInstance(workflows.Workflow)
       
    71              nics = self.set_network_port_profiles(request,
       
    72                                                    context['network_id'],
       
    73                                                    context['profile_id'])
       
    74 +        metadata = {}
       
    75 +        if getattr(settings, 'SOLARIS_BOOTARGS', True):
       
    76 +            bopts = context.get('boot_options').strip()
       
    77 +            if bopts:
       
    78 +                metadata = {
       
    79 +                    "bootargs": bopts,
       
    80 +                    "bootargs_persist": str(context.get('bootargs_persist'))
       
    81 +                }
       
    82  
       
    83          ports = context.get('ports')
       
    84          if ports:
       
    85 @@ -971,7 +980,8 @@ class LaunchInstance(workflows.Workflow)
       
    86                                     instance_count=int(context['count']),
       
    87                                     admin_pass=context['admin_pass'],
       
    88                                     disk_config=context.get('disk_config'),
       
    89 -                                   config_drive=context.get('config_drive'))
       
    90 +                                   config_drive=context.get('config_drive'),
       
    91 +                                   meta=metadata)
       
    92              return True
       
    93          except Exception:
       
    94              if port_profiles_supported: