Remove block-cleaner-daemon
This service currently does more harm (desync libvirt state with reality) than good. Since we have qubesd, we may come back to implementing it properly using libvirt events.
This commit is contained in:
parent
774f4c8d49
commit
207d497bfe
@ -5,5 +5,4 @@ install:
|
||||
mkdir -p $(DESTDIR)/usr/lib/qubes
|
||||
cp cleanup-dispvms $(DESTDIR)/usr/lib/qubes
|
||||
cp startup-misc.sh $(DESTDIR)/usr/lib/qubes
|
||||
cp block-cleaner-daemon.py $(DESTDIR)/usr/lib/qubes/
|
||||
cp fix-dir-perms.sh $(DESTDIR)/usr/lib/qubes/
|
||||
|
@ -1,53 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import xen.lowlevel.xs
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
xs = xen.lowlevel.xs.xs()
|
||||
|
||||
domain_list = []
|
||||
|
||||
def setup_watches():
|
||||
global domain_list
|
||||
|
||||
new_domain_list = xs.ls('', '/local/domain')
|
||||
for dom in new_domain_list:
|
||||
if dom not in domain_list:
|
||||
print "Adding: %s" % dom
|
||||
xs.watch('/local/domain/%s/backend/vbd' % dom, int(dom))
|
||||
for dom in domain_list:
|
||||
if dom not in new_domain_list:
|
||||
print "Removing: %s" % dom
|
||||
xs.unwatch('/local/domain/%s/backend/vbd' % dom, int(dom))
|
||||
domain_list = new_domain_list
|
||||
|
||||
def handle_vbd_state(path):
|
||||
state = xs.read('', path)
|
||||
if state == '6':
|
||||
# Closed state; wait a moment to not interrupt reconnect
|
||||
time.sleep(0.500)
|
||||
state = xs.read('', path)
|
||||
if state == '6':
|
||||
# If still closed, detach device
|
||||
path_components = path.split('/')
|
||||
# /local/domain/<BACK XID>/backend/vbd/<FRONT XID>/<DEV>/...
|
||||
vm_xid = path_components[6]
|
||||
vm_dev = path_components[7]
|
||||
if vm_xid in domain_list:
|
||||
subprocess.call(['xl', 'block-detach', vm_xid, vm_dev])
|
||||
|
||||
def main():
|
||||
|
||||
xs.watch('@introduceDomain', 'reload')
|
||||
xs.watch('@releaseDomain', 'reload')
|
||||
setup_watches()
|
||||
while True:
|
||||
(path, token) = xs.read_watch()
|
||||
if token == 'reload':
|
||||
setup_watches()
|
||||
else:
|
||||
if path.endswith('/state'):
|
||||
handle_vbd_state(path)
|
||||
|
||||
main()
|
@ -5,7 +5,6 @@ all:
|
||||
|
||||
install:
|
||||
mkdir -p $(DESTDIR)$(UNITDIR)
|
||||
cp qubes-block-cleaner.service $(DESTDIR)$(UNITDIR)
|
||||
cp qubes-core.service $(DESTDIR)$(UNITDIR)
|
||||
cp qubes-netvm.service $(DESTDIR)$(UNITDIR)
|
||||
cp qubes-vm@.service $(DESTDIR)$(UNITDIR)
|
||||
|
@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=Qubes block device cleaner (xen front/back)
|
||||
After=qubes-core.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/lib/qubes/block-cleaner-daemon.py
|
||||
StandardOutput=syslog
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -391,12 +391,10 @@ fi
|
||||
%{python3_sitelib}/qubespolicy/glade/RPCConfirmationWindow.glade
|
||||
|
||||
/usr/lib/qubes/cleanup-dispvms
|
||||
/usr/lib/qubes/block-cleaner-daemon.py*
|
||||
/usr/lib/qubes/fix-dir-perms.sh
|
||||
/usr/lib/qubes/startup-misc.sh
|
||||
/usr/libexec/qubes/qubes-notify-tools
|
||||
/usr/libexec/qubes/qubes-notify-updates
|
||||
%{_unitdir}/qubes-block-cleaner.service
|
||||
%{_unitdir}/qubes-core.service
|
||||
%{_unitdir}/qubes-netvm.service
|
||||
%{_unitdir}/qubes-qmemman.service
|
||||
|
Loading…
Reference in New Issue
Block a user