1. 07 Oct, 2013 2 commits
    • Christos Stavrakakis's avatar
      cyclades: Refactor reconciliation of pools · 33fe9eb8
      Christos Stavrakakis authored
      Move reconciliation of IP pools from 'snf-manage reconcile-networks'
      to 'snf-manage reconcile-pools'. Also change the way reconciliation
      works: Instead of reconciling the IP pools in DB with the IP pools in
      Ganeti, the new reconciliation just checks that:
      * there is no IPv4 address that is used by more than one NICs
      * the only reserved values in the pools are the ones that are currently
        used by NICs
      The reason why reconciliation of pools with Ganeti has been removed is
      that there are too many race conditions, and that it may result in
      strange incosistencies. As far as external reservations is concerned,
      the new reconciliation mechanism just checks that each IP that is
      reserved in a Ganeti backend is also reserved in the Cyclades DB.
      33fe9eb8
    • Christos Stavrakakis's avatar
      cyclades: Make (network, ipv4) unique for each NIC · b7dae491
      Christos Stavrakakis authored
      Add a unique constraint to NetworkInterface model. This constraint
      asserts that the same IPv4 address from the same network will no be
      assigned to more than one NICs.
      b7dae491
  2. 02 Oct, 2013 3 commits
  3. 01 Oct, 2013 1 commit
  4. 20 Sep, 2013 1 commit
    • Christos Stavrakakis's avatar
      cyclades: Handle errors during vm creation · c99c44cb
      Christos Stavrakakis authored
      Commit #f2080d1 mocked an OP_INSTANCE_REMOVE when enqueuing an
      OP_INSTANCE_CREATE job to Ganeti failed. However, this may result in
      releasing IPs that may get reserved in Ganeti, because we can never
      really know if the job has reached Ganeti or not (e.g.  timeout).  For
      this reason, we should *never* delete the VM. Instead we mark the VM as
      being in error state.  The user must explicitly delete the server.  This
      has the downside, that we return 202 with the resulting VM being in
      ERROR state. However, this is the only way to be really secure.
      c99c44cb
  5. 10 Sep, 2013 1 commit
  6. 06 Sep, 2013 1 commit
    • Christos Stavrakakis's avatar
      cyclades: Fix bug in snf-dispatcher logic · a399119b
      Christos Stavrakakis authored
      This commit reverts commits #07602322 and #30514662 which introduced a
      bug in dispatcher's logic. These commit fixed the issue that, in a case
      the Cyclades DB is unsynced with Ganeti, a resource that does not exist
      in the Ganeti backend, it  will not be deleted from DB in case the
      remove job fails.
      
      This commits fixes this issue, by quering Ganeti each time a failed
      OP_INSTANCE_REMOVE or OP_NETWORK_REMOVE is processed.
      a399119b
  7. 07 Aug, 2013 1 commit
  8. 25 Jul, 2013 1 commit
  9. 24 Jul, 2013 1 commit
  10. 17 Jul, 2013 2 commits
    • Christos Stavrakakis's avatar
      cyclades: Fix exception message · f58b1628
      Christos Stavrakakis authored
      f58b1628
    • Christos Stavrakakis's avatar
      cyclades: Support IPv6 only networks · a0ad2412
      Christos Stavrakakis authored
      Make Cyclades support IPv6 only networks. Such networks will have
      the 'subnet' attribute set to None, in the same way that IPv4 only
      networks have the 'subnet6' attribute set to None.
      
      Because currently Ganeti does not support IPv6 only networks, we create the
      corresponding Ganeti network with a dummy IPv4 subnet(10.0.0.0/24) that will be
      never used, since Cyclades will connect instances to IPv6 networks with
      'address' attribute set to None.
      a0ad2412
  11. 10 Jul, 2013 1 commit
  12. 02 Jul, 2013 10 commits
    • Christos Stavrakakis's avatar
      cyclades: Check if a NIC is a floating IP. · 9f6b9834
      Christos Stavrakakis authored
      Extend NetworkInterface model with a property showing if the IPv4
      address of the NIC is a floating IP or not. Also, simplify some
      relevant code.
      9f6b9834
    • Christos Stavrakakis's avatar
      cyclades: Separate logic for networks from API · 31d9b58d
      Christos Stavrakakis authored
      Remove code handling networks from network API views to logic.networks
      31d9b58d
    • Christos Stavrakakis's avatar
      Distinquish between networks and Floating IP pools · b755a9c9
      Christos Stavrakakis authored
      Extend Network model with the 'floating_ip_pool' boolean field, to
      indicate whether a Network can be a floating IP pool or not. Networks
      that are floating IP pools must exist in all Backends, and so
      'snf-manage backend-add' should try to add them.
      
      Also, update reconciliation to create networks that are floating IP
      pools to the Ganeti backends that do not exist.
      b755a9c9
    • Christos Stavrakakis's avatar
      8e23ed50
    • Christos Stavrakakis's avatar
      cyclades: Extend /servers with floating IP actions · d4ea2f75
      Christos Stavrakakis authored
      Extend '/servers/action' API endpoint, to support 'addFloatingIP'
      and 'removeFloatingIP' actions.
      d4ea2f75
    • Christos Stavrakakis's avatar
      cyclades: Add FloatingIP model · 02da2000
      Christos Stavrakakis authored
      Add Floating IP model to represent a floating IP that has been reserved
      by a user. Each FloatingIP has an owner(UUID), an IPv4 address, the
      network(pool) that has reserved from and the date is was reserved. Also,
      it may be related to a VirtualMachine, if there is some VM that uses
      this IP.
      
      Also, create the corresponding model factory for tests.
      02da2000
    • Christos Stavrakakis's avatar
      cyclades: Major refactor to api and logic apps · d15f509c
      Christos Stavrakakis authored
      Major refactor to cyclades api and logic apps that removes most code
      from the api views and moves it to logic app, so that the same logic
      code can be used by different apps (e.g. EC2 API). Code is moved into
      logic.servers.
      
      This commit also introduces the VirtualMachine.task attribute
      which contains the last issued action to a server. This attribute is set
      when the corresponding job is sent to Ganeti, and is cleared upon
      completion of the corresponding job (task_job_id attribute). Until the
      task is completed, no other action is allowed on the VM. The only
      exception is 'DESTROY' action which is always allowed. Actions on VMs
      with uncompleted tasks results in a bad request fault.  Also, some
      actions are not allowed if the operating state of the VM is not correct.
      For example, it is not allowed to start or resize a running VM.  The
      running task is also exposed to the API (SNF:task_state), and the
      available states are:
      * BUILDING
      * STARTING
      * STOPPING
      * REBOOTING
      * DESTROYING
      * RESIZING
      * CONNECTING
      * DISCONNECTING
      
      Also, this commit introduces two quotable resources, the 'active_ram'
      and 'active_cpu' representing the ram and cpu of running instances,
      specifically the instances in 'STARTED', 'BUILD' and 'ERROR' operstate.
      In order to count quotas for these resources, commissioning is needed
      when starting, stopping and rebooting instances. Also, the destroy
      commissioning is different if the vm is running or is stopped.
      
      Finally this commit changes the way commissioning is used in
      snf-dispatcher. Until now dispatcher only accepted or rejected
      commissions issued by the API. This commit introduces extra logic in
      dispatcher, to issue commissions for every quotable change, if a
      commission for this change has not already been issued by the API. This
      enables the administrator to do whatever action in the Ganeti backend
      without resulting in unsynced quotas. If a new commission is required,
      the previous commission for the VM by the API (if existing) will be
      rejected, since this commission will reflect a different change in the
      VM.
      d15f509c
    • Christos Stavrakakis's avatar
      83125514
    • Christos Stavrakakis's avatar
      cyclades: Implement resize action API call · 0e0f08cb
      Christos Stavrakakis authored
      Implement resize API call, which is a POST at
      /servers/<server_id>/action' with body:
      {"resize": {"flavorRef": <flavor_id>}}
      
      The resize can only be performed if the disk size and disk template of
      the new flavor are the same with the old one, and if the VM is in
      STOPPED status.
      
      Also add 'RESIZE' operstate to VirtualMachine
      
      Refs #3870
      0e0f08cb
    • Christos Stavrakakis's avatar
      2004ace3
  13. 13 Jun, 2013 1 commit
  14. 31 May, 2013 1 commit
    • Christos Stavrakakis's avatar
      cyclades: Add 'drained' flag to Network · d7f41fac
      Christos Stavrakakis authored
      Extend Network model with the 'drained' attribute, to indicate whether a
      network should be used in public IP allocation when creating servers.
      This option is only useful for public networks.
      d7f41fac
  15. 21 May, 2013 2 commits
    • Christos Stavrakakis's avatar
      cyclades: Add --hypervisor option to backend cmds · a44fc4c2
      Christos Stavrakakis authored
      Add '--hypervisor' option to 'backend-add' and 'backend-modify'
      management commands.
      
      Refs #3772
      a44fc4c2
    • Christos Stavrakakis's avatar
      cyclades: Sypport backends with Xen hypervisor · 8bcc0f5f
      Christos Stavrakakis authored
      Support Ganeti backends with Xen hypervisor:
      * Extend 'Backend' model with the 'hypervisor' attribute, which
        currently can be 'kvm' or 'xen'. Use 'kvm' as default value to
        easy database migration. Also add the corresponding schema migration.
      * Do not use hotplug at Xen backends, since it is not
        implemented.
      * Support different 'hvparams' for Xen and KVM backends. Update
        GANETI_CREATEINSTNACE_KWARGS setting to hold 'hvparams' for both
        Xen and KVM.
      * When getting instance console, check 'serial_console' hvparam only
        for Xen instances.
      
      Refs #3772
      8bcc0f5f
  16. 13 May, 2013 1 commit
    • Christos Stavrakakis's avatar
      cyclades: Implement lazy networks · 8aff3951
      Christos Stavrakakis authored
      Implement "lazy networks", which are not created to all Ganeti backends
      upon creation, but only when an instance that resides in a Ganeti is
      connected to that network.
      
      Update 'create_network' to create the Network object in DB without
      creating network in Ganeti, or correspoding BackendNetwork entries. The
      state of the Network becomes 'ACTIVE' upon creation, instead of
      'PENDING' that was until now. Also, update 'delete_network' function to
      delete the network only from the backends that it is not in 'DELETED'
      state. The state of the network will become 'DELETED' only when all
      corresponding backend networks become 'DELETED' (including offline
      backends).
      
      Extend code that connects a VM to a network to check if the network
      already exists and is in 'ACTIVE' state in the Ganeti backend that hosts
      the VM.  If not, it will create the network and then connect the VM
      (using Ganeti chained-jobs to ensure correct ordering of jobs).
      
      Update 'reconcile-networks' management command to work with lazy
      networks. Specifically, do not check if private networks exist in all
      backends.
      
      Update 'network-add' management command to create the network in the
      Ganeti, only if a backend is specified.
      
      Finally, when using Ganeti chained-jobs to impose ordering of jobs, do
      not depend only on 'success' of a job, but also on 'error' and 'cancel'.
      This is needed to cover case that a job fails (e.g. create network)
      because the resource already exists.
      8aff3951
  17. 30 Apr, 2013 1 commit
    • Christos Stavrakakis's avatar
      Refactor QuotaHolder serial model · 9b602630
      Christos Stavrakakis authored
      * Merge 'accepted' and 'rejected' field to 'accept' field.
      * Add 'resolved' field, indicating whether this commission has been
        accepted/rejected to Quotaholder
      * Remove custom save() method. Handle 'pending' field manually.
      
      Also add the corresponding database migrations.
      9b602630
  18. 08 Apr, 2013 2 commits
  19. 22 Mar, 2013 1 commit
  20. 21 Mar, 2013 1 commit
    • Christos Stavrakakis's avatar
      Create public NIC when creating VM · dc1554e4
      Christos Stavrakakis authored
      Until now, a server's public NetworkInterface was not created in the DB
      until the arrival of the message from Ganeti hooks. However, the IPv4
      address of the NIC is reserved before sending the OP_INSTANCE_CREATE
      job to Ganeti.
      
      This drawback of this approach is that if the Ganeti hooks never run
      (building ERROR), Cyclades will never associate the IPv4 address with
      a machine and therefore this address will never be released.
      
      This commit fixes this issue by creating the VM's public NIC in DB when
      creating the server. Also the NetworkInterface model is extended with
      a 'state' field to indicate if the NIC is active or still building.
      Finally, the corresponding API calls are modified in order to return
      only 'ACTIVE' NICs.
      dc1554e4
  21. 08 Mar, 2013 1 commit
    • Christos Stavrakakis's avatar
      Bypass commissioning for orphan networks · ffc55de8
      Christos Stavrakakis authored
      Cyclades public networks do not have an owner, and since can not use
      the commissioning system. Also, make snf-dispatcher instead of failing
      for networks without userid to just a log a warning. This does not apply for
      API, because all API requests should have a userid.
      ffc55de8
  22. 14 Feb, 2013 1 commit
  23. 01 Feb, 2013 2 commits
  24. 04 Jan, 2013 1 commit
    • Christos Stavrakakis's avatar
      Fix bug about networks and offline backends · 0b24cf2c
      Christos Stavrakakis authored
      Ignore offline backends when computing the state of the network, since
      no notification will be received from them. Also, create no
      BackendNetwork for an offline backend. This will be created by
      reconcilliation, when the backend gets online again.
      0b24cf2c