Nir Soffer has uploaded a new change for review.
Change subject: lvm: Remove duplication in udev rules ......................................................................
lvm: Remove duplication in udev rules
The horrible uuid pattern was repeated 5 times, making the source unreadable. Now we build the udev patterns once, and use the built patterns to format the final output.
Change-Id: Id259071c8c2c8e059308377823081e6b307ccbe0 Signed-off-by: Nir Soffer nsoffer@redhat.com --- M vdsm/storage/vdsm_lvm_rules.template.in 1 file changed, 21 insertions(+), 6 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/09/39309/1
diff --git a/vdsm/storage/vdsm_lvm_rules.template.in b/vdsm/storage/vdsm_lvm_rules.template.in index d73c0c6..045d523 100644 --- a/vdsm/storage/vdsm_lvm_rules.template.in +++ b/vdsm/storage/vdsm_lvm_rules.template.in @@ -11,8 +11,21 @@ """ import sys
-write = sys.stdout.write enable_chown_hack = "@CHOWN_HACK@" + +env = { + "uuid": "-".join(("[a-f0-9]" * 8, + "[a-f0-9]" * 4, + "[a-f0-9]" * 4, + "[a-f0-9]" * 4, + "[a-f0-9]" * 12)), + "temp": "[a-zA-Z0-9]" * 8, +} + + +def write(fmt): + sys.stdout.write(fmt % env) +
write("""\ # @@ -30,7 +43,7 @@ ACTION!="add|change", GOTO="lvm_end"
# Filter out vgs which do not look like a vdsm vg -ENV{DM_VG_NAME}!="[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]", GOTO="lvm_end" +ENV{DM_VG_NAME}!="%(uuid)s", GOTO="lvm_end"
# Volumes used as vdsm images """) @@ -40,18 +53,20 @@ # WARNING: we cannot use OWNER, GROUP and MODE since using any of them will # change the selinux label to the default, causing vms to pause after extending # disks. https://bugzilla.redhat.com/1147910 -ENV{DM_LV_NAME}=="[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]", RUN+="@CHOWN_PATH@ @VDSMUSER@:@QEMUGROUP@ $env{DEVNAME}", GOTO="lvm_end" +ENV{DM_LV_NAME}=="%(uuid)s", RUN+="@CHOWN_PATH@ @VDSMUSER@:@QEMUGROUP@ $env{DEVNAME}", GOTO="lvm_end" """) else: write("""\ -ENV{DM_LV_NAME}=="[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]", OWNER:="@VDSMUSER@", GROUP:="@QEMUGROUP@", GOTO="lvm_end" +ENV{DM_LV_NAME}=="%(uuid)s", OWNER:="@VDSMUSER@", GROUP:="@QEMUGROUP@", GOTO="lvm_end" """)
write("""\
# Temporary volumes - not accessed by libvirt/qemu -ENV{DM_LV_NAME}=="[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]_MERGE", OWNER:="@VDSMUSER@", GROUP:="@QEMUGROUP@", GOTO="lvm_end" -ENV{DM_LV_NAME}=="_remove_me_[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9]_[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9]-[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]", OWNER:="@VDSMUSER@", GROUP:="@QEMUGROUP@", GOTO="lvm_end" +ENV{DM_LV_NAME}=="%(uuid)s_MERGE", OWNER:="@VDSMUSER@", GROUP:="@QEMUGROUP@", GOTO="lvm_end" + +# Deleted volumes +ENV{DM_LV_NAME}=="_remove_me_%(temp)s_%(uuid)s", OWNER:="@VDSMUSER@", GROUP:="@QEMUGROUP@", GOTO="lvm_end"
# Special volumes used by vdsm ENV{DM_LV_NAME}=="metadata|inbox|outbox", MODE:="0600", OWNER:="@VDSMUSER@", GROUP:="@QEMUGROUP@", GOTO="lvm_end"
automation@ovirt.org has posted comments on this change.
Change subject: lvm: Remove duplication in udev rules ......................................................................
Patch Set 1:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
oVirt Jenkins CI Server has posted comments on this change.
Change subject: lvm: Remove duplication in udev rules ......................................................................
Patch Set 1:
Build Started (1/2) -> http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17449/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: lvm: Remove duplication in udev rules ......................................................................
Patch Set 1:
Build Started (2/2) -> http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/17275/
oVirt Jenkins CI Server has posted comments on this change.
Change subject: lvm: Remove duplication in udev rules ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/17275/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit-tests_created/17449/ : SUCCESS
automation@ovirt.org has posted comments on this change.
Change subject: lvm: Remove duplication in udev rules ......................................................................
Patch Set 2:
* Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3'])
Nir Soffer has posted comments on this change.
Change subject: lvm: Remove duplication in udev rules ......................................................................
Patch Set 2: Verified+1
Dan Kenigsberg has posted comments on this change.
Change subject: lvm: Remove duplication in udev rules ......................................................................
Patch Set 2: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: lvm: Remove duplication in udev rules ......................................................................
lvm: Remove duplication in udev rules
The horrible uuid pattern was repeated 5 times, making the source unreadable. Now we build the udev patterns once, and use the built patterns to format the final output.
Change-Id: Id259071c8c2c8e059308377823081e6b307ccbe0 Signed-off-by: Nir Soffer nsoffer@redhat.com Reviewed-on: https://gerrit.ovirt.org/39309 Continuous-Integration: Jenkins CI Reviewed-by: Dan Kenigsberg danken@redhat.com --- M vdsm/storage/vdsm_lvm_rules.template.in 1 file changed, 21 insertions(+), 6 deletions(-)
Approvals: Nir Soffer: Verified Jenkins CI: Passed CI tests Dan Kenigsberg: Looks good to me, approved
automation@ovirt.org has posted comments on this change.
Change subject: lvm: Remove duplication in udev rules ......................................................................
Patch Set 3:
* Update tracker::IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org