VirtualBox

Changeset 94643 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Apr 20, 2022 9:08:37 AM (3 years ago)
Author:
vboxsync
Message:

Main/Update check: Big overhaul of the API and functionality.

  • Now uses VBOX_WITH_UPDATE_AGENT to entirely disable the feature (enabled by default).
  • Main: Uses new (more abstract) API as proposed in the latest UML docs.
  • Main: Added support for several events.
  • Main: Added support for update severities, order and dependencies (all optional).
  • Settings/XML: Now has own "Updates" branch to also cover other updatable components (later); not part of the system properties anymore.
  • Prepared for GuestAdditions and ExtPack updates.
  • FE/Qt: Adapted to new API.
  • FE/VBoxManage: Adapted to new API; uses more uniform (common) synopsis "modify" and "list" for modifying and listing (showing) update settings.
  • Docs: Fixed various typos, extended documentation.

Work in progress. bugref:7983

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r94598 r94643  
    16381638    , uLogHistoryCount(3)
    16391639    , fExclusiveHwVirt(true)
    1640     , fVBoxUpdateEnabled(true)
    1641     , uVBoxUpdateCount(0)
    1642     , uVBoxUpdateFrequency(1)
    1643     , uVBoxUpdateTarget(VBoxUpdateTarget_Stable)
    16441640{
    16451641#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS)
     
    16471643#endif
    16481644}
     1645
     1646#ifdef VBOX_WITH_UPDATE_AGENT
     1647UpdateAgent::UpdateAgent()
     1648   : fEnabled(false)
     1649   , enmChannel(UpdateChannel_Stable)
     1650   , uCheckFreqSeconds(RT_SEC_1DAY)
     1651   , enmProxyMode(ProxyMode_NoProxy)
     1652   , uCheckCount(0)
     1653{
     1654}
     1655#endif /* VBOX_WITH_UPDATE_AGENT */
    16491656
    16501657/**
     
    23322339                            fCopyProxySettingsFromExtraData = true;
    23332340                        pelmGlobalChild->getAttributeValue("proxyUrl", systemProperties.strProxyUrl);
    2334                         pelmGlobalChild->getAttributeValue("updateEnabled", systemProperties.fVBoxUpdateEnabled);
    2335                         pelmGlobalChild->getAttributeValue("updateCount", systemProperties.uVBoxUpdateCount);
    2336                         pelmGlobalChild->getAttributeValue("updateFrequency", systemProperties.uVBoxUpdateFrequency);
    2337                         pelmGlobalChild->getAttributeValue("updateTarget", systemProperties.uVBoxUpdateTarget);
    2338                         pelmGlobalChild->getAttributeValue("updateLastCheckDate",
    2339                             systemProperties.strVBoxUpdateLastCheckDate);
    23402341                        pelmGlobalChild->getAttributeValue("LanguageId", systemProperties.strLanguageId);
    23412342                    }
     2343#ifdef VBOX_WITH_UPDATE_AGENT
     2344                    else if (pelmGlobalChild->nameEquals("Updates"))
     2345                    {
     2346                        /* We keep the updates configuration as part of the host for now, as the API exposes the IHost::updateHost attribute,
     2347                         * but use an own "Updates" branch in the XML for better structurizing stuff in the future. */
     2348                        UpdateAgent &updateHost = host.updateHost;
     2349
     2350                        xml::NodesLoop nlLevel4(*pelmGlobalChild);
     2351                        const xml::ElementNode *pelmLevel4Child;
     2352                        while ((pelmLevel4Child = nlLevel4.forAllNodes()))
     2353                        {
     2354                            if (pelmLevel4Child->nameEquals("Host"))
     2355                            {
     2356                                pelmLevel4Child->getAttributeValue("enabled", updateHost.fEnabled);
     2357                                pelmLevel4Child->getAttributeValue("channel", (uint32_t&)updateHost.enmChannel);
     2358                                pelmLevel4Child->getAttributeValue("checkFrequency", updateHost.uCheckFreqSeconds);
     2359                                pelmLevel4Child->getAttributeValue("repoUrl", updateHost.strRepoUrl);
     2360                                pelmLevel4Child->getAttributeValue("proxyMode", (uint32_t&)updateHost.enmProxyMode);
     2361                                pelmLevel4Child->getAttributeValue("proxyUrl", (uint32_t&)updateHost.enmProxyMode);
     2362                                pelmLevel4Child->getAttributeValue("lastCheckDate", updateHost.strLastCheckDate);
     2363                                pelmLevel4Child->getAttributeValue("checkCount", updateHost.uCheckCount);
     2364                            }
     2365                            /** @todo Add update settings for ExtPack and Guest Additions here later. See @bugref{7983}. */
     2366                        }
     2367
     2368                        /* Global enabled switch for updates. Currently bound to host updates, as this is the only update we have so far. */
     2369                        pelmGlobalChild->getAttributeValue("enabled", updateHost.fEnabled);
     2370                    }
     2371#endif
    23422372                    else if (pelmGlobalChild->nameEquals("ExtraData"))
    23432373                        readExtraData(*pelmGlobalChild, mapExtraDataItems);
     
    25612591#endif /* VBOX_WITH_CLOUD_NET */
    25622592
     2593#ifdef VBOX_WITH_UPDATE_AGENT
     2594    /* We keep the updates configuration as part of the host for now, as the API exposes the IHost::updateHost attribute,
     2595     * but use an own "Updates" branch in the XML for better structurizing stuff in the future. */
     2596    UpdateAgent &updateHost = host.updateHost;
     2597
     2598    xml::ElementNode *pelmUpdates = pelmGlobal->createChild("Updates");
     2599    /* Global enabled switch for updates. Currently bound to host updates, as this is the only update we have so far. */
     2600    pelmUpdates->setAttribute("enabled", updateHost.fEnabled);
     2601
     2602    xml::ElementNode *pelmUpdateHost = pelmUpdates->createChild("Host");
     2603    pelmUpdateHost->setAttribute("enabled", updateHost.fEnabled);
     2604    pelmUpdateHost->setAttribute("channel", (int32_t)updateHost.enmChannel);
     2605    pelmUpdateHost->setAttribute("checkFrequency", updateHost.uCheckFreqSeconds);
     2606    if (updateHost.strRepoUrl.length())
     2607        pelmUpdateHost->setAttribute("repoUrl", updateHost.strRepoUrl);
     2608    pelmUpdateHost->setAttribute("proxyMode", (int32_t)updateHost.enmProxyMode);
     2609    if (updateHost.strProxyUrl.length())
     2610        pelmUpdateHost->setAttribute("proxyUrl", updateHost.strProxyUrl);
     2611    if (updateHost.strLastCheckDate.length())
     2612        pelmUpdateHost->setAttribute("lastCheckDate", updateHost.strLastCheckDate);
     2613    pelmUpdateHost->setAttribute("checkCount", updateHost.uCheckCount);
     2614    /** @todo Add update settings for ExtPack and Guest Additions here later. See @bugref{7983}. */
     2615#endif
    25632616
    25642617    xml::ElementNode *pelmSysProps = pelmGlobal->createChild("SystemProperties");
     
    25842637    pelmSysProps->setAttribute("proxyMode", systemProperties.uProxyMode);
    25852638    pelmSysProps->setAttribute("exclusiveHwVirt", systemProperties.fExclusiveHwVirt);
    2586     pelmSysProps->setAttribute("updateEnabled", systemProperties.fVBoxUpdateEnabled);
    2587     pelmSysProps->setAttribute("updateCount", systemProperties.uVBoxUpdateCount);
    2588     pelmSysProps->setAttribute("updateFrequency", systemProperties.uVBoxUpdateFrequency);
    2589     pelmSysProps->setAttribute("updateTarget", systemProperties.uVBoxUpdateTarget);
    2590     if (systemProperties.strVBoxUpdateLastCheckDate.length())
    2591         pelmSysProps->setAttribute("updateLastCheckDate", systemProperties.strVBoxUpdateLastCheckDate);
    25922639    if (systemProperties.strLanguageId.isNotEmpty())
    25932640        pelmSysProps->setAttribute("LanguageId", systemProperties.strLanguageId);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette