“c9ff52fb8a85599990620f7a5916c408a0f65fc5”上不存在“src/storage/storage_backend_logical.c”
storage_backend_logical.c 20.6 KB
Newer Older
1 2 3
/*
 * storage_backend_logvol.c: storage backend for logical volume handling
 *
4
 * Copyright (C) 2007-2009 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
 * Copyright (C) 2007-2008 Daniel P. Berrange
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 * Author: Daniel P. Berrange <berrange@redhat.com>
 */

#include <config.h>

#include <sys/wait.h>
#include <sys/stat.h>
#include <stdio.h>
#include <regex.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>

34
#include "virterror_internal.h"
35 36 37
#include "storage_backend_logical.h"
#include "storage_conf.h"
#include "util.h"
38
#include "memory.h"
39
#include "logging.h"
40

41 42
#define VIR_FROM_THIS VIR_FROM_STORAGE

43 44 45 46
#define PV_BLANK_SECTOR_SIZE 512


static int
47
virStorageBackendLogicalSetActive(virStoragePoolObjPtr pool,
48 49 50 51 52 53
                                  int on)
{
    const char *cmdargv[4];

    cmdargv[0] = VGCHANGE;
    cmdargv[1] = on ? "-ay" : "-an";
54
    cmdargv[2] = pool->def->source.name;
55 56
    cmdargv[3] = NULL;

57
    if (virRun(cmdargv, NULL) < 0)
58 59 60 61 62 63 64
        return -1;

    return 0;
}


static int
65
virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
                                char **const groups,
                                void *data)
{
    virStorageVolDefPtr vol = NULL;
    unsigned long long offset, size, length;

    /* See if we're only looking for a specific volume */
    if (data != NULL) {
        vol = data;
        if (STRNEQ(vol->name, groups[0]))
            return 0;
    }

    /* Or filling in more data on an existing volume */
    if (vol == NULL)
        vol = virStorageVolDefFindByName(pool, groups[0]);

    /* Or a completely new volume */
    if (vol == NULL) {
85
        if (VIR_ALLOC(vol) < 0) {
86
            virReportOOMError();
87 88 89
            return -1;
        }

90 91
        vol->type = VIR_STORAGE_VOL_BLOCK;

92
        if ((vol->name = strdup(groups[0])) == NULL) {
93
            virReportOOMError();
94
            virStorageVolDefFree(vol);
95 96 97
            return -1;
        }

98 99
        if (VIR_REALLOC_N(pool->volumes.objs,
                          pool->volumes.count + 1)) {
100
            virReportOOMError();
101 102 103 104
            virStorageVolDefFree(vol);
            return -1;
        }
        pool->volumes.objs[pool->volumes.count++] = vol;
105 106 107
    }

    if (vol->target.path == NULL) {
108 109
        if (virAsprintf(&vol->target.path, "%s/%s",
                        pool->def->target.path, vol->name) < 0) {
110
            virReportOOMError();
111 112 113 114 115 116 117 118
            virStorageVolDefFree(vol);
            return -1;
        }
    }

    if (groups[1] && !STREQ(groups[1], "")) {
        if (virAsprintf(&vol->backingStore.path, "%s/%s",
                        pool->def->target.path, groups[1]) < 0) {
119
            virReportOOMError();
120
            virStorageVolDefFree(vol);
121 122
            return -1;
        }
123 124

        vol->backingStore.format = VIR_STORAGE_POOL_LOGICAL_LVM2;
125 126 127
    }

    if (vol->key == NULL &&
128
        (vol->key = strdup(groups[2])) == NULL) {
129
        virReportOOMError();
130 131 132
        return -1;
    }

133
    if (virStorageBackendUpdateVolInfo(vol, 1) < 0)
134 135 136 137
        return -1;


    /* Finally fill in extents information */
138 139
    if (VIR_REALLOC_N(vol->source.extents,
                      vol->source.nextent + 1) < 0) {
140
        virReportOOMError();
141 142 143 144
        return -1;
    }

    if ((vol->source.extents[vol->source.nextent].path =
145
         strdup(groups[3])) == NULL) {
146
        virReportOOMError();
147 148 149
        return -1;
    }

150
    if (virStrToLong_ull(groups[4], NULL, 10, &offset) < 0) {
151
        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
J
Jim Meyering 已提交
152
                              "%s", _("malformed volume extent offset value"));
153 154
        return -1;
    }
155
    if (virStrToLong_ull(groups[5], NULL, 10, &length) < 0) {
156
        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
J
Jim Meyering 已提交
157
                              "%s", _("malformed volume extent length value"));
158 159
        return -1;
    }
160
    if (virStrToLong_ull(groups[6], NULL, 10, &size) < 0) {
161
        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
J
Jim Meyering 已提交
162
                              "%s", _("malformed volume extent size value"));
163 164 165 166 167 168 169 170 171 172 173
        return -1;
    }

    vol->source.extents[vol->source.nextent].start = offset * size;
    vol->source.extents[vol->source.nextent].end = (offset * size) + length;
    vol->source.nextent++;

    return 0;
}

static int
174
virStorageBackendLogicalFindLVs(virStoragePoolObjPtr pool,
175 176 177
                                virStorageVolDefPtr vol)
{
    /*
178 179 180 181 182 183
     *  # lvs --separator , --noheadings --units b --unbuffered --nosuffix --options "lv_name,origin,uuid,devices,seg_size,vg_extent_size" VGNAME
     *  RootLV,,06UgP5-2rhb-w3Bo-3mdR-WeoL-pytO-SAa2ky,/dev/hda2(0),5234491392,33554432
     *  SwapLV,,oHviCK-8Ik0-paqS-V20c-nkhY-Bm1e-zgzU0M,/dev/hda2(156),1040187392,33554432
     *  Test2,,3pg3he-mQsA-5Sui-h0i6-HNmc-Cz7W-QSndcR,/dev/hda2(219),1073741824,33554432
     *  Test3,,UB5hFw-kmlm-LSoX-EI1t-ioVd-h7GL-M0W8Ht,/dev/hda2(251),2181038080,33554432
     *  Test3,Test2,UB5hFw-kmlm-LSoX-EI1t-ioVd-h7GL-M0W8Ht,/dev/hda2(187),1040187392,33554432
184
     *
185
     * Pull out name, origin, & uuid, device, device extent start #, segment size, extent size.
186 187
     *
     * NB can be multiple rows per volume if they have many extents
188
     *
189 190 191 192
     * NB lvs from some distros (e.g. SLES10 SP2) outputs trailing "," on each line
     *
     * NB Encrypted logical volumes can print ':' in their name, so it is
     *    not a suitable separator (rhbz 470693).
193 194
     */
    const char *regexes[] = {
195
        "^\\s*(\\S+),(\\S*),(\\S+),(\\S+)\\((\\S+)\\),(\\S+),([0-9]+),?\\s*$"
196 197
    };
    int vars[] = {
198
        7
199 200
    };
    const char *prog[] = {
201
        LVS, "--separator", ",", "--noheadings", "--units", "b",
202
        "--unbuffered", "--nosuffix", "--options",
203
        "lv_name,origin,uuid,devices,seg_size,vg_extent_size",
204
        pool->def->source.name, NULL
205 206
    };

207 208
    int exitstatus;

209
    if (virStorageBackendRunProgRegex(pool,
210 211 212 213 214 215 216
                                      prog,
                                      1,
                                      regexes,
                                      vars,
                                      virStorageBackendLogicalMakeVol,
                                      vol,
                                      &exitstatus) < 0) {
217
        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
J
Jim Meyering 已提交
218
                              "%s", _("lvs command failed"));
219 220 221 222
                              return -1;
    }

    if (exitstatus != 0) {
223
        virStorageReportError(VIR_ERR_INTERNAL_ERROR,
224 225 226 227 228 229
                              _("lvs command failed with exitstatus %d"),
                              exitstatus);
        return -1;
    }

    return 0;
230 231 232
}

static int
233
virStorageBackendLogicalRefreshPoolFunc(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
234 235 236 237 238 239 240 241 242 243 244 245 246
                                        char **const groups,
                                        void *data ATTRIBUTE_UNUSED)
{
    if (virStrToLong_ull(groups[0], NULL, 10, &pool->def->capacity) < 0)
        return -1;
    if (virStrToLong_ull(groups[1], NULL, 10, &pool->def->available) < 0)
        return -1;
    pool->def->allocation = pool->def->capacity - pool->def->available;

    return 0;
}


247
static int
248
virStorageBackendLogicalFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
249 250 251
                                            char **const groups,
                                            void *data)
{
252 253 254 255 256 257 258 259 260 261 262
    virStoragePoolSourceListPtr sourceList = data;
    char *pvname = NULL;
    char *vgname = NULL;
    int i;
    virStoragePoolSourceDevicePtr dev;
    virStoragePoolSource *thisSource;

    pvname = strdup(groups[0]);
    vgname = strdup(groups[1]);

    if (pvname == NULL || vgname == NULL) {
263
        virReportOOMError();
264 265 266 267 268 269 270 271 272 273
        goto err_no_memory;
    }

    thisSource = NULL;
    for (i = 0 ; i < sourceList->nsources; i++) {
        if (STREQ(sourceList->sources[i].name, vgname)) {
            thisSource = &sourceList->sources[i];
            break;
        }
    }
274

275
    if (thisSource == NULL) {
276
        if (!(thisSource = virStoragePoolSourceListNewSource(sourceList)))
277 278 279
            goto err_no_memory;

        thisSource->name = vgname;
280
    }
281 282
    else
        VIR_FREE(vgname);
283

284
    if (VIR_REALLOC_N(thisSource->devices, thisSource->ndevice + 1) != 0) {
285
        virReportOOMError();
286
        goto err_no_memory;
287 288
    }

289 290
    dev = &thisSource->devices[thisSource->ndevice];
    thisSource->ndevice++;
291
    thisSource->format = VIR_STORAGE_POOL_LOGICAL_LVM2;
292 293 294

    memset(dev, 0, sizeof(*dev));
    dev->path = pvname;
295 296

    return 0;
297 298 299 300 301 302

 err_no_memory:
    VIR_FREE(pvname);
    VIR_FREE(vgname);

    return -1;
303 304 305
}

static char *
306
virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED,
307 308 309 310
                                        const char *srcSpec ATTRIBUTE_UNUSED,
                                        unsigned int flags ATTRIBUTE_UNUSED)
{
    /*
311 312 313
     * # pvs --noheadings -o pv_name,vg_name
     *   /dev/sdb
     *   /dev/sdc VolGroup00
314 315
     */
    const char *regexes[] = {
316
        "^\\s*(\\S+)\\s+(\\S+)\\s*$"
317 318
    };
    int vars[] = {
319
        2
320
    };
321
    const char *const prog[] = { PVS, "--noheadings", "-o", "pv_name,vg_name", NULL };
322
    const char *const scanprog[] = { VGSCAN, NULL };
323 324
    int exitstatus;
    char *retval = NULL;
325 326
    virStoragePoolSourceList sourceList;
    int i;
327

328 329 330 331 332
    /*
     * NOTE: ignoring errors here; this is just to "touch" any logical volumes
     * that might be hanging around, so if this fails for some reason, the
     * worst that happens is that scanning doesn't pick everything up
     */
333
    if (virRun(scanprog, &exitstatus) < 0) {
334 335
        VIR_WARN0("Failure when running vgscan to refresh physical volumes");
    }
336

337
    memset(&sourceList, 0, sizeof(sourceList));
338 339
    sourceList.type = VIR_STORAGE_POOL_LOGICAL;

340
    if (virStorageBackendRunProgRegex(NULL, prog, 1, regexes, vars,
341
                                      virStorageBackendLogicalFindPoolSourcesFunc,
342
                                      &sourceList, &exitstatus) < 0)
343 344
        return NULL;

345
    retval = virStoragePoolSourceListFormat(&sourceList);
346
    if (retval == NULL) {
347
        virStorageReportError(VIR_ERR_INTERNAL_ERROR, "%s",
348
                              _("failed to get source from sourceList"));
349 350 351 352
        goto cleanup;
    }

 cleanup:
353 354 355 356
    for (i = 0; i < sourceList.nsources; i++)
        virStoragePoolSourceFree(&sourceList.sources[i]);

    VIR_FREE(sourceList.sources);
357 358 359 360 361

    return retval;
}


362
static int
363
virStorageBackendLogicalStartPool(virConnectPtr conn ATTRIBUTE_UNUSED,
364 365
                                  virStoragePoolObjPtr pool)
{
366
    if (virStorageBackendLogicalSetActive(pool, 1) < 0)
367 368 369 370 371 372 373
        return -1;

    return 0;
}


static int
374
virStorageBackendLogicalBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
375 376 377 378 379 380 381 382 383 384
                                  virStoragePoolObjPtr pool,
                                  unsigned int flags ATTRIBUTE_UNUSED)
{
    const char **vgargv;
    const char *pvargv[3];
    int n = 0, i, fd;
    char zeros[PV_BLANK_SECTOR_SIZE];

    memset(zeros, 0, sizeof(zeros));

385
    if (VIR_ALLOC_N(vgargv, 3 + pool->def->source.ndevice) < 0) {
386
        virReportOOMError();
387 388 389 390
        return -1;
    }

    vgargv[n++] = VGCREATE;
391
    vgargv[n++] = pool->def->source.name;
392 393 394 395 396 397 398 399 400 401

    pvargv[0] = PVCREATE;
    pvargv[2] = NULL;
    for (i = 0 ; i < pool->def->source.ndevice ; i++) {
        /*
         * LVM requires that the first sector is blanked if using
         * a whole disk as a PV. So we just blank them out regardless
         * rather than trying to figure out if we're a disk or partition
         */
        if ((fd = open(pool->def->source.devices[i].path, O_WRONLY)) < 0) {
402
            virReportSystemError(errno,
403 404
                                 _("cannot open device '%s'"),
                                 pool->def->source.devices[i].path);
405 406
            goto cleanup;
        }
407
        if (safewrite(fd, zeros, sizeof(zeros)) < 0) {
408
            virReportSystemError(errno,
409 410
                                 _("cannot clear device header of '%s'"),
                                 pool->def->source.devices[i].path);
411 412 413 414
            close(fd);
            goto cleanup;
        }
        if (close(fd) < 0) {
415
            virReportSystemError(errno,
416 417
                                 _("cannot close device '%s'"),
                                 pool->def->source.devices[i].path);
418 419 420 421 422 423 424 425 426
            goto cleanup;
        }

        /*
         * Initialize the physical volume because vgcreate is not
         * clever enough todo this for us :-(
         */
        vgargv[n++] = pool->def->source.devices[i].path;
        pvargv[1] = pool->def->source.devices[i].path;
427
        if (virRun(pvargv, NULL) < 0)
428 429 430
            goto cleanup;
    }

431
    vgargv[n] = NULL;
432 433

    /* Now create the volume group itself */
434
    if (virRun(vgargv, NULL) < 0)
435 436
        goto cleanup;

437
    VIR_FREE(vgargv);
438 439 440 441

    return 0;

 cleanup:
442
    VIR_FREE(vgargv);
443 444 445 446 447
    return -1;
}


static int
448
virStorageBackendLogicalRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED,
449 450 451 452 453 454 455
                                    virStoragePoolObjPtr pool)
{
    /*
     *  # vgs --separator : --noheadings --units b --unbuffered --nosuffix --options "vg_size,vg_free" VGNAME
     *    10603200512:4328521728
     *
     * Pull out size & free
456 457
     *
     * NB vgs from some distros (e.g. SLES10 SP2) outputs trailing ":" on each line
458 459
     */
    const char *regexes[] = {
460
        "^\\s*(\\S+):([0-9]+):?\\s*$"
461 462 463 464 465 466 467
    };
    int vars[] = {
        2
    };
    const char *prog[] = {
        VGS, "--separator", ":", "--noheadings", "--units", "b", "--unbuffered",
        "--nosuffix", "--options", "vg_size,vg_free",
468
        pool->def->source.name, NULL
469
    };
470
    int exitstatus;
471

472
    virFileWaitForDevices();
473

474
    /* Get list of all logical volumes */
475
    if (virStorageBackendLogicalFindLVs(pool, NULL) < 0) {
476 477 478 479 480
        virStoragePoolObjClearVols(pool);
        return -1;
    }

    /* Now get basic volgrp metadata */
481
    if (virStorageBackendRunProgRegex(pool,
482 483 484 485 486
                                      prog,
                                      1,
                                      regexes,
                                      vars,
                                      virStorageBackendLogicalRefreshPoolFunc,
487 488 489 490 491 492 493
                                      NULL,
                                      &exitstatus) < 0) {
        virStoragePoolObjClearVols(pool);
        return -1;
    }

    if (exitstatus != 0) {
494 495 496 497 498 499 500
        virStoragePoolObjClearVols(pool);
        return -1;
    }

    return 0;
}

501 502 503 504
/*
 * This is actually relatively safe; if you happen to try to "stop" the
 * pool that your / is on, for instance, you will get failure like:
 * "Can't deactivate volume group "VolGroup00" with 3 open logical volume(s)"
505 506
 */
static int
507
virStorageBackendLogicalStopPool(virConnectPtr conn ATTRIBUTE_UNUSED,
508 509
                                 virStoragePoolObjPtr pool)
{
510
    if (virStorageBackendLogicalSetActive(pool, 0) < 0)
511 512 513 514 515 516
        return -1;

    return 0;
}

static int
517
virStorageBackendLogicalDeletePool(virConnectPtr conn ATTRIBUTE_UNUSED,
518 519 520 521
                                   virStoragePoolObjPtr pool,
                                   unsigned int flags ATTRIBUTE_UNUSED)
{
    const char *cmdargv[] = {
522
        VGREMOVE, "-f", pool->def->source.name, NULL
523
    };
524 525
    const char *pvargv[3];
    int i, error;
526

527
    /* first remove the volume group */
528
    if (virRun(cmdargv, NULL) < 0)
529 530
        return -1;

531 532 533 534 535 536
    /* now remove the pv devices and clear them out */
    error = 0;
    pvargv[0] = PVREMOVE;
    pvargv[2] = NULL;
    for (i = 0 ; i < pool->def->source.ndevice ; i++) {
        pvargv[1] = pool->def->source.devices[i].path;
537
        if (virRun(pvargv, NULL) < 0) {
538
            error = -1;
539
            virReportSystemError(errno,
540 541
                                 _("cannot remove PV device '%s'"),
                                 pool->def->source.devices[i].path);
542 543 544
            break;
        }
    }
545

546
    return error;
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561
}


static int
virStorageBackendLogicalDeleteVol(virConnectPtr conn,
                                  virStoragePoolObjPtr pool,
                                  virStorageVolDefPtr vol,
                                  unsigned int flags);


static int
virStorageBackendLogicalCreateVol(virConnectPtr conn,
                                  virStoragePoolObjPtr pool,
                                  virStorageVolDefPtr vol)
{
562
    int fdret, fd = -1;
563
    char size[100];
564
    const char *cmdargvnew[] = {
565 566 567
        LVCREATE, "--name", vol->name, "-L", size,
        pool->def->target.path, NULL
    };
568 569 570 571 572 573
    const char *cmdargvsnap[] = {
        LVCREATE, "--name", vol->name, "-L", size,
        "-s", vol->backingStore.path, NULL
    };
    const char **cmdargv = cmdargvnew;

574
    if (vol->target.encryption != NULL) {
575
        virStorageReportError(VIR_ERR_NO_SUPPORT,
576 577 578 579 580
                              "%s", _("storage pool does not support encrypted "
                                      "volumes"));
        return -1;
    }

581 582 583
    if (vol->backingStore.path) {
        cmdargv = cmdargvsnap;
    }
584 585 586 587

    snprintf(size, sizeof(size)-1, "%lluK", vol->capacity/1024);
    size[sizeof(size)-1] = '\0';

588 589
    vol->type = VIR_STORAGE_VOL_BLOCK;

590 591 592 593
    if (vol->target.path != NULL) {
        /* A target path passed to CreateVol has no meaning */
        VIR_FREE(vol->target.path);
    }
594 595 596 597

    if (virAsprintf(&vol->target.path, "%s/%s",
                    pool->def->target.path,
                    vol->name) == -1) {
598
        virReportOOMError();
599 600 601
        return -1;
    }

602
    if (virRun(cmdargv, NULL) < 0)
603 604
        return -1;

605
    if ((fdret = virStorageBackendVolOpen(vol->target.path)) < 0)
606
        goto cleanup;
607
    fd = fdret;
608 609 610 611

    /* We can only chown/grp if root */
    if (getuid() == 0) {
        if (fchown(fd, vol->target.perms.uid, vol->target.perms.gid) < 0) {
612
            virReportSystemError(errno,
613 614
                                 _("cannot set file owner '%s'"),
                                 vol->target.path);
615 616 617 618
            goto cleanup;
        }
    }
    if (fchmod(fd, vol->target.perms.mode) < 0) {
619
        virReportSystemError(errno,
620 621
                             _("cannot set file mode '%s'"),
                             vol->target.path);
622 623 624 625
        goto cleanup;
    }

    if (close(fd) < 0) {
626
        virReportSystemError(errno,
627 628
                             _("cannot close file '%s'"),
                             vol->target.path);
629 630 631 632 633
        goto cleanup;
    }
    fd = -1;

    /* Fill in data about this new vol */
634
    if (virStorageBackendLogicalFindLVs(pool, vol) < 0) {
635
        virReportSystemError(errno,
636 637
                             _("cannot find newly created volume '%s'"),
                             vol->target.path);
638 639 640 641 642 643 644 645 646 647 648 649
        goto cleanup;
    }

    return 0;

 cleanup:
    if (fd != -1)
        close(fd);
    virStorageBackendLogicalDeleteVol(conn, pool, vol, 0);
    return -1;
}

650 651
static int
virStorageBackendLogicalBuildVolFrom(virConnectPtr conn,
652
                                     virStoragePoolObjPtr pool,
653 654 655 656 657 658
                                     virStorageVolDefPtr vol,
                                     virStorageVolDefPtr inputvol,
                                     unsigned int flags)
{
    virStorageBackendBuildVolFrom build_func;

659
    build_func = virStorageBackendGetBuildVolFromFunction(vol, inputvol);
660 661 662
    if (!build_func)
        return -1;

663
    return build_func(conn, pool, vol, inputvol, flags);
664 665
}

666
static int
667
virStorageBackendLogicalDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
668 669 670 671 672 673 674 675
                                  virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
                                  virStorageVolDefPtr vol,
                                  unsigned int flags ATTRIBUTE_UNUSED)
{
    const char *cmdargv[] = {
        LVREMOVE, "-f", vol->target.path, NULL
    };

676
    if (virRun(cmdargv, NULL) < 0)
677 678 679 680 681 682 683 684 685
        return -1;

    return 0;
}


virStorageBackend virStorageBackendLogical = {
    .type = VIR_STORAGE_POOL_LOGICAL,

686
    .findPoolSources = virStorageBackendLogicalFindPoolSources,
687 688 689 690 691
    .startPool = virStorageBackendLogicalStartPool,
    .buildPool = virStorageBackendLogicalBuildPool,
    .refreshPool = virStorageBackendLogicalRefreshPool,
    .stopPool = virStorageBackendLogicalStopPool,
    .deletePool = virStorageBackendLogicalDeletePool,
692 693
    .buildVol = NULL,
    .buildVolFrom = virStorageBackendLogicalBuildVolFrom,
694 695 696
    .createVol = virStorageBackendLogicalCreateVol,
    .deleteVol = virStorageBackendLogicalDeleteVol,
};