Commit Graph

1079 Commits

Author SHA1 Message Date
Joshua Boniface 69462d2c7b Ensure myhostname is short
PVC now uses shortnames for node names, so ensure this is reflected
in the default choices for some node-level commands.
2019-05-23 22:27:34 -04:00
Joshua Boniface 8ef21cf9f2 Sleep longer before removing gateways
1 second was just slightly too little time to wait and packets would
occasionally be lost on primary switchover. Increase this to 2
seconds to provide more time for arping to run on the new primary.
2019-05-23 22:20:38 -04:00
Joshua Boniface d59280d829 Update dependencies for Postgres 2019-05-22 21:57:06 -04:00
Joshua Boniface 8881b97e8b Correct a missing capitalization 2019-05-21 23:19:19 -04:00
Joshua Boniface 4bfbbaa7d9 Remove commented needless call 2019-05-21 23:08:28 -04:00
Joshua Boniface 3893666507 Improve performance by removing spurious actions
1. Remove a number of time.sleep commands which don't really seem
necessary any longer and which significantly increased the startup
time while parsing the VM list.
2. Handle some variable sets during initialization of the object,
rather than waiting for a management command, enabling...
3. Know when a state change, and the corresponding Libvirt lookup,
is unnecessary due to the target node not matching the current node.
This also removes a number of unremovable errors from Libvirt on the
console which were annoying.

This reduces the total time taken by the VM startup segment (lines
760-762 of Daemon.py) from 17.117s down to 0.976s for 82 VMs.
2019-05-21 22:56:40 -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 595cf1782c Switch DNS aggregator to PostgreSQL
MariaDB+Galera was terribly unstable, with the cluster failing to
start or dying randomly, and generally seemed incredibly unsuitable
for an HA solution. This commit switches the DNS aggregator SQL
backend to PostgreSQL, implemented via Patroni HA.

It also manages the Patroni state, forcing the primary instance to
follow the PVC coordinator, such that the active DNS Aggregator
instance is always able to communicate read+write with the local
system.

This required some logic changes to how the DNS Aggregator worked,
specifically ensuring that database changes aren't attempted while
the instance isn't actively running - to be honest this was a bug
anyways that had just never been noticed.

Closes #34
2019-05-21 01:07:41 -04:00
Joshua Boniface 73443ecbaf Update vm.py to allow API use 2019-05-20 22:15:28 -04:00
Joshua Boniface 9e806d30f9 Only stop log parser if it's actually running 2019-05-11 12:09:42 -04:00
Joshua Boniface 3cf573baf6 Update domainstate after unflush is complete 2019-05-11 00:55:15 -04:00
Joshua Boniface 18a122c772 Remove redundant try block 2019-05-11 00:47:50 -04:00
Joshua Boniface 516ea1b57c Handle unflushes like flushes squentially
Makes an unflush a controlled event like flushing, rather than a
free-for-all. This does slow down unflushing somewhat (disallowing
parallelism from multiple hosts to the current host), but allows
the locking to actually be effective.
2019-05-11 00:30:47 -04:00
Joshua Boniface 91ea96b772 Actually send wait for unflush 2019-05-11 00:16:38 -04:00
Joshua Boniface 62a71af46e Implement locking for unflush as well
References #32
2019-05-11 00:13:03 -04:00
Joshua Boniface 9d8c886811 Correct typo in flush_lock write 2019-05-11 00:08:07 -04:00
Joshua Boniface e1c53c40a6 Merge branch 'api' 2019-05-10 23:58:34 -04:00
Joshua Boniface c19902d952 Implement flush locking for nodes
Implements a locking mechanism to prevent clobbering of node
flushes. When a flush begins, a global cluster lock is placed
which is freed once the flush completes. While the lock is in place,
other flush events queue waiting for the lock to free before
proceeding.

Modifies the CLI output flow when the `--wait` option is specified.
First, if a lock exists when running the command, the message is
tweaked to indicate this, and the client will wait first for the
lock to free, and then for the flush as normal. Second, the wait
depends on the active lock rather than the domain_status for
consistency purposes.

Closes #32
2019-05-10 23:52:24 -04:00
Joshua Boniface 045ad131af Update node.py to allow API use
Addresses #33
2019-05-10 23:27:34 -04:00
Joshua Boniface 2151566b74 Send total memory via ZK so its accurate 2019-05-10 23:26:59 -04:00
Joshua Boniface 7416d440d5 Use zkhandler when writing initial node config 2019-05-10 23:26:59 -04:00
Joshua Boniface ae1650759b Add new endpoints 2019-05-10 23:26:59 -04:00
Joshua Boniface 41d3e79187 Add pause between stop/start on restart 2019-05-10 23:26:59 -04:00
Joshua Boniface b6ecd36588 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-05-10 23:26:59 -04:00
Joshua Boniface 5ad2dda6d4 Only print file name 2019-05-10 23:26:59 -04:00
Joshua Boniface 9809b798cc Correct bug in non-editor modify 2019-05-10 23:26:59 -04:00
Joshua Boniface ba4a44f5e7 Allow the zk_conn to be none properly 2019-05-10 23:26:59 -04:00
Joshua Boniface 989c5f6bed Don't depend start on mariadb 2019-05-10 23:26:59 -04:00
Joshua Boniface e41b3053f7 Update methods to POST where relevant 2019-04-12 12:27:49 -04:00
Joshua Boniface d20ea8b79d Add pause between stop/start on restart 2019-04-12 11:18:53 -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 cbad19adfe Only print file name 2019-04-10 16:29:26 -04:00
Joshua Boniface 30002f95d7 Correct bug in non-editor modify 2019-04-10 16:18:18 -04:00
Joshua Boniface c8c5d6f884 Allow the zk_conn to be none properly 2019-04-09 16:25:45 -04:00
Joshua Boniface 2a5106fa92 Don't depend start on mariadb 2019-04-09 08:18:11 -04:00
Joshua Boniface 1126382ac9 Initial API including fixes to common functons
Some functions were doing `click.echo` inside themselves; don't
do that as it's not API compatible, just return everything.
2019-03-21 11:19:28 -04:00
Joshua Boniface 2e4c0c8eb9 Correct header file name 2019-03-20 12:06:15 -04:00
Joshua Boniface 55ce75aa9f Remove junk file 2019-03-20 12:05:35 -04:00
Joshua Boniface d5ea38732a Disable RP filtering only on VNI and Upstream devs 2019-03-20 12:01:26 -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 0dbd1c41a9 Create floating VNI address on brcluster 2019-03-18 20:17:26 -04:00
Joshua Boniface 24a9612377 Remove obsolete about 2019-03-17 22:37:57 -04:00
Joshua Boniface 013f75111a Rearrange sysctl for rp_filtering off on bridge 2019-03-17 20:05:58 -04:00
Joshua Boniface 4050c452d6 Update dnsmasq script to use YAML config 2019-03-17 13:59:05 -04:00
Joshua Boniface deb4247e25 Only remove gateways when managed 2019-03-17 13:19:44 -04:00
Joshua Boniface 3ec09686d2 Don't load provisioner 2019-03-17 12:56:52 -04:00
Joshua Boniface 3924586eb5 Update zookeeper inside keepalive start
If nodes reconnect to ZK, this way they update immediately too.
2019-03-17 12:52:23 -04:00
Joshua Boniface 3df8365851 Only manage DHCP on managed networks 2019-03-17 12:36:39 -04:00