cyclades: Replace FloatingIP with IPAddress
This commit just replaces all references to FloatingIP objects withreferences to IPAddress object, in order to be able to just load thecode. But the code is left unchanged, so all tests will fail.
cyclades: Include 'index' when comparing NICs
cyclades: Clear FloatingIP when deleting NIC
Override 'delete' method of NetworkInterface model, to clear the'machine' flag of the corresponding NIC, if any.
cyclades: Ignore Ganeti NICs with unknown ID
Do not process Ganeti NICs that do not have a valid ID and so areunknown to Cyclades, because processing these NICs would require tocreate them in DB and then rename them in Ganeti with the correspondingidentifier....
cyclades: Use NIC UUID in firewall tags
Use NICs UUID instead of index to generate firewall tags. Make the'set_firewall_profile' action to take the NICs ID as argument. Also,update the firewall settings.
cyclades: Fix case where 'dfree' is None
If Ganeti has not enabled 'plain' or 'drbd' disk template, then itreports 'dfree' as None. Fix this corner case by treating None as 0.
cyclades: Add 'ip_type' attribute to NIC
Extend NetworkInterface model with the 'ip_type' attribute to showwhether the IP is a floating or fixed.
Signed-off-by: Christos Stavrakakis <cstavr@grnet.gr>
cyclades: Use UUIDs to update VM NICs
Callback functions of snf-dispatcher updated the NICs of a VM bydeleting all NICs from DB, and creating the new NICs that were describedin the message. However, since NICs have UUIDs, this is no longerrequired. This commit update callbacks to update the NICs based on their...
gtools: Make eventd send job fields
Make snf-ganeti-eventd send 'job_fields' for instance and networkopcodes, and modify the corresponding backend functions andsnf-dispatcher callbacks.
cyclades: Fix getting action from Ganeti opcode
Parse the fields of the Ganeti command, to distinquish between'CONNECT' and 'DISCONNECT' in case of 'OP_INSTANCE_SET_PARAMS'.
cyclades: Make reconciliation timeouts constants
Remove hard-coded timeouts from code and make them constants. Also donot perform reconciliation for recent building NICs.
cyclades: Use NIC uuid when deleting NIC
cyclades: Use Ganeti NIC UUIDs
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 commitupdates Synnefo to refer to devices by their name. Synnefo will set thename of the devices which will be a UUID. We do not use Ganeti's UUIDs...
Fix compatibility issues with ganeti-2.7
Use opportunistic locking
Use opportunistic locking, introduced in Ganeti 2.7, to allow parallel creationof VMs in the Ganeti backend. When this option is set, Ganeti iallocatorwill allocate the VM only to nodes that not locked (e.g. by other VMcreation). This may result in unbalanced clusters, but `hbal` can be...
Remove deprecated network type in ganeti
Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Pass network type info in tags during create
Remove hotplug from InstanceCreate
New style format for modifying a NIC
cyclades: fix typo in snf-dispatcher
cyclades: Fix bug for externally reserved IPs
Skip check if there are no externally reserved IPs in the Ganetibackend.
cyclades: Do not release externally reserved IPs
Do not automatically release an externally reserved IP if it is releasedfrom a Ganeti backend. The IP should be released with snf-managenetwork-modify management commands.
cyclades: Refactor reconciliation of pools
Move reconciliation of IP pools from 'snf-manage reconcile-networks'to 'snf-manage reconcile-pools'. Also change the way reconciliationworks: Instead of reconciling the IP pools in DB with the IP pools inGaneti, the new reconciliation just checks that:...
cyclades: Refactor code for renaming a server
Created function for renaming a server.
cyclades: Fix bug in backend_allocator
The 'disk_template' attribute for flavors of external disk templateincluded the name of the provider. The backend allocator tried to find abackend with an enabled 'ext_$(provider)' disk template. This commitfixes this by searching only for 'ext' in the enabled disk templates.
cyclades: Fix bug in update_cluster callback
Decorate 'update_cluster' callback with 'handle_message_delivery' tohandle acknowledgement of messages.
cyclades: Remove custom ProtectedDeletedManager
Remove custom ProtectedDeletedManager. Instead use theForeignKey.on_delete attribute that has been introduced in Django 1.4.
cyclades: Add missing queue
QUEUE_CLUSTER must be included in QUEUES.
cyclades: Make disk_templates work with Ganeti<2.8
'enabled_disk_templates' cluster attribute has been added in Ganeti 2.8.If this attribute is missing, return the ipolicy disk templates.
cyclades: Fix typo
cyclades: Callback for cluster modifications
Extend snf-dispatcher callbacks with one to run every time anOP_CLUSTER_ opcode is executed in a Ganeti backend.
cyclades: Refactor backend-update-status cmd
The command has been changed to no longer take any arguments or options.Instead, this command always updates the resources and the enabled disktemplates of all online Ganeti backends.
Allocate VMs based on enabled disk-templates
Remove the ARCHIPELAGO_BACKENDS setting. Instead allocate VMs based onthe disk-templates that are enabled and allowed in ipolicy for eachbackend. The command 'snf-manage backend-update-status' can be used to...
cyclades: Display disk-templates in backend-list
cyclades: Return the newest vm object upon creation
The server_command decorator commits the just created object and retrievesit back from the database. Return the latter, because the former is stalein memory.
cyclades: Fix wrong quotas when creating server
Catch exception when talking to Ganeti inside 'server_command',otherwise the pending commission will be rejected. Also, accept thecommission in case of build, because the VM will be created in DB.
cyclades: Helper function for commissioning
Create 'quotas.handle_resource_commission' function for handlingcommissions for VMs and Networks.
cyclades: Handle errors during vm creation
Commit #f2080d1 mocked an OP_INSTANCE_REMOVE when enqueuing anOP_INSTANCE_CREATE job to Ganeti failed. However, this may result inreleasing IPs that may get reserved in Ganeti, because we can neverreally know if the job has reached Ganeti or not (e.g. timeout). For...
cyclades: refactor server creation command
Split the server creation command in more steps in order to bedecorated with the 'server_command' function and follow the logic of allother server commands. The main change is that the commission job is notaccepted when the VM is stored in DB, but when the OP_INSTANCE_CREATE...
cyclades: Apply old commits to moved files
Code from file 'api/servers.py' has been moved to 'logic/servers.py'.During the merge of hotfix-0.14.6 the develop, this code was lost. Thiscommit applies commits #f2080d1, #ea9b0fb, #32a0b85 to the new file.
Merge branch 'hotfix-0.14.6' into develop
Conflicts: Changelog docs/admin-guide.rst snf-cyclades-app/synnefo/api/management/commands/network-remove.py snf-cyclades-app/synnefo/api/servers.py snf-cyclades-app/synnefo/api/tests/servers.py snf-cyclades-app/synnefo/logic/backend.py...
cyclades: Make GanetiRapiClient work with gevent
GanetiRapiClient uses PyCurl, a Python interface to libcurl, andperforms blocking requests, so does not work well with gevent. Thiscommit makes GanetiRapiClient to use 'Requests' HTTP library that isgreenlet-safe.
cyclades: Simplify code
Simplify code by removing unnecessary temp variable.
cyclades: Do not release resources if already deleted
Ensure that a commission to release vm resources is issued only once.If a vm is marked `deleted', then resources must have already beenreleased.
cyclades: Do not save stale objects after a commit
Call to issue_and_accept_commission saves the resource object (eg a vm)and commits the transaction. This has the side-effect that the resourceobject becomes stale: its lock is released and another thread may acquire...
cyclades: fix typos
cyclades: Update NICs even if job failed
Make snf-ganeti-eventd send the NICs of the instance not only onsuccess, but also if the job has failed or has been canceled. Also,update snf-dispatcher to handle those messages. This step is required toclear BUILDING NICs that fail.
cyclades: Store action to the VM
cyclades: Fix bug in reconciliation
VMs at building error that do not exist in Ganeti must not be reportedas stale. The VM is stale only if the user has asked to destroy the VM,and so the action is DESTROY.
cyclades: Create NIC before send job to Ganeti
Create NICs in building state before enqueuing corresponding jobs toGaneti. This has already been done when creating the instance, but notwhen connecting it to other networks.
cyclades: Fix bug in snf-dispatcher logic
This commit reverts commits #07602322 and #30514662 which introduced abug in dispatcher's logic. These commit fixed the issue that, in a casethe Cyclades DB is unsynced with Ganeti, a resource that does not exist...
cyclades: Fix bug in handling of reboot type.
'type' attribute of reboot OS API call was directly mapped to the'reboot_type' option of Ganeti reboot job. However these two aresemantically different. The 'SOFT' and 'HARD' reboot types of OS API aremapped to 'shutdown_timeout' option of Ganeti jobs. However, setting...
cyclades: Do not pass 'hotplug' if disabled
Fix passing of hotplug argument to GanetiRAPIClient, in case theGANETI_USE_HOTPLUG is unset. If the Ganeti version does not supporthotplug, passing hotplug=False, will make the jobs fail at Ganeti opcodevalidation. This commit fixes this by passing the argument, only when...
cyclades: Add check for net action with no hotplug
In case hotplug is disabled, via GANETI_USE_HOTPLUG setting, networkactions should be allowed only on STOPPED vms. This commit adds thischeck and a unittest for this case. Also it makes some other checks...
cyclades: Fix check for firewall profile
cyclades: Remove firewall tag when removing NIC
Remove firewall tag from ganeti instance when disconnecting them fromnetworks. Until now, this was not needed because a vm could not bedisconnected from public networks. Since floating IPs, a vm may bedynamically be connected and disconnected to public networks, and so a...
cyclades: Fix bug in servers tests
Import settings from django.conf instead of synnefo.
cyclades: Import settings from django.conf
cyclades: init dispatcher with DJANGO_SETINGS_MODULE
cyclades: Fix condition for network netmask size
cyclades: Check that IPv6 network netmask is /64
Check that IPv6 network netmask is /64, because this is imposed by the'mac2eui64' utility that generates EUI-64 addresses from 48-bit MACaddresses.
Refs #4201
cyclades: Move code for validating network values
Move code for network parameters validation from 'api' module to 'logic'.
Fix stale import statements
Commit 7cfc0ce moved code from webproject to snf_django. This commitfixes some stale imports that skipped renaming.
snf-django: Move ListCommand to snf-django
snf-webproject contained the generic ListCommand, and because of this ithad a dependency from snf-django-lib. This commit moves this command fromsnf-webproject to snf-django-lib and removes this dependency. Also,...
cyclades: Add 'name' to all commissions.
Make all quotaholder commissions to have a name. Since, Cyclades doesnot store the association of a commission with a resource, we includethe resource in the commission name.
cyclades: Add network to multiple backends
Update snf-manage network-create command to take a list of commaseperated backend IDs to create the network to.
cyclades: Add check for link during network create
Add a check when creating IP_LESS_ROUTED networks, that the connectivitylink is not already used by another network.
cyclades: Fixes in network management commands
Merge code from logic/networks.py and network management commands.
cyclades: Set firewall profile per NIC
Set firewall profile per NIC, because since Floating IPs an instance canhave more than one NICs in a public network. Extend the API call to takethe NIC index as argument, and modify the Ganeti instance tags to beformated with the NIC index.
cyclades-rapi: Add bulk option to GetJobs
cyclades: Reconciliation for pending vm tasks
Extend reconciliation mechanism, to detect instances with stale pendingtasks, by looking if the corresponding job, 'vm.task_job_id', is stillrunning in the Ganeti backend.
Also refactor code that performed reconciliation for buildign vms, to...
cyclades: Minor improvements in manage commands
cyclades: Fix import of renamed settings
cyclades: No commission for public networks
Do not issue commission for public networks, since they do not have anowner.
cyclades: Consider IPv6 only networks in allocator
Backend allocator excludes backends that do not have a free IPv4address. Since, from now on, not all instances are connected to a publicnetwork, this check is only needed when 'SNF:ANY_PUBIC' network is used.
cyclades: Implement NetworkReconciler class
Refactory network reconciliation. Implement NetworkReconciler class tohold all reconciliation functions.
cyclades: Move NetworkReconciler to reconciliation
Move NetworkReconciler class from network-create command toreconciliation module.
cyclades: Add tests for network reconciliation
cyclades: Simple code refactoring
cyclades: Support IPv6 only networks
Make Cyclades support IPv6 only networks. Such networks will havethe 'subnet' attribute set to None, in the same way that IPv4 onlynetworks have the 'subnet6' attribute set to None.
Because currently Ganeti does not support IPv6 only networks, we create the...
cyclades: Add tests for IPv6 only networks
Add tests to check creation and usage of IPv6 only networks. Tests alsocover creation of other type of networks.
cyclades: Refactor code relative to networks
Move code checks from network-create management command tologic/networks.py.
Also create common decorator for management commands to convert apifaults to command errors.
cyclades: Refactor logic tests
Create tests module to hold all tests for logic.
Merge branch 'hotfix-0.14.2' into develop
Conflicts: Changelog snf-astakos-app/astakos/im/messages.py snf-astakos-app/astakos/im/views/target/__init__.py snf-cyclades-app/synnefo/logic/backend.py snf-cyclades-app/synnefo/logic/management/commands/reconcile-servers.py...
cyclades: Fix reconciliation of building vms
When reconciling a building vm, you first have to reconciliation it'screation and then it's operstate. Otherwise it is possible to end uphaving wrong quotas.
cyclades: Fix corner case in snf-dispatcher
Same as commit 0514662, but for servers.
cyclades: Fix typo bug in management command
cyclades: Fix type error
Create network may return a list of job IDs.
cyclades: Fix wrong unit of ram
cyclades: Parallel server reconciliation
Major refactor to reconcile-servers management command to make it workin parallel for each backend. Also, removed all --detect options, anddetect all incosistencies by default.
cyclades: Add tests for server reconciliation
Delete network from DB when job fails but the action of network isDESTROY. This case appears when someone tries to remove a network thathas been deleted from Ganeti backend, but not yet from DB.
cyclades: Fix typo in reconciliation
reconciliation: Strip Ganeti IP addresses
Strip spaces from Ganeti IP addresses, since they are not automaticallyignored in newer versions of ipaddr.
reconciliation: Get servers from DB ater ganeti
Change server reconciliation, to get the instances from DB after gettinginstances from Ganeti, to decrease the possibility for races.
cyclades: Fix exception message
Fix exception message when trying to connect an instance to a non-activepublic network.
cyclades: Wrap diagnostic creation in transaction
Fix bug in snf-dispatcher causing wrong updates of VMs from ganeti.Creation if instance diagnostics must run inside a transaction, becauseotherwise, the lock of the vm (select_for_update) is released too early....
cyclades: Rename "public" to "SNF:ANY_PUBLIC"
Rename reserved work for automatically choosing a public network from"public" to "SNF:ANY_PUBLIC". Also add the setting description to conffiles.