Commit Graph

36 Commits

Author SHA1 Message Date
Chris Roberts
9acfd16dfc Add ShutdownDomain action and use during halt sequence
This adds in a ShutdownDomain action which allows for the
    GracefulHalt action to attempt to shutdown the domain. If
    it does not transition to domain successfully to a shutoff
    state, the ShutdownDomain action is used to "nicely" shutdown
    the domain. Likewise, if that action fails to transition the
    domain, the HaltDomain action will be used to forcibly stop it.
2021-08-14 00:12:58 +01:00
Darragh Bailey
7ce85f2216 Make disks attribute path required check for name collisions (#1293)
Ensure the path attribute for disks in the new format is required to
ensure there is always one parameter required for the hash element in
the array of disks. This avoids a certain amount of magical behaviour.

Identify that the name attribute is optional, however add checks for
collisions in volume names generated, as well as ensuring the volumes
are still prefixed in a way to prevent accidental collisions between
boxes utilizing the same names.

Add notes to the README identifying the format as experimental, with
notes on how the format should appear.
2021-05-22 16:59:11 +01:00
Darragh Bailey
98ff2dfb51 Retrieve disk format and virtual size directly (#1274)
When uploading disks to libvirt storage it is unnecessary to require
that the virtual size or the format be provided as these can be
retrieved by calling qemu-img on the box files to retrieve the required
information.

Update the handle box image support to separate the handling of the two
different formats and remove the need to specify the additional settings
in the case of the V2 format for multi disk boxes.
2021-05-10 23:02:25 +01:00
Richard Turc
225237b125 Allow to use many disks in vagrant box for libvirt provider
Adds support for a new multi disk box format and handling to upload the
multiple disks to the storage pool.

New format is:
{
  'disks': [
    {
      'name': 'disk1.img',
      'virtual_size': 10,
      'format': 'qcow2'
    },
    {
      'name': 'disk2.img',
      'virtual_size': 15,
      'format': 'qcow2'
    },
    {
      'name': 'disk3.img',
    }
  ],
  'provider': 'libvirt',
  'format': 'qcow2'
}

It is expected to remove format from being set at the top level when
using the new format, with the assuming that qcow2 should be the default
format, and other formats should be permitted to be specified as needed.

Includes tests for handling the box images and creation of domain
volumes. Additionally includes an integration test to ensure a box with
2 disks will work as expected.

Partially fixes: #602
2021-05-08 17:04:10 +01:00
ryanfitzsimon
a83900f1ae Download images with libvirt instead of copying (#928)
Packaging an existing vagrant environment relied on copying the backing
image. Users may not have permission to read this file despite being
able to interact with it through libvirt.

Use ruby-libvirt to download the image instead so any user with libvirt
access can run the package command.
2020-05-10 13:13:56 +01:00
Vít Ondruch
608037c15c Use fog-libvirt facilities to create volumes for QEMU session.
This is supported since fog-libvirt 0.6.0 via https://github.com/fog/fog-libvirt/pull/60
2019-07-17 18:27:00 +02:00
Daniel T Chen
41e5b2f362 Updated Libvirt-based Vagrant box search reference and edited names for consistency 2019-02-11 20:18:02 -05:00
Tobias Wolter
fce3bb3cdd Added missing translation string
Fixes messages like:
```
==> default: translation missing: en.vagrant_libvirt.package_domain
```
2018-04-16 23:50:08 +02:00
qazokm
b0eddf6770 Create storage pools and volumes with correct permissions 2018-02-22 15:52:58 +08:00
Nicholas Brown
dea85d7cbc Don't silently ignore udp port forwarding option
Currently it ignores the option and turns it into a tcp port.
Instead warn about the UDP option and skip it.
2018-02-02 13:03:23 +00:00
Eric Pulvino
92e3e88d7c Reverts PR#777 and adds a new error message for a discretely different case. 2017-05-13 22:57:28 -04:00
Eric Pulvino
c4063c3613 Making adapter exhaustion error message more helpful. 2017-05-11 16:05:06 -04:00
Michal Skalski
8ef6df014d Make mgmt network detachable from no box VMs
Pxe nodes are not provisioned, mgmt network is not required for them.
Provide new domain option 'mgmt_attach' which one can use to remove mgmt
interface from VM. Default behaviour is not changed.
Also take into account bridge interfaces when set boot order, to support
scenario when we would like to use vagrant VM to pxe boot physical nodes
in existing network.
2016-12-13 21:43:59 +01:00
Martin André
30600f4ac3 Fix wrong interpolation argument
This caused an ugly stacktrace when the requested virtual size is
smaller than the actual image size.
2015-11-01 21:53:06 +09:00
stanley karunditu
17254d4358 previously in PR#413 added tcp tunnel support. adding mcast tunnel support
and merging features and just calling it tunnel support.
2015-09-08 14:11:05 -04:00
Dusty Mabe
6bbb16fc34 A few spelling/wording enhancements. 2015-08-25 10:44:16 -04:00
Darragh Bailey
efeb6c6b8a Allow shutting-down state to be returned
If the machine is in a shutting-down state, simply return this instead
of waiting until the machine has reached a steady state.
2015-07-31 09:31:52 +01:00
Darragh Bailey
e7dec9acc3 Condense state description retrieval
Reduce state description retrieval to keying off the state id and use a
simple substitution for the short name of the same.
2015-07-31 09:31:52 +01:00
Darragh Bailey
cee934a482 Remove machine ssh_info and state from using actions
Remove the ReadSSHInfo and ReadState actions and corresponding calls to
dispatch queries by vagrant on the provider for current `ssh_info` and
`state` to be handled by actions. Change the corresponding methods added
to the Driver and Provider classes to avoid modifying `machine.id`
directly and allow vagrant to take care of resetting it whenever `state`
returns :not_created.

This ensures that both `ssh_info` and `state` may be called by other
threads, such as the ansible provisioner building the inventory file,
on machines without causing exceptions due to machine locks preventing
modification (setting `machine.id` to nil) and Batch locking preventing
multiple sets of actions being executed on the same machine by
different threads/processes.

Follows the design of the in-tree docker provider for vagrant.
2015-07-31 09:31:52 +01:00
stanley karunditu
789fa369c8 add libvirt interface tcp tunnel support.
Useful when configuring Virtualized Switch topologies using Switch VMs like Cumulus
Linux.

vagrant network interface auto_config is disabled in the code. This may be
re-enabled in a future update, once it is better understood how to
auto configure these types of links. All guestOS ports, for now, that are
connected to a tcp tunnel are in a link down state.

TCP tunnels allow guest OSes to exchange STP and LLDP information as
if they are directly connected to each other.

This is not possible with the default virtual switch network mode.

Reference:
https://libvirt.org/formatdomain.html#elementsNICSTCP
2015-07-11 10:49:00 -04:00
Darragh Bailey
d4c72212eb Support volume size resize configuration
Allow control of the volume size to be increased from the box default
virtual_size value so that it is possible to use a box configured with a
minimal initial disk size and create virtual guests with larger disk
sizes.

Warn the user and ignore sizes that are less than the box size, and
inform them that a manual filesystem resize will be needed to take
advantage of the additional available disk space.

fixes: #37
2015-06-28 15:50:44 +01:00
Romuald du Song
2e01a54fc3 add step to remove stale volume on destroy action 2015-05-23 21:49:51 +02:00
dima
7a7844f773 close #291 2015-04-04 22:29:21 +02:00
Mike Perez
ddaf54bab6 Add en locale for long_shutoff message 2014-08-04 20:16:09 -07:00
Steven Leung
bf79f2a76d Added cleanup capability for 9p mounts
This will allow proper halting, and reloading
2014-04-30 17:17:18 -07:00
Brian Pitts
c323468d73 Rename default network to management network. Closes #126.
The use of the term default makes discussing this network confusing.
This network must exist and be configured a certain way in order for vagrant
to manage a VMs configuration, so lets call it the management network instead.
2014-01-17 18:56:44 -06:00
Brian Pitts
46306503f4 Fail if any existing networks configured to have DHCP do not have it. Relates to #103 and #123. 2014-01-17 17:22:09 -06:00
Brian Pitts
de553d0ea7 Create default network if needed. Relates to #102.
This commit

* renames the option default_network to default_network_name
* introduces the option default_network_address, since we need an
address in order to create a network
* handles creation of the default network similarly to other private
networks if needed
2014-01-17 17:21:13 -06:00
Matt
b4993072a8 Corrected a wrongly spelled key and added domain_name to the error output 2014-01-07 14:08:49 +01:00
Brian Pitts
69f97cf33a Delete any snapshots when destroying a domain 2013-10-19 13:50:28 -05:00
pradels
813a7c811e * Private network support.
* Creating private networks if ip address is set and network
  is not available.
* Guest network interfaces configuration.
2013-05-09 20:32:06 +02:00
pradels
e98c64c0be IP of VM is searched in dnsmasq lease files only. 2013-04-10 17:34:09 +02:00
pradels
72f1e41d9a Halt action added. This resulted into action.rb file rewrite. There
was a need to split up actions into more subactions + more checking
of VM state - if it's up when trying to ssh etc..
2013-04-01 17:10:35 +02:00
pradels
99d649a2c3 - Changed way how to get IP address of new VM - checks
/var/lib/libvirt/dnsmasq/*.leases files.

- IP address is saved in $data_dir/ip file for future.
  This IP is then checked if it match with VMs MAC address.

- Added ssh, provision and resume subcommand
2013-04-01 02:17:05 +02:00
dima
0a66fd2cff pause <-> resume 2013-03-30 13:42:59 +01:00
pradels
810f0b31b9 Initial commit 2013-03-27 00:55:30 +01:00