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 298754 Details for
Bug 247448
LVM2 allows final MDA to be removed from a VG
[?]
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]
create format instance for orphan volume groups
vg_read_orphans.patch (text/plain), 4.24 KB, created by
Bryn M. Reeves
on 2008-03-20 22:33:43 UTC
(
hide
)
Description:
create format instance for orphan volume groups
Filename:
MIME Type:
Creator:
Bryn M. Reeves
Created:
2008-03-20 22:33:43 UTC
Size:
4.24 KB
patch
obsolete
>Index: LVM2/lib/metadata/metadata.c >=================================================================== >--- LVM2.orig/lib/metadata/metadata.c >+++ LVM2/lib/metadata/metadata.c >@@ -714,7 +714,7 @@ int vg_split_mdas(struct cmd_context *cm > } > } > >- if (list_empty(mdas_from) || list_empty(mdas_to)) >+ if (list_empty(mdas_from) || (!is_orphan_vg(vg_to->name) && list_empty(mdas_to))) > return common_mda; > > return 1; >@@ -1339,13 +1339,12 @@ static struct volume_group *_vg_read_orp > { > struct lvmcache_vginfo *vginfo; > struct lvmcache_info *info; >+ struct format_type *fmt; >+ struct format_instance *fid; > struct pv_list *pvl; > struct volume_group *vg; > struct physical_volume *pv; > >- if (!(vginfo = vginfo_from_vgname(orphan_vgname, NULL))) >- return_NULL; >- > if (!(vg = dm_pool_zalloc(cmd->mem, sizeof(*vg)))) { > log_error("vg allocation failed"); > return NULL; >@@ -1359,6 +1358,22 @@ static struct volume_group *_vg_read_orp > return NULL; > } > >+ if (!(fmt = fmt_from_vgname(cmd, orphan_vgname, NULL))) { >+ log_error("Failed to determine format type for orphan PVs"); >+ return NULL; >+ } >+ >+ /* create format instance with appropriate metadata area */ >+ if (!(fid = fmt->ops->create_instance(fmt, orphan_vgname, NULL, NULL))) { >+ log_error("Failed to create format instance"); >+ return NULL; >+ } >+ >+ vg->fid = fid; >+ >+ if (!(vginfo = vginfo_from_vgname(orphan_vgname, NULL))) >+ goto out; >+ > list_iterate_items(info, &vginfo->infos) { > if (!(pv = _pv_read(cmd, dev_name(info->dev), NULL, NULL, 1))) { > continue; >@@ -1372,6 +1387,7 @@ static struct volume_group *_vg_read_orp > vg->pv_count++; > } > >+out: > return vg; > } > >@@ -1437,13 +1453,13 @@ static struct volume_group *_vg_read(str > > /* Find the vgname in the cache */ > /* If it's not there we must do full scan to be completely sure */ >- if (!(fmt = fmt_from_vgname(vgname, vgid))) { >+ if (!(fmt = fmt_from_vgname(cmd, vgname, vgid))) { > lvmcache_label_scan(cmd, 0); >- if (!(fmt = fmt_from_vgname(vgname, vgid))) { >+ if (!(fmt = fmt_from_vgname(cmd, vgname, vgid))) { > if (memlock()) > return_NULL; > lvmcache_label_scan(cmd, 2); >- if (!(fmt = fmt_from_vgname(vgname, vgid))) >+ if (!(fmt = fmt_from_vgname(cmd, vgname, vgid))) > return_NULL; > } > } >@@ -1511,7 +1527,7 @@ static struct volume_group *_vg_read(str > if (memlock()) > return_NULL; > lvmcache_label_scan(cmd, 2); >- if (!(fmt = fmt_from_vgname(vgname, vgid))) >+ if (!(fmt = fmt_from_vgname(cmd, vgname, vgid))) > return_NULL; > > if (precommitted && !(fmt->features & FMT_PRECOMMIT)) >Index: LVM2/lib/cache/lvmcache.c >=================================================================== >--- LVM2.orig/lib/cache/lvmcache.c >+++ LVM2/lib/cache/lvmcache.c >@@ -143,7 +143,19 @@ struct lvmcache_vginfo *vginfo_from_vgna > return vginfo; > } > >-const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid) >+static const struct format_type *_fmt_from_orphan_vgname(struct cmd_context *cmd, >+ const char *vgname) >+{ >+ struct format_type *fmt; >+ >+ list_iterate_items(fmt, &cmd->formats) { >+ if(!strncmp(vgname, fmt->orphan_vg_name, NAME_LEN)) >+ return fmt; >+ } >+ return NULL; >+} >+ >+const struct format_type *fmt_from_vgname(struct cmd_context *cmd, const char *vgname, const char *vgid) > { > struct lvmcache_vginfo *vginfo; > struct lvmcache_info *info; >@@ -153,6 +165,10 @@ const struct format_type *fmt_from_vgnam > struct device_list *devl; > char vgid_found[ID_LEN + 1] __attribute((aligned(8))); > >+ if (is_orphan_vg(vgname)) { >+ return _fmt_from_orphan_vgname(cmd, vgname); >+ } >+ > if (!(vginfo = vginfo_from_vgname(vgname, vgid))) > return NULL; > >Index: LVM2/lib/cache/lvmcache.h >=================================================================== >--- LVM2.orig/lib/cache/lvmcache.h >+++ LVM2/lib/cache/lvmcache.h >@@ -87,7 +87,7 @@ void lvmcache_lock_vgname(const char *vg > void lvmcache_unlock_vgname(const char *vgname); > > /* Queries */ >-const struct format_type *fmt_from_vgname(const char *vgname, const char *vgid); >+const struct format_type *fmt_from_vgname(struct cmd_context *cmd, const char *vgname, const char *vgid); > struct lvmcache_vginfo *vginfo_from_vgname(const char *vgname, > const char *vgid); > struct lvmcache_vginfo *vginfo_from_vgid(const char *vgid);
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 247448
:
158763
| 298754 |
298755