Changeset 5b320ac in mainline for uspace/app


Ignore:
Timestamp:
2024-11-22T18:38:49Z (15 months ago)
Author:
Miroslav Cimerman <mc@…>
Children:
d0f0744
Parents:
06f2762
Message:

hr: hotspares + RAID1 rebuild

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/hrctl/hrctl.c

    r06f2762 r5b320ac  
    6969    "  -4                        parity on one extent\n"
    7070    "  -5                        distributed parity\n"
     71    "  -H, --hotspare=DEV        add hotspare extent\n"
    7172    "\n"
    7273    "When specifying name for creation or assembly, the device name\n"
     
    8081    "    - assembles RAID device named /hr0 consisting of 2 drives,\n"
    8182    "      that were previously in an array\n"
     83    "  hrctl devices/hr0 --hotspare=devices/disk10\n"
     84    "    - adds \"devices/disk10\" as hotspare extent\n"
    8285    "Limitations:\n"
    8386    "  - device name must be less than 32 characters in size\n";
     
    9396        { "destroy", required_argument, 0, 'D' },
    9497        { "fail-extent", required_argument, 0, 'F' },
     98        { "hotspare", required_argument, 0, 'H' },
    9599        { 0, 0, 0, 0 }
    96100};
     
    247251
    248252        while (c != -1) {
    249                 c = getopt_long(argc, argv, "hsC:c:A:a:l:0145Ln:D:F:",
     253                c = getopt_long(argc, argv, "hsC:c:A:a:l:0145Ln:D:F:H:",
    250254                    long_options, NULL);
    251255                switch (c) {
     
    345349                        }
    346350                        break;
     351                case 'H':
     352                        if (optind != 3 && argc != 4)
     353                                goto bad;
     354
     355                        service_id_t hotspare;
     356                        service_id_t vol_svc_id;
     357
     358                        rc = loc_service_get_id(argv[1], &vol_svc_id, 0);
     359                        if (rc != EOK) {
     360                                printf("hrctl: error resolving volume \"%s\", "
     361                                    "aborting extent addition\n", argv[1]);
     362                                goto bad;
     363                        }
     364
     365                        rc = loc_service_get_id(optarg, &hotspare, 0);
     366                        if (rc != EOK) {
     367                                printf("hrctl: error resolving device \"%s\", "
     368                                    "aborting extent addition\n", optarg);
     369                                goto bad;
     370                        }
     371
     372                        rc = hr_add_hotspare(vol_svc_id, hotspare);
     373                        if (rc != EOK)
     374                                printf("hrctl: hr_add_hotspare() rc: %s\n",
     375                                    str_error(rc));
     376
     377                        free(cfg);
     378                        if (rc != EOK)
     379                                return 1;
     380                        else
     381                                return 0;
    347382                }
    348383        }
Note: See TracChangeset for help on using the changeset viewer.