Beispiel #1
0
        protected override void Run()
        {
            SafeToExit = false;

            try
            {
                _patch = UploadRetailPatch();
                log.InfoFormat("File '{0}' uploaded to server '{1}'", _patchName, Host.Name());
                Tick(100, string.Format(Messages.UPLOAD_PATCH_UPLOADED_DESCRIPTION, _patchName));
            }
            catch (Failure f)
            {
                // Need to check if the patch already exists.
                // If it does then we use it and ignore the PATCH_ALREADY_EXISTS error (CA-110209).
                if (f.ErrorDescription != null &&
                    f.ErrorDescription.Count > 1 &&
                    f.ErrorDescription[0] == Failure.PATCH_ALREADY_EXISTS)
                {
                    string  uuid    = f.ErrorDescription[1];
                    Session session = Host.Connection.DuplicateSession();
                    _patch = Connection.Resolve(Pool_patch.get_by_uuid(session, uuid));
                }
                else
                {
                    throw;
                }
            }
        }
Beispiel #2
0
        protected override void Run()
        {
            SafeToExit = false;
            TotalSize  = retailHosts.Count * FileSize(retailPatchPath);

            foreach (Host host in retailHosts)
            {
                try
                {
                    patches[host] = UploadRetailPatch(host);
                }
                catch (Failure f)
                {
                    // Need to check if the patch already exists.
                    // If it does then we use it and ignore the PATCH_ALREADY_EXISTS error (CA-110209).
                    if (f.ErrorDescription != null &&
                        f.ErrorDescription.Count > 1 &&
                        f.ErrorDescription[0] == XenAPI.Failure.PATCH_ALREADY_EXISTS)
                    {
                        string  uuid    = f.ErrorDescription[1];
                        Session session = host.Connection.DuplicateSession();
                        patches[host] = Connection.Resolve(Pool_patch.get_by_uuid(session, uuid));
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            if (retailHosts.Count > 1)
            {
                this.Description = Messages.ALL_UPDATES_UPLOADED;
            }
        }
Beispiel #3
0
        protected override void Run()
        {
            SafeToExit = false;
            TotalSize  =
                (embeddedHosts.Count > 0 ? embeddedHosts.Count * FileSize(embeddedPatchPath) : 0)
                + (retailHosts.Count > 0 ? retailHosts.Count * FileSize(retailPatchPath) : 0);

            foreach (Host host in embeddedHosts)
            {
                UploadEmbeddedPatch(host);
            }

            foreach (Host host in retailHosts)
            {
                try
                {
                    patches[host] = UploadRetailPatch(host);
                }
                catch (Failure f)
                {
                    // Need to check if the patch already exists.
                    // If it does, and we're upload multiple patches
                    // (ie from the wizard) then we don't care about
                    // throwing the error
                    if (f.ErrorDescription != null &&
                        f.ErrorDescription.Count > 1 &&
                        f.ErrorDescription[0] == XenAPI.Failure.PATCH_ALREADY_EXISTS &&
                        embeddedHosts.Count + retailHosts.Count > 1)
                    {
                        string  uuid    = f.ErrorDescription[1];
                        Session session = host.Connection.DuplicateSession();
                        patches[host] = Connection.Resolve(Pool_patch.get_by_uuid(session, uuid));
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            if (embeddedHosts.Count + retailHosts.Count > 1)
            {
                this.Description = Messages.ALL_UPDATES_UPLOADED;
            }
        }