Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: split slot mount helper as a standalone module, refactor to make the mount/umount more robust #417

Merged
merged 12 commits into from
Nov 11, 2024

Conversation

Bodong-Yang
Copy link
Member

@Bodong-Yang Bodong-Yang commented Nov 11, 2024

Introduction

This PR implements the robust mount/umount for SlotMountHelper. Now otaclient will try its best to ensure the mount point is clear(no other mounts on it) before mount, and for standby slot mount, also ensure the standby slot dev is not mounted before mounting. The failure reason for the mount failure will also be logged.

Tests

  • OTA works when the active_slot and/or standby slot mount points are both already mounted.
  • OTA works when the standby slot dev is already mounted(at multiple places).
  • OTA works when the /run/otaclient/mnt is removed.
  • normal OTA works.

@Bodong-Yang Bodong-Yang added the refactor Rewrite/remove related code instead of patching them label Nov 11, 2024
Copy link
Contributor

github-actions bot commented Nov 11, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/ota_metadata/legacy
   __init__.py10100% 
   parser.py3264386%100, 156, 161, 197–198, 208–209, 212, 224, 277–279, 283–286, 320–323, 392, 395, 403–405, 418, 427–428, 431–432, 597–599, 649–650, 653, 681–683, 737, 740–742
   types.py841384%37, 40–42, 112–116, 122–125
src/ota_metadata/utils
   cert_store.py420100% 
src/ota_proxy
   __init__.py361072%59, 61, 63, 72, 81–82, 102, 104–106
   __main__.py770%16–18, 20, 22–23, 25
   _consts.py150100% 
   cache_control_header.py68494%71, 91, 113, 121
   cache_streaming.py1422284%154–156, 184–186, 211, 225, 229–230, 265–266, 268, 280, 348, 354–355, 358, 366–369
   config.py170100% 
   db.py731875%109, 115, 153, 159–160, 163, 169, 171, 192–199, 201–202
   errors.py50100% 
   lru_cache_helper.py47295%84–85
   ota_cache.py2155972%70–71, 140, 151–152, 184–185, 202, 239–243, 247–249, 251, 253–260, 262–264, 267–268, 272–273, 277, 324, 332–334, 413–416, 430, 433–434, 448–449, 451–453, 457–458, 464–465, 496, 502, 529, 581–583
   server_app.py1393971%76, 79, 85, 101, 103, 162, 171, 213–214, 216–218, 221, 226–228, 231–232, 235, 238, 241, 244, 257–258, 261–262, 264, 267, 293–296, 299, 313–315, 321–323
   utils.py140100% 
src/otaclient
   __init__.py5260%17, 19
   __main__.py110%16
   _types.py740100% 
   errors.py1210100% 
   log_setting.py51590%52, 54, 63–65
   status_monitor.py1581391%46, 48–49, 134–135, 154, 157, 174, 177, 193–194, 201, 204
   utils.py170100% 
src/otaclient/app
   __main__.py110%16
   interface.py30100% 
   main.py44588%48–49, 71–73
   ota_client.py38611370%85, 93, 114, 141, 143–144, 146, 150, 154–155, 160–161, 167, 169, 210–213, 219, 223, 229, 348, 360–361, 363, 372, 375, 380–381, 384, 390, 392–396, 415–418, 421–428, 456–459, 512–513, 517, 519–520, 550–551, 560–567, 574, 577–583, 631–633, 635, 637–640, 648, 663, 692–694, 699–701, 704–705, 707–708, 710, 768–769, 772, 780–781, 784, 795–796, 799, 807–808, 811, 822, 841, 868, 887, 905
   update_stats.py104991%57, 103, 105, 114, 116, 125, 127, 148, 179
src/otaclient/boot_control
   __init__.py40100% 
   _common.py2199058%69–70, 91–93, 109–110, 130–131, 150–151, 171–178, 197–198, 220–222, 237–238, 262–268, 289, 297, 315, 323, 342–343, 346–347, 370, 372–381, 383–392, 394–396, 415, 418, 426, 434, 450–452, 454–460, 553, 558, 563, 676, 680–681, 684, 691, 693–694, 709
   _firmware_package.py932276%82, 86, 136, 180, 186, 209–210, 213–218, 220–221, 224–229, 231
   _grub.py42013667%217, 265–268, 274–278, 315–316, 323–328, 331–337, 340, 343–344, 349, 351–353, 362–368, 370–371, 373–375, 384–386, 388–390, 469–470, 474–475, 527, 533, 559, 581, 585–586, 601–603, 629–632, 644, 648–650, 652–654, 700–703, 705, 708–709, 712–716, 741–744, 767–770, 782–783, 786–787, 822, 828, 848–849, 851, 863, 866, 869, 872, 876–878, 896–899, 927–930, 935–943, 948–956
   _jetson_cboot.py2642640%20, 22–25, 27–28, 34–40, 42–43, 59–60, 62, 64–65, 71, 75, 134, 137, 139–140, 143, 150–151, 159–160, 163, 169–170, 178, 187–191, 193, 199, 202–203, 209, 212–213, 218–219, 221, 227–228, 231–232, 235–237, 239, 245, 250–252, 254–256, 261, 263–266, 268–269, 278–279, 282–283, 288–289, 292–296, 299–300, 305–306, 309, 312–316, 321–324, 327, 330–331, 334, 337–338, 341, 345–350, 354–355, 359, 362–363, 366, 369–372, 374, 377–378, 382, 385, 388–391, 393, 400, 404–405, 408–409, 415–416, 422, 424–425, 429, 431, 433–435, 438, 442, 445, 448–449, 451, 454, 462–463, 470, 480, 483, 491–492, 497–500, 502, 509, 511–513, 519–520, 524–525, 528, 532, 535, 537, 544–548, 550, 562–565, 568, 571, 573, 580, 584–585, 587–588, 590–592, 594, 596, 599, 602, 605, 607–608, 611–615, 619–621, 623, 631–635, 637, 640, 644, 647, 658–659, 664, 674, 677–685, 689–698, 702–711, 715, 717–719, 721–722, 724–725
   _jetson_common.py1734573%133, 141, 289–292, 295, 312, 320, 355, 360–365, 383, 409–410, 412–414, 418–421, 423–424, 426–430, 432, 439–440, 443–444, 454, 457–458, 461, 463, 507–508
   _jetson_uefi.py39927132%124–126, 131–132, 151–153, 158–161, 328, 446, 448–451, 455, 459–460, 462–470, 472, 484–485, 488–489, 492–493, 496–498, 502–503, 508–510, 514, 518–519, 522–523, 526–527, 531, 534–535, 537, 542–543, 547, 550–551, 556, 560–561, 564, 568–570, 572, 576–579, 581–582, 604–605, 609–610, 612, 616, 620–621, 624–625, 632, 635–637, 640, 642–643, 648–649, 652–655, 657–658, 663, 665–666, 674, 677–680, 682–683, 685, 689–690, 694, 702–706, 709–710, 712, 715–719, 722, 725–729, 733–734, 737–742, 745–746, 749–752, 754–755, 762–763, 773–776, 779, 782–785, 788–792, 795–796, 799, 802–805, 808, 810, 815–816, 819, 822–825, 827, 833, 838–839, 858–859, 862, 870–871, 878, 888, 891, 898–899, 904–907, 915–918, 926–927, 939–942, 944, 947, 950, 958, 969–971, 973–975, 977–981, 986–987, 989, 1002, 1006, 1009, 1019, 1024, 1032–1033, 1036, 1040, 1042–1044, 1050–1051, 1056, 1064–1071, 1076–1084, 1089–1097, 1103–1105
   _rpi_boot.py28913453%55, 58, 122–123, 127, 135–138, 152–155, 162–163, 165–166, 171–172, 175–176, 185–186, 226, 232–236, 239, 257–259, 263–265, 270–272, 276–278, 288–289, 292, 295, 297–298, 300–301, 303–305, 311, 314–315, 325–328, 336–340, 342, 344–345, 350–351, 358, 361–366, 397, 399–402, 412–415, 419–420, 422–426, 454–457, 476–479, 484, 487, 505–508, 513–521, 526–534, 551–554, 560–562, 565, 568
   _slot_mnt_helper.py130100% 
   configs.py510100% 
   protocol.py40100% 
   selecter.py412929%45–47, 50–51, 55–56, 59–61, 64, 66, 70, 78–80, 82–83, 85–86, 90, 92, 94–95, 97, 99–100, 102, 104
src/otaclient/configs
   __init__.py170100% 
   _cfg_configurable.py490100% 
   _cfg_consts.py47197%97
   _common.py80100% 
   _ecu_info.py56394%59, 64–65
   _proxy_info.py51296%88, 90
   cfg.py190100% 
src/otaclient/create_standby
   __init__.py13561%30–32, 34, 36
   common.py2244480%62, 65–66, 70–72, 74, 78–79, 81, 129, 177–179, 181–183, 185, 188–191, 195, 206, 280–281, 283–288, 300, 337, 365, 368–370, 386–387, 401, 405, 427–428
   interface.py50100% 
   rebuild_mode.py98990%95–97, 109–114
src/otaclient/grpc
   _otaproxy_ctx.py1175156%68–70, 72–73, 81–84, 87–89, 93, 98–99, 101–102, 105, 107–108, 111–113, 116–117, 120–122, 127–132, 136, 139–143, 145–146, 154–156, 159, 196–198, 203, 239
src/otaclient/grpc/api_v2
   ecu_status.py1511292%73, 76, 79, 145, 169, 171, 195, 241, 298, 368–369, 408
   ecu_tracker.py321843%40–42, 48–51, 55–57, 64–66, 69, 73–76
   servicer.py1182876%88, 177–179, 186, 216–217, 220–224, 233–242, 249, 255, 258–259, 263, 266
   types.py44440%17, 19, 21–23, 26, 33–37, 39, 42, 45, 48, 51–52, 61, 67, 70–71, 73–76, 78–79, 82–88, 91–97, 100, 102–103
src/otaclient_api/v2
   api_caller.py39684%45–47, 83–85
   api_stub.py170100% 
   types.py2562391%86, 89–92, 131, 209–210, 212, 259, 262–263, 506–508, 512–513, 515, 518–519, 522–523, 586
src/otaclient_common
   __init__.py341555%42–44, 61, 63, 68–77
   _io.py64198%41
   common.py1061189%44, 148, 151–153, 168, 175–177, 271, 275
   downloader.py1991094%107–108, 126, 153, 369, 424, 428, 516–517, 526
   linux.py611575%51–53, 59, 69, 74, 76, 108–109, 133–134, 190, 195–196, 198
   logging.py29196%55
   persist_file_handling.py1181884%113, 118, 150–152, 163, 192–193, 228–232, 242–244, 246–247
   proto_streamer.py42880%33, 48, 66–67, 72, 81–82, 100
   proto_wrapper.py3984887%87, 165, 172, 184–186, 205, 210, 221, 257, 263, 268, 299, 303, 307, 402, 462, 469, 472, 492, 499, 501, 526, 532, 535, 537, 562, 568, 571, 573, 605, 609, 611, 625, 642, 669, 672, 676, 707, 713, 760–763, 765, 803–805
   retry_task_map.py105595%158–159, 161, 181–182
   typing.py31487%48, 97–98, 100
TOTAL6714173974% 

Tests Skipped Failures Errors Time
241 0 💤 0 ❌ 0 🔥 14m 12s ⏱️

Copy link

@Bodong-Yang Bodong-Yang marked this pull request as ready for review November 11, 2024 12:48
@Bodong-Yang Bodong-Yang merged commit ab667c6 into main Nov 11, 2024
7 checks passed
@Bodong-Yang Bodong-Yang deleted the refactor/refine_slotmnt_helper branch November 11, 2024 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Rewrite/remove related code instead of patching them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant