- node_name = self.items[0]
- remote_node = self._checkStringVariable("remote_node", default=None)
- iallocator = self._checkStringVariable("iallocator", default=None)
- early_r = bool(self._checkIntVariable("early_release", default=0))
- dry_run = bool(self.dryRun())
-
- cl = baserlib.GetClient()
-
- op = opcodes.OpNodeEvacStrategy(nodes=[node_name],
- iallocator=iallocator,
- remote_node=remote_node)
-
- job_id = baserlib.SubmitJob([op], cl)
- # we use custom feedback function, instead of print we log the status
- result = cli.PollJob(job_id, cl, feedback_fn=baserlib.FeedbackFn)
-
- jobs = []
- for iname, node in result[0]:
- if dry_run:
- jid = None
- else:
- op = opcodes.OpInstanceReplaceDisks(instance_name=iname,
- remote_node=node, disks=[],
- mode=constants.REPLACE_DISK_CHG,
- early_release=early_r)
- jid = baserlib.SubmitJob([op])
- jobs.append((jid, iname, node))
+ op = baserlib.FillOpcode(opcodes.OpNodeEvacuate, self.request_body, {
+ "node_name": self.items[0],
+ "dry_run": self.dryRun(),
+ })