summaryrefslogtreecommitdiff
path: root/src/Propellor/Property/Libvirt.hs
diff options
context:
space:
mode:
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