91 Commits

Author SHA1 Message Date
2eef6a1c21 Lint: E265 block comment should start with '# ' 2020-11-06 21:32:17 -05:00
cb2defbde9 Lint: W391 blank line at end of file 2020-11-06 21:14:19 -05:00
98a573bbc7 Lint: E402 module level import not at top of file 2020-11-06 20:40:32 -05:00
d9e7b7ec15 Lint: F401 <library> imported but unused 2020-11-06 19:22:49 -05:00
63f4f9aed7 Lint: E722 do not use bare 'except' 2020-11-06 18:55:10 -05:00
ec0b8acf90 Support per-VM migration type selectors
Allow a VM to specify its migration type as a default choice. The valid
options are "default" (i.e. behave as now), "live" which forces a live
migration only, and "shutdown" which forces a shutdown migration only.
The new option is treated as a VM meta option and is set to default if
not found.
2020-10-29 12:01:29 -04:00
d63e757c32 Ensure args are checked against form body
Required for XML definitions but erroneously removed during file parsing
reworking.
2020-10-27 02:30:59 -04:00
f85c2c2a75 Remove PyWSGI and move to Flask server
Gevent was completely failure. The API would block during large file
uploads with no obvious solutions beyond "use gunicorn", which is not
suited to this. I originally had this working with the Flask "debug"
server, so just move to using that all the time. SSL is added using a
custom context with the OpenSSL library, so include that as a
dependency.
2020-10-26 01:58:43 -04:00
ffaa4c033f Improve handling of large file uploads
By default, Werkzeug would require the entire file (be it an OVA or
image file) to be uploaded and saved to a temporary, fake file under
`/tmp`, before any further processing could occur. This blocked most of
the execution of these functions until the upload was completed.

This entirely defeated the purpose of what I was trying to do, which was
to save the uploads directly to the temporary blockdev in each case,
thus avoiding any sort of memory or (host) disk usage.

The solution is two-fold:

  1. First, ensure that the `location='args'` value is set in
  RequestParser; without this, the `files` portion would be parsed
  during the argument parsing, which was the original source of this
  blocking behaviour.

  2. Instead of the convoluted request handling that was being done
  originally here, instead entirely defer the parsing of the `files`
  arguments until the point in the code where they are ready to be
  saved. Then, using an override stream_factory that simply opens the
  temporary blockdev, the upload can commence while being written
  directly out to it, rather than using `/tmp` space.

This does alter the error handling slightly; it is impossible to check
if the argument was passed until this point in the code, so it may take
longer to fail if the API consumer does not specify a file as they
should. This is a minor trade-off and I would expect my API consumers to
be sane here.
2020-10-19 01:00:34 -04:00
a4b80be5ed Add provisioned memory to node info
Adds a separate field to the node memory, "provisioned", which totals
the amount of memory provisioned to all VMs on the node, regardless of
state, and in contrast to "allocated" which only counts running VMs.

Allows for the detection of potential overprovisioned states when
factoring in non-running VMs.

Includes the supporting code to get this data, since the original
implementation of VM memory selection was dependent on the VM being
running and getting this from libvirt. Now, if the VM is not active, it
gets this from the domain XML instead.
2020-10-18 14:17:15 -04:00
eb06c1494e Add API spec for benchmark results 2020-08-25 12:43:16 -04:00
887e14a4e2 Add storage benchmarking to API 2020-08-25 01:57:21 -04:00
2b4d980685 Display Ceph health in PVC status as well
Makes this output a little more realistic and allows proper monitoring
of the Ceph cluster status (separate from the PVC status which is
tracking only OSD up/in state).
2020-08-13 15:10:57 -04:00
bafdcf9f8c Use new_size to match new_name 2020-08-05 10:25:37 -04:00
be405caa11 Remove spurious print statement 2020-07-08 13:28:47 -04:00
a1ba9d2eeb Allow specifying arbitrary script_args on CLI
Allow the specifying of arbitrary provisioner script install() args on
the provisioner create CLI, either overriding or adding additional
per-VM arguments to those found in the profile. Reference example is
setting a "vm_fqdn" on a per-run basis.

Closes #100
2020-07-08 13:18:12 -04:00
37a58d35e8 Implement limiting of node output
Closes #98
2020-06-25 11:51:53 -04:00
4cdf1f7247 Add statistics values to the API 2020-06-07 02:15:33 -04:00
654a3cb7fa Improve debug output and use ceph df util data 2020-06-06 22:52:49 -04:00
ce60836c34 Allow enforcement of live migration
Provides a CLI and API argument to force live migration, which triggers
a new VM state "migrate-live". The node daemon VMInstance during migrate
will read this flag from the state and, if enforced, will not trigger a
shutdown migration.

Closes #95
2020-06-06 12:00:44 -04:00
73eb4fb457 Fix typo of macaddress in dhcp add 2020-05-09 00:15:25 -04:00
ca5327b908 Make strtobool even more robust
If strtobool fails, return False always.
2020-03-09 09:30:16 -04:00
d36d8e0637 Use custom strtobool to handle weird edge cases 2020-03-06 09:40:13 -05:00
56a9e48163 Normalize all return messages
Ensure all API return messages are formated the same: no "error", a
final period except when displaying Exception text, and a regular spaced
out format.
2020-02-20 22:42:19 -05:00
8678dedfea Revert "Implement wait for node coordinator transition"
This reverts commit 0aefafa7f777157776084db846240dd027b81fe3.

This does not work since the API goes away during the transition.

References #72
2020-02-19 10:50:21 -05:00
0aefafa7f7 Implement wait for node coordinator transition
References #72
2020-02-19 10:50:04 -05:00
99f579e41a Add wait support to API commands
References #72
2020-02-19 09:51:42 -05:00
ca68321be3 Allow modification of system templates
Closes #82
2020-02-18 16:18:27 -05:00
db558ec91f Complete implementation of OVA handling
Add functions for uploading, listing, and removing OVA images to the API
and CLI interfaces. Includes improved parsing of the OVF and creation of
a system_template and profile for each OVA.

Also modifies some behaviour around profiles, making most components
option at creation to support both profile types (and incomplete
profiles generally).

Implementation part 2/3 - remaining: OVA VM creation

References #71
2020-02-17 23:22:50 -05:00
f3de900bdb Import all database models 2020-02-16 19:15:21 -05:00
560cb609ba Add database management with SQLAlchemy
Add management of the pvcprov database with SQLAlchemy, to allow
seamless management of the database. Add automatic tasks to the postinst
of the API to execute these migrations.
2020-02-15 22:51:27 -05:00
bd8536d9d1 Add OVA upload to API (initial)
Initial, very barebones OVA parsing and image creation.

References #71
2020-02-15 02:10:14 -05:00
b29c69378d Just describe the body in words 2020-02-09 21:08:27 -05:00
ad60f4b1f1 Try again with just query 2020-02-09 21:06:33 -05:00
68638d7760 Use in: body for body contents 2020-02-09 21:05:15 -05:00
602c2f9d4a Use request instead of requestBody 2020-02-09 21:02:13 -05:00
c979fed10a Use proper requestBody description of file 2020-02-09 20:59:03 -05:00
1231ba19b7 Ensure image_format is mandatory
References #68
2020-02-09 20:45:43 -05:00
e419855911 Support converting types during upload
Allow the user to specify other, non-raw files and upload them,
performing a conversion with qemu-img convert and a temporary block
device as a shim (since qemu-img can't use FIFOs).

Also ensures that the target volume exists before proceeding.

Addresses #68
2020-02-09 20:29:12 -05:00
49e5ce1176 Support uploading disk images to volumes in API
Addresses #68
2020-02-09 13:45:04 -05:00
26c2c2c295 Further split API so only Flask can be loaded 2020-02-08 20:36:53 -05:00