Commit Graph

1426 Commits

Author SHA1 Message Date
Darragh Bailey
84e2fed626
Fix release workflow default branch detection (#1585)
Ensure that the github script to retrieve the default branch uses string
encoding instead of json. This will strip the unnecessary quotes
preventing matching.
2022-09-08 18:14:27 +01:00
Darragh Bailey
ba2c7be494
Handle REXML requires for Ubuntu focal (#1584)
The distribution provided vagrant package on Ubuntu 20.04 is version
2.2.6 running on ruby 2.7.2. It appears that the rexml layout is
slightly different and imports different paths than the current code
expects. Add this combination to the unit tests and switch the requires
to load the specific library requirements instead of relying on rexml
loading everything underneath.

Additionally it appears the hook behaviour change appeared earlier that
the understood vagrant release of 2.2.11, and 2.2.6 also requires the
newer hook behaviour.
2022-09-08 12:44:05 +01:00
Darragh Bailey
602b4e9ad8
Replace remaining stray references with main (#1582)
Ensure default branch has been fully updated everywhere to main, which
should fix the running of the unit and integration tests on the main
branch.
2022-09-07 10:50:28 +00:00
Darragh Bailey
7d48c5ec46
Make failure to apply XML domain update non fatal (#1581)
As this is the first time people may be alerted to an issue applying
changes, given that previously they would be silently discarded, better
to switch to warning the end user rather than blocking the domain start.
This is no worse than the previous position, and allows previous
configurations that were understood to be working, to continue to work
as they are, with hopefully issues logged by users that will allow
more correct XML to be sent before making failure to match the changes
applied fatal.
2022-09-07 10:35:25 +00:00
Darragh Bailey
1db6618f76
Remove need to explicitly set VAGRANT_HOME before running tests (#1580)
Ensure that the tests always set VAGRANT_HOME into the environment to
prevent the global plugin manager from trying to load the plugins under
this directory.
2022-09-06 12:30:18 +01:00
Darragh Bailey
316ca8e1d4
Reduce nested rescues in start domain (#1573)
Remove the unnecessary nesting of begin/rescue entries in start domain
which partially existed due to vagrant-libvirt destroying domain
definitions on error, even for machines that had previously been
created.

Since this is no longer a problem as existing domains will be halted
rather than removed when an exception occurs, it is perfectly fine to
let the exception percolate upwards and be handled by the warden, which
is what the current code is doing, but at the expense of catching and
re-raising multiple times.
2022-09-03 16:28:56 +01:00
Darragh Bailey
606b86df67
Return early from set_boot_order if not needed (#1578)
Switch to calling the returning the next middleware in the chain as soon
as possible in the set boot order action. Makes the overall remaining
logic tidier.

Include basic tests to check existing behaviour.
2022-09-03 16:11:11 +01:00
Darragh Bailey
8f868b9b88
Handle setting of graphics options avoiding XML diff (#1577)
The attribute autoport="no" will be dropped, therefore ensure that when
graphics_autoport should be disabled, default it to nil, which allows
the existing code to exclude it from the domain template.

Otherwise being set to no will result in an apparent difference due to
the returned XML after update dropping the attribute.
2022-09-03 14:06:26 +00:00
Darragh Bailey
cede7fff8b
Ensure XML diff output if not fully applied (#1576)
Make sure to perform a diff of the actual XML strings and not the object
representations if encountering the bug where the XML failed to be
updated correctly.
2022-09-03 15:01:03 +01:00
Darragh Bailey
c28aca9d21
Improve handling when run using root user (#1572)
Allow for the image to be run with the root user if desired, however
change to requiring setting of a variable to allow it to continue as it
may change ownership of files unexpectedly.

Additionally ensure that the workdir passed to docker matches the target
mount path used, in case the realpath to ${PWD} resolves to be different
to it's value resulting in the starting workdir being somewhere
different to the current path on the host.

Fixes: #1442
2022-09-03 11:37:25 +00:00
Darragh Bailey
42411eb005
Update to more recent Ubuntu LTS (#1575)
Move to Jammy LTS release of Ubuntu in an effort to fix the current
build behaviour on github.
2022-09-03 12:32:42 +01:00
Darragh Bailey
d282a9dbd6
Docker image bundle vagrant-libvirt with vagrant (#1569)
Move the vagrant-libvirt plugin into being combined directly with
vagrant which both prevents the plugin from being reinstalled by any
subsequent call to `vagrant plugin install <plugin>` and avoids the need
to create and manage symlinks to a /vagrant.d directory for boxes.
2022-09-01 20:14:24 +01:00
Darragh Bailey
c4efd1de49
Correct type for workflow event (#1570) 2022-09-01 17:39:13 +00:00
Darragh Bailey
6b244cd9bf
Save UI to instance to avoid passing env (#1568)
The UI should not change between what is provided during instance setup
and what is subsequently passed to the call method.
2022-09-01 18:05:24 +01:00
Darragh Bailey
439830b6d4
Switch to xml-simple for document comparison (#1567)
The switch to compare-xml exhibits non intuitive behaviour in that
comparing without use of verbose mode does not detect documents that are
identical. The if statement allowed the tests to pass but reads that if
the documents compare as true then emit an error message and raise an
exception. However this is because it returns false even with the docs
are the same content. Unfortunately there was no pre-existing test
case added when

Since there were concerns about equivalent-xml not being active upstream
raised by a distribution maintainer, switching back should be avoided.
Attempted use of nokogiri-diff indicated that whitespace changes would
be treated as differences with it being unclear how to easily exclude.

Moving to xml-simple, which although will treat whitespace as
significant and even with NormaliseSpace set to disregard any whitespace
around content elements, it requires walking the returned structure to
remove the empty content attribute that is left behind to allow a direct
comparison between the data structures.

To ensure the XML comparison is validated add a test where libvirt
returns XML that is different to what was requested, and assert that
the expected error is raised, an error message emitted and that the
domain define would be reverted to the previous state if possible.

Relates-To: #1565
Fixes: #1556
2022-08-30 12:47:05 +01:00
Dan Čermák
64910dbd90
Use compare-xml instead of equivalent-xml (#1565)
`equivalent-xml` is pretty much dead upstream, `compare-xml` on the
other hand has some upstream activity
2022-08-29 14:44:02 +01:00
Darragh Bailey
fc5598ddb8
Use equivalent-xml to compare xml (#1564)
Using diffy alone is insufficient to spot when the XML returned by
libvirt for the changes applied is equivalent but formatted differently.

When libvirt returns slightly differently formatted XML corresponding to
what changes were actually applied, it can result in an error being
assumed to have happened when the update actually worked as expected.

Equivalent-xml handles detecting XML documents as being identical,
therefore switching to using it instead of diffy should produce more
reliable results, while retaining diffy for better formatted diffs
should an issue occur is useful.

Fixes: #1556
2022-08-28 12:10:46 +01:00
Darragh Bailey
0ce13fbcd8
Use function rather than instance variable (#1562)
Fix a rather dumb error on my part where after checking the code
behaviour and then moving it to the driver, switched to using the
instance variable instead of the function. Because of this, on the first
usage the instance variable may not be populated, while the function
will correctly set up the connection.

Fixes: #1561
2022-08-26 22:18:44 +01:00
Darragh Bailey
f19478b050
Ensure boot order is preserved unless overridden (#1560)
Add boot_order to the merge function to ensure that provider config
sections will persist the value if defined in earlier blocks. However to
ensure it is possible to override, definitions in latter sections will
replace the earlier definitions, but only if provided.

Fixes: #937
2022-08-25 17:46:33 +00:00
Darragh Bailey
3f1f2e79b3
Update URL for logo display in README (#1559)
Moving the image asset around broke display in README.
2022-08-25 15:59:25 +00:00
Darragh Bailey
8673fa2791
Ensure usernames with at symbols handled (#1558)
Domain usernames may use '@' as part of the username, which requires
encoding to be able to be used within an URI.
2022-08-24 18:16:14 +01:00
Darragh Bailey
1945754f67
Allow bridges referenced by libvirt networks (#1554)
Permit reference to bridge devices referenced by existing libvirt
networks.

Fixes: #1553
2022-08-22 18:05:04 +01:00
Darragh Bailey
591e151b13
Use libvirt to query host physical devices (#1550)
Request the list of physical devices from libvirt when performing
config validation. This ensures remote instances using bridges will get
the correct list of devices as well as be alerted when the device needed
does not exist.

Fixes issue introduced with #1499
2022-08-17 15:14:25 +01:00
Darragh Bailey
06fd99fcef
Fix github context reference in workflow (#1548)
Ensure references to the github context are correct.
2022-08-17 12:23:19 +01:00
Nils Ballmann
63d265d9ca
add sysinfo support (#1500)
For testing certain scenarios with vagrant-libvirt, need in the guest system a
value for the systems serial number in the DMI/SMBIOS system information.
The domain https://libvirt.org/formatdomain.html#smbios-system-information
format of libvirt allows to specify those values.

While adding `-smbios type=1,serial=$serial_value` to the `qemuargs` parameter
of the libvirt provider is already able to achieve this, a dedicated provider config
value adds native support from the `Vagrantfile` layering system. For example,
in the .box included Vagrantfile a random serial number can be enforced by
adding the following:

require 'securerandom'
Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.dmi_system_serial = SecureRandom.alphanumeric(8).upcase
  end
end

Then in an instance specific Vagrantfile this value can be overwritten by adding:

Vagrant.configure("2") do |config|
  config.vm.provider :libvirt do |libvirt|
    libvirt.dmi_system_serial = "ABCDEFGH"
  end
end

Co-authored-by: Nils Ballmann <nils.ballmann.ext@siemens.com>
Co-authored-by: Darragh Bailey <daragh.bailey@gmail.com>
2022-08-16 17:44:11 +01:00
Darragh Bailey
77e53a2f53
Move plugin version menu dependencies to script (#1545)
Move to manage the entire plugin version menu and dependencies from the
same script. This will allow the entire site to roll forward to newer
releases and bugfix the plugin versions menu as issues are found, mostly
without needing to touch any of the individual releases.
2022-08-15 23:45:33 +01:00
Darragh Bailey
4fc3c8481d
Adjust to ensure previews load isolated code (#1547)
Ensure previews use the plugin script from the tree instead
of the common one for latest and version releases
2022-08-15 22:42:26 +01:00
Darragh Bailey
86fc5f05d0
Adjust menu loading and styles to be more complete (#1544)
Rework the links provided and menu styling to allow for a clear menu
edge, and a slight highlighting when hovering. Ensures that clicking
anywhere in the highlighted section should bring you to the selected
version.
2022-08-15 14:27:25 +01:00
Darragh Bailey
49ab1e529f
Load plugin versions menu always from latest (#1543)
Always use the same version of the plugin versions menu script, loading
from the latest across all releases. This is to allow for updates to
this component to be deployed across any release at the same time to
allow for a consistent switching experience.
2022-08-13 14:28:17 +00:00
Darragh Bailey
366bd87c67
Switch plugin version menu to div and style by JS (#1540)
Replace the select options for the plugin versions with one managed
purely using div tags and style primarily using JavaScript so the entire
menu can be managed from loading from a single script.

Retain a simple base style in the generated css file to facilitate
switching themes.
2022-08-13 09:02:57 +01:00
Darragh Bailey
8717eb6935
Explicity set action for preview action input (#1542)
GitHub actions have changed behaviour subtly in that
now setting the env is no longer sufficient for the
following action to pick up automatically.

Instead switch to being explicit.
2022-08-12 21:27:02 +00:00
Darragh Bailey
442ef24e64
Make switcher JavaScript unparsed and reduce elements (#1539)
Avoid the need to parse the main version switching menu creation and
handling code by moving the site constants to a separate file.

Additionally move more of the element construction into the JavaScript
code to make it closer to a web component and facilitate more control by
a common script to be loaded by all published versions.
2022-08-12 18:30:57 +01:00
Darragh Bailey
a60836e260
Merge pull request #1536 with maintenance improvements
Simple maintenance improvements
2022-08-10 10:17:25 +01:00
a1346054
f7ecf03232
Remove dependence on deprecated apt-key for installation 2022-08-09 09:10:19 +00:00
a1346054
af77b859e3
Trim trailing whitespace 2022-08-08 22:46:07 +00:00
a1346054
b87652701d
Losslessly compress logo
using `zopflipng -m --iterations=500 in.png out.png`
2022-08-08 22:45:41 +00:00
a1346054
fc996b795f
Stop mixing tabs and spaces 2022-08-08 22:44:45 +00:00
a1346054
759a851428
Add missing final newline 2022-08-08 22:44:45 +00:00
a1346054
dbd2d3fdce
Fix typos 2022-08-08 22:44:45 +00:00
a1346054
b5e3f156e3
Properly quote variable 2022-08-08 22:44:44 +00:00
a1346054
37261dc180
Protect against $VAGRANT_HOME containing a space 2022-08-08 22:44:41 +00:00
Darragh Bailey
8a2bae3535
Cache requests for plugin version menu (#1533)
Add caching support to reduce the number of requests to lookup the
github APIs when generating the plugin version select menu.
2022-07-29 14:56:57 +01:00
dependabot[bot]
bec7fdc462
Bump github-pages from 226 to 227 in /docs (#1531) 2022-07-24 09:21:16 +00:00
Darragh Bailey
5fa1ed9dbd
Create dependabot config (#1530)
Enable dependency updates for docs generation
2022-07-24 09:00:51 +00:00
Darragh Bailey
82202945ce
Migrate documentation to github pages (#1523)
Switch from having all documentation contained within the README to
publishing a jekyll static site of documentation under github pages.

This allows for configuration and installation guides to be handled
separately to make for the relevant pieces to be in smaller chunks and
therefore easier to follow for users. Additionally a table of contents
can now be included in a left navigation section that ensures it should
be possible to quickly jump from the start to any section and back
again.

Include support for publishing previews and releases under separate
directories to allow for them to exist at the same time as the other
latest version of the documents.

The navigation section also includes support for accessing any of the
other versions published so that it easier to see what configuration
options exist for a given release. These will be published automatically
when releases are added.
2022-07-19 13:48:02 +00:00
Darragh Bailey
206a9244a8
Simple prepare test for 9p and virtiofs synced_folders (#1529)
Provide basic tests for 9p and virtiofs synced_folder capabilities to
validate prepare behaviour.
2022-07-13 16:36:17 +00:00
Nick Brown
2dc704e1f9
Support different rexml location for older vagrant (#1526)
Attempt fallback to loading rexml from rexml/rexml which is the path
used by older vagrant releases.
2022-07-12 17:41:54 +00:00
Darragh Bailey
41d153b91f
Tidy up virtiofs and 9p synced_folder messages (#1527)
Remove the excessive output generated for the synced_folder messages
emitted when using 9p and virtiofs synced_folders.

Fixes: #1525
2022-07-12 18:28:51 +01:00
Darragh Bailey
c5ed4bd89c
Ensure disk controller passed to create domain (#1520)
Previous PR added tests but missed that the disk controller was not
being set correctly in the create domain action by default.

Update config documentation to include option.
2022-06-25 15:48:05 +01:00
Michael Kerrin
37c3330de1 Allow use of virtio-scsi driver for SCSI devices (#692)
For better performance allows enabling the virtio-scsi model on the
scsi controller in VM's.

Additionally supports inferring use of virtio-scsi model from disk
device or bus, and similarly infer the correct values for these
based on device or bus.

Currently one controller per 7 domain volume disks is created, this
follows virt-manager's behaviour, and is assumed a reasonable default.
However note that virtio-scsi should be capable of allowing many more
disks to be assigned per controller than this. It is presumed that the
source of the number 7 is allowing for 8 devices per controller
including the host adapter, which therefore allows for 7. Hardware SCSI
controllers typically supported 16 addressable devices including the
adapter providing for a 15 disk limit. Whether this is necessary is not
yet clear.

Co-authored-by: Darragh Bailey <daragh.bailey@gmail.com>
2022-06-24 19:02:11 +01:00