Revision 6e7275c0 lib/hypervisor/hv_xen.py
b/lib/hypervisor/hv_xen.py | ||
---|---|---|
257 | 257 |
|
258 | 258 |
return disk_data |
259 | 259 |
|
260 |
def MigrateInstance(self, instance, target, live): |
|
261 |
"""Migrate an instance to a target node. |
|
262 |
|
|
263 |
Arguments: |
|
264 |
- instance: the name of the instance |
|
265 |
- target: the ip of the target node |
|
266 |
- live: whether to do live migration or not |
|
267 |
|
|
268 |
Returns: none, errors will be signaled by exception. |
|
269 |
|
|
270 |
The migration will not be attempted if the instance is not |
|
271 |
currently running. |
|
272 |
|
|
273 |
""" |
|
274 |
if self.GetInstanceInfo(instance) is None: |
|
275 |
raise errors.HypervisorError("Instance not running, cannot migrate") |
|
276 |
args = ["xm", "migrate"] |
|
277 |
if live: |
|
278 |
args.append("-l") |
|
279 |
args.extend([instance, target]) |
|
280 |
result = utils.RunCmd(args) |
|
281 |
if result.failed: |
|
282 |
raise errors.HypervisorError("Failed to migrate instance %s: %s" % |
|
283 |
(instance, result.output)) |
|
284 |
|
|
260 | 285 |
|
261 | 286 |
class XenPvmHypervisor(XenHypervisor): |
262 | 287 |
"""Xen PVM hypervisor interface""" |
Also available in: Unified diff