mpalmer / lvmsync

Synchronise LVM LVs across a network by sending only snapshotted changes
http://theshed.hezmatt.org/lvmsync
GNU General Public License v3.0
380 stars 60 forks source link

Variables vary even more than you might think... #27

Closed deriamis closed 9 years ago

deriamis commented 9 years ago

Turns out there are some capital characters showing up in these vgcfgbackups:

[root@clustertest1 lvmsync]# lvmsync ${vg_name}/r0-lvmsync root@clustertest2.profgator.com:${remote_vg_name}/r0
/opt/rh/ruby193/root/usr/local/share/gems/gems/lvmsync-1.0.2/lib/lvm/vg_config.rb:22:in `initialize': Cannot parse vgcfgbackup output: Expected one of [\s], [a-z0-9_-], #, } at line 38, column 3 (byte 963) after vg_clustertest1 { (RuntimeError)
        id = "ckCfGZ-qi93-SacM-IbNc-RjE2-UMgD-Kw2NR3"
        seqno = 6
        format = "lvm2" # informational
        status = ["RESIZEABLE", "READ", "WRITE"]
        flags = []
        extent_size = 8192              # 4 Megabytes
        max_lv = 0
        max_pv = 0
        metadata_copies = 0

        physical_volumes {

                pv0 {
                        id = "28k8K3-C8mp-GXeq-ipYT-Wwuc-9x1M-Q9ew0p"
                        device = "/dev/vda2"    # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 1898993664   # 905.511 Gigabytes
                        pe_start = 2048
                        pe_count = 231810       # 905.508 Gigabytes
                }
        }

        logical_volumes {

        from /opt/rh/ruby193/root/usr/local/share/gems/gems/lvmsync-1.0.2/bin/lvmsync:154:in `new'
        from /opt/rh/ruby193/root/usr/local/share/gems/gems/lvmsync-1.0.2/bin/lvmsync:154:in `run_client'
        from /opt/rh/ruby193/root/usr/local/share/gems/gems/lvmsync-1.0.2/bin/lvmsync:93:in `main'
        from /opt/rh/ruby193/root/usr/local/share/gems/gems/lvmsync-1.0.2/bin/lvmsync:256:in `<top (required)>'
        from /opt/rh/ruby193/root/usr/bin/lvmsync:23:in `load'
        from /opt/rh/ruby193/root/usr/bin/lvmsync:23:in `<main>'

The bad part:

        logical_volumes {

                LogVol00 {
                        id = "75z1xl-hzjo-j9HB-1rpR-bqCc-EwJh-93ehA2"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        creation_host = "localhost.localdomain"
                        creation_time = 1409176238      # 2014-08-27 16:50:38 -0500
                        segment_count = 1

                        segment1 {
                                start_extent = 0
                                extent_count = 51200    # 200 Gigabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv0", 0
                                ]
                        }
                }

I am a ruby n00b, so please forgive if I make mistakes.

deriamis commented 9 years ago

I also added an option so you can pass an SSH key to the ssh binary. It seems to work on my own tests, but YMMV.

deriamis commented 9 years ago

I also added an option so you can pass an SSH key to the ssh binary. It seems to work on my own tests, but YMMV.

deriamis commented 9 years ago

I also added an option so you can pass an SSH key to the ssh binary. It seems to work on my own tests, but YMMV.

deriamis commented 9 years ago

Wow. I don't know what happened with those last comments... sorry!

mpalmer commented 9 years ago

D'oh! I really should just open that regex right out, I think... it keeps catching all sorts of corner cases. I'll fix that up RSN. Could you split the SSH key option out into a separate PR?

deriamis commented 9 years ago

Yeah, I wasn't expecting to have both in there at first. Let me close this one out and create two new branches with the changes for you.