Example #1
0
        protected override void Run()
        {
            Description = Messages.ACTION_VM_MIGRATING;
            try
            {
                PercentComplete = 0;
                Session session = Host.Connection.DuplicateSession();
                Dictionary <string, string> sendData = Host.migrate_receive(session, Host.opaque_ref,
                                                                            transferNetwork.opaque_ref, new Dictionary <string, string>());
                PercentComplete = 5;
                LiveMigrateOptionsVmMapping options = new LiveMigrateOptionsVmMapping(mapping, VM);

                RelatedTask = VM.async_migrate_send(Session, VM.opaque_ref, sendData,
                                                    options.Live, options.VdiMap,
                                                    options.VifMap, options.Options);

                PollToCompletion(PercentComplete, 100);
            }
            catch (CancelledException)
            {
                Description = string.Format(Messages.ACTION_VM_MIGRATE_CANCELLED, VM.Name);
                throw;
            }
            catch (Failure ex)
            {
                Description = ex.Message;
                List <string> errors = ex.ErrorDescription;
                throw;
            }

            Description = Messages.ACTION_VM_MIGRATED;
        }
        protected override void Run()
        {
            Description = copy ? Messages.ACTION_VM_COPYING: Messages.ACTION_VM_MIGRATING;
            try
            {
                PercentComplete = 0;
                Session session = Host.Connection.DuplicateSession();
                Dictionary <string, string> sendData = Host.migrate_receive(session, Host.opaque_ref,
                                                                            transferNetwork.opaque_ref, new Dictionary <string, string>());
                PercentComplete = 5;
                LiveMigrateOptionsVmMapping options = new LiveMigrateOptionsVmMapping(mapping, VM);
                //options.Options.Add("encrypt", migrateEncrypt+"");
                if (migrateEncrypt)
                {
                    sendData["xenops"] = sendData["xenops"].Replace("http:", "https:");
                }
                //options.Options["encrypt"] = migrateEncrypt + "";
                var _options = new Dictionary <string, string>(options.Options);
                if (copy)
                {
                    _options.Add("copy", "true");
                }
                RelatedTask = VM.async_migrate_send(Session, VM.opaque_ref, sendData,
                                                    options.Live, options.VdiMap,
                                                    options.VifMap, _options);

                PollToCompletion(PercentComplete, 100);
            }
            catch (CancelledException)
            {
                Description = string.Format(copy ? Messages.ACTION_VM_CROSS_POOL_COPY_CANCELLED : Messages.ACTION_VM_MIGRATE_CANCELLED,
                                            VM.Name);
                throw;
            }
            catch (Failure ex)
            {
                Description = ex.Message;
                List <string> errors = ex.ErrorDescription;
                throw;
            }
            Description = copy ? Messages.ACTION_VM_COPIED: Messages.ACTION_VM_MIGRATED;
        }