Revision 07b49e41
b/lib/hypervisor/hv_base.py | ||
---|---|---|
111 | 111 |
"""Start an instance.""" |
112 | 112 |
raise NotImplementedError |
113 | 113 |
|
114 |
def StopInstance(self, instance, force=False): |
|
115 |
"""Stop an instance.""" |
|
114 |
def StopInstance(self, instance, force=False, retry=False): |
|
115 |
"""Stop an instance |
|
116 |
|
|
117 |
@type instance: L{objects.Instance} |
|
118 |
@param instance: instance to stop |
|
119 |
@type force: boolean |
|
120 |
@param force: whether to do a "hard" stop (destroy) |
|
121 |
@type retry: boolean |
|
122 |
@param retry: whether this is just a retry call |
|
123 |
|
|
124 |
""" |
|
116 | 125 |
raise NotImplementedError |
117 | 126 |
|
118 | 127 |
def RebootInstance(self, instance): |
b/lib/hypervisor/hv_chroot.py | ||
---|---|---|
171 | 171 |
raise HypervisorError("Can't run the chroot start script: %s" % |
172 | 172 |
result.output) |
173 | 173 |
|
174 |
def StopInstance(self, instance, force=False): |
|
174 |
def StopInstance(self, instance, force=False, retry=False):
|
|
175 | 175 |
"""Stop an instance. |
176 | 176 |
|
177 | 177 |
This method has complicated cleanup tests, as we must: |
... | ... | |
180 | 180 |
- finally unmount the instance dir |
181 | 181 |
|
182 | 182 |
""" |
183 |
if retry: |
|
184 |
return |
|
183 | 185 |
root_dir = "%s/%s" % (self._ROOT_DIR, instance.name) |
184 | 186 |
if not os.path.exists(root_dir): |
185 | 187 |
return |
b/lib/hypervisor/hv_fake.py | ||
---|---|---|
130 | 130 |
raise errors.HypervisorError("Failed to start instance %s: %s" % |
131 | 131 |
(instance.name, err)) |
132 | 132 |
|
133 |
def StopInstance(self, instance, force=False): |
|
133 |
def StopInstance(self, instance, force=False, retry=False):
|
|
134 | 134 |
"""Stop an instance. |
135 | 135 |
|
136 | 136 |
For the fake hypervisor, this just removes the file in the base |
b/lib/hypervisor/hv_kvm.py | ||
---|---|---|
535 | 535 |
if wait < 5: |
536 | 536 |
wait *= 1.3 |
537 | 537 |
|
538 |
def StopInstance(self, instance, force=False): |
|
538 |
def StopInstance(self, instance, force=False, retry=False):
|
|
539 | 539 |
"""Stop an instance. |
540 | 540 |
|
541 | 541 |
""" |
542 |
if retry: |
|
543 |
return |
|
542 | 544 |
pidfile, pid, alive = self._InstancePidAlive(instance.name) |
543 | 545 |
if pid > 0 and alive: |
544 | 546 |
if force or not instance.hvparams[constants.HV_ACPI]: |
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
178 | 178 |
(instance.name, result.fail_reason, |
179 | 179 |
result.output)) |
180 | 180 |
|
181 |
def StopInstance(self, instance, force=False): |
|
181 |
def StopInstance(self, instance, force=False, retry=False):
|
|
182 | 182 |
"""Stop an instance. |
183 | 183 |
|
184 | 184 |
""" |
185 |
if retry: |
|
186 |
return |
|
185 | 187 |
self._RemoveConfigFile(instance.name) |
186 | 188 |
if force: |
187 | 189 |
command = ["xm", "destroy", instance.name] |
Also available in: Unified diff