summaryrefslogtreecommitdiffstats
path: root/qa/suites/orch/cephadm/smoke-roleless/2-services/nfs-ingress-rgw-user.yaml
blob: 721aecfc34e5748cb679297bb890cd5cd7353da8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
tasks:
- vip:

# make sure cephadm notices the new IP
- cephadm.shell:
    host.a:
      - ceph orch device ls --refresh

# stop kernel nfs server, if running
- vip.exec:
    all-hosts:
      - systemctl stop nfs-server

- cephadm.shell:
    host.a:
      - ceph orch apply rgw foorgw --port 8800
      - ceph nfs cluster create foo --ingress --virtual-ip {{VIP0}}/{{VIPPREFIXLEN}}

- vip.exec:
    host.a:
      - dnf install -y python3-boto3 || apt install -y python3-boto3
      - /home/ubuntu/cephtest/cephadm shell radosgw-admin user create --uid foouser --display-name foo > /tmp/user.json

- python:
    host.a: |
      import boto3
      import json

      with open('/tmp/user.json', 'rt') as f:
          info = json.loads(f.read())
      s3 = boto3.resource(
          's3',
          aws_access_key_id=info['keys'][0]['access_key'],
          aws_secret_access_key=info['keys'][0]['secret_key'],
          endpoint_url='http://localhost:8800',
      )
      bucket = s3.Bucket('foobucket')
      bucket.create()
      bucket.put_object(Key='myobject', Body='thebody')

- cephadm.shell:
    host.a:
      - ceph nfs export create rgw --cluster-id foo --pseudo-path /foouser --user-id foouser

- cephadm.wait_for_service:
    service: nfs.foo
- cephadm.wait_for_service:
    service: ingress.nfs.foo

## export and mount

- vip.exec:
    host.a:
      - mkdir /mnt/foo
      - sleep 5
      - mount -t nfs {{VIP0}}:/foouser /mnt/foo
      - test -d /mnt/foo/foobucket
      - find /mnt/foo -ls
      - grep thebody /mnt/foo/foobucket/myobject
      - echo test > /mnt/foo/foobucket/newobject
      - sync

- python:
    host.a: |
      import boto3
      import json
      from io import BytesIO

      with open('/tmp/user.json', 'rt') as f:
          info = json.loads(f.read())
      s3 = boto3.resource(
          's3',
          aws_access_key_id=info['keys'][0]['access_key'],
          aws_secret_access_key=info['keys'][0]['secret_key'],
          endpoint_url='http://localhost:8800',
      )
      bucket = s3.Bucket('foobucket')
      data = BytesIO()
      bucket.download_fileobj(Fileobj=data, Key='newobject')
      print(data.getvalue())
      assert data.getvalue().decode() == 'test\n'

- vip.exec:
    host.a:
      - umount /mnt/foo

- cephadm.shell:
    host.a:
      - ceph nfs export rm foo /foouser
      - ceph nfs cluster rm foo