summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Libvirt.hs
diff options
context:
space:
mode:
authorSean Whitton2018-11-05 20:07:22 -0700
committerSean Whitton2018-11-05 20:07:22 -0700
commit8cec852a8737b53967e8ae89f30e94975e5f4f5b (patch)
tree14933f5a6f19c0e7a2da038d7d7d929f501b2301 /src/Propellor/Property/Libvirt.hs
parent22f044602fcdcfefec77153f4ccb47a77847c387 (diff)
libvirt: don't try to start running VM
Diffstat (limited to 'src/Propellor/Property/Libvirt.hs')
-rw-r--r--src/Propellor/Property/Libvirt.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/Propellor/Property/Libvirt.hs b/src/Propellor/Property/Libvirt.hs
index a1d44e9b..80222248 100644
--- a/src/Propellor/Property/Libvirt.hs
+++ b/src/Propellor/Property/Libvirt.hs
@@ -116,8 +116,11 @@ kvmDefined imageType mem cpus auto h =
])
started :: Property UnixLike
started = case AutoStart of
- AutoStart -> cmdProperty "virsh" ["start", hostName h]
- `assume` MadeChange
+ AutoStart -> scriptProperty
+ [ "virsh list | grep -q \""
+ ++ hostName h ++ " .*running\" && exit 0"
+ , "virsh start " ++ hostName h
+ ] `assume` NoChange
NoAutoStart -> doNothing
image = case imageType of