Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(NFSSR): ensure we can attach SR during attach_from_config call #44

Open
wants to merge 20 commits into
base: 2.30.8-8.2
Choose a base branch
from

Commits on Oct 13, 2023

  1. backport of ccd121c: CA-354692: check for device parameter in create/…

    …probe calls
    
    Signed-off-by: Mark Syms <[email protected]>
    Signed-off-by: Ronan Abhamon <[email protected]>
    MarkSymsCtx authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    b7d3ea7 View commit details
    Browse the repository at this point in the history
  2. Update xs-sm.service's description for XCP-ng

    This was a patch added to the sm RPM git repo before we had this
    forked git repo for sm in the xcp-ng github organisation.
    stormi authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    3a0c67d View commit details
    Browse the repository at this point in the history
  3. Add TrueNAS multipath config

    This was a patch added to the sm RPM git repo before we had this
    forked git repo for sm in the xcp-ng github organisation.
    stormi authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    a8168e1 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6120e7f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    dbfbe5f View commit details
    Browse the repository at this point in the history
  6. Re-add the ext4 driver for users who need to transition

    The driver is needed to transition to the ext driver.
    Users who upgrade from XCP-ng <= 8.0 need a working driver so that they
    can move the VMs out of the ext4 SR and delete the SR.
    
    Not keeping that driver would force such users to upgrade to 8.1 first,
    convert their SR, then upgrade to a higher version.
    
    However, like in XCP-ng 8.1, the driver will refuse any new ext4 SR
    creation.
    stormi authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    696bd1c View commit details
    Browse the repository at this point in the history
  7. feat(drivers): add LinstorSR driver

    Some important points:
    
    - linstor.KV must use an identifier name that starts with a letter (so it uses a "sr-" prefix).
    
    - Encrypted VDI are supported with key_hash attribute (not tested, experimental).
    
    - When a new LINSTOR volume is created on a host (via snapshot or create), the remaining diskless
    devices are not necessarily created on other hosts. So if a resource definition exists without
    local device path, we ask it to LINSTOR. Wait 5s for symlink creation when a new volume
    is created => 5s is is purely arbitrary, but this guarantees that we do not try to access the
    volume if the symlink has not yet been created by the udev rule.
    
    - Can change the provisioning using the device config 'provisioning' param.
    
    - We can only increase volume size (See: LINBIT/linstor-server#66),
    it would be great if we could shrink volumes to limit the space used by the snapshots.
    
    - Inflate/Deflate can only be executed on the master host, a linstor-manager plugin is present
    to do this from slaves. The same plugin is used to open LINSTOR ports + start controller.
    
    - Use a `total_allocated_volume_size` method to have a good idea of the reserved memory
    Why? Because `physical_free_size` is computed using the LVM used size, in the case of thick provisioning it's ok,
    but when thin provisioning is choosen LVM returns only the allocated size using the used block count. So this method
    solves this problem, it takes the fixed virtual volume size of each node to compute the required size to store the
    volume data.
    
    - Call vhd-util on remote hosts using the linstor-manager when necessary, i.e. vhd-util is called to get vhd info,
    the DRBD device can be in use (and unusable by external processes), so we must use the local LVM device that
    contains the DRBD data or a remote disk if the DRBD device is diskless.
    
    - If a DRBD device is in use when vhdutil.getVHDInfo is called, we must have no
    errors. So a LinstorVhdUtil wrapper is now used to bypass DRBD layer when
    VDIs are loaded.
    
    - Refresh PhyLink when unpause in called on DRBD devices:
    We must always recreate the symlink to ensure we have
    the right info. Why? Because if the volume UUID is changed in
    LINSTOR the symlink is not directly updated. When live leaf
    coalesce is executed we have these steps:
    "A" -> "OLD_A"
    "B" -> "A"
    Without symlink update the previous "A" path is reused instead of
    "B" path. Note: "A", "B" and "OLD_A" are UUIDs.
    
    - Since linstor python modules are not present on every XCP-ng host,
    module imports are protected by try.. except... blocks.
    
    - Provide a linstor-monitor daemon to check master changes
    Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    b06f04f View commit details
    Browse the repository at this point in the history
  8. feat(tests): add unit tests concerning ZFS (close xcp-ng/xcp#425)

    - Check if "create" doesn't succeed without zfs packages
    - Check if "scan" failed if the path is not mounted (not a ZFS mountpoint)
    Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    d64ac06 View commit details
    Browse the repository at this point in the history
  9. If no NFS ACLs provided, assume everyone:

    Some QNAP devices do not provide ACL when fetching NFS mounts.
    In this case the assumed ACL should be: "*".
    
    This commit fixes the crash when attempting to access the non existing ACL.
    Relevant issues:
    - xapi-project#511
    - xcp-ng/xcp#113
    benjamreis authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    68e67e6 View commit details
    Browse the repository at this point in the history
  10. Added SM Driver for MooseFS

    Co-authored-by: Piotr Robert Konopelko <[email protected]>
    Signed-off-by: Aleksander Wieliczko <[email protected]>
    Signed-off-by: Ronan Abhamon <[email protected]>
    2 people authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    769a4b9 View commit details
    Browse the repository at this point in the history
  11. Avoid usage of umount in ISOSR when legacy_mode is used

    `umount` should not be called when `legacy_mode` is enabled, otherwise a mounted dir
    used during SR creation is unmounted at the end of the `create` call (and also
    when a PBD is unplugged) in `detach` block.
    
    Signed-off-by: Ronan Abhamon <[email protected]>
    Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    b53271b View commit details
    Browse the repository at this point in the history
  12. MooseFS SR uses now UUID subdirs for each SR

    A sm-config boolean param `subdir` is available to configure where to store the VHDs:
    - In a subdir with the SR UUID, the new behavior
    - In the root directory of the MooseFS SR
    
    By default, new SRs are created with `subdir` = True.
    Existing SRs  are not modified and continue to use the folder that was given at
    SR creation, directly, without looking for a subdirectory.
    
    Signed-off-by: Ronan Abhamon <[email protected]>
    Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    9bccc87 View commit details
    Browse the repository at this point in the history
  13. Fix is_open call for many drivers (#25)

    Ensure all shared drivers are imported in `_is_open` definition to register
    them in the driver list. Otherwise this function always fails with a SRUnknownType exception.
    
    Also, we must add two fake mandatory parameters to make MooseFS happy: `masterhost` and `rootpath`.
    Same for CephFS with: `serverpath`. (NFS driver is directly patched to ensure there is no usage of
    the `serverpath` param because its value is equal to None.)
    
    `location` param is required to use ZFS, to be more precise, in the parent class: `FileSR`.
    
    Signed-off-by: Ronan Abhamon <[email protected]>
    Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    b018cd2 View commit details
    Browse the repository at this point in the history
  14. Remove SR_CACHING capability for many SR types (#24)

    SR_CACHING offers the capacity to use IntelliCache, but this
    feature is only available using NFS SR.
    
    For more details, the implementation of `_setup_cache` in blktap2.py
    uses only an instance of NFSFileVDI for the shared target.
    
    Signed-off-by: Ronan Abhamon <[email protected]>
    Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    bdb7ced View commit details
    Browse the repository at this point in the history
  15. Remove SR_PROBE from ZFS capabilities (#37)

    The probe method is not implemented so we
    shouldn't advertise it.
    
    Signed-off-by: BenjiReis <[email protected]>
    benjamreis authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    4de671d View commit details
    Browse the repository at this point in the history
  16. Fix vdi-ref when static vdis are used

    When static vdis are used there is no snapshots and we don't want to
    call method from XAPI.
    
    Signed-off-by: Guillaume <[email protected]>
    gthvn1 authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    0aec61e View commit details
    Browse the repository at this point in the history
  17. Tell users not to edit multipath.conf directly

    This file is meant to remain unchanged and regularly updated along with
    the SM component. Users can create a custom configuration file in
    /etc/multipath/conf.d/ instead.
    
    Signed-off-by: Samuel Verschelde <[email protected]>
    (cherry picked from commit b44d3f5)
    stormi authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    9e7f3ac View commit details
    Browse the repository at this point in the history
  18. Add custom.conf multipath configuration file

    Meant to be installed as /etc/multipath/conf.d/custom.conf for users
    to have an easy entry point for editing, as well as information on what
    will happen to this file through future system updates and upgrades.
    
    Signed-off-by: Samuel Verschelde <[email protected]>
    (cherry picked from commit 18b79a5)
    stormi authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    20616a7 View commit details
    Browse the repository at this point in the history
  19. Install /etc/multipath/conf.d/custom.conf

    Update Makefile so that the file is installed along with sm.
    
    Signed-off-by: Samuel Verschelde <[email protected]>
    stormi authored and Wescoeur committed Oct 13, 2023
    Configuration menu
    Copy the full SHA
    398471d View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2023

  1. fix(NFSSR): ensure we can attach SR during attach_from_config call

    We can get a trace like that if the SR is not attached:
    ```
    2170:Oct 10 16:02:59 xcp4 SM: [2564] ***** NFSFileVDI.attach_from_config: EXCEPTION <type 'exceptions.AttributeError'>, 'NoneType' object has no attribute 'xenapi'
    2329-Oct 10 16:02:59 xcp4 SM: [2564]   File "/opt/xensource/sm/NFSSR", line 296, in attach_from_config
    2427-Oct 10 16:02:59 xcp4 SM: [2564]     self.sr.attach(sr_uuid)
    2487-Oct 10 16:02:59 xcp4 SM: [2564]   File "/opt/xensource/sm/NFSSR", line 148, in attach
    2573-Oct 10 16:02:59 xcp4 SM: [2564]     self._check_hardlinks()
    2633-Oct 10 16:02:59 xcp4 SM: [2564]   File "/opt/xensource/sm/FileSR.py", line 1122, in _check_hardlinks
    2734-Oct 10 16:02:59 xcp4 SM: [2564]     self.session.xenapi.SR.remove_from_sm_config(
    2816-Oct 10 16:02:59 xcp4 SM: [2564]
    ```
    
    Because the session is not set during this call.
    So instead of using the XenAPI to store hardlink support, use a file on the storage itself.
    
    Signed-off-by: Ronan Abhamon <[email protected]>
    Wescoeur committed Oct 16, 2023
    Configuration menu
    Copy the full SHA
    b04358e View commit details
    Browse the repository at this point in the history