On Thu, Apr 22, 2010 at 7:47 PM, Michael Hanselmann <[email protected]> wrote: > Use instance data transfer utility to import instances. > > Signed-off-by: Michael Hanselmann <[email protected]> > --- > lib/cmdlib.py | 36 ++++++++++++++++++++++++------------ > 1 files changed, 24 insertions(+), 12 deletions(-) > > diff --git a/lib/cmdlib.py b/lib/cmdlib.py > index 2cb1300..7eb8c2a 100644 > --- a/lib/cmdlib.py > +++ b/lib/cmdlib.py > @@ -6809,18 +6809,30 @@ class LUCreateInstance(LogicalUnit): > > elif self.op.mode == constants.INSTANCE_IMPORT: > feedback_fn("* running the instance OS import scripts...") > - src_node = self.op.src_node > - src_images = self.src_images > - cluster_name = self.cfg.GetClusterName() > - # FIXME: pass debug option from opcode to backend > - import_result = self.rpc.call_instance_os_import(pnode_name, iobj, > - src_node, > src_images, > - cluster_name, > - self.op.debug_level) > - msg = import_result.fail_msg > - if msg: > - self.LogWarning("Error while importing the disk images for > instance" > - " %s on node %s: %s" % (instance, pnode_name, msg)) > + > + transfers = [] > + > + for idx, image in enumerate(self.src_images): > + if not image: > + continue > + > + # FIXME: pass debug option from opcode to backend > + dt = masterd.instance.DiskTransfer("disk/%s" % idx, > + constants.IEIO_FILE, (image, ), > + constants.IEIO_SCRIPT, > + (iobj.disks[idx], idx), > + None) > + transfers.append(dt) > + > + import_result = \ > + masterd.instance.TransferInstanceData(self, feedback_fn, > + self.op.src_node, pnode_name, > + self.pnode.secondary_ip, > + iobj, transfers) > + if not compat.all(import_result): > + self.LogWarning("Some disks for instance %s on node %s were not" > + " imported successfully" % (instance, pnode_name)) > + > else: > # also checked in the prereq part > raise errors.ProgrammerError("Unknown OS initialization mode '%s'" > -- > 1.7.0.4
LGTM > > > > -- > Subscription settings: > http://groups.google.com/group/ganeti-devel/subscribe?hl=en >
