Revision bbcf7ad0 lib/hypervisor/hv_xen.py

b/lib/hypervisor/hv_xen.py
189 189
                                   (instance.name, result.fail_reason,
190 190
                                    result.output))
191 191

  
192
  def StopInstance(self, instance, force=False, retry=False):
192
  def StopInstance(self, instance, force=False, retry=False, name=None):
193 193
    """Stop an instance.
194 194

  
195 195
    """
196
    self._RemoveConfigFile(instance.name)
196
    if name is None:
197
      name = instance.name
198
    self._RemoveConfigFile(name)
197 199
    if force:
198
      command = ["xm", "destroy", instance.name]
200
      command = ["xm", "destroy", name]
199 201
    else:
200
      command = ["xm", "shutdown", instance.name]
202
      command = ["xm", "shutdown", name]
201 203
    result = utils.RunCmd(command)
202 204

  
203 205
    if result.failed:
204 206
      raise errors.HypervisorError("Failed to stop instance %s: %s, %s" %
205
                                   (instance.name, result.fail_reason,
206
                                    result.output))
207
                                   (name, result.fail_reason, result.output))
207 208

  
208 209
  def RebootInstance(self, instance):
209 210
    """Reboot an instance.

Also available in: Unified diff