threefoldtecharchive / jumpscaleX_archived

Apache License 2.0
1 stars 6 forks source link

error when reserving vm on a farm using capacity reserve #679

Closed hossnys closed 5 years ago

hossnys commented 5 years ago

JSX Branch development

Following documentation https://github.com/threefoldfoundation/info_grid/tree/development/docs/capacity_reservation

Error when reserving a zos vm:

JSX> result = w.capacity.reserve_zos_vm( email='hossnys@codescalers.com', threebot_id='samir1', location='tf-production', size=1 )   

Wed 03 11:51:05 GedisClient.py   - 138 - j.clients.gedis:gedisclient        : redisclient: notary.grid.tf:5000 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sandbox/lib/jumpscale/Jumpscale/clients/blockchain/tfchain/TFChainCapacity.py", line 125, in reserve_zos_vm
    return self._process_reservation(reservation, threebot_id, source=source, refund=refund)
  File "/sandbox/lib/jumpscale/Jumpscale/clients/blockchain/tfchain/TFChainCapacity.py", line 225, in _process_reservation
    response = self._notary_client.register(threebot_id, signature.message, signature.signature)
  File "/sandbox/lib/jumpscale/Jumpscale/clients/blockchain/tfchain/TFChainCapacity.py", line 27, in _notary_client
    self._notary_client_ = c.actors.notary_actor
  File "/sandbox/lib/jumpscale/DigitalMe/clients/gedis/GedisClient.py", line 84, in actors
    self._actorsmeta[actor_name] = j.servers.gedis._cmds_get(key, data)
  File "/sandbox/lib/jumpscale/DigitalMe/servers/gedis/GedisFactory.py", line 41, in _cmds_get
    return GedisCmds(namespace=namespace, name=name, data=data)
  File "/sandbox/lib/jumpscale/DigitalMe/servers/gedis/GedisCmds.py", line 50, in __init__
    self.data = self.schema.get(data=data)
TypeError: get() got an unexpected keyword argument 'data'

get() got an unexpected keyword argument 'data'
serboctor commented 5 years ago

Fixed https://github.com/threefoldtech/digitalmeX/commit/c76aaddc6abf59e364611b7092fb807444beeb2a

hossnys commented 5 years ago

Verified on branch development note : you need to create you 3bot with months value greater than 1 month as the duration for any next reservations is 1 month which is calculated after 3bot creation and if you create 3bot with one month and tried to reserve you will get this error :

JSX> result = ww.capacity.reserve_zos_vm(email='hossnys@codescalers.com', threebot_id='ops-2', location='cairo_office', size=1, duration=1 )     
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sandbox/lib/jumpscale/Jumpscale/clients/blockchain/tfchain/TFChainCapacity.py", line 206, in reserve_zos_vm
    return self._process_reservation(reservation, threebot_id, source=source, refund=refund)
  File "/sandbox/lib/jumpscale/Jumpscale/clients/blockchain/tfchain/TFChainCapacity.py", line 301, in _process_reservation
    raise ValueError("Capacity expiration time exceeds threebot's expiration")
ValueError: Capacity expiration time exceeds threebot's expiration
serboctor commented 5 years ago

@hossnys if you create them both on the same day it shouldn't be a problem, the check disregards hours and minutes.

hossnys commented 5 years ago

I just created both 3bot and reserve vm in the same hour and i got the error of Capacity expiration time exceeds threebot's expiration !!

serboctor commented 5 years ago

This shouldnt be the case :/ I already tested this scenario before. Let me test it again.

serboctor commented 5 years ago
JSX> w.threebot.record_new(months=1, names=["bigggbot.hopefully"],addresses=["bigggbot.org"], key_index=2)                                                                                                  
TransactionSendResult(transaction=transaction v144 41ddc7c09a8fb14de8d2c84d8892f497f81ecb75ee1b4d6ad22a3a484f876282, submitted=True)

JSX> w.capacity.reserve_zos_vm(email="boctor.sarah@gmail.com", threebot_id="bigggbot.hopefully", location="green edge cloud.austria.vienna 1", size=1, duration=1, organization="sarah")                    
TransactionSendResult(transaction=transaction v1 6834cb8aeb84430ecdc2a1b0e69ebb53afb535d46e8f54308d15f8d6de817c57, submitted=True)
hossnys commented 5 years ago

verified :

JSX> result = ww.threebot.record_new(months=1, names=["devtest2"], adcresses=["example.org"],  key_index=0)
JSX> result = ww.capacity.reserve_zos_vm(email='hossnys@codescalers.com', threebot_id='devtest2', location='freefarm', size=1, duration=1 )                                                         
Thu 11 10:27:22 BCDBMeta.py      - 166 - bcdbmeta:bcdbmeta                  : schema set in BCDB:system meta:jumpscale.gedis.client (md5:'4c47b74e2101b80082d468c0ce37b507')
Thu 11 10:27:22 BCDBMeta.py      - 175 - bcdbmeta:bcdbmeta                  : new schema in meta:
system: jumpscale.gedis.client:4c47b74e2101b80082d468c0ce37b507
Thu 11 10:27:22 BCDBMeta.py      - 133 - bcdbmeta:bcdbmeta                  : save meta:system
Thu 11 10:27:22 BCDB.py          - 409 - bcdb:bcdb                          : load model:jumpscale.gedis.client
Thu 11 10:27:22 BCDBMeta.py      - 163 - bcdbmeta:bcdbmeta                  : schema set in BCDB:system meta:jumpscale.gedis.client (EXISTING)
Thu 11 10:27:22 GedisClient.py   - 138 - j.clients.gedis:gedisclient        : redisclient: notary.grid.tf:5000 
Thu 11 10:27:36 GedisClient.py   - 102 - j.clients.gedis:gedisclient        : cmds for actor:notary_actor
JSX> result = ww.capacity.reserve_zos_vm(email='hossnys@codescalers.com', threebot_id='devtest2', location='freefarm', size=1, duration=1 )                                                         
JSX> result.transaction                                                                                                                                                                             
transaction v1 e93731b8e5ed0eb18d9ec020011bfb1558a07240eb906f3637ac80996292abf0

JSX> result.submitted                                                                                                                                                                               
True

it's appear that i wasn't on the latest update of JsX