Commit Graph

58 Commits

Author SHA1 Message Date
Joshua Boniface a95e7d1f76 Add profile from provisioner to data stored in ZK 2019-12-11 16:49:11 -05:00
Joshua Boniface 867634cea7 Fix missing argument 2019-12-09 11:31:56 -05:00
Joshua Boniface d4dc3ac649 Enforce VM uniqueness when defining
Closes #56
2019-12-09 09:56:59 -05:00
Joshua Boniface 531578fd28 Use consistent tense for VM states
Replace "failed" with "fail" and "disabled" with "disable" for
consistency with the remaining states.
2019-10-23 23:57:59 -04:00
Joshua Boniface 6a4c75deb8 Clean up unnecessary zookeeper connection handling 2019-10-23 23:50:46 -04:00
Joshua Boniface 32b4ed66e8 Add VM disable command
Closes #53
2019-10-23 23:44:47 -04:00
Joshua Boniface 53dc343ea2 Avoid migration to invalid target_nodes 2019-10-17 12:16:21 -04:00
Joshua Boniface 03447d3374 Update copyright string year to include 2019 2019-10-13 12:09:51 -04:00
Joshua Boniface 75d95bbef7 Fix minor bugs 2019-10-12 02:03:23 -04:00
Joshua Boniface 0763bd2d51 Fix minor bugs 2019-10-12 01:55:37 -04:00
Joshua Boniface e5393082b6 Use build-in selector and respect limits in client
Use the new built-in selector option, as well as respecting node limits,
when performing migrate or move actions on a VM via the clients.
2019-10-12 01:45:44 -04:00
Joshua Boniface 8dc0c8f0ac Fix minor bugs 2019-10-12 01:36:50 -04:00
Joshua Boniface 5995353597 Implement VM metadata and use it
Implements the storing of three VM metadata attributes:
1. Node limits - allows specifying a list of hosts on which the VM must
run. This limit influences the migration behaviour of VMs.
2. Per-VM node selectors - allows each VM to have its migration
autoselection method specified, to automatically allow different methods
per VM based on the administrator's preferences.
3. VM autorestart - allows a VM to be automatically restarted from a
stopped state, presumably due to a failure to find a target node (either
due to limits or otherwise) during a flush/fence recovery, on the next
node unflush/ready state of its home hypervisor. Useful mostly in
conjunction with limits to ensure that VMs which were shut down due to
there being no valid migration targets are started back up when their
node becomes ready again.

Includes the full client interaction with these metadata options,
including printing, as well as defining a new function to modify this
metadata. For the CLI it is set/modified either on `vm define` or via the
`vm meta` command. For the API it is set/modified either on a POST to
the `/vm` endpoint (during VM definition) or on POST to the `/vm/<vm>`
endpoint. For the API this replaces the previous reserved word for VM
creation from scratch as this will no longer be implemented in-daemon
(see #22).

Closes #52
2019-10-12 01:17:39 -04:00
Joshua Boniface 0c9d6db14f Gracefully handle log following output
If the Zookeeper node goes away (e.g. VM is deleted), return a
reasonable error message instead of a stack trace.
2019-09-07 12:30:31 -04:00
Joshua Boniface 43756fc62b Implement lock flush function for clients
Uses a similar command pathway as the Ceph commands do, but in a
different location (pending move of the Ceph commands to a similar
location).
2019-08-07 13:38:49 -04:00
Joshua Boniface 6a712ffe7a Don't crash if VM has invalid disks
Useful if storage=False and removing a VM.
2019-07-31 23:05:00 -04:00
Joshua Boniface 1da7462e0d Move bad-net colour outside of string
This just trashed the formatting of the string if the network didn't
exist, despite several previous attempts to get this to align. Give up;
set the colour for the whole net list if any one network is invalid.
This is not as nice as per-network colouring but saves the hassle and
complexity.
2019-07-26 11:41:51 -04:00
Joshua Boniface fb40ef5b04 Fix typo in common 2019-07-25 15:45:45 -04:00
Joshua Boniface bcd48648b2 Add is_migrated check function 2019-07-25 14:33:50 -04:00
Joshua Boniface 0d513fea4d Add delay after deleting VM
Otherwise there might still be a watcher on the block device when we go
to delete it, which causes a failure.
2019-07-10 19:05:36 -04:00
Joshua Boniface 6426607769 Store list of RBD disks in ZK
Store a basic list of RBD disks in Zookeeper for access by the node
subsystem to handle RBD locks. This avoids the need to implement complex
parsing logic inside the fencing configuration (or elsewhere).

Also handle a malformed XML content properly during VM define.
2019-07-09 10:22:23 -04:00
Joshua Boniface e263a05237 Reorganize client functions
Move some functions to the common file for future usage.
2019-07-09 09:29:47 -04:00
Joshua Boniface a3de9da513 Add quotes around vars in all return messages 2019-07-08 22:37:26 -04:00
Joshua Boniface f75216d946 Make force_migrate not replace existing node
Previous to this, if once force-migrated a VM, the previous_node value
would be updated to the current node, which is likely never what an
administrator would want. Change this functionality so that the previous
node value is not changed, and update the documentation to reflect this.
2019-07-07 15:10:48 -04:00
Joshua Boniface 4f6d0baf6c Fix bad ZK node entry 2019-07-06 01:42:55 -04:00
Joshua Boniface 5ac3d55b8d Always use the passed domain in messages
Don't ever output an ugly UUID unless that's what was actually sent to
the function. Makes output much much nicer, especially on errors.
2019-07-05 16:38:54 -04:00
Joshua Boniface 18520d6c77 Support disabling fuzzy limit matching
Used for the APIs when they filter by name but we don't want a fuzzy
limit since we specified an exact name.
2019-07-05 16:30:20 -04:00
Joshua Boniface dc16f51b2a Fix variable naming bug 2019-07-05 14:18:18 -04:00
Joshua Boniface d28b1ba133 Support removing VMs (and disks) from PVC clients
Adds full support for removing a VM entirely, including its RBD disks,
via the PVC client(s). Avoids needing an undefine + manual removal.
2019-06-27 11:19:48 -04:00
Joshua Boniface b52cf01ecc Make conditionals more Pythonic 2019-06-25 12:36:37 -04:00
Joshua Boniface 93be983b39 Properly verify node inputs 2019-06-25 12:36:37 -04:00
Joshua Boniface 4922e973c7 Functionize duplicate code and fix net length bug 2019-06-24 10:10:07 -04:00
Joshua Boniface 1316b9ed59 Fix refactoring bugs 2019-06-24 09:56:06 -04:00
Joshua Boniface 6fd4710f7f Remove bad replacement 2019-05-21 19:51:23 -04:00
Joshua Boniface 79d0a2eafc Handle raw sorting properly with new list format 2019-05-21 14:44:45 -04:00
Joshua Boniface 73443ecbaf Update vm.py to allow API use 2019-05-20 22:15:28 -04:00
Joshua Boniface 31f252ad9b Implement domain log watching
Implements the ability for a client to watch almost-live domain
console logs from the hypervisors. It does this using a deque-based
"tail -f" mechanism (with a configurable buffer per-VM) that watches
the domain console logfile in the (configurable) directory every
half-second. It then stores the current buffer in Zookeeper when
changed, where a client can then request it, either as a static piece
of text in the `less` pager, or via a similar "tail -f" functionality
implemented using fixed line splitting and comparison to provide a
generally-seamless output.

Enabling this feature requires each guest VM to implement a Libvirt
serial log and write its (text) console to it, for example using the
default logging directory:

```
<serial type='pty'>
    <log file='/var/log/libvirt/vmname.log' append='off'/>
<serial>
```

The append mode can be either on or off; on grows files unbounded,
off causes the log (and hence the PVC log data) to be truncated on
initial VM startup from offline. The administrator must choose how
they best want to handle this until Libvirt implements their own
clog-type logging format.
2019-04-12 11:15:32 -04:00
Joshua Boniface 9f0d7c5bf8 Support VM list filtering by state 2019-03-20 11:31:54 -04:00
Joshua Boniface eec14ff177 Don't set unmigrated VMs to start 2019-03-20 10:19:01 -04:00
Joshua Boniface 15c832650d Don't block stopping on non-start state 2019-03-16 23:32:13 -04:00
Joshua Boniface 318a2353ea Fix missing format key on delete 2019-03-15 01:13:03 -04:00
Joshua Boniface df394c5c39 Handle regex in a more consistent way 2019-03-12 23:52:59 -04:00
Joshua Boniface 1180a4c88e Remove debug 2019-03-12 21:46:30 -04:00
Joshua Boniface abbc361520 Sort the names properly 2019-03-12 21:46:09 -04:00
Joshua Boniface d6b554e88e Move the output to a better place; 2019-03-12 21:40:52 -04:00
Joshua Boniface eb087a26e7 Deleted the wrong line 2019-03-12 21:39:17 -04:00
Joshua Boniface 2e187ae032 But sort it right 2019-03-12 21:38:22 -04:00
Joshua Boniface 717e518deb List names instead of UUIDs 2019-03-12 21:35:33 -04:00
Joshua Boniface c4a97f04a7 Support raw VM listing 2019-03-12 21:30:01 -04:00
Joshua Boniface 081d855a03 Allow dumping of VMs 2019-03-12 21:09:54 -04:00