Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA-315107 Create xapi-init-complete systemd target #3851

Merged
merged 1 commit into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ install:
$(IDATA) attach-static-vdis.service $(DESTDIR)/usr/lib/systemd/system/attach-static-vdis.service
$(IDATA) save-boot-info.service $(DESTDIR)/usr/lib/systemd/system/save-boot-info.service
$(IDATA) mpathalert.service $(DESTDIR)/usr/lib/systemd/system/mpathalert.service
$(IDATA) xapi-init-complete.target $(DESTDIR)/usr/lib/systemd/system/xapi-init-complete.target
$(IDATA) xapi-wait-init-complete.service $(DESTDIR)/usr/lib/systemd/system/xapi-wait-init-complete.service
mkdir -p $(DESTDIR)$(ETCDIR)/master.d
$(IPROG) on-master-start $(DESTDIR)$(ETCDIR)/master.d/01-example
$(IPROG) mpathalert-daemon $(DESTDIR)$(ETCDIR)/master.d/03-mpathalert-daemon
Expand Down
18 changes: 5 additions & 13 deletions scripts/xapi-autostart-vms
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@

[ -e /proc/xen ] || exit 0

XAPI_START_TIMEOUT_SECONDS=240
auto_poweron_pool=$(xe pool-list params=uuid other-config:auto_poweron=true --minimal 2> /dev/null)

# wait for xapi to complete initialisation for a max of XAPI_START_TIMEOUT_SECONDS
@BINDIR@/xapi-wait-init-complete ${XAPI_START_TIMEOUT_SECONDS}

if [ $? -eq 0 ]; then

auto_poweron_pool=$(xe pool-list params=uuid other-config:auto_poweron=true --minimal 2> /dev/null)

if [ $? -eq 0 ] && [ -n "$auto_poweron_pool" ]; then
logger "$0 auto_poweron is enabled on the pool-- this is an unsupported configuration."
# if xapi init completed then start vms (best effort, don't report errors)
xe vm-start other-config:auto_poweron=true power-state=halted --multiple >/dev/null 2>/dev/null || true
fi
if [ $? -eq 0 ] && [ -n "$auto_poweron_pool" ]; then
logger "$0 auto_poweron is enabled on the pool-- this is an unsupported configuration."
# if xapi init completed then start vms (best effort, don't report errors)
xe vm-start other-config:auto_poweron=true power-state=halted --multiple >/dev/null 2>/dev/null || true
fi
3 changes: 2 additions & 1 deletion scripts/xapi-domains.service
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[Unit]
Description=Start/stop domains on dom0 start/shutdown
Requires=proc-xen.mount
After=remote-fs.target xapi.service
Wants=xapi-init-complete.target
After=remote-fs.target xapi-init-complete.target
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this still do the right thing on shutdown, i.e. stop xapi-domains before xapi?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't change the shutdown behaviour. Since xapi-domains is started after xapi, it will be shut down before.


[Service]
Type=oneshot
Expand Down
4 changes: 4 additions & 0 deletions scripts/xapi-init-complete.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Unit]
Description=Xapi is available
After=syslog.target
After=time-sync.target
13 changes: 13 additions & 0 deletions scripts/xapi-wait-init-complete.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Unit]
Description=Wait for Xapi to complete initialisation
Requires=xapi.service
After=xapi.service
Before=xapi-init-complete.target

[Service]
Type=oneshot
ExecStart=@BINDIR@/xapi-wait-init-complete 240
RemainAfterExit=yes

[Install]
WantedBy=xapi-init-complete.target