threefoldtecharchive / 0-templates

0-robot templates
Apache License 2.0
1 stars 1 forks source link

Can't create namespace using namespace template. #49

Closed rkhamis closed 6 years ago

rkhamis commented 6 years ago

Issue migrated from [https://api.github.com/repos/zero-os/0-templates/issues/165](), opened by @john-kheir

Scenario 1

1- create a zdb service

In [6]: zdb = robot.services.create(
   ...:             template_uid='github.com/zero-os/0-templates/zerodb/0.0.1',
   ...:             service_name='test1',
   ...:             data={'sync': True,
   ...:                   'mode': 'user',
   ...:                   'admin': 'admin',
   ...:                   'path': '/var/cache'})
   ...:                   

In [7]: 

In [7]: zdb.schedule_action('install').wait(die=True, timeout=30)
Out[7]: install

2- Create a namespace service

In [13]: ns2 = robot.services.create(
    ...:            template_uid='github.com/zero-os/0-templates/namespace/0.0.1',
    ...:            service_name='test2',
    ...:            data={'size': 10,
    ...:                  'password': 'password'})
    ...:                  

In [14]: res = ns2.schedule_action('install').wait(die=True, timeout=30)
Traceback (most recent call last):
  File "/opt/code/github/zero-os/0-robot/zerorobot/task/task.py", line 77, in execute
    self._result = self._func(**self._args)
  File "/opt/code/github/zero-os/0-templates/templates/node/node.py", line 211, in create_zdb_namespace
    potentials.pop(info['path'])
KeyError: '/var/cache'
---------------------------------------------------------------------------
ErrorConditionObject                      Traceback (most recent call last)
/usr/local/bin/js9 in <module>()

Notes

1- I'm using a freshly zos node from development branch. 2- Disks info:

In [4]: client.disk.list()
Out[4]: 
[{'alignment': '0',
  'blocksize': 512,
  'children': [{'alignment': '0',
    'disc-aln': '0',
    'disc-gran': '4096',
    'disc-max': '2147450880',
    'disc-zero': '0',
    'fstype': 'btrfs',
    'group': 'disk',
    'hctl': None,
    'hotplug': '0',
    'kname': 'sda1',
    'label': 'sp_zos-cache',
    'log-sec': '512',
    'maj:min': '8:1',
    'min-io': '4096',
    'mode': 'brw-rw----',
    'model': '',
    'mountpoint': '/mnt/storagepools/sp_zos-cache',
    'name': 'sda1',
    'opt-io': '0',
    'owner': 'root',
    'partflags': None,
    'partlabel': 'primary',
    'parttype': '0fc63daf-8483-4772-8e79-3d69d8477de4',
    'partuuid': 'ca608d8e-fef4-4584-a943-c4a585740bc2',
    'phy-sec': '4096',
    'pkname': 'sda',
    'ra': '128',
    'rand': '0',
    'rev': None,
    'rm': '1',
    'ro': '0',
    'rota': '0',
    'rq-size': '128',
    'sched': 'noop',
    'serial': '',
    'size': '80025223168',
    'state': None,
    'subsystems': 'block:scsi:pci',
    'tran': '',
    'type': 'part',
    'uuid': '843b294b-259c-41e7-96cc-7fcb57774dcb',
    'vendor': None,
    'wsame': '0',
    'wwn': '0x5488282698218755533x'}],
  'disc-aln': '0',
  'disc-gran': '4096',
  'disc-max': '2147450880',
  'disc-zero': '0',
  'end': 80026361855,
  'free': [{'end': 1048575, 'size': 1031168, 'start': 17408},
   {'end': 80026344959, 'size': 73216, 'start': 80026271744}],
  'fstype': None,
  'group': 'disk',
  'hctl': '0:0:0:0',
  'hotplug': '1',
  'kname': 'sda',
  'label': None,
  'log-sec': '512',
  'maj:min': '8:0',
  'min-io': '4096',
  'mode': 'brw-rw----',
  'model': 'INTEL SSDSC2BB08',
  'mountpoint': None,
  'name': 'sda',
  'opt-io': '0',
  'owner': 'root',
  'partflags': None,
  'partlabel': None,
  'parttype': None,
  'partuuid': None,
  'phy-sec': '4096',
  'pkname': None,
  'ra': '128',
  'rand': '0',
  'rev': '0140',
  'rm': '1',
  'ro': '0',
  'rota': '0',
  'rq-size': '128',
  'sched': 'noop',
  'serial': 'BTWA5284017T080BGN',
  'size': 80026361856,
  'start': 0,
  'state': 'running',
  'subsystems': 'block:scsi:pci',
  'table': 'gpt',
  'tran': 'sata',
  'type': 'disk',
  'uuid': None,
  'vendor': 'ATA     ',
  'wsame': '0',
  'wwn': '0x5488282698218755533x'}]
zaibon commented 6 years ago

@john-kheir can you confirm this is still a valid bug or close it

BolaNasr commented 6 years ago

@zaibon it's look like work good

data = {'sync': True,'mode': 'user','admin': 'admin','path':'/mnt/storagepools/sdd'}

zdb = robot.services.create('github.com/threefoldtech/0-templates/zerodb/0.0.1', 'zerodb1',data=data)
zdb.schedule_action('install').wait(die=True, timeout=30)
In [100]: args = {                                                                                    
     ...:     'size': 10,
     ...:     'password': 'password',
     ...:     'diskType': 'ssd',
     ...: }

In [101]: namespace = robot.services.create('github.com/threefoldtech/0-templates/namespace/0.0.1', 'n
     ...: amespace_one', data=args)

In [102]: namespace.schedule_action('install')
Out[102]: install