1. 04 Dec, 2015 1 commit
    • Alain Takoudjou's avatar
      Introduce new garbage collector for instances ignored by buildout · 0a4d0dbe
      Alain Takoudjou authored
      Buildout cannot request destroy sub instances when it is removed from
      instance parameters by the user. Ex: request a cluster of KVM, with
      kvm1 and kvm2 instances, edit parameters and remove kvm2 in the list.
      Buildout will just ignore that instance and it will be removed only when
      the hosting subscription will be destroyed.
      
                       -- kvm1
      root instance --|
                       -X- kvm2
      
      So when processing a partition, we send to master the list of requested sub
      instance(s). If the previous list was ['kvm1', 'kvm2'], then after remove kvm2
      the list will be ['kvm1'] (for the root instance). Commit this list to the
      master will unlink between root instance and kvm2 (predecessor categorie).
      
      A new alarm will search for unlinked instances: Instance which has no parent,
      and destroy them (also destroy the sub tree).
      0a4d0dbe
  2. 02 Dec, 2015 1 commit
  3. 01 Dec, 2015 2 commits
  4. 30 Nov, 2015 4 commits
  5. 27 Nov, 2015 1 commit
  6. 19 Nov, 2015 1 commit
  7. 16 Nov, 2015 1 commit
  8. 15 Nov, 2015 3 commits
    • Kirill Smelkov's avatar
      slapproxy: Teach slapproxy to handle non-ascii instance parameters · 347d33d6
      Kirill Smelkov authored
      1. when forming instance parameters xml dict on client side, we cannot
         use str() to convert parameter_value to string - because it breaks e.g.
         this way:
      
         In [1]: s = u'Привет Мир!'
         In [2]: str(s)
         ---------------------------------------------------------------------------
         UnicodeEncodeError                        Traceback (most recent call
      
         UnicodeEncodeError: 'ascii' codec can't encode characters in position
         0-5: ordinal not in range(128)
      
         Fix is: convert arguments to unicode strings.
      
      2. when decoding xml on server side it was erroneously assumed to be
         always unicode, and this way xml.encode('utf-8') fails if xml is str
         but with non-ascii characters:
      
         In [3]: r = 'hello world'
      
         In [4]: r.encode('utf-8')
         Out[4]: 'hello world'
      
         In [5]: t = s.encode('utf-8')
      
         In [6]: t
         Out[6]: '\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82 \xd0\x9c\xd0\xb8\xd1\x80!'
      
         In [7]: t.encode('utf-8')
         ---------------------------------------------------------------------------
         UnicodeDecodeError                        Traceback (most recent call last)
      
         UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
      
         Fix is: don't assume xml string is unicode and decode it only, if it
                 is unicode, and leave as it is if it is just str.
      347d33d6
    • Kirill Smelkov's avatar
      util/sqlite_connect: Allow 8-bit strings · af7de08e
      Kirill Smelkov authored
      Because e.g. for the following instance parameters
      
          <?xml version='1.0' encoding='utf-8'?>
          <instance>
            <parameter id="text">Привет Мир!</parameter>
          </instance>
      
      we get the following DB query
      
          'UPDATE %s SET slap_state="busy" ,software_release=? ,partition_reference=? ,requested_by=? ,software_type=? ,xml=? WHERE
      reference=? AND computer_reference=?',
          ['http://sr//', 'myinstance', 'slappart0', 'default',
           '<?xml version=\'1.0\' encoding=\'utf-8\'?>\n<instance>\n  <parameter id="text">\xd0\x9f\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82\xd0\x9c\xd0\xb8\xd1\x80!</parameter>\n</instance>\n',
           'slappart6', 'computer']
      
      which fails the following way:
      
        File ".../site-packages/flask/app.py", line 1817, in wsgi_app
          response = self.full_dispatch_request()
        File ".../site-packages/flask/app.py", line 1477, in full_dispatch_request
          rv = self.handle_user_exception(e)
        File ".../site-packages/flask/app.py", line 1381, in handle_user_exception
          reraise(exc_type, exc_value, tb)
        File ".../site-packages/flask/app.py", line 1475, in full_dispatch_request
          rv = self.dispatch_request()
        File ".../site-packages/flask/app.py", line 1461, in dispatch_request
          return self.view_functions[rule.endpoint](**req.view_args)
        File "slapos/proxy/views.py", line 393, in requestComputerPartition
          software_instance = requestNotSlave(**parsed_request_dict)
        File "slapos/proxy/views.py", line 609, in requestNotSlave
          execute_db('partition', q, args)
        File "slapos/proxy/views.py", line 142, in execute_db
          cur = db.execute(query, args)
      ProgrammingError: You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.
      
      our instance parameters is always XML UTF-8 encoded, and thus it is not
      unicode and we cannot go the 'use unicode always' way.
      
      So autotune sqlite connections on open to support 8-bit strings.
      af7de08e
    • Kirill Smelkov's avatar
      *: Factor opening sqlite db into separate function · 8bf68261
      Kirill Smelkov authored
      Currently it is just sqlite3.connect(), but we'll want to add connection
      autotuning in the next patch, so before that let's consolidate all
      sqlite opening places in the code into one.
      8bf68261
  9. 13 Nov, 2015 2 commits
  10. 12 Nov, 2015 2 commits
  11. 11 Nov, 2015 2 commits
  12. 27 Oct, 2015 2 commits
  13. 26 Oct, 2015 3 commits
  14. 15 Oct, 2015 5 commits
  15. 02 Oct, 2015 1 commit
  16. 29 Sep, 2015 1 commit
  17. 25 Sep, 2015 2 commits
  18. 03 Sep, 2015 1 commit
  19. 21 Aug, 2015 1 commit
  20. 17 Aug, 2015 1 commit
  21. 14 Aug, 2015 3 commits