Skip to content

Boot order handling - #111

Merged
WillNilges merged 8 commits into
ComputerScienceHouse:masterfrom
harmonherring:boot-order
Nov 12, 2021
Merged

WillNilges merged 8 commits into
ComputerScienceHouse:masterfrom
harmonherring:boot-order

Conversation

@harmonherring

Copy link
Copy Markdown
Contributor

Fixes #85
May need adjustments for mobile devices, possibly remove device description in the selection modal

Update boot order parsing so as to be compatible with the new
Proxmox syntax for virtual machine boot device ordering.

Maintain support for the deprecated boot device order syntax. Virtual
machines using the deprecated syntax are not updated to use the new
syntax.
Create a method to get the drives attached to a vm that have
media type cdrom.
Propose new boot order to owners of VMs that exist on nodes
running Proxmox version 6.3 or greater.

Instead of returning the legacy boot order to the UI, a new boot
order is created and sent instead. The new order mimics the old
order, but is compliant with the new format. The new order will
take effect only if the user explicitly updates.
Change format of the VM boot order JSON. This new format allows
the UI to mimic the Proxmox boot order selection system.

The new format is as follows
{
  'legacy': False,
  'order': [
    {
      'device': 'virtio0',
      'description': 'local-lvm:vm-102-disk-0,size=8G',
      'enabled': True
    },
    ...
  ]
}
Update the UI boot order selection element. It has been modified to
support the new 'order=' format for the Proxmox boot order option
in a more intuitive way for the user. The new element allows users
to enable any bootable device and choose the order for these
devices to boot in.

The new UI element is a table with four columns. The first column
indicates the order of the corresponding device. The second column
indicates whether the device is enabled as bootable. The third
column contains the device name. The fourth column contains the
device description. The order of the columns is changed by
dragging, enabled by SortableJS.

In cases of legacy nodes, the older dropdown boxes are used.
Disabled boot devices will no longer show up in the boot order
display on the vm details page in the resources section.
@WillNilges WillNilges self-assigned this Sep 27, 2021
@WillNilges
WillNilges self-requested a review September 27, 2021 05:43
@WillNilges

Copy link
Copy Markdown
Member

I'd like to get this working on my local machine before we merge this, if I can actually find a single second in my day to actually do so.

})
);
row.insertCell().innerHTML = boot_order.order[i].device;
row.insertCell().innerHTML = boot_order.order[i].description;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to @harmonherring the boot order selection menu descriptions break the view on mobile devices.

@WillNilges WillNilges left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have verified that the changes work. @harmonherring has a known issue with the mobile view that he'll fix. As soon as that's pushed, I'll merge this PR.

@WillNilges

WillNilges commented Nov 12, 2021 •

Copy link
Copy Markdown
Member

So, not having this is causing a lot of issues in Proxstar right now.

2021-11-11 19:20:47,395 ERROR Exception on /vm/217 [GET]
Traceback (most recent call last):
  File "/opt/app-root/lib64/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/app-root/lib64/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/app-root/lib64/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/opt/app-root/lib64/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/opt/app-root/lib64/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/app-root/lib64/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/opt/app-root/lib64/python3.8/site-packages/flask_pyoidc/flask_pyoidc.py", line 253, in wrapper
    return view_func(*args, **kwargs)
  File "/opt/app-root/src/proxstar/__init__.py", line 220, in vm_details
    return render_template(
  File "/opt/app-root/lib64/python3.8/site-packages/flask/templating.py", line 137, in render_template
    return _render(
  File "/opt/app-root/lib64/python3.8/site-packages/flask/templating.py", line 120, in _render
    rv = template.render(context)
  File "/opt/app-root/lib64/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/opt/app-root/lib64/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/opt/app-root/lib64/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/opt/app-root/src/proxstar/templates/vm_details.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/opt/app-root/src/proxstar/templates/base.html", line 90, in top-level template code
    {% block body %}
  File "/opt/app-root/src/proxstar/templates/vm_details.html", line 21, in block "body"
    {% for interface in vm.interfaces %}
  File "/opt/app-root/lib64/python3.8/site-packages/jinja2/environment.py", line 471, in getattr
    return getattr(obj, attribute)
  File "/opt/app-root/src/proxstar/util.py", line 18, in _lazy_property
    setattr(self, attr_name, fn(self))
  File "/opt/app-root/src/proxstar/vm.py", line 153, in interfaces
    ip = get_ip_for_mac(starrs, mac)
  File "/opt/app-root/src/proxstar/starrs.py", line 20, in get_ip_for_mac
    c.execute('BEGIN')
psycopg2.OperationalError: SSL connection has been closed unexpectedly

Gonna merge this to make it stop dying. @galenguyer and I aren't 100% sure if it'll help, but ¯\_(ツ)_/¯

@WillNilges
WillNilges merged commit 8e5f173 into ComputerScienceHouse:master Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix boot order handling

3 participants