ibm_zos_core icon indicating copy to clipboard operation
ibm_zos_core copied to clipboard

[Enabler] [zos_mount] GDG/GDS and special character support

Open ddimatos opened this issue 10 months ago • 3 comments

Enabler description

New MVSDataset class

There is a new MVSDataset class introduced in #1386 that represents a data set, when used, as part of initialization it escapes and resolves the gds relative name if any.

This is a sample on how to initialize the new class, many of these params can just be None.

MVSDataSet(
            name = params.get("name"),
            record_format = params.get("record_format", None),
            volumes = params.get("volumes", None),
            data_set_type = params.get("type", None),
            block_size = params.get("block_size", None),
            record_length = params.get("record_length", None),
            space_primary = params.get("space_primary", None),
            space_secondary = params.get("space_secondary", None),
            space_type = params.get("space_type", None),
            directory_blocks = params.get("directory_blocks", None),
            key_length = params.get("key_length", None),
            key_offset = params.get("key_offset", None),
            sms_storage_class = params.get("sms_storage_class", None),
            sms_data_class = params.get("sms_data_class", None),
            sms_management_class = params.get("sms_management_class", None),
        )

GDG/GDS Support

Research if this feature makes sense.

Option src accepts data set name or path, given a GDS relative name the module needs to resolve the relative name into absolute name.

- name: Mount a filesystem with no security checks.
  zos_mount:
    src: ZOAUSER.GDG(0)
    path: /u/omvsadm/core
    fs_type: ZFS
    state: mounted
    mount_opts: NOSECURITY

Internally, in the case of a data set name being a GDS relative name we should resolve those names into absolute GDS names when the generation number is 0 or negative.

# Sample of soon to be implemented gdg function
if DataSet.is_gds_relative_name(name):
    src = DataSet.resolve_gds_absolute_name(src)

Symbols support

Changes done to the BetterArgParser should be adopted in the module to not break and use the correct escaped name in case of the data set name having a symbol in it.

Add symbol support to the dest_data_set name option.

data set name with symbol

ZOAUSER.TE$T

That way, the modules will have to retrieve the new escaped named and the original user provided name inside the dictionary like:

name = DataSet.escape_data_set_name(name)

Escaping special characters could be done via a new function inside the BetterArgParser. These are some of the special characters:

  • #
  • @
  • $
  • -

For this task completion we need:

  • [ ] Do the development work
  • [ ] Update the docs to talk about GDG and GDS handling in the module.
  • [ ] Update the docs with at least 1 example on how to use with GDSs.
  • [ ] Create a new test case for GDSs.
  • [ ] Create a new test case for symbols.

Ansible module

zos_mount

ddimatos avatar Apr 03 '24 06:04 ddimatos

This doe not appear possible, based on the nature of HFS/ZFS aggregates. -- a mount uses only a zfs aggregate.
A sample run on an EC:

bash-4.3# zfsadm define -aggregate MYNEWW.SHARE.OS.V001.ZFS -volumes ANSI01 -cylinders 900 1 IOEZ00248I VSAM linear dataset MYNEWW.SHARE.OS.V001.ZFS successfully created.

bash-4.3# zfsadm format -aggregate MYNEWW.SHARE.OS.V001.ZFS IOEZ00077I HFS-compatibility aggregate MYNEWW.SHARE.OS.V001.ZFS has been successfully created.

Normally, we do things like:

bash-4.3# mkdir testos bash-4.3# /usr/sbin/mount -t zfs -f MYNEWW.SHARE.OS.V001.ZFS /testos bash-4.3# ls testos

bash-4.3# cp /tmp/*.txt testos bash-4.3# ll testos total 64 drwxr-xr-x 2 BPXROOT SYS1 8192 Jul 26 11:26 . drwxr-xr-x 20 BPXROOT SYS1 8192 Jul 26 11:22 .. t ISO8859-1 T=on -rw-r--r-- --s- ---- 1 BPXROOT SYS1 277 Jul 26 11:26 pythontable.txt t ISO8859-1 T=on -rw-r--r-- --s- ---- 1 BPXROOT SYS1 394 Jul 26 11:26 zoautable.txt

Looking into zoau code:

zoau/version/lib/_py/datasets.py:

try: if dataset_type.upper() in ["KSDS", "ESDS", "RRDS", "LDS"]: dataset = list_vsam_datasets(assigned_name)[0] else: dataset = list_datasets(assigned_name)[0]

So, a vsam needs to be ksds, esds, rrds, or lds to be listable or copyable... leaving zfs/hfs out?

a quiesce is required... addrssu is used, then an un-quiesce

cp and dcp can not see the file: dfsms is required, addrssu is used to do the work

copy only works if type and size match, or destination is larger than source

============ The option here is to support symbol escaping only.

Backups

For the same reason, a zfs backup can only be to a same-or larger sized aggregate, so GDG encoding will lead to a failure.

However, sysbol escaping needs to go in here as well.

I'll validate this with zoau team.

I'll get this into a PR within a day (Saturday/Monday), but we can only support symbles, not gdgs in this module.

richp405 avatar Jul 26 '24 19:07 richp405

slack C037EFBNPAN/p1722023475397699 This ticket will be reduced to just symbols only. A new triage and research issue will appear for gdg support. There appears to be a way to make a copy (backup dest), but need to consult some experts to see if the format-change for gdg is supported or not.

richp405 avatar Jul 26 '24 21:07 richp405

Adding symbol support to mount/src and backup name, and passing GDG usage to new ticket #1630.

richp405 avatar Jul 29 '24 14:07 richp405