summaryrefslogtreecommitdiffstats
path: root/lib/format_text
Commit message (Collapse)AuthorAgeFilesLines
* cleanup: drop unneeded included header filesZdenek Kabelac2012-08-235-8/+0
| | | | | This headers were not resolving anything used for compiled .c files. Remove unused util.c file.
* cleanup: replace memset with struct initilizationZdenek Kabelac2012-06-221-2/+1
| | | | | Simplifies the code, properly detects too long socket paths, drops unused parameter.
* Fix division by zero if PV with zero PE count is used during vgcfgrestore.Peter Rajnoha2012-05-091-1/+1
|
* Check if info struct returned is not NULL.Peter Rajnoha2012-04-101-0/+3
| | | | Just some missing checks revealed by Coverity in recent code.
* Pass struct device around internally rather than dev_t.Alasdair Kergon2012-03-021-1/+1
| | | | | | | Add 3rd daemon return state "unknown" for lookups that are carried out successfully but don't find the item requested. Avoid issuing error messages when it's expected that a device that's being looked up in lvmetad might not be there.
* Change pvscan --lvmetad to pvscan --cache.Alasdair Kergon2012-03-021-1/+1
|
* Pass 'single_device' parameter down to suppress 'Can't find uuid' messagesAlasdair Kergon2012-02-294-10/+15
| | | | | | when reading VG text metadate and called from pvscan --lvmetad. (Longer-term, that check needs moving outside of that code.)
* Add some stack traces for dev_close error pathsZdenek Kabelac2012-02-281-2/+4
|
* Just code move of hash initialization in front of functionZdenek Kabelac2012-02-271-18/+18
| | | | | | | Make sure both hash tables are initialized before _read_sections() call. Presents no functional change (since PV scan phase was not adding LV hashes), but makes the code easier to handle mem failing case, and static analyzer is hapier as well.
* Add stack traces for lock_vol failuresZdenek Kabelac2012-02-271-1/+2
| | | | | | | | Adding at least stack traces with some FIXMEs for cases, where we might want to do something cleaver - maybe fail command or give user hints something is not going well ? For remote_backup is stack probably 'good' enough for now.
* Remove test for pvidZdenek Kabelac2012-02-271-1/+0
| | | | | Since pvid is char buffer[] and not pointer, there is no point to check it for NULL.
* Some reformating for lvmetad uddatesZdenek Kabelac2012-02-231-5/+14
| | | | | | | cleanup gcc warning, use PRIu64 header cleanups const pointer fixes.
* The lvmetad client-side integration. Only active when use_lvmetad = 1 is set inPetr Rockai2012-02-234-12/+73
| | | | lvm.conf *and* lvmetad is running.
* Add check for mda_copy failureZdenek Kabelac2012-02-131-1/+2
|
* Add free_orphan_vgZdenek Kabelac2012-02-131-7/+2
| | | | | | | Move commod code to destroy orphan VG into free_orphan_vg() function. Use orphan vgmem for creation of PV lists. Remove some free_pv_fid() calls (FIXME: check all of them) FIXME: Check whether we could merge release_vg back again for all VGs.
* Clean error paths for format instanceZdenek Kabelac2012-02-131-18/+15
| | | | | With updated orphan VG code this code needed some updates. Add missing log_error for allocation failures.
* FMT_INSTANCE_VG is redundant nowAlasdair Kergon2012-02-123-15/+8
|
* Keep a global (per-format) orphan_vg and keep any and all orphan PVs linked toPetr Rockai2012-02-101-23/+40
| | | | | it. Avoids the need for FMT_INSTANCE_PV and enables further simplifications. No functional change, internal refactor only.
* Move lvmcache data structures behind an API (making the structures private toPetr Rockai2012-02-105-217/+181
| | | | lvmcache.c). No functional change.
* Use dm_snprintf and improve error handlingZdenek Kabelac2012-02-081-6/+9
| | | | | | Add standard error reporting with error logging. Use plain alloc instead of zalloc for string buffer. Use dm_snprintf with valid test for <0.
* Fix resource leaks for failing allocationZdenek Kabelac2012-02-081-7/+5
| | | | | In case, something would fail during format initialization, return allocated memory.
* Instrument code that pointer are already releasedZdenek Kabelac2012-01-251-2/+6
| | | | Set pointers to NULL since on the function exit they are no longer valid.
* Check for correctness of uint64 value if existsZdenek Kabelac2012-01-251-1/+5
|
* Thin until proper vgcfgrestore for thin is implementad, disable restore.Zdenek Kabelac2012-01-201-0/+12
| | | | | Since it may probably do more harm to leave it enabled - add extra test for presence of thin volumes in VG, and in this case disable restore.
* Add support to keep info about creation time and host for each LVZdenek Kabelac2012-01-192-1/+41
| | | | | | | | Basic support to keep info when the LV was created. Host and time is stored into LV mda section. FIXME: Current version doesn't support configurable string via lvm.conf and used fixed version strftime "%Y-%m-%d %T %z".
* Rename internal macro to match signessZdenek Kabelac2012-01-191-3/+3
| | | | | Since _read_int64 called dm_config_get_uint64, rename it to less confusing _read_uint64.
* Allow empty strings for description and creation_host config fieldsZdenek Kabelac2011-12-211-2/+2
|
* Make a cleaner split between config tree and config file functionality. MovePetr Rockai2011-12-181-10/+10
| | | | the latter out of libdm.
* Support the ability to replace specific devices in a RAID array.Jonathan Earl Brassow2011-11-301-0/+1
| | | | | | | | | | | | | | | | | RAID is not like traditional LVM mirroring. LVM mirroring required failed devices to be removed or the logical volume would simply hang. RAID arrays can keep on running with failed devices. In fact, for RAID types other than RAID1, removing a device would mean substituting an error target or converting to a lower level RAID (e.g. RAID6 -> RAID5, or RAID4/5 to RAID0). Therefore, rather than removing a failed device unconditionally and potentially allocating a replacement, RAID allows the user to "replace" a device with a new one. This approach is a 1-step solution vs the current 2-step solution. example> lvconvert --replace <dev_to_remove> vg/lv [possible_replacement_PVs] '--replace' can be specified more than once. example> lvconvert --replace /dev/sdb1 --replace /dev/sdc1 vg/lv
* Replace dynamic buffer allocations for PATH_MAXZdenek Kabelac2011-11-181-1/+1
| | | | | | | | | | Use static buffer instead of stack allocated buffer. This reduces stack size usage of lvm tool and the change is very simple. Since the whole library is not thread safe - it should not add any new problems - and if there will be some conversion it's easy to convert this to use some preallocated buffer.
* Avoid 'mda inconsistency' by properly registering UNLABELLED_PV flag (2.02.86).Peter Rajnoha2011-11-151-0/+1
| | | | | | | | | | | | | | | | When a PV label write is deferred to a vg_write call (as introduced by a patch in 2.02.86), the PV is flagged with the internal UNLABELLED_PV flag. However, when calling vg_archive before vg_write, we still have the PV labelled with the UNLABELLED_PV flag which was not recognised as a proper flag while exporting VG metadata: # vgcreate vg /dev/sda No physical volume label read from /dev/sda Metadata inconsistency: Not all flags successfully exported. Metadata inconsistency: Not all flags successfully exported. Writing physical volume data to disk "/dev/sda" Physical volume "/dev/sda" successfully created Volume group "vg" successfully created
* Drop mempool parameter from read functionsZdenek Kabelac2011-10-231-19/+17
| | | | Use implicit vgmem pool.
* Always use vg memory pool for allocated lv segmentZdenek Kabelac2011-10-231-1/+1
| | | | | Remove mem pool parameter from alloc_lv_segment() Since we should always allocate LV segment from the vg mempool.
* lvcreate/remove thin_pool and thin volumes (--driverloaded n only)Alasdair Kergon2011-09-081-0/+4
|
* lvcreate parsing for thin provisioning.Alasdair Kergon2011-09-061-1/+1
| | | | The rest is incomplete so this isn't usable yet.
* Use size_t return typeZdenek Kabelac2011-09-012-4/+4
| | | | Since these function returns buffer size - use size_t type for them.
* Replace const usage of dm_config_find_node with more appropriate value-lookupPetr Rockai2011-08-312-62/+38
| | | | | | | | | | | | | functionality. A number of bugs (copied and pasted all over the code) should disappear: - most string lookup based on dm_config_find_node would segfault when encountering a non-zero integer (the intention there was to print an error message instead) - check for required sections in metadata would have been satisfied by values as well (i.e. not sections) - encountering a section in place of expected flag value would have segfaulted (due to assumed but unchecked cn->v != NULL)
* Move the core of the lib/config/config.c functionality into libdevmapper,Petr Rockai2011-08-309-96/+96
| | | | | | | leaving behind the LVM-specific parts of the code (convenience wrappers that handle `struct device` and `struct cmd_context`, basically). A number of functions have been renamed (in addition to getting a dm_ prefix) -- namely, all of the config interface now has a dm_config_ prefix.
* Directly allocate buffer memory in a pvck scan instead of using a mempool.Peter Rajnoha2011-08-291-3/+3
| | | | | | | | | | | | | | There's a very high memory usage when calling _pv_analyse_mda_raw (e.g. while executing pvck) that can end up with "out of memory". _pv_analyse_mda_raw scans for metadata in the MDA, iteratively increasing the size to scan with SECTOR_SIZE until we find a probable config section or we're at the edge of the metadata area. However, when using a memory pool, we're also iteratively chasing for bigger and bigger mempool chunk which can't be found and so we're always allocating a new one, consuming more and more memory... This patch just changes the mempool to direct memory allocation in this problematic part of the code.
* Replace free_vg with release_vgZdenek Kabelac2011-08-104-7/+7
| | | | | | | | Move the free_vg() to vg.c and replace free_vg with release_vg and make the _free_vg internal. Patch is needed for sharing VG in vginfo cache so the release_vg function name is a better fit here.
* Add basic RAID segment type(s) support.Jonathan Earl Brassow2011-08-023-4/+25
| | | | | | | | | | | | | Implementation described in doc/lvm2-raid.txt. Basic support includes: - ability to create RAID 1/4/5/6 arrays - ability to delete RAID arrays - ability to display RAID arrays Notable missing features (not included in this patch): - ability to clean-up/repair failures - ability to convert RAID segment types - ability to monitor RAID segment types
* Code move of vg_mark_partial() up in stackZdenek Kabelac2011-06-171-0/+7
| | | | | | | | | | | | It's useful to keep the partial flag cached - so just move the call for vg_mark_partil_lvs() into import_vg_from_config_tree() so it gets evaluated before it goes through the lvmcache. This patch should not present any functional change. Note: It is rather temporal solution - proper place is probably inside the 'read' call back - but needs some more discussion. For now using this minor hack.
* Remove unused internal flag ACTIVATE_EXCL from the codeZdenek Kabelac2011-06-171-1/+0
|
* Fix RHBZ 651590 (failure to lock LV results in failure to repair mirror afterPetr Rockai2011-06-151-1/+8
| | | | | | | | | | | | | | | | | | transient error), stemming from the following sequence of events: 1) devices fail IO, triggering repair 2) dmeventd starts fixing up the mirror 3) during the downconversion, a new metadata version is written --> the devices come back online here 4) the mirror device suspend/resume is called to update DM tables 5) during the suspend/resume cycle, *pre*-commit metadata is read; however, since the failed devices are now back online, we get back inconsistent set of precommit metadata and the whole operation fails The patch relaxes the check that fails in step 5 above, namely by ignoring inconsistencies coming from PVs that are marked MISSING.
* Defer writing PV labels to vg_write.Alasdair Kergon2011-06-012-31/+9
| | | | Store label_sector only in struct physical_volume.
* Use new dev_open_readonly fn to prevent opening devices for read-write when ↵Peter Rajnoha2011-05-282-6/+6
| | | | | | | | | | | | | | | | | | | not necessary. Before, we used vg_write_lock_held call to determnine the way a device is opened. Unfortunately, this opened many devices in RW mode when it was not really necessary. With the OPTIONS+="watch" rule used in the udev rules, this could fire numerous events while closing such devices (and it caused useless scans from within udev rules in return). A common bug we hit with this was with the lvremove command which was unable to remove the LV since it was being opened from within the udev rules. This patch should minimize such situations (at least with respect to LVM handling of devices). Though there's still a possibility someone will open a device 'outside' in parallel and fire the event based on the watch rule when closing a device once opened for RW.
* test update without WHATS_NEW to check it gives warning nowAlasdair Kergon2011-04-291-1/+1
|
* Fix use of released vgname and vgidZdenek Kabelac2011-04-211-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoid using of already released memory when duplicated MDA is found. As get_pv_from_vg_by_id() may call lvmcache_label_scan() use the local copy of the vgname and vgid on the stack as vginfo may dissapear and code was then accessing garbage in memory. i.e. pvs /dev/loop0 (when /dev/loop0 and /dev/loop1 has same MDA content) Invalid read of size 1 at 0x523C986: dm_hash_lookup (hash.c:325) by 0x440C8C: vginfo_from_vgname (lvmcache.c:399) by 0x4605C0: _create_vg_text_instance (format-text.c:1882) by 0x46140D: _text_create_text_instance (format-text.c:2243) by 0x47EB49: _vg_read (metadata.c:2887) by 0x47FBD8: vg_read_internal (metadata.c:3231) by 0x477594: get_pv_from_vg_by_id (metadata.c:344) by 0x45F07A: _get_pv_if_in_vg (format-text.c:1400) by 0x45F0B9: _populate_pv_fields (format-text.c:1414) by 0x45F40F: _text_pv_read (format-text.c:1493) by 0x480431: _pv_read (metadata.c:3500) by 0x4802B2: pv_read (metadata.c:3462) Address 0x652ab80 is 0 bytes inside a block of size 4 free'd at 0x4C2756E: free (vg_replace_malloc.c:366) by 0x442277: _free_vginfo (lvmcache.c:963) by 0x44235E: _drop_vginfo (lvmcache.c:992) by 0x442B23: _lvmcache_update_vgname (lvmcache.c:1165) by 0x443449: lvmcache_update_vgname_and_id (lvmcache.c:1358) by 0x443C07: lvmcache_add (lvmcache.c:1492) by 0x46588C: _text_read (text_label.c:271) by 0x466A65: label_read (label.c:289) by 0x4413FC: lvmcache_label_scan (lvmcache.c:635) by 0x4605AD: _create_vg_text_instance (format-text.c:1881) by 0x46140D: _text_create_text_instance (format-text.c:2243) by 0x47EB49: _vg_read (metadata.c:2887) Add testing script
* Add missing printf attributesZdenek Kabelac2011-04-081-0/+3
| | | | | These attributes were missing in previous patch, that was adding instrumentation for printf formating string parameter.
* s/MIRROR_NOTSYNCED/LV_NOTSYNCED/ - Flag will may refer to more than just mirrorsJonathan Earl Brassow2011-03-291-1/+1
|