Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

ostree update on IP secondary (reworked) #1518

Merged
merged 11 commits into from
Jan 17, 2020

Conversation

mike-sul
Copy link
Collaborator

No description provided.

@codecov-io
Copy link

codecov-io commented Jan 15, 2020

Codecov Report

Merging #1518 into master will increase coverage by 0.12%.
The diff coverage is 86.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1518      +/-   ##
==========================================
+ Coverage   80.74%   80.86%   +0.12%     
==========================================
  Files         184      184              
  Lines       11181    11196      +15     
==========================================
+ Hits         9028     9054      +26     
+ Misses       2153     2142      -11
Impacted Files Coverage Δ
src/libaktualizr/storage/sqlstorage.h 50% <ø> (ø) ⬆️
src/libaktualizr/storage/invstorage.h 97.56% <ø> (ø) ⬆️
...tualizr/package_manager/packagemanagerinterface.cc 94.28% <100%> (+0.16%) ⬆️
src/libaktualizr/storage/sqlstorage.cc 77.09% <83.33%> (+0.75%) ⬆️
src/aktualizr_info/main.cc 90.23% <0%> (-0.94%) ⬇️
src/libaktualizr/package_manager/ostreemanager.cc 78.27% <0%> (-0.75%) ⬇️
src/libaktualizr/primary/sotauptaneclient.cc 88.95% <0%> (+0.13%) ⬆️
src/libaktualizr/storage/sql_utils.h 86.11% <0%> (+1.38%) ⬆️
src/libaktualizr/storage/sqlstorage_base.cc 79.05% <0%> (+4.72%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 635962f...ed9a0e3. Read the comment docs.

@mike-sul mike-sul force-pushed the feat/OTA-4174/ostree-update-on-IP-secondary branch from 27db9c8 to 770e25d Compare January 15, 2020 11:30
@lgtm-com
Copy link

lgtm-com bot commented Jan 15, 2020

This pull request fixes 1 alert when merging de61528 into 21c8595 - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jan 16, 2020

This pull request fixes 1 alert when merging 6baf1c2 into 635962f - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jan 16, 2020

This pull request fixes 1 alert when merging e10b080 into 635962f - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

@mike-sul mike-sul force-pushed the feat/OTA-4174/ostree-update-on-IP-secondary branch from e10b080 to 088edc9 Compare January 16, 2020 13:36
@lgtm-com
Copy link

lgtm-com bot commented Jan 16, 2020

This pull request fixes 1 alert when merging 088edc9 into 635962f - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

@lgtm-com
Copy link

lgtm-com bot commented Jan 16, 2020

This pull request fixes 1 alert when merging dd01c3a into 635962f - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

@lbonn lbonn changed the title Feat/ota 4174/ostree update on IP secondary ostree update on IP secondary (rebased) Jan 16, 2020
@lbonn lbonn changed the title ostree update on IP secondary (rebased) ostree update on IP secondary (reworked) Jan 16, 2020
Mike Sul added 2 commits January 16, 2020 18:59
 - Each target listed in Director's target file should have corresponding match in ImageRepo's one
 - Test for the use-case if IP Secondary Director's target file and ImageRepo's one have different number of targets

Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
@mike-sul mike-sul force-pushed the feat/OTA-4174/ostree-update-on-IP-secondary branch from dd01c3a to 3373d03 Compare January 16, 2020 17:11
@lgtm-com
Copy link

lgtm-com bot commented Jan 16, 2020

This pull request fixes 1 alert when merging 3373d03 into 635962f - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

@mike-sul mike-sul force-pushed the feat/OTA-4174/ostree-update-on-IP-secondary branch 2 times, most recently from 11681c2 to d660f55 Compare January 16, 2020 23:12
@lgtm-com
Copy link

lgtm-com bot commented Jan 16, 2020

This pull request fixes 1 alert when merging d660f55 into 635962f - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

@mike-sul mike-sul force-pushed the feat/OTA-4174/ostree-update-on-IP-secondary branch from d660f55 to 7c2fa9e Compare January 16, 2020 23:59
@lgtm-com
Copy link

lgtm-com bot commented Jan 17, 2020

This pull request fixes 1 alert when merging 7c2fa9e into 635962f - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

Copy link
Collaborator

@pattivacek pattivacek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small stuff. This looks quite good, though.

I did a diff with the last version and only noticed one thing missing that seems like it should be here: in src/aktualizr_secondary/aktualizr_secondary_config_test.cc, you previously had a change with #ifdef BUILD_OSTREE to control whether the default pacman was kOstree or kNone.

CHANGELOG.md Show resolved Hide resolved
storage_->loadInstalledVersions(ecu_serial_.ToString(), nullptr, &pending_target);
data::InstallationResult install_res =
data::InstallationResult(data::ResultCode::Numeric::kUnknown, "Unknown installation error");
LOG_INFO << "There is a pending update, try to apply it, update hash: " << pending_target_.sha256Hash();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth making this just a bit clearer. "Try to apply it" sounds like the user should take action. Maybe rephrase to "Pending update found; attempting to apply it. Target hash: ".

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

using Ptr = std::shared_ptr<AktualizrSecondary>;

public:
// TODO: free AktualizrSecondary from dependencies as much as possible, e.g. bootloader
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has now been freed of the bootloader, at least from the perspective of the constructor here. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

src/aktualizr_secondary/update_agent_file.cc Show resolved Hide resolved
storage->saveInstalledVersion(f.first.serial.ToString(), f.first.update,
fut_result == data::ResultCode::Numeric::kOk
? InstalledVersionUpdateMode::kCurrent
: InstalledVersionUpdateMode::kPending);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal or blocker here, but I'd probably prefer to have the three-line logic for calculating the result on its own line outside of the function call.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -171,6 +173,7 @@ class SotaUptaneClient {
// ecu_serial => secondary*
std::map<Uptane::EcuSerial, std::shared_ptr<Uptane::SecondaryInterface>> secondaries;
std::mutex download_mutex;
mutable Uptane::EcuSerial primary_ecu_serial_;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be mutable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does not have to be such anymore, leftover of one the previous versions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you still remove the mutable modifier, or did it turn out it was necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, just missed it in the first time.


private:
IsoTpSendRecv conn;
mutable IsoTpSendRecv conn;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this mutable too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because most of methods in the secondary interface are 'const' now and isotpsecondary uses IsoTpSendRecv non-const methods from within these const methods implementation.


extern "C" const char* ostree_deployment_get_csum(OstreeDeployment* ostree_deployment) {
return OstreeSecondaryUptaneVerificationTest::curOstreeRootfsRev(ostree_deployment);
}
Copy link
Collaborator

@pattivacek pattivacek Jan 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to this test suite? In the old version there were a bunch of non-OSTree-specific Uptane tests. Those still seem useful to me.

Update: oh wait, I think you just renamed this, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the total number of tests has actually increased, I just split the initial test file into two, one with all non-ostree tests and another with ostree specific.

bool AktualizrSecondary::sendFirmware(const std::string& firmware) {
// TODO: how to handle the case when secondary is rebooted after metadata are received
if (!pending_target_.IsValid()) {
LOG_ERROR << "No any pending target to receive update data/image for";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message is also a bit confusing. Maybe change to "Aborting image download; no valid target found."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@lgtm-com
Copy link

lgtm-com bot commented Jan 17, 2020

This pull request fixes 1 alert when merging 9223c90 into 6112216 - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

Mike Sul added 4 commits January 17, 2020 12:18
… for IP Secondary

Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
- Decouple the secondary interface implementation (aktualizr_secondary) from the TCP server
- Remove redundant wrappers over the aktualizr secondary class/interface

Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
- improve the TCP server implementation
- add tests for the TCP server and the RPC (serialization/deserialization)

Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
@mike-sul mike-sul force-pushed the feat/OTA-4174/ostree-update-on-IP-secondary branch from 9223c90 to 19527bc Compare January 17, 2020 10:34
@mike-sul
Copy link
Collaborator Author

@patrickvacek updated according to the comments

Mike Sul and others added 5 commits January 17, 2020 13:05
Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
…on both Primary and Secondary

Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
…xygen happy

Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
Also include the serial to make it somewhat more useful.

Signed-off-by: Patrick Vacek <patrickvacek@gmail.com>
@mike-sul mike-sul force-pushed the feat/OTA-4174/ostree-update-on-IP-secondary branch from 19527bc to ed9a0e3 Compare January 17, 2020 11:08
@lgtm-com
Copy link

lgtm-com bot commented Jan 17, 2020

This pull request fixes 1 alert when merging ed9a0e3 into 462fc83 - view on LGTM.com

fixed alerts:

  • 1 for FIXME comment

Copy link
Collaborator

@pattivacek pattivacek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for fixing all of these things!

Copy link
Contributor

@eu-siemann eu-siemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have time to review thoroughly so far but it looks much better than the previous PR and should it be easy now to revisit some parts later. Great job!

@pattivacek pattivacek merged commit da37d45 into master Jan 17, 2020
@pattivacek pattivacek deleted the feat/OTA-4174/ostree-update-on-IP-secondary branch January 17, 2020 13:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants