1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

7686 Commits

Author SHA1 Message Date
Peter Rajnoha
da3ea66a96 config: add config_source_t type to identify configuration source
A helper type that helps with identification of the configuration source
which makes handling the configuration cascade a bit easier, mainly
removing and adding configuration trees to cascade dynamically.

Currently, the possible types are:

  CONFIG_UNDEFINED - configuration is not defined yet (not initialized)
  CONFIG_FILE - one file configuration
  CONFIG_MERGED_FILES - configuration that is a result of merging more files into one
  CONFIG_STRING - configuration string typed on cmd line directly
  CONFIG_PROFILE - profile configuration (the new type of configuration, patches will follow...)

Also, generalize existing "remove_overridden_config_tree" to work with
configuration type identification in a cascade. Before, it was just
the CONFIG_STRING we used. Now, we need some more to add in a
cascade (like the CONFIG_PROFILE). So, we have:

  struct dm_config_tree *remove_config_tree_by_source(struct cmd_context *cmd, config_source_t source);
  config_source_t config_get_source_type(struct dm_config_tree *cft);

... for removing the tree by its source type from the cascade and
simply getting the source type.
2013-07-02 15:19:08 +02:00
Peter Rajnoha
2d784753c0 refactor: factor out common part of the code to open and read config files 2013-07-02 15:19:08 +02:00
Zdenek Kabelac
b31725d0ae archive: add missing bit set
In the last update not all code paths have set the archived flag.
If we run in test mode or without archiving enabled - set the bit
as well - so test whether archiving has been called succesfully
will be ok. (in relase fix).
2013-07-02 11:07:15 +02:00
Zdenek Kabelac
bdf0594aa8 cleanup: swap initial assignment
Easier to read code.
2013-07-01 23:12:36 +02:00
Zdenek Kabelac
47419d21ac cleanup: stack usage
Shortening code with macros return_0, return_NULL.
Add some missing stack prints in error paths.
2013-07-01 23:11:14 +02:00
Zdenek Kabelac
b90450b8a0 cleanup: introduce return_ECMD_FAILED macro
Use shortening macro for common code sequence
stack;
return ECMD_FAILED;
2013-07-01 23:10:33 +02:00
Zdenek Kabelac
4d9ed81075 vg/lvchange: drop local archived handling
Drop code handling archived flag now handled implicitely.
2013-07-01 23:10:33 +02:00
Zdenek Kabelac
e30028004b archiver: do not archive vg more then once
Do not keep multiple archives for the executed command.
Reuse the ALLOCATABLE_PV from pv status for
ARCHIVED_VG vg status. Mark VG with the bit with the
first archivation.
2013-07-01 23:09:26 +02:00
Zdenek Kabelac
afea2bf598 cleanup: move bit flags in order
Preseve the sequence of bits.
2013-07-01 23:06:41 +02:00
Zdenek Kabelac
2ab7699ec6 cleanup: simplify code around flock 2013-07-01 23:06:41 +02:00
Zdenek Kabelac
2fb116e71e cleanup: more dmeventd code cleanup 2013-07-01 23:06:41 +02:00
Zdenek Kabelac
fd399d52a9 dmeventd: move code from signal handler
Instead of calling syslog() from signal event handler,
run all logging code in the main loop.

Also it needs to take the lock and check for list
only when really needed.
2013-07-01 23:06:11 +02:00
Peter Rajnoha
0ca1688134 metadata: log_debug only when BA found in metadata
...not the other way round as it was before. This way it makes
more sense as BA use is exceptional and it's useless to
contaminate the log with messages about BA not being found
in metadata.
2013-06-27 16:03:35 +02:00
Peter Rajnoha
6de45db5b5 cleanup: clear outdated comment (TODO already done) 2013-06-27 15:26:39 +02:00
Zdenek Kabelac
9233e6d0bb dmeventd: fix cleanup commit
Fixing wrong rebase of cleanup commit.
Put back call to outth.
2013-06-25 23:05:06 +02:00
Zdenek Kabelac
939aeb7058 debug: add pointer to -DDEBUG_POOL compilation
Show 'at' pointer address with pool name.
It's useful for debugging to be able to locate pointer address in the
debug trace log. It's only available when compiled with extra debug
compilation flag DEBUG_POOL in make.tmpl.
2013-06-25 13:47:39 +02:00
Zdenek Kabelac
a4d6f7939c thin: check for creation of pool 2013-06-25 13:47:39 +02:00
Zdenek Kabelac
d46588c2d7 cleanup: add dot to lvchange message 2013-06-25 13:47:39 +02:00
Zdenek Kabelac
da9263905c cleanup: use "" around type in error message
A bit more cleaner error message for wrong discards paramater.
2013-06-25 13:47:39 +02:00
Zdenek Kabelac
19b064a309 cleanup: move mirror check code closer
Group a bit more code related to mirrors.
2013-06-25 13:47:39 +02:00
Zdenek Kabelac
09dc590b67 cleanup: code swap
Use easier to read positive query and indent line.
2013-06-25 13:47:39 +02:00
Zdenek Kabelac
2a059f2358 cleanup: use log_print instead of log_error
Since reduce the message has informational character and doesn't lead
to exit of the command - reduce the log level to info print as we
use for other similar types.

Reindent next print message.
2013-06-25 13:47:39 +02:00
Zdenek Kabelac
01174b8b8b cleanup: reformat code of dmeventd 2013-06-25 13:47:39 +02:00
Jonathan Brassow
88288ab433 cleanup: Remove message used for development
Failed to clean out all messages used during development.
2013-06-24 06:16:39 -05:00
Peter Rajnoha
c9e8e7c235 dev-type: dev_get_primary_dev: fix ret value if dev is a partition and we used sysfs 2013-06-23 12:39:35 +02:00
Jonathan Brassow
bdcfe8c6de TEST: Test RAID syncaction, writemostly, & refresh under snapshots
Test the different RAID lvchange scenarios under snapshot as well.

This patch also updates calculations for where to write to an
underlying PV when testing various syncactions.
2013-06-20 11:48:15 -05:00
Jonathan Brassow
8215846aa5 Clean-up: WHATS_NEW
Choosing between two entries and forgot to remove one.
2013-06-19 19:55:34 -05:00
Jonathan Brassow
a6d13308ec RAID/MIRROR: Honor mirror_segtype_default when upconverting linear LVs
If the user would upconvert a linear LV to a mirror without specifying
the segment type ("--type mirror" vs "--type raid1"), the "mirror"
segment type would be chosen without consulting the 'default_mirror_segtype'
setting in lvm.conf.  This is now used as the basis for determining
which should be used if left unspecified.
2013-06-19 17:50:10 -05:00
Zdenek Kabelac
4d2aa6a7aa cleanup: use parsed yes_no_arg
Do not parse yes_no_arg inside tools code and use already
available result as uint.
2013-06-18 22:13:42 +02:00
Zdenek Kabelac
f990b7298d cleanup: return lv_is_ as 1 or 0
Do not return 64bit values - return just plain int 0 or 1
2013-06-18 22:13:42 +02:00
Zdenek Kabelac
c5957ee2ff cleanup: easier to read loop code
buffer_write now accepts const pointer
Simplify loops and drop goto when not needed.
2013-06-18 22:13:41 +02:00
Zdenek Kabelac
155841c349 lvmetad: fix compare function
Check for enough space in preallocated buffer.
Fixes problem, when lvm code started to suddenly allocate
too big memory chunks.

TODO: lvmetad protocol should announce needed size ahead,
so if metadata have 1MB we are not reallocating memory...
2013-06-18 22:12:51 +02:00
Zdenek Kabelac
e3d3921779 lvmetad: use dm_ malloc wrappers
Use matching dm_ functions for internally used buffers.
2013-06-18 22:11:31 +02:00
Zdenek Kabelac
2562968864 vgcfgrestore: fix crash on restore of wrong vgname
When vgname has not existed in metadata, it has crashed on double free
in format_instance destroy() -  since VG was created, used FID and was
released - which also released FID, so further use was accessing bad
memory.

Fix it for this code path before release_vg() so FID will exists
when _vg_read_file_name() returns NULL.
2013-06-18 22:11:21 +02:00
Jonathan Brassow
1acad23d68 RAID: Remove optimization using static vars in lv_raid_dev_health
Revert commit 37ffe6a.  If static variables are to be used then we
will put them elsewhere and limit the optimization to reporting
code, rather that have it be used in the general case.
2013-06-17 13:03:15 -05:00
Jonathan Brassow
8ac9791c36 RAID: s/int/uint32_t for dev_count in dm_status_raid struct
Device count is never negative.  Change 'dev_count' to be
uint32_t instead of int.
2013-06-17 12:58:38 -05:00
Jonathan Brassow
7a4fdc1902 TEST: Fix 'dd' overrunning device size and causing test failure
Assumed size of 4M was too large and the test was failing because
'dd' was failing to perform its write.

Calculate the size we need to write with 'dd' instead, so we
don't overrun the device.
2013-06-17 12:38:09 -05:00
Peter Rajnoha
21f1062ef8 dev-type: add/fix references for dev_types in non-linux case 2013-06-17 15:17:15 +02:00
Zdenek Kabelac
d4308a558d snapshot: fix max size limit check for COW device
Use proper max size as a multiple of extent size.
And use 64bit arithmentic for validation of minsize.
(in release fix).
2013-06-17 09:37:50 +02:00
Zdenek Kabelac
2f334b16d2 cleanup: use struct assign
Simplier code with struct assign.
Drop unneeded zeroing of zallocated memory.
2013-06-17 09:37:06 +02:00
Zdenek Kabelac
2636cae139 clean: remove unneeded assign
Since init_unknown_segtype returns zalloced memory,
NULL assign is not needed.
2013-06-17 09:34:56 +02:00
Zdenek Kabelac
362d8ead64 tests: more test run in cluster mode
aux updates:

prepare_vg now created clustered VG for cluster tests.

since dm-raid doesn't work in cluster, skip the cluster
test when someone checks for dm-raid target until fixed.
2013-06-16 00:07:33 +02:00
Zdenek Kabelac
5d73c0c674 cleanup: access pool segs with check
Add some minor checks after first_seg(lv).
Use direct check for thin pool segment.
Drop some unneeded {}
2013-06-16 00:07:33 +02:00
Zdenek Kabelac
5e19410d93 cleanup: use simplier structure initialization
And also use static struct for _out_spec.
2013-06-16 00:07:33 +02:00
Zdenek Kabelac
636c51ae3f cleanup: use unrelated temporary variables
use of tmp_rq2 is unrelated to tmp_rq - so use separate
variable.
2013-06-16 00:07:33 +02:00
Zdenek Kabelac
450ac7be42 cleanup: move string in the use-place 2013-06-16 00:07:33 +02:00
Zdenek Kabelac
17a3ddf89e cleanup: drop unused headers
Drop heades which do not provide any used symbols.
2013-06-16 00:07:32 +02:00
Zdenek Kabelac
0240521942 cleanup: add extra internal error
Ensure the target line will work only with segment with pool.
2013-06-16 00:07:32 +02:00
Zdenek Kabelac
a040dd8cfb config: skip close of stdin
If the used stream has been stdout, do not close it.
2013-06-16 00:07:32 +02:00
Zdenek Kabelac
8fb5f63637 mirror: add missing error message
When a user has not proceeded with conversion,
print the error message why the command has failed.
2013-06-16 00:07:32 +02:00