1. 09 Oct, 2013 1 commit
    • Christos Stavrakakis's avatar
      cyclades: Use Ganeti NIC UUIDs · 1a4633ef
      Christos Stavrakakis authored
      Since Ganeti 2.8, it is supported to refer to devices (NICs and Disks)
      not only by their index but also by their name or UUID. This commit
      updates Synnefo to refer to devices by their name. Synnefo will set the
      name of the devices which will be a UUID. We do not use Ganeti's UUIDs
      because the UUID can not be known, until the NIC is created in the VM.
      Modify backend methods for connecting and removing a NIC from a VM, to
      not refer to NICs by index, but use the NICs backend_uuid. Also, set the
      name of the NIC to the backend_uuid, when creating a NIC.
      API relevant methods, will create a NIC object in BUILDING state,
      instead of creating the NIC when the message arrives from the backend.
      Modify NetworkInterface model:
      * remove 'dirty' attribute since it is no longer needed
      * make index null, since when the NIC is in building state, the index
        can not be known.
      * add property for getting the UUID of the NIC in the Ganeti backend.
      Fix relevant tests.
  2. 07 Oct, 2013 3 commits
    • Christos Stavrakakis's avatar
    • 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.
    • 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.
  3. 02 Oct, 2013 3 commits
  4. 01 Oct, 2013 1 commit
  5. 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.
  6. 10 Sep, 2013 1 commit
  7. 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
  8. 07 Aug, 2013 1 commit
  9. 25 Jul, 2013 1 commit
  10. 24 Jul, 2013 1 commit
  11. 17 Jul, 2013 2 commits
    • Christos Stavrakakis's avatar
      cyclades: Fix exception message · f58b1628
      Christos Stavrakakis authored
    • 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( that will be
      never used, since Cyclades will connect instances to IPv6 networks with
      'address' attribute set to None.
  12. 10 Jul, 2013 1 commit
  13. 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.
    • 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
    • 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.
    • Christos Stavrakakis's avatar
    • 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.
    • 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.
    • 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
      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
      * RESIZING
      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
    • Christos Stavrakakis's avatar
    • 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
    • Christos Stavrakakis's avatar
  14. 13 Jun, 2013 1 commit
  15. 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.
  16. 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
    • 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
      * 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
  17. 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
      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
      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.
  18. 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.
  19. 08 Apr, 2013 2 commits
  20. 22 Mar, 2013 1 commit
  21. 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.
  22. 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.
  23. 14 Feb, 2013 1 commit
  24. 01 Feb, 2013 1 commit