Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

machines: Add create vm dialog #7820

Merged
merged 1 commit into from
Feb 2, 2018

Conversation

atiratree
Copy link
Contributor

@atiratree atiratree commented Oct 5, 2017

Hello, I overtook #7138
creating vm works now but it was not tested properly yet

there are few changes in the proposed UI

  • no memory slider unless somebody knows how to detect maximum memory
  • operating system and version are changed to vendor and operating system because of osinfo-query
  • composition of the Ui is a bit changed mainly because it was not possible to fit vendor and os next to each other (too long names)

also I had to extend Select in pkg/lib/cockpit-components-select.jsx because it does not have any way to select items programmatically. Please let me know if I should refactor it or just use my StatelessSelect

todo:

  • open created vm in vmList
  • add remote url/server's filesystem options
  • create vm bar is hidden when no vms are present
  • better input validation
  • error localization
  • optimize shell scripts
  • refactor toMega/Kilo/GigaByte helpers
  • sorting
  • add console
  • start-immediatelly flow
  • postpone install flow [needs refactoring and correctness check]
  • fix double cd-rom creation
  • add install fail handler (possibly create as well)
  • add live cd checkbox
  • pass through number of cpus and consoles
  • testing (for disks test only size and format until disks dialog is implemented)
  • install (hide on click)

@petervo
Copy link
Contributor

petervo commented Oct 5, 2017

no memory slider unless somebody knows how to detect maximum memory

You can get memory a few different ways. Can you use metrics to get the memory metadata. (http://cockpit-project.org/guide/latest/cockpit-metrics.html). You can also of course run and parse commands like free or vmstat or even read and parse /proc/meminfo.

operating system and version are changed to vendor and operating system because of osinfo-query
composition of the Ui is a bit changed mainly because it was not possible to fit vendor and os next to each other (too long names)

@andreasn or @garrett you have any thoughts here?

@petervo
Copy link
Contributor

petervo commented Oct 5, 2017

also I had to extend Select in pkg/lib/cockpit-components-select.jsx because it does not have any way to select items programmatically. Please let me know if I should refactor it or just use my StatelessSelect

I'd suggest adding the feature to lib/cockpit-components-select.jsx.

I'd also suggest using the file selector here: https://github.com/cockpit-project/cockpit/blob/master/pkg/lib/cockpit-components-file-autocomplete.css

@atiratree
Copy link
Contributor Author

You can get memory a few different ways. Can you use metrics to get the memory metadata. (http://cockpit-project.org/guide/latest/cockpit-metrics.html). You can also of course run and parse commands like free or vmstat or even read and parse /proc/meminfo.

It is dependent mostly on the version of qemu/emulated machine and OS. There would need to be some backend which gets these values for us, because we do not want to delegate this functionality to frontend. Maybe we could add it in the future, but I would just use the input field for now.

I'd suggest adding the feature to lib/cockpit-components-select.jsx.

I will look at it again and see if the refactoring makes sense. But for now the StatelessSelect has different use case (delegates selected state to parent)

I'd also suggest using the file selector here: https://github.com/cockpit-project/cockpit/blob/master/pkg/lib/cockpit-components-file-autocomplete.css

thanks, I will try that

@petervo
Copy link
Contributor

petervo commented Oct 6, 2017

It is dependent mostly on the version of qemu/emulated machine and OS. There would need to be some backend which gets these values for us, because we do not want to delegate this functionality to frontend. Maybe we could add it in the future, but I would just use the input field for now.

In the absence of something better is there a reason we can't set it based on the machine's available memory. Still seems better to me than an text field.

@atiratree
Copy link
Contributor Author

atiratree commented Oct 6, 2017

In the absence of something better is there a reason we can't set it based on the machine's available memory. Still seems better to me than an text field.

I think it is mostly about the priorities what to do. I'd rather leave it until we can know the value correctly.



const _ = cockpit.gettext;
const OTHER_OS = "Other Os"
Copy link
Contributor

Choose a reason for hiding this comment

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

Capitalization error. Make this "Other OS"

<tr>
<td className="top">
<label className="control-label" for="location">
{_("Installation Location")}
Copy link
Contributor

Choose a reason for hiding this comment

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

At first I thought this referred to what directory it would install the OS into.
I would make this "Installation Source" to be more consistent with the Fedora/RHEL installer.
See https://access.redhat.com/webassets/avalon/d/Red_Hat_Enterprise_Linux-7-Installation_Guide-en-US/images/2f2c6dc8424ea84cc783f1d26d645839/installationsource.png

@garrett
Copy link
Member

garrett commented Oct 9, 2017

Thanks for implementing this! It's looking good so far.

...But I do have a lot to say about things that need changing still.

I'll keep this particular comment confined to the OS vendors & OS versions dropdowns, including the subtopics of widget implementation and dropdown content.


Dropdown height

Dropdowns extend past page height, as they do not take into account their starting position.

A fix in pkg/machines/machines.less would look like:

/* Make the max-height based on the screen hight - offset from the top */
#vendor-select .dropdown-menu {
    max-height: ~"calc(90vh - 50px - 8em)"
}

#system-select .dropdown-menu {
    max-height: ~"calc(90vh - 50px - 10em)"
}

Vendor dropdown order & grouping

The vendor list does not make sense.

vendor

  • Vendors should be grouped by OS (see https://getbootstrap.com/docs/3.3/components/#dropdowns-headers for implementation — Cockpit extends Patternfly which extends Bootstrap, so this is the way headings in dropdown lists should be implemented in Cockpit)
  • "Not specified" should be "Unspecified"
  • Dividers should be used between OS vendors and Unspecified
  • Most likely OS vendors should be placed first
  • Vendors within vendor groups should then be sorted alphabetically
  • Canonical should probably be listed as Ubuntu, else some people will probably not find it
  • Microsoft is split in two; it should be combined in one or renamed DOS and Windows
  • Sun and Oracle both only have Solaris versions — should that be combined into one "Solaris" group?
  • Mandriva hasn't existed for a few years. Should it be removed or put until other?
  • ALTLinux is a Russian distro; wikipedia lists the last release as version 6 from 2012; their website lists version 7 as their latest version and also "product removed from sale" (when http://www.altlinux.ru/products/7th-platform/centaurus/ is translated) — I'd suggest this be moved into the "Other" category or outright removed.
  • It may make sense to move host's OS to the top of the OS vendor list. (Example: In the case of RHEL, Red Hat would be first.)

Suggested list reorder

  • Linux
    • Canonical (Ubuntu)
    • CentOS
    • Debian
    • Fedora
    • Mageia
    • openSUSE
    • Red Hat
    • SUSE
  • Microsoft
    • Windows
    • DOS
  • UNIX
    • FreeBSD
    • NetBSD
    • OpenBSD
    • Solaris
  • Other
    • Alt Linux
    • Mandriva
    • Novell
  • --- [divider hr here] ---
  • Unspecified

OS version lists are not ordered properly

Screenshots of dropdowns:

Debian Fedora Windows
debian fedora windows
  • What are the (numbered) versions of Debian releases? What's stable? What's testing?
  • Fedora is all over the place. The first one is "Fedora", which is... what? The very old versions of Fedora Core are haphazardly inserted in random places. Fedora numbered releases are sorted alphabetically instead of numerically, so you have 1, 10, 11, ..., 19, 2, 20, 21, ... 26, 3, 4, ... — they should be sorted numerically (and in reverse order, so most recent are at the top)
  • Windows releases are all over the place as well, with 1.0 at the top, then 10, then 2.0, and so on.
  • Red Hat (not pictured above, as the list is so huge) contains RHEL and (the very old) Red Hat Linux from 1995 - 2003, making it quite awkward, especially since the sorting also does not make sense. Suggestion: Remove RHL and keep only Red Hat Enterprise Linux

Suggestions for OS version lists

All the OS version lists have issues. This stems from the fact that the current ordering doesn't work at all. The common solution would be to sort them in release order, from newest to oldest (so the most likely ones would be at the top).

Extremely old releases probably should be kicked out from the list — certainly this is the case for Red Hat Linux, but we might want to consider it for others as well.

Generic versions without release versions (such as "Fedora") should be renamed to "Generic" and placed at the bottom of the lists with a divider line above them.

For some OS versions that contain distinct products, we might want to consider grouping here as well. For example: Windows desktop versus Windows server. In the case of Windows specifically, this grouping would help make the releases make more sense, as release order would alternate between the distinct products. In this case, we probably would list Server versions before Desktop versions, because that's much more likely to be used in a server environment. (I would also suggest that we would only show server versions, but I do know people have odd setups where they use a desktop OS in a server environment for whatever reasons, so leaving it out entirely for Windows might not be a good idea.)

@garrett
Copy link
Member

garrett commented Oct 9, 2017

For reference, here's what the dialog currently looks like on my computer:

screenshot-2017-10-9 virtual machines - sunny

Further questions on the current implementation in this PR:

  • What is installation location and what should it contain? Is it the ISO that you install from? Is it a disk you provide? Is it a the VM is stored on the server? Is it optional? It's not clear; it's just an empty text input here.
  • Memory and storage size are both 0. Should they be set to a default size? If they're both 0, the VM wouldn't work ­— would it?
  • Related to the above sizes: When selecting a OS vendor & version, shouldn't the suggested disk & RAM sizes be prefilled?

@andreasn
Copy link
Contributor

andreasn commented Oct 9, 2017

Windows releases are all over the place as well, with 1.0 at the top, then 10, then 2.0, and so on.

Using the cli, if you sort them with osinfo-query os vendor="Microsoft Corporation" -s version then you'll get it a bit more right. However, it will need some more sorting logic, so it understands that 10 comes after 9 instead of 1.

@garrett
Copy link
Member

garrett commented Oct 9, 2017

For reference, I've ran the following command, had it parsed by splitting at | and stripping the results (using LibreOffice, but it can easily be parsed otherwise — not sure how it's currently parsed) and uploaded to Google Docs:

osinfo-query os --fields=release-date,eol-date,short-id,version,family,vendor,codename,id

Google Docs output: https://docs.google.com/spreadsheets/d/1Vdfo4m2mXcmhgEh6XabBU2txr7TxxjE4dWD6lIJ776Y/edit?usp=sharing

What I'm proposing is:

  • group by family for the label, merging a few together (for example: BSDs into a "UNIX" category, "win*" as "Windows", and so on)
  • sort OSes by a reverse numerical sort based on versions (so most recent are at the top)
  • include code names alongside versions, when applicable (with parenthesis when they exist)
  • a few string changes to make things a little nicer

@garrett
Copy link
Member

garrett commented Oct 9, 2017

I'm not sure which languages are used, but I've included some sorting examples in JavaScript.

Simple number-only sorting comparison:

[95, 3.11, 5, 9.4, 3, 12, 10].sort(function(a, b) { return b - a; });

Here's a more correct version that handles both strings and numbers:

[95, 3.11, 5, 9.4, "foo", "bar", 3, 12, 10].sort(function(a, b) {
    return (b + "").localeCompare(a, undefined, {
        numeric: true,
        sensitivity: 'base'
    });
});

(In most cases that have both numbers and strings, the strings are rolling releases and more current, so this works.)

@atiratree
Copy link
Contributor Author

I fixed the strings and dropdown height. Thanks for the css @garrett

At first I thought this referred to what directory it would install the OS into.
I would make this "Installation Source" to be more consistent with the Fedora/RHEL installer.
See https://access.redhat.com/webassets/avalon/d/Red_Hat_Enterprise_Linux-7-Installation_Guide-en-US/images/2f2c6dc8424ea84cc783f1d26d645839/installationsource.png

Sorry for the mistake - yes it is Installation Source. Btw should we have the switch as shown in your link? For URL and file or just one input with Upload button?

Memory and storage size are both 0. Should they be set to a default size? If they're both 0, the VM wouldn't work ­— would it?

0 memory would not work
0 storage is useful because it will not create any disk

Related to the above sizes: When selecting a OS vendor & version, shouldn't the suggested disk & RAM sizes be prefilled?

These are only suggestions for libvirt for optimizations. They do not have any other meaning. You can have different ISO than selected OS. I don't know If I misunderstood but I think these values are up to the user.

@atiratree
Copy link
Contributor Author

atiratree commented Oct 9, 2017

  • group by family for the label, merging a few together (for example: BSDs into a "UNIX" category, "win*" as "Windows", and so on)

So the selects stay same with the same meaning. And the vendor select will have family headers + better sorted right?

I would group just the win* family otherwise you will not have many labels. Still not sure if msdos should belong there.

  • sort OSes by a reverse numerical sort based on versions (so most recent are at the top)
  • include code names alongside versions, when applicable (with parenthesis when they exist)
  • a few string changes to make things a little nicer

sounds good

I'm not sure which languages are used, but I've included some sorting examples in JavaScript.

the sorting in javascript should not be a problem. script itself is in shell

Mandriva hasn't existed for a few years. Should it be removed or put until other?
ALTLinux is a Russian distro; wikipedia lists the last release as version 6 from 2012; their
etc.

I would rather not introduce any rules based on specific distros/families. How do we decide which distro goes out and which does not? I do not think user will be bothered by that much if we implement sorting well. virt-install expects one of these values and I think the user should have the option to do so as well

@atiratree
Copy link
Contributor Author

also I had to extend Select in pkg/lib/cockpit-components-select.jsx because it does not have any way to select items programmatically. Please let me know if I should refactor it or just use my StatelessSelect

I'd suggest adding the feature to lib/cockpit-components-select.jsx.

me and @vojtechszocs refactored the selects. There are still two selects because they have different use cases, but they make much more sense now. Please let me know if I should keep the naming or make the first one Select and the second one StatefulSelect.

I also used @mareklibra devices.listing from #5562 because I needed the functionality to open created vm in the list

@mareklibra
Copy link
Contributor

mareklibra commented Oct 12, 2017

At first I thought this referred to what directory it would install the OS into.
I would make this "Installation Source" to be more consistent with the Fedora/RHEL installer.
See https://access.redhat.com/webassets/avalon/d/Red_Hat_Enterprise_Linux-7-Installation_Guide-en-US/images/2f2c6dc8424ea84cc783f1d26d645839/installationsource.png

Sorry for the mistake - yes it is Installation Source. Btw should we have the switch as shown in your link? For URL and file or just one input with Upload button?

As an user, I would not expect any change happening on the system before pressing the Create button. This includes the iso image upload.
So, if an URL is provided, its string is passed to virt-install.
If local file name is entered, it's upload shall start after pressing the Create button.

For this reason, there's probably no need to render the Upload button. Or rename to Choose ... or something to pop up local file selection dialog.
I don't see any additional differences between local file/remote URL, so I would not render any switch.

@atiratree
Copy link
Contributor Author

there is still third option - to use ISO already present in the cockpit machine and locate it with already mentioned

https://github.com/cockpit-project/cockpit/blob/master/pkg/lib/cockpit-components-file-autocomplete.jsx

@atiratree atiratree force-pushed the virt-create branch 3 times, most recently from a24c890 to 7a1779e Compare October 12, 2017 17:30
@atiratree
Copy link
Contributor Author

@garrett sorting fixed, can you please check if it is ok now?

I also added SelectDivider and SelectHeader to the components
and fixed few minor bugs

@garrett
Copy link
Member

garrett commented Oct 16, 2017

Headers

Thanks for adding headers! It's much better.

However, it's hard to differentiate between groups, so I'd suggest adding in some CSS like such:

#vendor-select .dropdown-header,
#vendor-select .divider {
  margin-top: 2ex;
}

Red Hat

There's still a huge problem with Red Hat. It merges Red Hat Linux (really old predecessor to both Fedora and RHEL) and Red Hat Enterprise Linux, and worse yet, it sorts purely by version number. This means RHL 9 (from 2003) is sorted before Red Hat Enterprise Linux 7.4 (current release, a few months ago, in 2017)!

These are two distinct OSes — one is ancient (discontinued after 2003) and the other is current and one of the main OSes most people will want to choose (especially in Cockpit).

Here's the list:

  • Red Hat Linux 9 (Shrike)
  • Red Hat Linux 8.0 (Psyche)
  • Red Hat Enterprise Linux 7.4 (Maipo)
  • Red Hat Enterprise Linux 7.3 (Maipo)
  • Red Hat Linux 7.3 (Valhalla)
  • Red Hat Enterprise Linux Atomic Host 7.2
  • Red Hat Enterprise Linux 7.2 (Maipo)
  • Red Hat Linux 7.2 (Enigma)
  • Red Hat Enterprise Linux Atomic Host 7.1
  • Red Hat Enterprise Linux 7.1 (Maipo)
  • Red Hat Linux 7.1 (Seawolf)
  • Red Hat Enterprise Linux Atomic Host 7.0
  • Red Hat Enterprise Linux 7.0 (Maipo)
  • Red Hat Linux 7 (Guinness)
  • Red Hat Enterprise Linux 6.9 (Santiago)
  • Red Hat Enterprise Linux 6.8 (Santiago)
  • Red Hat Enterprise Linux 6.7 (Santiago)
  • Red Hat Enterprise Linux 6.6 (Santiago)
  • Red Hat Enterprise Linux 6.5 (Santiago)
  • Red Hat Enterprise Linux 6.4 (Santiago)
  • Red Hat Enterprise Linux 6.3 (Santiago)
  • Red Hat Enterprise Linux 6.2 (Santiago)
  • Red Hat Linux 6.2 (Zoot)
  • Red Hat Enterprise Linux 6.1 (Santiago)
  • Red Hat Linux 6.1 (Cartman)
  • Red Hat Enterprise Linux 6.0 (Santiago)
  • Red Hat Linux 6.0 (Hedwig)
  • Red Hat Enterprise Linux 5.11 (Tikanga)
  • Red Hat Enterprise Linux 5.10 (Tikanga)
  • Red Hat Enterprise Linux 5.9 (Tikanga)
  • Red Hat Enterprise Linux 5.8 (Tikanga)
  • Red Hat Enterprise Linux 5.7 (Tikanga)
  • Red Hat Enterprise Linux 5.6 (Tikanga)
  • Red Hat Enterprise Linux 5.5 (Tikanga)
  • Red Hat Enterprise Linux 5.4 (Tikanga)
  • Red Hat Enterprise Linux 5.3 (Tikanga)
  • Red Hat Enterprise Linux 5.2 (Tikanga)
  • Red Hat Linux 5.2 (Apollo)
  • Red Hat Enterprise Linux 5.1 (Tikanga)
  • Red Hat Linux 5.1 (Manhattan)
  • Red Hat Enterprise Linux 5.0 (Tikanga)
  • Red Hat Linux 5.0 (Hurricane)
  • Red Hat Enterprise Linux 4.9 (Nahant)
  • Red Hat Enterprise Linux 4.8 (Nahant)
  • Red Hat Enterprise Linux 4.7 (Nahant)
  • Red Hat Enterprise Linux 4.6 (Nahant)
  • Red Hat Enterprise Linux 4.5 (Nahant)
  • Red Hat Enterprise Linux 4.4 (Nahant)
  • Red Hat Enterprise Linux 4.3 (Nahant)
  • Red Hat Enterprise Linux 4.2 (Nahant)
  • Red Hat Linux 4.2 (Biltmore)
  • Red Hat Enterprise Linux 4.1 (Nahant)
  • Red Hat Linux 4.1 (Vanderbilt)
  • Red Hat Enterprise Linux 4.0 (Nahant)
  • Red Hat Linux 4.0 (Colgate)
  • Red Hat Enterprise Linux 3 Update 9 (3.9 Taroon)
  • Red Hat Enterprise Linux 3 Update 8 (3.8 Taroon)
  • Red Hat Enterprise Linux 3 Update 7 (3.7 Taroon)
  • Red Hat Enterprise Linux 3 Update 6 (3.6 Taroon)
  • Red Hat Enterprise Linux 3 Update 5 (3.5 Taroon)
  • Red Hat Enterprise Linux 3 Update 4 (3.4 Taroon)
  • Red Hat Enterprise Linux 3 Update 3 (3.3 Taroon)
  • Red Hat Enterprise Linux 3 Update 2 (3.2 Taroon)
  • Red Hat Enterprise Linux 3 Update 1 (3.1 Taroon)
  • Red Hat Linux 3.0.3 (Picasso)
  • Red Hat Enterprise Linux 3 (Taroon)
  • Red Hat Enterprise Linux 2.1 Update 7 (2.1.7 Pensacola)
  • Red Hat Enterprise Linux 2.1 Update 6 (2.1.6 Pensacola)
  • Red Hat Enterprise Linux 2.1 Update 5 (2.1.5 Pensacola)
  • Red Hat Enterprise Linux 2.1 Update 4 (2.1.4 Pensacola)
  • Red Hat Enterprise Linux 2.1 Update 3 (2.1.3 Pensacola)
  • Red Hat Enterprise Linux 2.1 Update 2 (2.1.2 Pensacola)
  • Red Hat Enterprise Linux 2.1 Update 1 (2.1.1 Pensacola)
  • Red Hat Enterprise Linux 2.1 (Pensacola)
  • Red Hat Linux 2.1
  • Red Hat Linux 2.0
  • Red Hat Linux 1.1 (Mother's Day + 0.1)
  • Red Hat Linux 1.0 (Mother's Day)

Again, aside from nostalgia, I think we really should not even have the ability to have old, unsupported operating systems. We need a blocklist to make sure some OSes (especially with random Linux distros) do not show up.

GNOME?

Why is GNOME in the vendor dropdown?

GNOME is a desktop, not a distro, and this create new desktop UI in Cockpit is for servers, not desktops.

(Yeah, it's probably included in osinfo for running GNOME continuous via libvirt in other ways, but that's a completely different use case than what's needed in Cockpit.)

Win

Win should be Windows

The sorting of Windows is still incorrect, similar to Red Hat. It needs to be sorted by release date, not by version. (It should be sorted by version after release date, for those OSes without release dates.)

OS groups

The OS groups (that is: the groups of vendors) should not be sorted by alphabetical order, but by most likely to be used. That would be Linux, Windows, then the rest in alphabetical order.

(The items within these groups should be sorted alphabetically still.)

Improper encoding

The distro names should be in UTF-8, but it seems there's improper encoding somewhere between the DB to the browser. You can see the result of improper encoding in Fedora release 19: "Schrödinger's Cat". In the OS dropdown, it's listed as "Schr?dinger's Cat"

Old, insecure OSes are still included

Of course, some people may need to run old OSes behind a firewall (Windows XP, for example, or even DOS) — this is a bad practice, but sometimes necessary for some ancient corporate software.

However, when it comes to Linux distributions, it's a bit different. Sure, people are sometimes lax in upgrading to a supported distro.

The most recent version of ALTLinux is from 2012. The most recent version of Mandriva is from 2011. (Mandriva even went bankrupt in 2012 and was dissolved in 2015 — as of 2010, the distro was forked and lives on as Mageia, which is already included as a vendor choice.)

Red Hat Linux (not Red Hat Enterprise Linux) ended in 2003 and was replaced with Red Hat Enterprise Linux and Fedora. Red Hat Linux is old and should be removed.

The severely outdated distros should be removed outright.

As far as cutoff points for current distributions, it would make sense to have something like > 1 or 2 years after the EOL date to have a very generous a buffer time.

@garrett
Copy link
Member

garrett commented Oct 16, 2017

Grouping & sorting, continued

While playing with all the data, I figured out how it the releases should be be sorted into the two dropdowns and tested it out with a mockup @ http://garrettlesage.com/cockpit-mockweb/osinfo/ — however, this is generated in Jekyll and Liquid (the templating language that Jekyll uses) is really barebones, so it doesn't have a way to sort things properly, so when things are sorted by version, it's just plain wrong.

I've commented in the source at https://github.com/garrett/cockpit-mockweb/blob/master/osinfo/index.md#group-by-os-name-more-or-less

Basically, the way it works is this:

  1. Vendor dropdown: Group by OS (you have this already mostly implemented properly — see notes in previous comment @ machines: Add create vm dialog #7820 (comment) for some minor tweaks)
  2. Vendor dropdown: Check to see if there has been either a release or if a supported version is within the past year; do not display vendor unless this criteria is met (it would be better to just grab all the dates from both, sort them, filter out empty dates, and take the last date and see if it is within the past year — in Liquid, as it is very basic, I had to do dirty things to achieve this)
    • This only applies to Linux (and could apply to *BSD, but they don't have reliable enough release dates)
    • Windows and macOS releases are short enough that it doesn't matter too much
  3. OS dropdown: Sort by release date, then version (in Liquid, I can only sort by 1 field, and it doesn't sort unpadded numbers properly — so release dates work, but versions do not for these two reasons)
    • for Windows, you'll need to special case: just sort by version, as version 8 doesn't have release dates... be aware you must special-case DOS however, as its version is different; it should either not show up or it should be shown at the bottom of the list — alternatively, we can add release dates where they're missing (Windows 8 & DOS), which should be done anyway
    • for Linux, you have to special-case rolling releases — I have this done by checking if the release has no begin and also no end date — this check fails for older releases, but we have them filtered out anyway
  4. OS dropdown: Do some special detection for displaying version and/or codename
    • Show the version if the name doesn't contain the version as a case-insensitive substring
    • If the release code name exists, show it in parenthesis at the end of the string

With all of the above, it shows a generous list for Linux distros (quite old releases) and happens to programatically filter out the distros I mentioned in the previous content without having to special case any distros.

Please note:

  • The grouping isn't correct (your implementation is nearly what I wrote in the above comment and much better than this demo, which is mainly about filtering & sorting in the second dropdown — it just needs rearrangement so that Linux is first, Windows is second, and the rest are alphabetical, optimally grouping all the BSDs, all outlined in the above comment @ machines: Add create vm dialog #7820 (comment)).
  • Liquid is extremely limited as a programming language. It just has the basics and I had to work around it quite a bit. As such, the code is super-sloppy and sorting is not quite right. Your implementation will be ≥1000× better. 😉

Thanks! Hopefully all this makes sense. Feel free to ask me to clarify anything if I haven't phrased it properly and don't hesitate to contact me if you have any questions.

@martinpitt
Copy link
Member

Can you please rebase to resolve the conflicts? I'll trigger the tests then.

@atiratree atiratree force-pushed the virt-create branch 2 times, most recently from 79ee5b2 to 9c23767 Compare October 17, 2017 15:50
@atiratree atiratree force-pushed the virt-create branch 2 times, most recently from c8c7469 to feccf33 Compare January 30, 2018 15:31
@atiratree
Copy link
Contributor Author

@martinpitt
The tests were run multiple times on rhel-7-5 but it is always failing at least on
166: testBasic (check_kdump.TestKdump)

Do you know if anything is wrong with that?

@atiratree
Copy link
Contributor Author

@martinpitt
correction: there were few runs when it passed but it seems to be pretty consistent otherwise

@martinpitt
Copy link
Member

@suomiy : test-kdump failure is a known flake. Also, rhel-7-5 currently hangs indefinitely very often, I'm fixing that in PR #8532. So don't worry too much about that one for now.

@martinpitt
Copy link
Member

@suomiy : I'll retry the failed test here after landing #8532, which is hopefully today.

@atiratree
Copy link
Contributor Author

@martinpitt thanks

Heavily modified and finished by suomiy

Closes cockpit-project#7820
@martinpitt
Copy link
Member

This again collided with the polyfill fix (PR #8523), so I rebased to current master and also squashed the current commits together. This really needs to land at some point :-)

Some questions for @suomiy :

  • You don't have a real name in your profile. For now I left the commit as authored by Dominik with mentioning that "suomiy" did the heavy lifting for the finishing and testing. Is that okay for you or do you want to have Author: changed to you with a name and email address?

  • Likewise, should I credit your ID or your real name in the release notes?

  • Is https://user-images.githubusercontent.com/3648838/33062426-91e50b12-ce9f-11e7-9cc4-374668217e08.png still a current screenshot, or does this need a new one? Do you want to make a video of this, as creating a new VM involves several steps? If not, we can also help you/do that, but you might want it on your Youtube page :-)

Thanks!

@martinpitt
Copy link
Member

I just tested this with a Fedora Atomic Workstation ISO and the graphical VNC console, this is really cool! Do you also plan a mode where one doesn't supply an installer ISO, but can import an already existing .qcow2 image, and it then just creates the libvirt metadata?

Also, this is green at last, so let's land this before the next conflict comes along :-)

@martinpitt martinpitt merged commit e788a18 into cockpit-project:master Feb 2, 2018
@atiratree
Copy link
Contributor Author

@martinpitt don't worry about the credits

Is https://user-images.githubusercontent.com/3648838/33062426-91e50b12-ce9f-11e7-9cc4-374668217e08.png still a current screenshot, or does this need a new one? Do you want to make a video of this, as creating a new VM involves several steps? If not, we can also help you/do that, but you might want it on your Youtube page :-)

Yup, that is a current one.
I am not sure about making the video. Anyway it might be more useful to wait after some patches.

I just tested this with a Fedora Atomic Workstation ISO and the graphical VNC console, this is really cool! Do you also plan a mode where one doesn't supply an installer ISO, but can import an already existing .qcow2 image, and it then just creates the libvirt metadata?

It is not planned at the moment. I guess it depends on the direction and priorities.

Also, this is green at last, so let's land this before the next conflict comes along :-)

Great! :)

@andreasn
Copy link
Contributor

andreasn commented Feb 5, 2018

I am not sure about making the video. Anyway it might be more useful to wait after some patches.

The video is needed for the release notes, so it will reflect the current state of the release.
I wouldn't worry too much if there are some little details that we know will be fixed as followup PRs in there. The bigger audience will read the RHEL, Fedora, Debian etc. release notes, and by then it will be in much better shape anyway.

@atiratree
Copy link
Contributor Author

I can make the video, but it will take me at least a week to get to that, if that is fine?

Though, I would rather wait at least for #8441

@martinpitt
Copy link
Member

@suomiy: We will release tomorrow (end of current sprint). I can make a current screenshot or two, and then we'll put the video into the next release notes, when this got some more cleanup?

@atiratree
Copy link
Contributor Author

oki

@martinpitt
Copy link
Member

Screenshot from current master:

vmcreate

@martinpitt
Copy link
Member

I made a series of screenshots for an internal presentation. Adding them here in case they get useful for anything else again:

vms-1
vms-2
vms-3
vms-4
vms-5
vms-6

@atiratree
Copy link
Contributor Author

@martinpitt Can I still make YT video on this?

@martinpitt
Copy link
Member

@suomiy: Of course :-)

@atiratree
Copy link
Contributor Author

@martinpitt
here it is: https://www.youtube.com/watch?v=B1ziXyDJH_c
took me a long time to finally do it ^^

please give me feedback, if it should be done differently

@martinpitt
Copy link
Member

martinpitt commented Apr 18, 2018 via email

@atiratree
Copy link
Contributor Author

@martinpitt thanks
yup, virt-install uses that to download initrd and vmlinuz first. There is no feature for remote ISOs in virt-install that I am aware of.

@garrett
Copy link
Member

garrett commented Apr 24, 2018

@suomiy: This is great!


I have a couple of questions with regard to some minor formatting things (as seen in the video; screengrabs included below):

checkbox-wrong

  1. The checkbox is styled incorrectly (see machines: start vm checkbox is too large #8916)

And on this second screenshot:
background-issue

  1. The "Connected..." font is wrong. It's some serif font; it should use the same sans serif fonts as the rest of Cockpit.
  2. There's also an issue with the background. (This might be out of our control?)

@atiratree
Copy link
Contributor Author

@garrett thanks

  1. The checkbox is styled incorrectly (see machines: start vm checkbox is too large #8916)

you are right. It behaves weirdly and also depends on a browser

  1. The "Connected..." font is wrong. It's some serif font; it should use the same sans serif fonts as the rest of Cockpit.
  2. There's also an issue with the background. (This might be out of our control?)

@mareklibra ?

@mareklibra
Copy link
Contributor

I can't reproduce the styling issue with Connected and I don't see any obvious issue in the code ATM.

When verifying, the VNC session "blinks" blank for a moment when installing Centos. But since this is when the VNC session is already established and VM is booting, I guess it's what the VNC server sends. Anyway, it disappears quickly, so I don't see it as a big issue.

Please note, the component is about to be replaced by patternfly-react VncConsole - the higher-level styling will be changed slightly so potential issue reported here might be fixed.
The underlying xterm library will be upgraded with this change as well.

Recent screenshots from my testing:
01

02

03

@andreasn
Copy link
Contributor

Since this PR is merged, does't it make more sense to split new things off in new issues and PRs?
(I can also just unsubscribe to this PR if you want to keep discussing here)

@garrett
Copy link
Member

garrett commented Apr 26, 2018

@andreasn: Yep; #8916 is open and the other issues seem to be sporadic and related to the widget (which is soon-to-be-replaced). I think the conversation is done here.

@mareklibra mareklibra mentioned this pull request Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants