   (delete [this]
      (with-instance-id 
        (debug "deleting" instance-id)
-       (let [compute (servers tenant)]
-         (when-let [floating (get-in spec [:openstack :floating-ip])]
-           (dissoc-ip compute (.get compute instance-id) floating))
-         (.delete compute instance-id))))
+       (let [servers' (servers tenant)]
+         (when-let [ip (get-in spec [:openstack :floating-ip])]
+           (dissoc-floating (floating-ips tenant) (.get servers' instance-id) ip))
+         (.delete servers' instance-id))))
 
   (stop [this]
      (with-instance-id 
        (debug "stopping" instance-id )
-       (.action (servers tenant) instance-id Action/STOP)))
+       (.action (servers tenant) instance-id Action/STOP)
+       (wait-for-stop this [5 :minute])))
 
   (status [this] 
      (if-let [instance-id (instance-id* spec)]

    (.networks (openstack :network-ids))
    (.build)))

(defn wait-for-ip  [compute id network timeout]
  "Wait for an ip to be avilable"
  (wait-for {:timeout timeout} #(not (nil? (first-ip (.get compute id) network)))
    {:type ::openstack:status-failed :timeout timeout} 
      "Timed out on waiting for ip to be available"))


(defmethod vconstruct :openstack [spec]
  (apply ->Instance (translate spec)))



