New upstream version 2.28
Michael Biebl
1 year, 7 months ago
0 | name: Run static analysis using csmock | |
1 | ||
2 | env: | |
3 | CSMOCK_CHROOTS: "default" | |
4 | CSMOCK_TOOLS: "clang cppcheck gcc" | |
5 | ||
6 | on: | |
7 | pull_request: | |
8 | branches: | |
9 | - master | |
10 | ||
11 | jobs: | |
12 | build: | |
13 | name: csmock | |
14 | runs-on: ubuntu-22.04 | |
15 | env: | |
16 | CI_CONTAINER: libblockdev-ci-csmock | |
17 | steps: | |
18 | - name: Checkout libblockdev repository | |
19 | uses: actions/checkout@v3 | |
20 | ||
21 | - name: Install podman | |
22 | run: | | |
23 | sudo apt -qq update | |
24 | sudo apt -y -qq install podman | |
25 | ||
26 | - name: Build the container | |
27 | run: | | |
28 | podman build --no-cache -t ${{ env.CI_CONTAINER }} -f misc/ci.Dockerfile . | |
29 | ||
30 | - name: Start the container | |
31 | run: | | |
32 | podman run -d -t --name ${{ env.CI_CONTAINER }} --privileged --volume "$(pwd):/app" --workdir "/app" ${{ env.CI_CONTAINER }} | |
33 | ||
34 | - name: Install test dependencies in the container | |
35 | run: | | |
36 | podman exec -it ${{ env.CI_CONTAINER }} bash -c "ansible-playbook -i "localhost," -c local misc/install-test-dependencies.yml" | |
37 | ||
38 | - name: Run csmock build in the container | |
39 | run: | | |
40 | podman exec -it ${{ env.CI_CONTAINER }} bash -c "/ci/run_csmock_tests -c /ci/copr-builder.conf -p libblockdev-udisks -t ${{ env.CSMOCK_TOOLS }} -r ${{ env.CSMOCK_CHROOTS }}" | |
41 | ||
42 | - name: Upload the csmock logs | |
43 | if: always() | |
44 | uses: actions/upload-artifact@v3 | |
45 | with: | |
46 | name: csmock_logs | |
47 | path: csmock_*/* |
0 | name: Build RPM packages | |
1 | ||
2 | env: | |
3 | MOCK_CHROOTS: "fedora-rawhide fedora-37 fedora-36" | |
4 | ||
5 | on: | |
6 | pull_request: | |
7 | branches: | |
8 | - master | |
9 | ||
10 | jobs: | |
11 | build: | |
12 | name: rpmbuild | |
13 | runs-on: ubuntu-22.04 | |
14 | env: | |
15 | CI_CONTAINER: libblockdev-ci-rpmbuild | |
16 | steps: | |
17 | - name: Checkout libblockdev repository | |
18 | uses: actions/checkout@v3 | |
19 | ||
20 | - name: Install podman | |
21 | run: | | |
22 | sudo apt -qq update | |
23 | sudo apt -y -qq install podman | |
24 | ||
25 | - name: Build the container | |
26 | run: | | |
27 | podman build --no-cache -t ${{ env.CI_CONTAINER }} -f misc/ci.Dockerfile . | |
28 | ||
29 | - name: Start the container | |
30 | run: | | |
31 | podman run -d -t --name ${{ env.CI_CONTAINER }} --privileged --volume "$(pwd):/app" --workdir "/app" ${{ env.CI_CONTAINER }} | |
32 | ||
33 | - name: Install test dependencies in the container | |
34 | run: | | |
35 | podman exec -it ${{ env.CI_CONTAINER }} bash -c "ansible-playbook -i "localhost," -c local misc/install-test-dependencies.yml" | |
36 | ||
37 | - name: Run RPM mock builds in the container | |
38 | run: | | |
39 | podman exec -it ${{ env.CI_CONTAINER }} bash -c "/ci/run_rpmbuild_tests -c /ci/copr-builder.conf -p libblockdev-udisks -r ${{ env.MOCK_CHROOTS }}" | |
40 | ||
41 | - name: Upload the rpmbuild logs | |
42 | if: always() | |
43 | uses: actions/upload-artifact@v3 | |
44 | with: | |
45 | name: rpmbuild_logs | |
46 | path: rpmbuild_*.log |
0 | extraction: | |
1 | cpp: | |
2 | prepare: | |
3 | packages: | |
4 | - "libblkid-dev" | |
5 | - "libglib2.0-dev" | |
6 | - "libcryptsetup-dev" | |
7 | - "libpython3-dev" | |
8 | - "libdevmapper-dev" | |
9 | - "libudev-dev" | |
10 | - "libkmod-dev" | |
11 | - "libparted-dev" | |
12 | - "libmount-dev" | |
13 | - "libdmraid-dev" | |
14 | - "libgirepository1.0-dev" | |
15 | - "gobject-introspection" | |
16 | - "libyaml-dev" | |
17 | - "autoconf-archive" | |
18 | - "libvolume-key-dev" | |
19 | - "libbytesize-dev" | |
20 | - "libnss3-dev" | |
21 | - "libndctl-dev" | |
22 | - "libext2fs-dev" | |
23 | configure: | |
24 | command: "./autogen.sh && ./configure" |
0 | Libblockdev 2.28 | |
1 | ---------------- | |
2 | ||
3 | New minor release of the libblockdev library with multiple fixes. See below | |
4 | for details. | |
5 | ||
6 | **Full list of changes** | |
7 | ||
8 | Michael Biebl (1): | |
9 | ||
10 | - Fix typos | |
11 | ||
12 | Vojtech Trefny (17): | |
13 | ||
14 | - lvm: Fix bd_lvm_get_supported_pe_sizes in Python on 32bit | |
15 | - tests: Create bigger devices for XFS tests | |
16 | - tests: Use ext instead of xfs in MountTestCase.test_mount_ro_device | |
17 | - mpath: Memory leak fix | |
18 | - spec: Require the same version utils from plugins | |
19 | - mdraid: Try harder to get container UUID in bd_md_detail | |
20 | - Add a test case for DDF arrays/containers | |
21 | - mdraid: Do not ignore errors from bd_md_canonicalize_uuid in bd_md_examine | |
22 | - mdraid: Try harder to get container UUID in bd_md_examine | |
23 | - mdraid: Fix copy-paste error when checking return value | |
24 | - tests: Wait for raid and mirrored LVs to be synced before removing | |
25 | - tests: Make smaller images for test_lvcreate_type | |
26 | - dm: Fix comparing DM RAID member devices UUID | |
27 | - mdraid: Fix use after free | |
28 | - ci: Add .lgtm.yaml config for LGTM | |
29 | - ci: Add GitHub actions for running rpmbuilds and csmock | |
30 | - mpath: Fix potential NULL pointer dereference | |
31 | ||
32 | zhanghongtao (1): | |
33 | ||
34 | - Fix mismatched functions return value type | |
35 | ||
36 | ||
0 | 37 | Libblockdev 2.27 |
1 | 38 | ---------------- |
2 | 39 |
0 | 0 | # configure.ac for libblockdev |
1 | 1 | |
2 | AC_INIT([libblockdev], [2.27], [vpodzime@redhat.com]) | |
2 | AC_INIT([libblockdev], [2.28], [vpodzime@redhat.com]) | |
3 | 3 | |
4 | 4 | # Disable building static libraries. |
5 | 5 | # This needs to be set before initializing automake |
123 | 123 | %define configure_opts %{?python2_copts} %{?python3_copts} %{?bcache_copts} %{?lvm_dbus_copts} %{?btrfs_copts} %{?crypto_copts} %{?dm_copts} %{?loop_copts} %{?lvm_copts} %{?lvm_dbus_copts} %{?mdraid_copts} %{?mpath_copts} %{?swap_copts} %{?kbd_copts} %{?part_copts} %{?fs_copts} %{?nvdimm_copts} %{?vdo_copts} %{?tools_copts} %{?gi_copts} |
124 | 124 | |
125 | 125 | Name: libblockdev |
126 | Version: 2.27 | |
126 | Version: 2.28 | |
127 | 127 | Release: 1%{?dist} |
128 | 128 | Summary: A library for low-level manipulation with block devices |
129 | 129 | License: LGPLv2+ |
226 | 226 | %package btrfs |
227 | 227 | BuildRequires: libbytesize-devel |
228 | 228 | Summary: The BTRFS plugin for the libblockdev library |
229 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
229 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
230 | 230 | Requires: btrfs-progs |
231 | 231 | |
232 | 232 | %description btrfs |
237 | 237 | Summary: Development files for the libblockdev-btrfs plugin/library |
238 | 238 | Requires: %{name}-btrfs%{?_isa} = %{version}-%{release} |
239 | 239 | Requires: glib2-devel |
240 | Requires: %{name}-utils-devel%{?_isa} | |
240 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
241 | 241 | |
242 | 242 | %description btrfs-devel |
243 | 243 | This package contains header files and pkg-config files needed for development |
280 | 280 | %endif |
281 | 281 | BuildRequires: systemd-devel |
282 | 282 | Summary: The Device Mapper plugin for the libblockdev library |
283 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
283 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
284 | 284 | Requires: device-mapper |
285 | 285 | %if %{with_dmraid} |
286 | 286 | Requires: dmraid |
299 | 299 | %if %{with_dmraid} |
300 | 300 | Requires: dmraid-devel |
301 | 301 | %endif |
302 | Requires: %{name}-utils-devel%{?_isa} | |
302 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
303 | 303 | |
304 | 304 | %description dm-devel |
305 | 305 | This package contains header files and pkg-config files needed for development |
313 | 313 | BuildRequires: libblkid-devel |
314 | 314 | BuildRequires: libmount-devel |
315 | 315 | Summary: The FS plugin for the libblockdev library |
316 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
316 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
317 | 317 | |
318 | 318 | %description fs |
319 | 319 | The libblockdev library plugin (and in the same time a standalone library) |
322 | 322 | %package fs-devel |
323 | 323 | Summary: Development files for the libblockdev-fs plugin/library |
324 | 324 | Requires: %{name}-fs%{?_isa} = %{version}-%{release} |
325 | Requires: %{name}-utils-devel%{?_isa} | |
325 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
326 | 326 | Requires: glib2-devel |
327 | 327 | Requires: xfsprogs |
328 | 328 | Requires: dosfstools |
337 | 337 | %package kbd |
338 | 338 | BuildRequires: libbytesize-devel |
339 | 339 | Summary: The KBD plugin for the libblockdev library |
340 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
340 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
341 | 341 | %if %{with_bcache} |
342 | 342 | Requires: bcache-tools >= 1.0.8 |
343 | 343 | %endif |
350 | 350 | %package kbd-devel |
351 | 351 | Summary: Development files for the libblockdev-kbd plugin/library |
352 | 352 | Requires: %{name}-kbd%{?_isa} = %{version}-%{release} |
353 | Requires: %{name}-utils-devel%{?_isa} | |
353 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
354 | 354 | Requires: glib2-devel |
355 | 355 | |
356 | 356 | %description kbd-devel |
362 | 362 | %if %{with_loop} |
363 | 363 | %package loop |
364 | 364 | Summary: The loop plugin for the libblockdev library |
365 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
365 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
366 | 366 | |
367 | 367 | %description loop |
368 | 368 | The libblockdev library plugin (and in the same time a standalone library) |
371 | 371 | %package loop-devel |
372 | 372 | Summary: Development files for the libblockdev-loop plugin/library |
373 | 373 | Requires: %{name}-loop%{?_isa} = %{version}-%{release} |
374 | Requires: %{name}-utils-devel%{?_isa} | |
374 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
375 | 375 | Requires: glib2-devel |
376 | 376 | |
377 | 377 | %description loop-devel |
384 | 384 | %package lvm |
385 | 385 | BuildRequires: device-mapper-devel |
386 | 386 | Summary: The LVM plugin for the libblockdev library |
387 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
387 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
388 | 388 | Requires: lvm2 |
389 | 389 | |
390 | 390 | %description lvm |
406 | 406 | %package lvm-dbus |
407 | 407 | BuildRequires: device-mapper-devel |
408 | 408 | Summary: The LVM plugin for the libblockdev library |
409 | Requires: %{name}-utils%{?_isa} >= 1.4 | |
409 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
410 | 410 | Requires: lvm2-dbusd >= 2.02.156 |
411 | 411 | |
412 | 412 | %description lvm-dbus |
429 | 429 | %package mdraid |
430 | 430 | BuildRequires: libbytesize-devel |
431 | 431 | Summary: The MD RAID plugin for the libblockdev library |
432 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
432 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
433 | 433 | Requires: mdadm |
434 | 434 | |
435 | 435 | %description mdraid |
439 | 439 | %package mdraid-devel |
440 | 440 | Summary: Development files for the libblockdev-mdraid plugin/library |
441 | 441 | Requires: %{name}-mdraid%{?_isa} = %{version}-%{release} |
442 | Requires: %{name}-utils-devel%{?_isa} | |
442 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
443 | 443 | Requires: glib2-devel |
444 | 444 | |
445 | 445 | %description mdraid-devel |
452 | 452 | %package mpath |
453 | 453 | BuildRequires: device-mapper-devel |
454 | 454 | Summary: The multipath plugin for the libblockdev library |
455 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
455 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
456 | 456 | Requires: device-mapper-multipath |
457 | 457 | |
458 | 458 | %description mpath |
462 | 462 | %package mpath-devel |
463 | 463 | Summary: Development files for the libblockdev-mpath plugin/library |
464 | 464 | Requires: %{name}-mpath%{?_isa} = %{version}-%{release} |
465 | Requires: %{name}-utils-devel%{?_isa} | |
465 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
466 | 466 | Requires: glib2-devel |
467 | 467 | |
468 | 468 | %description mpath-devel |
475 | 475 | BuildRequires: ndctl-devel |
476 | 476 | BuildRequires: libuuid-devel |
477 | 477 | Summary: The NVDIMM plugin for the libblockdev library |
478 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
478 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
479 | 479 | Requires: ndctl |
480 | 480 | |
481 | 481 | %description nvdimm |
485 | 485 | %package nvdimm-devel |
486 | 486 | Summary: Development files for the libblockdev-nvdimm plugin/library |
487 | 487 | Requires: %{name}-nvdimm%{?_isa} = %{version}-%{release} |
488 | Requires: %{name}-utils-devel%{?_isa} | |
488 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
489 | 489 | Requires: glib2-devel |
490 | 490 | |
491 | 491 | %description nvdimm-devel |
498 | 498 | %package part |
499 | 499 | BuildRequires: parted-devel |
500 | 500 | Summary: The partitioning plugin for the libblockdev library |
501 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
501 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
502 | 502 | Requires: gdisk |
503 | 503 | Requires: util-linux |
504 | 504 | |
509 | 509 | %package part-devel |
510 | 510 | Summary: Development files for the libblockdev-part plugin/library |
511 | 511 | Requires: %{name}-part%{?_isa} = %{version}-%{release} |
512 | Requires: %{name}-utils-devel%{?_isa} | |
512 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
513 | 513 | Requires: glib2-devel |
514 | 514 | |
515 | 515 | %description part-devel |
522 | 522 | %package swap |
523 | 523 | BuildRequires: libblkid-devel |
524 | 524 | Summary: The swap plugin for the libblockdev library |
525 | Requires: %{name}-utils%{?_isa} >= 0.11 | |
525 | Requires: %{name}-utils%{?_isa} = %{version}-%{release} | |
526 | 526 | Requires: util-linux |
527 | 527 | |
528 | 528 | %description swap |
532 | 532 | %package swap-devel |
533 | 533 | Summary: Development files for the libblockdev-swap plugin/library |
534 | 534 | Requires: %{name}-swap%{?_isa} = %{version}-%{release} |
535 | Requires: %{name}-utils-devel%{?_isa} | |
535 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
536 | 536 | Requires: glib2-devel |
537 | 537 | |
538 | 538 | %description swap-devel |
601 | 601 | %package s390-devel |
602 | 602 | Summary: Development files for the libblockdev-s390 plugin/library |
603 | 603 | Requires: %{name}-s390%{?_isa} = %{version}-%{release} |
604 | Requires: %{name}-utils-devel%{?_isa} | |
604 | Requires: %{name}-utils-devel%{?_isa} = %{version}-%{release} | |
605 | 605 | Requires: glib2-devel |
606 | 606 | |
607 | 607 | %description s390-devel |
978 | 978 | %files plugins-all |
979 | 979 | |
980 | 980 | %changelog |
981 | * Wed Sep 14 2022 Vojtech Trefny <vtrefny@redhat.com> - 2.28-1 | |
982 | - mpath: Fix potential NULL pointer dereference (vtrefny) | |
983 | - ci: Add GitHub actions for running rpmbuilds and csmock (vtrefny) | |
984 | - ci: Add .lgtm.yaml config for LGTM (vtrefny) | |
985 | - mdraid: Fix use after free (vtrefny) | |
986 | - dm: Fix comparing DM RAID member devices UUID (vtrefny) | |
987 | - tests: Make smaller images for test_lvcreate_type (vtrefny) | |
988 | - tests: Wait for raid and mirrored LVs to be synced before removing (vtrefny) | |
989 | - mdraid: Fix copy-paste error when checking return value (vtrefny) | |
990 | - mdraid: Try harder to get container UUID in bd_md_examine (vtrefny) | |
991 | - mdraid: Do not ignore errors from bd_md_canonicalize_uuid in bd_md_examine (vtrefny) | |
992 | - Add a test case for DDF arrays/containers (vtrefny) | |
993 | - mdraid: Try harder to get container UUID in bd_md_detail (vtrefny) | |
994 | - Fix mismatched functions return value type (zhanghongtao22) | |
995 | - spec: Require the same version utils from plugins (vtrefny) | |
996 | - mpath: Memory leak fix (vtrefny) | |
997 | - tests: Use ext instead of xfs in MountTestCase.test_mount_ro_device (vtrefny) | |
998 | - tests: Create bigger devices for XFS tests (vtrefny) | |
999 | - lvm: Fix bd_lvm_get_supported_pe_sizes in Python on 32bit (vtrefny) | |
1000 | - Fix typos (biebl) | |
1001 | ||
981 | 1002 | * Wed Jun 01 2022 Vojtech Trefny <vtrefny@redhat.com> - 2.27-1 |
982 | 1003 | - crypto: Remove unused and leaking error in write_escrow_data_file (vtrefny) |
983 | 1004 | - kbd: Fix potential NULL pointer dereference in bd_kbd_bcache_create (vtrefny) |
0 | # latest fedora image for running some of our tests in GH actions | |
1 | ||
2 | FROM registry.fedoraproject.org/fedora:latest | |
3 | ||
4 | RUN set -e; \ | |
5 | dnf install -y ansible python3-pip rpm-build mock csmock git; \ | |
6 | pip3 install copr-builder; \ | |
7 | git clone --depth 1 https://github.com/storaged-project/ci.git; | |
8 | ||
9 | WORKDIR / |
0 | # This is a simple ansible playbook for installing packages needed by the | |
1 | # libblockdev test suite. | |
2 | # You can do this by using 'make install-requires' or manually using | |
3 | # 'ansible-playbook -K -i "localhost," -c local install-test-dependencies.yml' | |
4 | # Currently only Fedora, CentOS 8 and Debian/Ubuntu are supported by this playbook. | |
5 | ||
6 | --- | |
7 | - hosts: all | |
8 | become: true | |
9 | ||
10 | tasks: | |
11 | ####### Fedora | |
12 | - name: Install basic build tools (Fedora) | |
13 | package: name={{item}} state=present | |
14 | with_items: | |
15 | - gcc | |
16 | - make | |
17 | - libtool | |
18 | - autoconf | |
19 | - automake | |
20 | when: ansible_distribution == 'Fedora' | |
21 | ||
22 | - name: Install dnf-plugins-core for dnf builddep (Fedora) | |
23 | package: name=dnf-plugins-core state=present | |
24 | when: ansible_distribution == 'Fedora' | |
25 | ||
26 | - name: Install build dependencies (Fedora) | |
27 | command: "dnf -y builddep libblockdev --nogpgcheck" | |
28 | args: | |
29 | warn: false | |
30 | when: ansible_distribution == 'Fedora' | |
31 | ||
32 | - name: Install test dependencies (Fedora) | |
33 | package: name={{item}} state=present | |
34 | with_items: | |
35 | - btrfs-progs | |
36 | - bcache-tools | |
37 | - cryptsetup | |
38 | - device-mapper-multipath | |
39 | - dosfstools | |
40 | - e2fsprogs | |
41 | - e2fsprogs-devel | |
42 | - glibc-all-langpacks | |
43 | - lvm2-dbusd | |
44 | - mdadm | |
45 | - ndctl | |
46 | - nss-tools | |
47 | - ntfsprogs | |
48 | - python3-bytesize | |
49 | - python3-dbus | |
50 | - python3-packaging | |
51 | - python3-pylint | |
52 | - python3-yaml | |
53 | - targetcli | |
54 | - volume_key | |
55 | - xfsprogs | |
56 | when: ansible_distribution == 'Fedora' | |
57 | ||
58 | ####### CentOS 8 | |
59 | - name: Install basic build tools (CentOS 8) | |
60 | package: name={{item}} state=present | |
61 | with_items: | |
62 | - gcc | |
63 | - make | |
64 | - libtool | |
65 | - autoconf | |
66 | - automake | |
67 | when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8' | |
68 | ||
69 | - name: Enable EPEL repository (CentOS 8) | |
70 | package: name=epel-release state=present | |
71 | when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8' | |
72 | ||
73 | - name: Enable powertools repository (CentOS 8) | |
74 | command: yum config-manager --set-enabled powertools | |
75 | when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8' | |
76 | ||
77 | - name: Install dnf-plugins-core for dnf builddep (CentOS 8) | |
78 | package: name=dnf-plugins-core state=present | |
79 | when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8' | |
80 | ||
81 | - name: Install build dependencies (CentOS 8) | |
82 | command: "dnf -y builddep libblockdev --nogpgcheck" | |
83 | args: | |
84 | warn: false | |
85 | when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8' | |
86 | ||
87 | - name: Install test dependencies (CentOS 8) | |
88 | package: name={{item}} state=present | |
89 | with_items: | |
90 | - cryptsetup | |
91 | - device-mapper-multipath | |
92 | - dosfstools | |
93 | - e2fsprogs | |
94 | - e2fsprogs-devel | |
95 | - glibc-all-langpacks | |
96 | - kmod-kvdo | |
97 | - lvm2-dbusd | |
98 | - mdadm | |
99 | - ndctl | |
100 | - nss-tools | |
101 | - ntfsprogs | |
102 | - python3-bytesize | |
103 | - python3-dbus | |
104 | - python3-packaging | |
105 | - python3-pylint | |
106 | - python3-yaml | |
107 | - targetcli | |
108 | - vdo | |
109 | - volume_key | |
110 | - xfsprogs | |
111 | when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8' | |
112 | ||
113 | ####### Debian/Ubuntu | |
114 | - name: Update apt cache (Debian/Ubuntu) | |
115 | apt: | |
116 | update_cache: yes | |
117 | when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | |
118 | ||
119 | - name: Install basic build tools (Debian/Ubuntu) | |
120 | package: name={{item}} state=present | |
121 | with_items: | |
122 | - gcc | |
123 | - make | |
124 | when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | |
125 | ||
126 | - name: Add source repositories (Debian/Ubuntu) | |
127 | shell: "grep '^deb ' /etc/apt/sources.list | perl -pe 's/deb /deb-src /' >> /etc/apt/sources.list" | |
128 | when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | |
129 | ||
130 | - name: Update apt cache (Debian/Ubuntu) | |
131 | apt: | |
132 | update_cache: yes | |
133 | when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | |
134 | ||
135 | - name: Install build dependencies (Debian/Ubuntu) | |
136 | apt: | |
137 | name: libblockdev | |
138 | state: build-dep | |
139 | when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | |
140 | ||
141 | - name: Install test dependencies (Debian/Ubuntu) | |
142 | package: name={{item}} state=present | |
143 | with_items: | |
144 | - bcache-tools | |
145 | - btrfs-progs | |
146 | - cryptsetup | |
147 | - dosfstools | |
148 | - e2fsprogs | |
149 | - libext2fs-dev | |
150 | - libnss3-tools | |
151 | - locales-all | |
152 | - lvm2-dbusd | |
153 | - mdadm | |
154 | - ndctl | |
155 | - ntfs-3g | |
156 | - pylint3 | |
157 | - python3-bytesize | |
158 | - python3-packaging | |
159 | - python3-pydbus | |
160 | - python3-yaml | |
161 | - targetcli-fb | |
162 | - volume-key | |
163 | - xfsprogs | |
164 | when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' | |
165 | ||
166 | ####### Common actions | |
167 | ||
168 | - name: Start LVM DBus service | |
169 | service: name=lvm2-lvmdbusd state=started | |
170 | ignore_errors: yes |
636 | 636 | * bd_lvm_get_supported_pe_sizes: |
637 | 637 | * @error: (out): place to store error (if any) |
638 | 638 | * |
639 | * Returns: (transfer full) (array zero-terminated=1): list of supported PE sizes | |
639 | * Returns: (transfer full) (array fixed-size=25): list of supported PE sizes | |
640 | 640 | * |
641 | 641 | * Tech category: %BD_LVM_TECH_CALCS no mode (it is ignored) |
642 | 642 | */ |
501 | 501 | |
502 | 502 | if (!check_deps (&avail_deps, DEPS_BTRFS_MASK, deps, DEPS_LAST, &deps_check_lock, error) || |
503 | 503 | !check_module_deps (&avail_module_deps, MODULE_DEPS_BTRFS_MASK, module_deps, MODULE_DEPS_LAST, &deps_check_lock, error)) |
504 | return FALSE; | |
504 | return 0; | |
505 | 505 | |
506 | 506 | regex = g_regex_new ("ID (\\d+) .*", 0, 0, error); |
507 | 507 | if (!regex) { |
622 | 622 | |
623 | 623 | if (!check_deps (&avail_deps, DEPS_BTRFS_MASK, deps, DEPS_LAST, &deps_check_lock, error) || |
624 | 624 | !check_module_deps (&avail_module_deps, MODULE_DEPS_BTRFS_MASK, module_deps, MODULE_DEPS_LAST, &deps_check_lock, error)) |
625 | return FALSE; | |
625 | return NULL; | |
626 | 626 | |
627 | 627 | regex = g_regex_new (pattern, G_REGEX_EXTENDED, 0, error); |
628 | 628 | if (!regex) { |
702 | 702 | |
703 | 703 | if (!check_deps (&avail_deps, DEPS_BTRFS_MASK, deps, DEPS_LAST, &deps_check_lock, error) || |
704 | 704 | !check_module_deps (&avail_module_deps, MODULE_DEPS_BTRFS_MASK, module_deps, MODULE_DEPS_LAST, &deps_check_lock, error)) |
705 | return FALSE; | |
705 | return NULL; | |
706 | 706 | |
707 | 707 | if (snapshots_only) { |
708 | 708 | argv[4] = "-s"; |
816 | 816 | |
817 | 817 | if (!check_deps (&avail_deps, DEPS_BTRFS_MASK, deps, DEPS_LAST, &deps_check_lock, error) || |
818 | 818 | !check_module_deps (&avail_module_deps, MODULE_DEPS_BTRFS_MASK, module_deps, MODULE_DEPS_LAST, &deps_check_lock, error)) |
819 | return FALSE; | |
819 | return NULL; | |
820 | 820 | |
821 | 821 | regex = g_regex_new (pattern, G_REGEX_EXTENDED, 0, error); |
822 | 822 | if (!regex) { |
481 | 481 | |
482 | 482 | context = udev_new (); |
483 | 483 | device = udev_device_new_from_subsystem_sysname (context, "block", dev_name); |
484 | dev_uuid = udev_device_get_property_value (device, "UUID"); | |
484 | dev_uuid = udev_device_get_property_value (device, "ID_FS_UUID"); | |
485 | 485 | major_str = udev_device_get_property_value (device, "MAJOR"); |
486 | 486 | minor_str = udev_device_get_property_value (device, "MINOR"); |
487 | 487 |
129 | 129 | perc = filter_line_fsck (line, 5, error); |
130 | 130 | if (perc < 0) { |
131 | 131 | g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, |
132 | "An error occured when trying to parse a line with progress"); | |
132 | "An error occurred when trying to parse a line with progress"); | |
133 | 133 | return FALSE; |
134 | 134 | } |
135 | 135 |
289 | 289 | if (!probe) { |
290 | 290 | g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, |
291 | 291 | "Failed to create a new probe"); |
292 | return FALSE; | |
292 | return NULL; | |
293 | 293 | } |
294 | 294 | |
295 | 295 | fd = open (device, O_RDONLY|O_CLOEXEC); |
297 | 297 | g_set_error (error, BD_FS_ERROR, BD_FS_ERROR_FAIL, |
298 | 298 | "Failed to open the device '%s'", device); |
299 | 299 | blkid_free_probe (probe); |
300 | return FALSE; | |
300 | return NULL; | |
301 | 301 | } |
302 | 302 | |
303 | 303 | /* we may need to try mutliple times with some delays in case the device is |
312 | 312 | "Failed to create a probe for the device '%s'", device); |
313 | 313 | blkid_free_probe (probe); |
314 | 314 | synced_close (fd); |
315 | return FALSE; | |
315 | return NULL; | |
316 | 316 | } |
317 | 317 | |
318 | 318 | blkid_probe_enable_partitions (probe, 1); |
633 | 633 | BDKBDZramStats *ret = NULL; |
634 | 634 | |
635 | 635 | if (!check_module_deps (&avail_module_deps, MODULE_DEPS_ZRAM_MASK, module_deps, MODULE_DEPS_LAST, &deps_check_lock, error)) |
636 | return FALSE; | |
636 | return NULL; | |
637 | 637 | |
638 | 638 | ret = g_new0 (BDKBDZramStats, 1); |
639 | 639 |
1172 | 1172 | * bd_lvm_get_supported_pe_sizes: |
1173 | 1173 | * @error: (out): place to store error (if any) |
1174 | 1174 | * |
1175 | * Returns: (transfer full) (array zero-terminated=1): list of supported PE sizes | |
1175 | * Returns: (transfer full) (array fixed-size=25): list of supported PE sizes | |
1176 | 1176 | * |
1177 | 1177 | * Tech category: %BD_LVM_TECH_CALCS no mode (it is ignored) |
1178 | 1178 | */ |
3034 | 3034 | g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_CACHE_INVAL, |
3035 | 3035 | "Failed to determine cache pool name from: '%s'", ret); |
3036 | 3036 | g_free (ret); |
3037 | return FALSE; | |
3037 | return NULL; | |
3038 | 3038 | } |
3039 | 3039 | name_start++; |
3040 | 3040 | |
3043 | 3043 | g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_CACHE_INVAL, |
3044 | 3044 | "Failed to determine cache pool name from: '%s'", ret); |
3045 | 3045 | g_free (ret); |
3046 | return FALSE; | |
3046 | return NULL; | |
3047 | 3047 | } |
3048 | 3048 | |
3049 | 3049 | pool_name = g_strndup (name_start, name_end - name_start); |
707 | 707 | * bd_lvm_get_supported_pe_sizes: |
708 | 708 | * @error: (out): place to store error (if any) |
709 | 709 | * |
710 | * Returns: (transfer full) (array zero-terminated=1): list of supported PE sizes | |
710 | * Returns: (transfer full) (array fixed-size=25): list of supported PE sizes | |
711 | 711 | * |
712 | 712 | * Tech category: %BD_LVM_TECH_CALCS no mode (it is ignored) |
713 | 713 | */ |
2359 | 2359 | g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_CACHE_INVAL, |
2360 | 2360 | "Failed to determine cache pool name from: '%s'", ret); |
2361 | 2361 | g_free (ret); |
2362 | return FALSE; | |
2362 | return NULL; | |
2363 | 2363 | } |
2364 | 2364 | name_start++; |
2365 | 2365 | |
2368 | 2368 | g_set_error (error, BD_LVM_ERROR, BD_LVM_ERROR_CACHE_INVAL, |
2369 | 2369 | "Failed to determine cache pool name from: '%s'", ret); |
2370 | 2370 | g_free (ret); |
2371 | return FALSE; | |
2371 | return NULL; | |
2372 | 2372 | } |
2373 | 2373 | |
2374 | 2374 | pool_name = g_strndup (name_start, name_end - name_start); |
956 | 956 | gboolean found_array_line = FALSE; |
957 | 957 | |
958 | 958 | if (!check_deps (&avail_deps, DEPS_MDADM_MASK, deps, DEPS_LAST, &deps_check_lock, error)) |
959 | return FALSE; | |
959 | return NULL; | |
960 | 960 | |
961 | 961 | success = bd_utils_exec_and_capture_output (argv, NULL, &output, error); |
962 | 962 | if (!success) |
963 | 963 | /* error is already populated */ |
964 | return FALSE; | |
964 | return NULL; | |
965 | 965 | |
966 | 966 | table = parse_mdadm_vars (output, "\n", ":", &num_items); |
967 | 967 | g_free (output); |
982 | 982 | orig_data = ret->uuid; |
983 | 983 | if (orig_data) { |
984 | 984 | ret->uuid = bd_md_canonicalize_uuid (orig_data, error); |
985 | if (!ret->uuid) { | |
986 | g_prefix_error (error, "Failed to canonicalize MD UUID '%s': ", orig_data); | |
987 | g_free (orig_data); | |
988 | bd_md_examine_data_free (ret); | |
989 | return NULL; | |
990 | } | |
985 | 991 | g_free (orig_data); |
986 | 992 | } |
987 | 993 | |
988 | 994 | orig_data = ret->dev_uuid; |
989 | 995 | if (orig_data) { |
990 | 996 | ret->dev_uuid = bd_md_canonicalize_uuid (orig_data, error); |
997 | if (!ret->dev_uuid) { | |
998 | g_prefix_error (error, "Failed to canonicalize MD UUID '%s': ", orig_data); | |
999 | g_free (orig_data); | |
1000 | bd_md_examine_data_free (ret); | |
1001 | return NULL; | |
1002 | } | |
991 | 1003 | g_free (orig_data); |
992 | 1004 | } |
993 | 1005 | |
996 | 1008 | if (!success) { |
997 | 1009 | /* error is already populated */ |
998 | 1010 | bd_md_examine_data_free (ret); |
999 | return FALSE; | |
1011 | return NULL; | |
1000 | 1012 | } |
1001 | 1013 | |
1002 | 1014 | /* try to get a better information about RAID level because it may be |
1010 | 1022 | value++; |
1011 | 1023 | g_free (ret->level); |
1012 | 1024 | ret->level = g_strdup (value); |
1025 | } else if (!ret->uuid && g_str_has_prefix (output_fields[i], "MD_UUID=")) { | |
1026 | value = strchr (output_fields[i], '='); | |
1027 | value++; | |
1028 | ret->uuid = bd_md_canonicalize_uuid (value, error); | |
1029 | if (!ret->uuid) { | |
1030 | g_prefix_error (error, "Failed to canonicalize MD UUID '%s': ", value); | |
1031 | bd_md_examine_data_free (ret); | |
1032 | g_strfreev (output_fields); | |
1033 | return NULL; | |
1034 | } | |
1013 | 1035 | } |
1014 | 1036 | g_strfreev (output_fields); |
1015 | 1037 | |
1018 | 1040 | if (!success) { |
1019 | 1041 | /* error is already populated */ |
1020 | 1042 | bd_md_examine_data_free (ret); |
1021 | return FALSE; | |
1043 | return NULL; | |
1022 | 1044 | } |
1023 | 1045 | |
1024 | 1046 | /* try to find the "ARRAY /dev/md/something" pair in the output */ |
1069 | 1091 | * Tech category: %BD_MD_TECH_MDRAID-%BD_MD_TECH_MODE_QUERY |
1070 | 1092 | */ |
1071 | 1093 | BDMDDetailData* bd_md_detail (const gchar *raid_spec, GError **error) { |
1072 | const gchar *argv[] = {"mdadm", "--detail", NULL, NULL}; | |
1094 | const gchar *argv[] = {"mdadm", "--detail", NULL, NULL, NULL}; | |
1073 | 1095 | gchar *output = NULL; |
1074 | 1096 | gboolean success = FALSE; |
1075 | 1097 | GHashTable *table = NULL; |
1076 | 1098 | guint num_items = 0; |
1077 | 1099 | gchar *orig_uuid = NULL; |
1078 | gchar *mdadm_spec = NULL; | |
1100 | g_autofree gchar *mdadm_spec = NULL; | |
1101 | gchar *value = NULL; | |
1102 | gchar **output_fields = NULL; | |
1103 | guint i = 0; | |
1079 | 1104 | BDMDDetailData *ret = NULL; |
1080 | 1105 | |
1081 | 1106 | if (!check_deps (&avail_deps, DEPS_MDADM_MASK, deps, DEPS_LAST, &deps_check_lock, error)) |
1082 | return FALSE; | |
1107 | return NULL; | |
1083 | 1108 | |
1084 | 1109 | mdadm_spec = get_mdadm_spec_from_input (raid_spec, error); |
1085 | 1110 | if (!mdadm_spec) |
1089 | 1114 | argv[2] = mdadm_spec; |
1090 | 1115 | |
1091 | 1116 | success = bd_utils_exec_and_capture_output (argv, NULL, &output, error); |
1092 | if (!success) { | |
1093 | g_free (mdadm_spec); | |
1094 | /* error is already populated */ | |
1095 | return NULL; | |
1096 | } | |
1117 | if (!success) | |
1118 | /* error is already populated */ | |
1119 | return NULL; | |
1097 | 1120 | |
1098 | 1121 | table = parse_mdadm_vars (output, "\n", ":", &num_items); |
1099 | 1122 | g_free (output); |
1100 | 1123 | if (!table || (num_items == 0)) { |
1101 | g_free (mdadm_spec); | |
1102 | 1124 | /* something bad happened or some expected items were missing */ |
1103 | 1125 | g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to parse mddetail data"); |
1104 | 1126 | if (table) |
1108 | 1130 | |
1109 | 1131 | ret = get_detail_data_from_table (table, TRUE); |
1110 | 1132 | if (!ret) { |
1111 | g_free (mdadm_spec); | |
1112 | 1133 | g_set_error (error, BD_MD_ERROR, BD_MD_ERROR_PARSE, "Failed to get mddetail data"); |
1113 | 1134 | return NULL; |
1114 | 1135 | } |
1121 | 1142 | g_free (orig_uuid); |
1122 | 1143 | } |
1123 | 1144 | |
1124 | g_free (mdadm_spec); | |
1145 | if (!ret->uuid) { | |
1146 | argv[2] = "--export"; | |
1147 | argv[3] = mdadm_spec; | |
1148 | success = bd_utils_exec_and_capture_output (argv, NULL, &output, error); | |
1149 | if (!success) { | |
1150 | /* error is already populated */ | |
1151 | bd_md_detail_data_free (ret); | |
1152 | return NULL; | |
1153 | } | |
1154 | ||
1155 | /* try to get a better information about RAID level because it may be | |
1156 | missing in the output without --export */ | |
1157 | output_fields = g_strsplit (output, "\n", 0); | |
1158 | g_free (output); | |
1159 | output = NULL; | |
1160 | for (i = 0; (i < g_strv_length (output_fields) - 1); i++) | |
1161 | if (g_str_has_prefix (output_fields[i], "MD_UUID=")) { | |
1162 | value = strchr (output_fields[i], '='); | |
1163 | value++; | |
1164 | ret->uuid = bd_md_canonicalize_uuid (value, error); | |
1165 | if (!ret->uuid) { | |
1166 | g_prefix_error (error, "Failed to canonicalize MD UUID '%s': ", value); | |
1167 | bd_md_detail_data_free (ret); | |
1168 | g_strfreev (output_fields); | |
1169 | return NULL; | |
1170 | } | |
1171 | } | |
1172 | g_strfreev (output_fields); | |
1173 | } | |
1125 | 1174 | |
1126 | 1175 | return ret; |
1127 | 1176 | } |
406 | 406 | /* we are only interested in multipath maps */ |
407 | 407 | if (map_is_multipath (names->name, error)) { |
408 | 408 | deps = get_map_deps (names->name, NULL, error); |
409 | if (*error) { | |
410 | g_prefix_error (error, "Failed to determine deps for '%s'", names->name); | |
409 | if (!deps) { | |
410 | if (*error) | |
411 | g_prefix_error (error, "Failed to determine deps for '%s'", names->name); | |
412 | else | |
413 | g_set_error (error, BD_MPATH_ERROR, BD_MPATH_ERROR_NOT_ROOT, | |
414 | "No deps found for '%s'", names->name); | |
411 | 415 | g_free (dev_path); |
412 | 416 | dm_task_destroy (task_names); |
417 | g_strfreev (deps); | |
413 | 418 | return FALSE; |
414 | 419 | } |
415 | 420 | for (dev_name = deps; !ret && *dev_name; dev_name++) |
257 | 257 | if (success != 0) { |
258 | 258 | g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, |
259 | 259 | "Failed to create ndctl context"); |
260 | return FALSE; | |
260 | return NULL; | |
261 | 261 | } |
262 | 262 | |
263 | 263 | ndctl_bus_foreach (ctx, bus) { |
436 | 436 | break; |
437 | 437 | default: |
438 | 438 | g_set_error (error, BD_NVDIMM_ERROR, BD_NVDIMM_ERROR_NAMESPACE_FAIL, |
439 | "Failed to get information about namespaces: Unknow mode."); | |
439 | "Failed to get information about namespaces: Unknown mode."); | |
440 | 440 | bd_nvdimm_namespace_info_free (info); |
441 | 441 | return NULL; |
442 | 442 | } |
55 | 55 | |
56 | 56 | requested_plugins = BlockDev.plugin_specs_from_names(("fs", "loop")) |
57 | 57 | _vfat_version = _get_dosfstools_version() |
58 | _loop_size = 100 * 1024**2 | |
58 | 59 | |
59 | 60 | @classmethod |
60 | 61 | def setUpClass(cls): |
76 | 77 | |
77 | 78 | def setUp(self): |
78 | 79 | self.addCleanup(self._clean_up) |
79 | self.dev_file = utils.create_sparse_tempfile("fs_test", 100 * 1024**2) | |
80 | self.dev_file2 = utils.create_sparse_tempfile("fs_test", 100 * 1024**2) | |
80 | self.dev_file = utils.create_sparse_tempfile("fs_test", self._loop_size) | |
81 | self.dev_file2 = utils.create_sparse_tempfile("fs_test", self._loop_size) | |
81 | 82 | try: |
82 | 83 | self.loop_dev = utils.create_lio_device(self.dev_file) |
83 | 84 | except RuntimeError as e: |
571 | 572 | resize_function=BlockDev.fs_ext4_resize) |
572 | 573 | |
573 | 574 | class XfsTestMkfs(FSTestCase): |
575 | _loop_size = 500 * 1024**2 | |
576 | ||
574 | 577 | @tag_test(TestTags.CORE) |
575 | 578 | def test_xfs_mkfs(self): |
576 | 579 | """Verify that it is possible to create a new xfs file system""" |
592 | 595 | BlockDev.fs_wipe(self.loop_dev, True) |
593 | 596 | |
594 | 597 | class XfsTestWipe(FSTestCase): |
598 | _loop_size = 500 * 1024**2 | |
599 | ||
595 | 600 | def test_xfs_wipe(self): |
596 | 601 | """Verify that it is possible to wipe an xfs file system""" |
597 | 602 | |
622 | 627 | BlockDev.fs_wipe(self.loop_dev, True) |
623 | 628 | |
624 | 629 | class XfsTestCheck(FSTestCase): |
630 | _loop_size = 500 * 1024**2 | |
631 | ||
625 | 632 | def test_xfs_check(self): |
626 | 633 | """Verify that it is possible to check an xfs file system""" |
627 | 634 | |
641 | 648 | self.assertTrue(succ) |
642 | 649 | |
643 | 650 | class XfsTestRepair(FSTestCase): |
651 | _loop_size = 500 * 1024**2 | |
652 | ||
644 | 653 | def test_xfs_repair(self): |
645 | 654 | """Verify that it is possible to repair an xfs file system""" |
646 | 655 | |
658 | 667 | self.assertTrue(succ) |
659 | 668 | |
660 | 669 | class XfsGetInfo(FSTestCase): |
670 | _loop_size = 500 * 1024**2 | |
671 | ||
661 | 672 | @tag_test(TestTags.CORE) |
662 | 673 | def test_xfs_get_info(self): |
663 | 674 | """Verify that it is possible to get info about an xfs file system""" |
672 | 683 | fi = BlockDev.fs_xfs_get_info(self.loop_dev) |
673 | 684 | |
674 | 685 | self.assertEqual(fi.block_size, 4096) |
675 | self.assertEqual(fi.block_count, 100 * 1024**2 / 4096) | |
686 | self.assertEqual(fi.block_count, 500 * 1024**2 / 4096) | |
676 | 687 | self.assertEqual(fi.label, "") |
677 | 688 | # should be an non-empty string |
678 | 689 | self.assertTrue(fi.uuid) |
679 | 690 | |
680 | 691 | class XfsSetLabel(FSTestCase): |
692 | _loop_size = 500 * 1024**2 | |
693 | ||
681 | 694 | def test_xfs_set_label(self): |
682 | 695 | """Verify that it is possible to set label of an xfs file system""" |
683 | 696 | |
711 | 724 | self.assertEqual(fi.label, "") |
712 | 725 | |
713 | 726 | class XfsResize(FSTestCase): |
727 | _loop_size = 500 * 1024**2 | |
728 | ||
714 | 729 | def _destroy_lvm(self): |
715 | 730 | run("vgremove --yes libbd_fs_tests >/dev/null 2>&1") |
716 | 731 | run("pvremove --yes %s >/dev/null 2>&1" % self.loop_dev) |
720 | 735 | |
721 | 736 | run("pvcreate -ff -y %s >/dev/null 2>&1" % self.loop_dev) |
722 | 737 | run("vgcreate -s10M libbd_fs_tests %s >/dev/null 2>&1" % self.loop_dev) |
723 | run("lvcreate -n xfs_test -L50M libbd_fs_tests >/dev/null 2>&1") | |
738 | run("lvcreate -n xfs_test -L350M libbd_fs_tests >/dev/null 2>&1") | |
724 | 739 | self.addCleanup(self._destroy_lvm) |
725 | 740 | lv = "/dev/libbd_fs_tests/xfs_test" |
726 | 741 | |
730 | 745 | with mounted(lv, self.mount_dir): |
731 | 746 | fi = BlockDev.fs_xfs_get_info(lv) |
732 | 747 | self.assertTrue(fi) |
733 | self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2) | |
748 | self.assertEqual(fi.block_size * fi.block_count, 350 * 1024**2) | |
734 | 749 | |
735 | 750 | # no change, nothing should happen |
736 | 751 | with mounted(lv, self.mount_dir): |
740 | 755 | with mounted(lv, self.mount_dir): |
741 | 756 | fi = BlockDev.fs_xfs_get_info(lv) |
742 | 757 | self.assertTrue(fi) |
743 | self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2) | |
758 | self.assertEqual(fi.block_size * fi.block_count, 350 * 1024**2) | |
744 | 759 | |
745 | 760 | # (still) impossible to shrink an XFS file system |
746 | 761 | xfs_version = _get_xfs_version() |
749 | 764 | with self.assertRaises(GLib.GError): |
750 | 765 | succ = BlockDev.fs_resize(lv, 40 * 1024**2) |
751 | 766 | |
752 | run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1") | |
767 | run("lvresize -L400M libbd_fs_tests/xfs_test >/dev/null 2>&1") | |
753 | 768 | # should grow |
754 | 769 | with mounted(lv, self.mount_dir): |
755 | 770 | succ = BlockDev.fs_xfs_resize(self.mount_dir, 0, None) |
757 | 772 | with mounted(lv, self.mount_dir): |
758 | 773 | fi = BlockDev.fs_xfs_get_info(lv) |
759 | 774 | self.assertTrue(fi) |
760 | self.assertEqual(fi.block_size * fi.block_count, 70 * 1024**2) | |
761 | ||
762 | run("lvresize -L90M libbd_fs_tests/xfs_test >/dev/null 2>&1") | |
763 | # should grow just to 80 MiB | |
764 | with mounted(lv, self.mount_dir): | |
765 | succ = BlockDev.fs_xfs_resize(self.mount_dir, 80 * 1024**2 / fi.block_size, None) | |
775 | self.assertEqual(fi.block_size * fi.block_count, 400 * 1024**2) | |
776 | ||
777 | run("lvresize -L450M libbd_fs_tests/xfs_test >/dev/null 2>&1") | |
778 | # should grow just to 430 MiB | |
779 | with mounted(lv, self.mount_dir): | |
780 | succ = BlockDev.fs_xfs_resize(self.mount_dir, 430 * 1024**2 / fi.block_size, None) | |
766 | 781 | self.assertTrue(succ) |
767 | 782 | with mounted(lv, self.mount_dir): |
768 | 783 | fi = BlockDev.fs_xfs_get_info(lv) |
769 | 784 | self.assertTrue(fi) |
770 | self.assertEqual(fi.block_size * fi.block_count, 80 * 1024**2) | |
771 | ||
772 | # should grow to 90 MiB | |
785 | self.assertEqual(fi.block_size * fi.block_count, 430 * 1024**2) | |
786 | ||
787 | # should grow to 450 MiB | |
773 | 788 | with mounted(lv, self.mount_dir): |
774 | 789 | succ = BlockDev.fs_xfs_resize(self.mount_dir, 0, None) |
775 | 790 | self.assertTrue(succ) |
776 | 791 | with mounted(lv, self.mount_dir): |
777 | 792 | fi = BlockDev.fs_xfs_get_info(lv) |
778 | 793 | self.assertTrue(fi) |
779 | self.assertEqual(fi.block_size * fi.block_count, 90 * 1024**2) | |
794 | self.assertEqual(fi.block_size * fi.block_count, 450 * 1024**2) | |
780 | 795 | |
781 | 796 | class VfatTestMkfs(FSTestCase): |
782 | 797 | def test_vfat_mkfs(self): |
1111 | 1126 | |
1112 | 1127 | backing_file = create_sparse_tempfile("ro_mount", 50 * 1024**2) |
1113 | 1128 | self.addCleanup(os.unlink, backing_file) |
1114 | self.assertTrue(BlockDev.fs_xfs_mkfs(backing_file, None)) | |
1129 | self.assertTrue(BlockDev.fs_ext2_mkfs(backing_file, None)) | |
1115 | 1130 | |
1116 | 1131 | succ, dev = BlockDev.loop_setup(backing_file, 0, 0, True, False) |
1117 | 1132 | self.assertTrue(succ) |
1276 | 1291 | |
1277 | 1292 | class GenericCheck(FSTestCase): |
1278 | 1293 | log = [] |
1294 | _loop_size = 500 * 1024**2 | |
1279 | 1295 | |
1280 | 1296 | def _test_generic_check(self, mkfs_function): |
1281 | 1297 | # clean the device |
1325 | 1341 | self._test_generic_check(mkfs_function=BlockDev.fs_ntfs_mkfs) |
1326 | 1342 | |
1327 | 1343 | class GenericRepair(FSTestCase): |
1344 | _loop_size = 500 * 1024**2 | |
1345 | ||
1328 | 1346 | def _test_generic_repair(self, mkfs_function): |
1329 | 1347 | # clean the device |
1330 | 1348 | succ = BlockDev.fs_clean(self.loop_dev) |
1351 | 1369 | self._test_generic_repair(mkfs_function=BlockDev.fs_ntfs_mkfs) |
1352 | 1370 | |
1353 | 1371 | class GenericSetLabel(FSTestCase): |
1372 | _loop_size = 500 * 1024**2 | |
1373 | ||
1354 | 1374 | def _test_generic_set_label(self, mkfs_function): |
1355 | 1375 | # clean the device |
1356 | 1376 | succ = BlockDev.fs_clean(self.loop_dev) |
1377 | 1397 | self._test_generic_set_label(mkfs_function=BlockDev.fs_ntfs_mkfs) |
1378 | 1398 | |
1379 | 1399 | class GenericResize(FSTestCase): |
1400 | _loop_size = 500 * 1024**2 | |
1401 | ||
1380 | 1402 | def _test_generic_resize(self, mkfs_function, fs_info_func=None, info_size_func=None): |
1381 | 1403 | # clean the device |
1382 | 1404 | succ = BlockDev.fs_clean(self.loop_dev) |
1461 | 1483 | |
1462 | 1484 | run("pvcreate -ff -y %s >/dev/null 2>&1" % self.loop_dev) |
1463 | 1485 | run("vgcreate -s10M libbd_fs_tests %s >/dev/null 2>&1" % self.loop_dev) |
1464 | run("lvcreate -n xfs_test -L50M libbd_fs_tests >/dev/null 2>&1") | |
1486 | run("lvcreate -n xfs_test -L350M libbd_fs_tests >/dev/null 2>&1") | |
1465 | 1487 | self.addCleanup(self._destroy_lvm) |
1466 | 1488 | |
1467 | 1489 | lv = "/dev/libbd_fs_tests/xfs_test" |
1475 | 1497 | with mounted(lv, self.mount_dir): |
1476 | 1498 | fi = BlockDev.fs_xfs_get_info(lv) |
1477 | 1499 | self.assertTrue(fi) |
1478 | self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2) | |
1500 | self.assertEqual(fi.block_size * fi.block_count, 350 * 1024**2) | |
1479 | 1501 | |
1480 | 1502 | # no change, nothing should happen |
1481 | 1503 | with mounted(lv, self.mount_dir): |
1485 | 1507 | with mounted(lv, self.mount_dir): |
1486 | 1508 | fi = BlockDev.fs_xfs_get_info(lv) |
1487 | 1509 | self.assertTrue(fi) |
1488 | self.assertEqual(fi.block_size * fi.block_count, 50 * 1024**2) | |
1510 | self.assertEqual(fi.block_size * fi.block_count, 350 * 1024**2) | |
1489 | 1511 | |
1490 | 1512 | # (still) impossible to shrink an XFS file system |
1491 | 1513 | xfs_version = _get_xfs_version() |
1494 | 1516 | with self.assertRaises(GLib.GError): |
1495 | 1517 | succ = BlockDev.fs_resize(lv, 40 * 1024**2) |
1496 | 1518 | |
1497 | run("lvresize -L70M libbd_fs_tests/xfs_test >/dev/null 2>&1") | |
1519 | run("lvresize -L400M libbd_fs_tests/xfs_test >/dev/null 2>&1") | |
1498 | 1520 | # should grow |
1499 | 1521 | with mounted(lv, self.mount_dir): |
1500 | 1522 | succ = BlockDev.fs_resize(lv, 0) |
1502 | 1524 | with mounted(lv, self.mount_dir): |
1503 | 1525 | fi = BlockDev.fs_xfs_get_info(lv) |
1504 | 1526 | self.assertTrue(fi) |
1505 | self.assertEqual(fi.block_size * fi.block_count, 70 * 1024**2) | |
1506 | ||
1507 | run("lvresize -L90M libbd_fs_tests/xfs_test >/dev/null 2>&1") | |
1508 | # should grow just to 80 MiB | |
1509 | with mounted(lv, self.mount_dir): | |
1510 | succ = BlockDev.fs_resize(lv, 80 * 1024**2) | |
1527 | self.assertEqual(fi.block_size * fi.block_count, 400 * 1024**2) | |
1528 | ||
1529 | run("lvresize -L450M libbd_fs_tests/xfs_test >/dev/null 2>&1") | |
1530 | # should grow just to 430 MiB | |
1531 | with mounted(lv, self.mount_dir): | |
1532 | succ = BlockDev.fs_resize(lv, 430 * 1024**2) | |
1511 | 1533 | self.assertTrue(succ) |
1512 | 1534 | with mounted(lv, self.mount_dir): |
1513 | 1535 | fi = BlockDev.fs_xfs_get_info(lv) |
1514 | 1536 | self.assertTrue(fi) |
1515 | self.assertEqual(fi.block_size * fi.block_count, 80 * 1024**2) | |
1516 | ||
1517 | # should grow to 90 MiB | |
1537 | self.assertEqual(fi.block_size * fi.block_count, 430 * 1024**2) | |
1538 | ||
1539 | # should grow to 450 MiB | |
1518 | 1540 | with mounted(lv, self.mount_dir): |
1519 | 1541 | succ = BlockDev.fs_resize(lv, 0) |
1520 | 1542 | self.assertTrue(succ) |
1521 | 1543 | with mounted(lv, self.mount_dir): |
1522 | 1544 | fi = BlockDev.fs_xfs_get_info(lv) |
1523 | 1545 | self.assertTrue(fi) |
1524 | self.assertEqual(fi.block_size * fi.block_count, 90 * 1024**2) | |
1546 | self.assertEqual(fi.block_size * fi.block_count, 450 * 1024**2) | |
1525 | 1547 | |
1526 | 1548 | |
1527 | 1549 | class FSFreezeTest(FSTestCase): |
1550 | _loop_size = 500 * 1024**2 | |
1528 | 1551 | |
1529 | 1552 | def _clean_up(self): |
1530 | 1553 | try: |
6 | 6 | import re |
7 | 7 | import shutil |
8 | 8 | import subprocess |
9 | import time | |
10 | from contextlib import contextmanager | |
9 | 11 | from distutils.version import LooseVersion |
10 | 12 | from itertools import chain |
11 | 13 | |
15 | 17 | import dbus |
16 | 18 | sb = dbus.SystemBus() |
17 | 19 | lvm_dbus_running = any("lvmdbus" in name for name in chain(sb.list_names(), sb.list_activatable_names())) |
20 | ||
21 | ||
22 | @contextmanager | |
23 | def wait_for_sync(vg_name, lv_name): | |
24 | try: | |
25 | yield | |
26 | finally: | |
27 | time.sleep(2) | |
28 | while True: | |
29 | ret, out, _err = run_command("LC_ALL=C lvs -o copy_percent --noheadings %s/%s" % (vg_name, lv_name)) | |
30 | if ret != 0: | |
31 | break | |
32 | if int(float(out)) == 100: | |
33 | break | |
34 | time.sleep(1) | |
18 | 35 | |
19 | 36 | |
20 | 37 | class LVMTestCase(unittest.TestCase): |
67 | 84 | def test_get_supported_pe_sizes(self): |
68 | 85 | """Verify that supported PE sizes are really supported""" |
69 | 86 | |
70 | for size in BlockDev.lvm_get_supported_pe_sizes(): | |
87 | supported = BlockDev.lvm_get_supported_pe_sizes() | |
88 | ||
89 | for size in supported: | |
71 | 90 | self.assertTrue(BlockDev.lvm_is_supported_pe_size(size)) |
91 | ||
92 | self.assertIn(4 * 1024, supported) | |
93 | self.assertIn(4 * 1024 **2, supported) | |
94 | self.assertIn(16 * 1024**3, supported) | |
72 | 95 | |
73 | 96 | @tag_test(TestTags.NOSTORAGE) |
74 | 97 | def test_get_max_lv_size(self): |
252 | 275 | |
253 | 276 | @unittest.skipUnless(lvm_dbus_running, "LVM DBus not running") |
254 | 277 | class LvmPVonlyTestCase(LVMTestCase): |
278 | ||
279 | _sparse_size = 1024**3 | |
280 | ||
255 | 281 | # :TODO: |
256 | 282 | # * test pvmove (must create two PVs, a VG, a VG and some data in it |
257 | 283 | # first) |
258 | 284 | # * some complex test for pvs, vgs, lvs, pvinfo, vginfo and lvinfo |
259 | 285 | def setUp(self): |
260 | 286 | self.addCleanup(self._clean_up) |
261 | self.dev_file = create_sparse_tempfile("lvm_test", 1024**3) | |
262 | self.dev_file2 = create_sparse_tempfile("lvm_test", 1024**3) | |
287 | self.dev_file = create_sparse_tempfile("lvm_test", self._sparse_size) | |
288 | self.dev_file2 = create_sparse_tempfile("lvm_test", self._sparse_size) | |
263 | 289 | try: |
264 | 290 | self.loop_dev = create_lio_device(self.dev_file) |
265 | 291 | except RuntimeError as e: |
734 | 760 | |
735 | 761 | @unittest.skipUnless(lvm_dbus_running, "LVM DBus not running") |
736 | 762 | class LvmTestLVcreateType(LvmPVVGLVTestCase): |
763 | ||
764 | _sparse_size = 200 * 1024**2 | |
765 | ||
737 | 766 | def test_lvcreate_type(self): |
738 | 767 | """Verify it's possible to create LVs with various types""" |
739 | 768 | |
747 | 776 | self.assertTrue(succ) |
748 | 777 | |
749 | 778 | # try to create a striped LV |
750 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "striped", [self.loop_dev, self.loop_dev2], None) | |
779 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "striped", [self.loop_dev, self.loop_dev2], None) | |
751 | 780 | self.assertTrue(succ) |
752 | 781 | |
753 | 782 | # verify that the LV has the requested segtype |
757 | 786 | succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None) |
758 | 787 | self.assertTrue(succ) |
759 | 788 | |
760 | # try to create a mirrored LV | |
761 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None) | |
762 | self.assertTrue(succ) | |
789 | with wait_for_sync("testVG", "testLV"): | |
790 | # try to create a mirrored LV | |
791 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None) | |
792 | self.assertTrue(succ) | |
763 | 793 | |
764 | 794 | # verify that the LV has the requested segtype |
765 | 795 | info = BlockDev.lvm_lvinfo("testVG", "testLV") |
768 | 798 | succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None) |
769 | 799 | self.assertTrue(succ) |
770 | 800 | |
771 | # try to create a raid1 LV | |
772 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None) | |
773 | self.assertTrue(succ) | |
801 | with wait_for_sync("testVG", "testLV"): | |
802 | # try to create a raid1 LV | |
803 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None) | |
804 | self.assertTrue(succ) | |
774 | 805 | |
775 | 806 | # verify that the LV has the requested segtype |
776 | 807 | info = BlockDev.lvm_lvinfo("testVG", "testLV") |
6 | 6 | import re |
7 | 7 | import shutil |
8 | 8 | import subprocess |
9 | import time | |
10 | from contextlib import contextmanager | |
9 | 11 | from distutils.version import LooseVersion |
10 | 12 | |
11 | 13 | from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, fake_utils, fake_path, TestTags, tag_test, run_command |
12 | 14 | from gi.repository import BlockDev, GLib |
15 | ||
16 | ||
17 | @contextmanager | |
18 | def wait_for_sync(vg_name, lv_name): | |
19 | try: | |
20 | yield | |
21 | finally: | |
22 | time.sleep(2) | |
23 | while True: | |
24 | info = BlockDev.lvm_lvinfo(vg_name, lv_name) | |
25 | if not info: | |
26 | break | |
27 | if info.copy_percent == 100: | |
28 | break | |
29 | time.sleep(1) | |
13 | 30 | |
14 | 31 | |
15 | 32 | class LVMTestCase(unittest.TestCase): |
60 | 77 | def test_get_supported_pe_sizes(self): |
61 | 78 | """Verify that supported PE sizes are really supported""" |
62 | 79 | |
63 | for size in BlockDev.lvm_get_supported_pe_sizes(): | |
80 | supported = BlockDev.lvm_get_supported_pe_sizes() | |
81 | ||
82 | for size in supported: | |
64 | 83 | self.assertTrue(BlockDev.lvm_is_supported_pe_size(size)) |
84 | ||
85 | self.assertIn(4 * 1024, supported) | |
86 | self.assertIn(4 * 1024 **2, supported) | |
87 | self.assertIn(16 * 1024**3, supported) | |
65 | 88 | |
66 | 89 | @tag_test(TestTags.NOSTORAGE) |
67 | 90 | def test_get_max_lv_size(self): |
237 | 260 | BlockDev.lvm_cache_get_mode_from_str("bla") |
238 | 261 | |
239 | 262 | class LvmPVonlyTestCase(LVMTestCase): |
263 | ||
264 | _sparse_size = 1024**3 | |
265 | ||
240 | 266 | # :TODO: |
241 | 267 | # * test pvmove (must create two PVs, a VG, a VG and some data in it |
242 | 268 | # first) |
243 | 269 | # * some complex test for pvs, vgs, lvs, pvinfo, vginfo and lvinfo |
244 | 270 | def setUp(self): |
245 | 271 | self.addCleanup(self._clean_up) |
246 | self.dev_file = create_sparse_tempfile("lvm_test", 1024**3) | |
247 | self.dev_file2 = create_sparse_tempfile("lvm_test", 1024**3) | |
272 | self.dev_file = create_sparse_tempfile("lvm_test", self._sparse_size) | |
273 | self.dev_file2 = create_sparse_tempfile("lvm_test", self._sparse_size) | |
248 | 274 | try: |
249 | 275 | self.loop_dev = create_lio_device(self.dev_file) |
250 | 276 | except RuntimeError as e: |
666 | 692 | self.assertTrue(succ) |
667 | 693 | |
668 | 694 | class LvmTestLVcreateType(LvmPVVGLVTestCase): |
695 | _sparse_size = 200 * 1024**2 | |
696 | ||
669 | 697 | def test_lvcreate_type(self): |
670 | 698 | """Verify it's possible to create LVs with various types""" |
671 | 699 | |
679 | 707 | self.assertTrue(succ) |
680 | 708 | |
681 | 709 | # try to create a striped LV |
682 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "striped", [self.loop_dev, self.loop_dev2], None) | |
710 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "striped", [self.loop_dev, self.loop_dev2], None) | |
683 | 711 | self.assertTrue(succ) |
684 | 712 | |
685 | 713 | # verify that the LV has the requested segtype |
689 | 717 | succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None) |
690 | 718 | self.assertTrue(succ) |
691 | 719 | |
692 | # try to create a mirrored LV | |
693 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None) | |
694 | self.assertTrue(succ) | |
720 | with wait_for_sync("testVG", "testLV"): | |
721 | # try to create a mirrored LV | |
722 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "mirror", [self.loop_dev, self.loop_dev2], None) | |
723 | self.assertTrue(succ) | |
695 | 724 | |
696 | 725 | # verify that the LV has the requested segtype |
697 | 726 | info = BlockDev.lvm_lvinfo("testVG", "testLV") |
700 | 729 | succ = BlockDev.lvm_lvremove("testVG", "testLV", True, None) |
701 | 730 | self.assertTrue(succ) |
702 | 731 | |
703 | # try to create a raid1 LV | |
704 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 512 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None) | |
705 | self.assertTrue(succ) | |
732 | with wait_for_sync("testVG", "testLV"): | |
733 | # try to create a raid1 LV | |
734 | succ = BlockDev.lvm_lvcreate("testVG", "testLV", 100 * 1024**2, "raid1", [self.loop_dev, self.loop_dev2], None) | |
735 | self.assertTrue(succ) | |
706 | 736 | |
707 | 737 | # verify that the LV has the requested segtype |
708 | 738 | info = BlockDev.lvm_lvinfo("testVG", "testLV") |
5 | 5 | import overrides_hack |
6 | 6 | import six |
7 | 7 | |
8 | from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, fake_utils, fake_path, TestTags, tag_test | |
8 | from utils import create_sparse_tempfile, create_lio_device, delete_lio_device, fake_utils, fake_path, TestTags, tag_test, run_command | |
9 | 9 | from gi.repository import BlockDev, GLib |
10 | 10 | |
11 | 11 | |
89 | 89 | |
90 | 90 | class MDTestCase(MDTest): |
91 | 91 | |
92 | _sparse_size = 10 * 1024**2 | |
93 | ||
92 | 94 | def setUp(self): |
93 | 95 | if os.uname()[-1] == "i686": |
94 | 96 | self.skipTest("Skipping hanging MD RAID tests on i686") |
95 | 97 | |
96 | 98 | self.addCleanup(self._clean_up) |
97 | self.dev_file = create_sparse_tempfile("md_test", 10 * 1024**2) | |
98 | self.dev_file2 = create_sparse_tempfile("md_test", 10 * 1024**2) | |
99 | self.dev_file3 = create_sparse_tempfile("md_test", 10 * 1024**2) | |
99 | self.dev_file = create_sparse_tempfile("md_test", self._sparse_size) | |
100 | self.dev_file2 = create_sparse_tempfile("md_test", self._sparse_size) | |
101 | self.dev_file3 = create_sparse_tempfile("md_test", self._sparse_size) | |
100 | 102 | |
101 | 103 | try: |
102 | 104 | self.loop_dev = create_lio_device(self.dev_file) |
585 | 587 | action = f.read().strip() |
586 | 588 | self.assertEqual(action, "check") |
587 | 589 | |
590 | ||
591 | class MDTestDDFRAID(MDTestCase): | |
592 | ||
593 | _sparse_size = 50 * 1024**2 | |
594 | ||
595 | def _clean_up(self): | |
596 | try: | |
597 | BlockDev.md_deactivate("bd_test_ddf") | |
598 | except: | |
599 | pass | |
600 | try: | |
601 | BlockDev.md_deactivate(BlockDev.md_node_from_name("bd_test_ddf")) | |
602 | except: | |
603 | pass | |
604 | ||
605 | super(MDTestDDFRAID, self)._clean_up() | |
606 | ||
607 | def test_examine_ddf_container(self): | |
608 | succ = BlockDev.md_create("bd_test_md", "container", | |
609 | [self.loop_dev, self.loop_dev2], | |
610 | 0, "ddf", False) | |
611 | self.assertTrue(succ) | |
612 | ||
613 | # we cannot create the array with libblockdev because we cannot pass the --raid-devices option | |
614 | ret, _out, err = run_command("mdadm --create /dev/md/bd_test_ddf --run --level=raid0 --raid-devices=2 /dev/md/bd_test_md") | |
615 | self.assertEqual(ret, 0, msg="Failed to create RAID for DDF test: %s" % err) | |
616 | ||
617 | edata = BlockDev.md_examine(self.loop_dev) | |
618 | self.assertIsNotNone(edata) | |
619 | self.assertIsNotNone(edata.uuid) | |
620 | self.assertEqual(edata.level, "container") | |
621 | self.assertEqual(edata.metadata, "ddf") | |
622 | ||
623 | ddata = BlockDev.md_detail("bd_test_md") | |
624 | self.assertIsNotNone(ddata) | |
625 | self.assertIsNotNone(ddata.uuid) | |
626 | self.assertEqual(ddata.uuid, edata.uuid) | |
627 | self.assertEqual(ddata.level, "container") | |
628 | self.assertEqual(ddata.metadata, "ddf") | |
629 | ||
630 | ||
588 | 631 | class FakeMDADMutilTest(MDTest): |
589 | 632 | # no setUp nor tearDown needed, we are gonna use fake utils |
590 | 633 | @tag_test(TestTags.NOSTORAGE) |