LCOV - code coverage report
Current view: top level - misc/kabi/lvm2.git/tools - vgexport.c (source / functions) Hit Total Coverage
Test: unnamed Lines: 0 24 0.0 %
Date: 2010-04-13 Functions: 0 2 0.0 %
Branches: 0 18 0.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
       3                 :            :  * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
       4                 :            :  *
       5                 :            :  * This file is part of LVM2.
       6                 :            :  *
       7                 :            :  * This copyrighted material is made available to anyone wishing to use,
       8                 :            :  * modify, copy, or redistribute it subject to the terms and conditions
       9                 :            :  * of the GNU Lesser General Public License v.2.1.
      10                 :            :  *
      11                 :            :  * You should have received a copy of the GNU Lesser General Public License
      12                 :            :  * along with this program; if not, write to the Free Software Foundation,
      13                 :            :  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      14                 :            :  */
      15                 :            : 
      16                 :            : #include "tools.h"
      17                 :            : 
      18                 :          0 : static int vgexport_single(struct cmd_context *cmd __attribute((unused)),
      19                 :            :                            const char *vg_name,
      20                 :            :                            struct volume_group *vg,
      21                 :            :                            void *handle __attribute((unused)))
      22                 :            : {
      23                 :            :         struct pv_list *pvl;
      24                 :            :         struct physical_volume *pv;
      25                 :            : 
      26         [ #  # ]:          0 :         if (lvs_in_vg_activated(vg)) {
      27                 :          0 :                 log_error("Volume group \"%s\" has active logical volumes",
      28                 :            :                           vg_name);
      29                 :          0 :                 goto bad;
      30                 :            :         }
      31                 :            : 
      32         [ #  # ]:          0 :         if (!archive(vg))
      33                 :          0 :                 goto_bad;
      34                 :            : 
      35                 :          0 :         vg->status |= EXPORTED_VG;
      36                 :            : 
      37         [ #  # ]:          0 :         dm_list_iterate_items(pvl, &vg->pvs) {
      38                 :          0 :                 pv = pvl->pv;
      39                 :          0 :                 pv->status |= EXPORTED_VG;
      40                 :            :         }
      41                 :            : 
      42 [ #  # ][ #  # ]:          0 :         if (!vg_write(vg) || !vg_commit(vg))
      43                 :          0 :                 goto_bad;
      44                 :            : 
      45                 :          0 :         backup(vg);
      46                 :            : 
      47                 :          0 :         log_print("Volume group \"%s\" successfully exported", vg->name);
      48                 :            : 
      49                 :          0 :         return ECMD_PROCESSED;
      50                 :            : 
      51                 :            : bad:
      52                 :          0 :         return ECMD_FAILED;
      53                 :            : }
      54                 :            : 
      55                 :          0 : int vgexport(struct cmd_context *cmd, int argc, char **argv)
      56                 :            : {
      57 [ #  # ][ #  # ]:          0 :         if (!argc && !arg_count(cmd, all_ARG)) {
      58                 :          0 :                 log_error("Please supply volume groups or use -a for all.");
      59                 :          0 :                 return ECMD_FAILED;
      60                 :            :         }
      61                 :            : 
      62 [ #  # ][ #  # ]:          0 :         if (argc && arg_count(cmd, all_ARG)) {
      63                 :          0 :                 log_error("No arguments permitted when using -a for all.");
      64                 :          0 :                 return ECMD_FAILED;
      65                 :            :         }
      66                 :            : 
      67                 :          0 :         return process_each_vg(cmd, argc, argv, READ_FOR_UPDATE, NULL,
      68                 :            :                                &vgexport_single);
      69                 :            : }

Generated by: LCOV version 1.8