Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 146730 Details for
Bug 193543
'vgs' with options from 'pvs' treats arguments as PVs not VGs
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
attempt to fix
lvm2-pvs-vgs-args.patch (text/plain), 6.95 KB, created by
Milan Broz
on 2007-01-26 23:09:28 UTC
(
hide
)
Description:
attempt to fix
Filename:
MIME Type:
Creator:
Milan Broz
Created:
2007-01-26 23:09:28 UTC
Size:
6.95 KB
patch
obsolete
>Index: lvm2.up/tools/reporter.c >=================================================================== >--- lvm2.up.orig/tools/reporter.c 2007-01-24 17:01:09.000000000 +0100 >+++ lvm2.up/tools/reporter.c 2007-01-24 17:01:47.000000000 +0100 >@@ -146,6 +146,7 @@ static int _report(struct cmd_context *c > char *str; > const char *keys = NULL, *options = NULL, *separator; > int r = ECMD_PROCESSED; >+ report_type_t report_arg = report_type; > > int aligned, buffered, headings; > >@@ -272,6 +273,12 @@ static int _report(struct cmd_context *c > return 0; > } > >+ /* report_arg is original report_type */ >+ if (report_arg & PVSEGS) >+ report_arg = PVS; >+ else if (report_arg & SEGS) >+ report_arg = LVS; >+ > /* Change report type if fields specified makes this necessary */ > if (report_type & SEGS) > report_type = SEGS; >@@ -283,26 +290,37 @@ static int _report(struct cmd_context *c > report_type = PVS; > > switch (report_type) { >- case LVS: >- r = process_each_lv(cmd, argc, argv, LCK_VG_READ, report_handle, >- &_lvs_single); >+ /* PV */ >+ case PVS: >+ if (report_arg == VGS && argc) >+ r = process_each_pv_in_vgs(cmd, argc, argv, report_handle, >+ &_pvs_single); >+ else >+ r = process_each_pv(cmd, argc, argv, NULL, report_handle, >+ &_pvs_single); > break; >+ case PVSEGS: >+ if (report_arg == VGS && argc) >+ r = process_each_pv_in_vgs(cmd, argc, argv, report_handle, >+ &_pvsegs_single); >+ else >+ r = process_each_pv(cmd, argc, argv, NULL, report_handle, >+ &_pvsegs_single); >+ break; >+ /* VG */ > case VGS: > r = process_each_vg(cmd, argc, argv, LCK_VG_READ, 0, > report_handle, &_vgs_single); > break; >- case PVS: >- r = process_each_pv(cmd, argc, argv, NULL, report_handle, >- &_pvs_single); >+ /* LV */ >+ case LVS: >+ r = process_each_lv(cmd, argc, argv, LCK_VG_READ, report_handle, >+ &_lvs_single); > break; > case SEGS: > r = process_each_lv(cmd, argc, argv, LCK_VG_READ, report_handle, > &_lvsegs_single); > break; >- case PVSEGS: >- r = process_each_pv(cmd, argc, argv, NULL, report_handle, >- &_pvsegs_single); >- break; > } > > dm_report_output(report_handle); >Index: lvm2.up/tools/toollib.c >=================================================================== >--- lvm2.up.orig/tools/toollib.c 2007-01-24 17:01:09.000000000 +0100 >+++ lvm2.up/tools/toollib.c 2007-01-24 17:01:47.000000000 +0100 >@@ -489,6 +489,47 @@ static int _process_one_vg(struct cmd_co > return ret_max; > } > >+static int _arg_get_vg_list(struct cmd_context *cmd, int argc, char **argv, >+ struct list *arg_vgnames, struct list *tags) >+{ >+ int opt = 0; >+ const char *vg_name; >+ >+ log_verbose("Using volume group(s) on command line"); >+ >+ for (; opt < argc; opt++) { >+ vg_name = argv[opt]; >+ if (*vg_name == '@') { >+ if (!validate_name(vg_name + 1)) { >+ log_error("Skipping invalid tag %s", >+ vg_name); >+ continue; >+ } >+ if (!str_list_add(cmd->mem, tags, >+ dm_pool_strdup(cmd->mem, >+ vg_name + 1))) { >+ log_error("strlist allocation failed"); >+ return ECMD_FAILED; >+ } >+ continue; >+ } >+ vg_name = skip_dev_dir(cmd, vg_name); >+ >+ if (strchr(vg_name, '/')) { >+ log_error("Invalid volume group name: %s", >+ vg_name); >+ continue; >+ } >+ >+ if (!str_list_add(cmd->mem, arg_vgnames, >+ dm_pool_strdup(cmd->mem, vg_name))) { >+ log_error("strlist allocation failed"); >+ return ECMD_FAILED; >+ } >+ } >+ return 0; >+} >+ > int process_each_vg(struct cmd_context *cmd, int argc, char **argv, > int lock_type, int consistent, void *handle, > int (*process_single) (struct cmd_context * cmd, >@@ -496,7 +537,6 @@ int process_each_vg(struct cmd_context * > struct volume_group * vg, > int consistent, void *handle)) > { >- int opt = 0; > int ret_max = 0; > > struct str_list *sl; >@@ -508,41 +548,11 @@ int process_each_vg(struct cmd_context * > list_init(&tags); > list_init(&arg_vgnames); > >- if (argc) { >- log_verbose("Using volume group(s) on command line"); >- >- for (; opt < argc; opt++) { >- vg_name = argv[opt]; >- if (*vg_name == '@') { >- if (!validate_name(vg_name + 1)) { >- log_error("Skipping invalid tag %s", >- vg_name); >- continue; >- } >- if (!str_list_add(cmd->mem, &tags, >- dm_pool_strdup(cmd->mem, >- vg_name + 1))) { >- log_error("strlist allocation failed"); >- return ECMD_FAILED; >- } >- continue; >- } >- >- vg_name = skip_dev_dir(cmd, vg_name); >- if (strchr(vg_name, '/')) { >- log_error("Invalid volume group name: %s", >- vg_name); >- continue; >- } >- if (!str_list_add(cmd->mem, &arg_vgnames, >- dm_pool_strdup(cmd->mem, vg_name))) { >- log_error("strlist allocation failed"); >- return ECMD_FAILED; >- } >- } >+ if (argc) >+ if((ret_max = _arg_get_vg_list(cmd, argc, argv, &arg_vgnames, &tags))) >+ return ret_max; > >- vgnames = &arg_vgnames; >- } >+ vgnames = &arg_vgnames; > > if (!argc || !list_empty(&tags)) { > log_verbose("Finding all volume groups"); >@@ -757,6 +767,55 @@ int process_each_pv(struct cmd_context * > return ret_max; > } > >+int process_each_pv_in_vgs(struct cmd_context *cmd, int argc, char **argv, >+ void *handle, >+ int (*process_single) (struct cmd_context * cmd, >+ struct volume_group * vg, >+ struct physical_volume * pv, >+ void *handle)) >+{ >+ int ret = 0; >+ int ret_max = 0; >+ int consistent = 1; >+ struct list tags; >+ struct list arg_vgnames; >+ struct str_list *sl; >+ struct volume_group *vg; >+ >+ if (!argc) >+ return process_each_pv(cmd, argc, argv, NULL, handle, process_single); >+ >+ list_init(&tags); >+ list_init(&arg_vgnames); >+ >+ if((ret = _arg_get_vg_list(cmd, argc, argv, &arg_vgnames, &tags))) >+ return ret; >+ >+ list_iterate_items(sl, &arg_vgnames) { >+ if (!(vg = vg_read(cmd, sl->str, NULL, &consistent))) { >+ log_error("Volume group \"%s\" not found", sl->str); >+ ret_max = ECMD_FAILED; >+ continue; >+ } >+ if (!consistent) >+ continue; >+ >+ if ((vg->status & CLUSTERED) && >+ !locking_is_clustered() && >+ !lockingfailed()) { >+ log_error("Skipping clustered volume " >+ "group %s", sl->str); >+ continue; >+ } >+ >+ ret = process_each_pv_in_vg(cmd, vg, &tags, handle, process_single); >+ if (ret > ret_max) >+ ret_max = ret; >+ } >+ >+ return ret_max; >+} >+ > /* > * Determine volume group name from a logical volume name > */ >Index: lvm2.up/tools/toollib.h >=================================================================== >--- lvm2.up.orig/tools/toollib.h 2007-01-24 17:01:09.000000000 +0100 >+++ lvm2.up/tools/toollib.h 2007-01-24 17:01:47.000000000 +0100 >@@ -39,6 +39,12 @@ int process_each_pv(struct cmd_context * > struct volume_group * vg, > struct physical_volume * pv, > void *handle)); >+int process_each_pv_in_vgs(struct cmd_context *cmd, int argc, char **argv, >+ void *handle, >+ int (*process_single) (struct cmd_context * cmd, >+ struct volume_group * vg, >+ struct physical_volume * pv, >+ void *handle)); > int process_each_segment_in_pv(struct cmd_context *cmd, > struct volume_group *vg, > struct physical_volume *pv,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 193543
:
144217
|
146730