From a1d135bf195861a824bf2bb4d5ba5b14f652fec7 Mon Sep 17 00:00:00 2001 From: Szabolcs Gelencser <gelencser.szabolcs.94@gmail.com> Date: Thu, 22 Feb 2018 14:12:45 +0100 Subject: [PATCH] Deploy and Shutoff operations work --- .idea/workspace.xml | 538 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- circle/acl/models.py | 108 +++++++++++------------------------------------------------------------------------------------------------- circle/circle/db.sqlite3 | Bin 304128 -> 0 bytes circle/common/operations.py | 89 ++++++++++++++--------------------------------------------------------------------------- circle/dashboard/urls.py | 6 +++--- circle/dashboard/views/util.py | 2 +- circle/dashboard/views/vm.py | 69 ++++++++++++++++++++++++++++++--------------------------------------- circle/vm/migrations/0006_remove_instance_name.py | 19 +++++++++++++++++++ circle/vm/models/instance.py | 2 +- circle/vm/operations.py | 294 +++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 10 files changed, 331 insertions(+), 796 deletions(-) create mode 100644 circle/vm/migrations/0006_remove_instance_name.py diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 38ee091..d6f642d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,98 +2,13 @@ <project version="4"> <component name="ChangeListManager"> <list default="true" id="1fbec8af-5a7c-40f9-b994-83ac07d1ae1d" name="Default" comment=""> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/__init__.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/base.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/cinder.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/glance.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/keystone.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/microversions.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/network.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/neutron.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/nova.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/__init__.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/cinder.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/config.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/glance.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/json_encoder.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/keystone.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/network.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/neutron.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/nova.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/policy.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/swift.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/urls.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/rest/utils.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_api/swift.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/__init__.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/backend.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/exceptions.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/forms.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/de/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/en_GB/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/eo/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/es/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/fr/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/id/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/ja/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/ko_KR/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/pt_BR/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/locale/zh_CN/LC_MESSAGES/django.po" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/models.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/plugin/__init__.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/plugin/base.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/plugin/k2k.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/plugin/password.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/plugin/token.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/policy.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/__init__.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/conf/keystone_policy.json" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/conf/no_default_policy.json" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/conf/nova_policy.json" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/conf/policy.v3cloudsample.json" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/conf/with_default_policy.json" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/data_v2.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/data_v3.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/settings.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/templates/auth/blank.html" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/templates/auth/login.html" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/unit/__init__.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/unit/test_auth.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/unit/test_policy.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/unit/test_user.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/unit/test_utils.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/tests/urls.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/urls.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/user.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/utils.py" /> - <change beforePath="" afterPath="$PROJECT_DIR$/circle/openstack_auth/views.py" /> + <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change beforePath="$PROJECT_DIR$/circle/acl/models.py" afterPath="$PROJECT_DIR$/circle/acl/models.py" /> - <change beforePath="$PROJECT_DIR$/circle/circle/settings/base.py" afterPath="$PROJECT_DIR$/circle/circle/settings/base.py" /> - <change beforePath="$PROJECT_DIR$/circle/circle/settings/local.py" afterPath="$PROJECT_DIR$/circle/circle/settings/local.py" /> - <change beforePath="$PROJECT_DIR$/circle/circle/urls.py" afterPath="$PROJECT_DIR$/circle/circle/urls.py" /> - <change beforePath="$PROJECT_DIR$/circle/common/models.py" afterPath="$PROJECT_DIR$/circle/common/models.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/admin.py" afterPath="$PROJECT_DIR$/circle/dashboard/admin.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/context_processors.py" afterPath="$PROJECT_DIR$/circle/dashboard/context_processors.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/forms.py" afterPath="$PROJECT_DIR$/circle/dashboard/forms.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/models.py" afterPath="$PROJECT_DIR$/circle/dashboard/models.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/tables.py" afterPath="$PROJECT_DIR$/circle/dashboard/tables.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/templates/base.html" afterPath="$PROJECT_DIR$/circle/dashboard/templates/base.html" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/base.html" afterPath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/base.html" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html" afterPath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index.html" afterPath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/index.html" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail.html" afterPath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail.html" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail/access.html" afterPath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail/access.html" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail/home.html" afterPath="$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail/home.html" /> + <change beforePath="$PROJECT_DIR$/circle/circle/db.sqlite3" afterPath="$PROJECT_DIR$/circle/circle/db.sqlite3" /> + <change beforePath="$PROJECT_DIR$/circle/common/operations.py" afterPath="$PROJECT_DIR$/circle/common/operations.py" /> <change beforePath="$PROJECT_DIR$/circle/dashboard/urls.py" afterPath="$PROJECT_DIR$/circle/dashboard/urls.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/views/__init__.py" afterPath="$PROJECT_DIR$/circle/dashboard/views/__init__.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/views/index.py" afterPath="$PROJECT_DIR$/circle/dashboard/views/index.py" /> - <change beforePath="$PROJECT_DIR$/circle/dashboard/views/user.py" afterPath="$PROJECT_DIR$/circle/dashboard/views/user.py" /> <change beforePath="$PROJECT_DIR$/circle/dashboard/views/util.py" afterPath="$PROJECT_DIR$/circle/dashboard/views/util.py" /> <change beforePath="$PROJECT_DIR$/circle/dashboard/views/vm.py" afterPath="$PROJECT_DIR$/circle/dashboard/views/vm.py" /> - <change beforePath="$PROJECT_DIR$/circle/firewall/models.py" afterPath="$PROJECT_DIR$/circle/firewall/models.py" /> - <change beforePath="$PROJECT_DIR$/circle/request/models.py" afterPath="$PROJECT_DIR$/circle/request/models.py" /> - <change beforePath="$PROJECT_DIR$/circle/storage/models.py" afterPath="$PROJECT_DIR$/circle/storage/models.py" /> - <change beforePath="$PROJECT_DIR$/circle/vm/models/__init__.py" afterPath="$PROJECT_DIR$/circle/vm/models/__init__.py" /> <change beforePath="$PROJECT_DIR$/circle/vm/models/instance.py" afterPath="$PROJECT_DIR$/circle/vm/models/instance.py" /> <change beforePath="$PROJECT_DIR$/circle/vm/operations.py" afterPath="$PROJECT_DIR$/circle/vm/operations.py" /> </list> @@ -124,88 +39,42 @@ <file leaf-file-name="urls.py" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/circle/dashboard/urls.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="3706"> - <caret line="226" column="18" lean-forward="false" selection-start-line="226" selection-start-column="18" selection-end-line="226" selection-end-column="18" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="util.py" pinned="false" current-in-tab="true"> - <entry file="file://$PROJECT_DIR$/circle/dashboard/views/util.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="629"> - <caret line="105" column="79" lean-forward="true" selection-start-line="105" selection-start-column="79" selection-end-line="105" selection-end-column="79" /> - <folding /> + <state relative-caret-position="163"> + <caret line="101" column="35" lean-forward="true" selection-start-line="101" selection-start-column="35" selection-end-line="101" selection-end-column="35" /> + <folding> + <element signature="e#732#770#0" expanded="true" /> + </folding> </state> </provider> </entry> </file> - <file leaf-file-name="models.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/circle/acl/models.py"> + <file leaf-file-name="__init__.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/circle/dashboard/views/__init__.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="2601"> - <caret line="164" column="19" lean-forward="false" selection-start-line="164" selection-start-column="19" selection-end-line="164" selection-end-column="19" /> + <state relative-caret-position="187"> + <caret line="11" column="5" lean-forward="false" selection-start-line="11" selection-start-column="5" selection-end-line="11" selection-end-column="5" /> <folding /> </state> </provider> </entry> </file> - <file leaf-file-name="vm.py" pinned="false" current-in-tab="false"> + <file leaf-file-name="vm.py" pinned="false" current-in-tab="true"> <entry file="file://$PROJECT_DIR$/circle/dashboard/views/vm.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="4488"> - <caret line="307" column="14" lean-forward="false" selection-start-line="307" selection-start-column="14" selection-end-line="307" selection-end-column="14" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="operations.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/circle/vm/operations.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="2057"> - <caret line="162" column="0" lean-forward="false" selection-start-line="162" selection-start-column="0" selection-end-line="162" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="activity.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/circle/vm/models/activity.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1598"> - <caret line="111" column="0" lean-forward="false" selection-start-line="111" selection-start-column="0" selection-end-line="111" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="operations.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/circle/common/operations.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="2261"> - <caret line="140" column="0" lean-forward="false" selection-start-line="140" selection-start-column="0" selection-end-line="140" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - </file> - <file leaf-file-name="base.py" pinned="false" current-in-tab="false"> - <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/template/base.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="16898"> - <caret line="1023" column="0" lean-forward="false" selection-start-line="1023" selection-start-column="0" selection-end-line="1023" selection-end-column="0" /> - <folding /> + <state relative-caret-position="350"> + <caret line="1308" column="56" lean-forward="false" selection-start-line="1308" selection-start-column="56" selection-end-line="1308" selection-end-column="56" /> + <folding> + <element signature="e#731#787#0" expanded="true" /> + </folding> </state> </provider> </entry> </file> - <file leaf-file-name="wsgi.py" pinned="false" current-in-tab="false"> - <entry file="file://$PROJECT_DIR$/circle/circle/wsgi.py"> + <file leaf-file-name="models.py" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/circle/dashboard/models.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="969"> - <caret line="59" column="0" lean-forward="false" selection-start-line="59" selection-start-column="0" selection-end-line="59" selection-end-column="0" /> + <state relative-caret-position="205"> + <caret line="86" column="27" lean-forward="false" selection-start-line="86" selection-start-column="27" selection-end-line="86" selection-end-column="27" /> <folding /> </state> </provider> @@ -214,8 +83,8 @@ <file leaf-file-name="instance.py" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/circle/vm/models/instance.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="4624"> - <caret line="310" column="0" lean-forward="false" selection-start-line="310" selection-start-column="0" selection-end-line="310" selection-end-column="0" /> + <state relative-caret-position="197"> + <caret line="334" column="0" lean-forward="true" selection-start-line="334" selection-start-column="0" selection-end-line="334" selection-end-column="0" /> <folding /> </state> </provider> @@ -233,29 +102,6 @@ </component> <component name="FindInProjectRecents"> <findStrings> - <find>orderedDict</find> - <find>VmDeploy</find> - <find>VmOpera</find> - <find>class VmOpera</find> - <find>OperationView</find> - <find>TokenOperationView</find> - <find>refrest</find> - <find>get_fr</find> - <find>access_method</find> - <find>_format_ac</find> - <find>acti</find> - <find>get_acti</find> - <find>vm_acti</find> - <find>render_to_string</find> - <find>autocom</find> - <find>stat</find> - <find>get_status_</find> - <find>get_status</find> - <find>get_status_displa</find> - <find>get_status_display</find> - <find>STATUS</find> - <find>icon</find> - <find>os</find> <find>system</find> <find>@profiler.trace</find> <find>access</find> @@ -263,7 +109,33 @@ <find>dep</find> <find>precond</find> <find>deployopera</find> + <find>Subope</find> + <find>suboper</find> + <find>deployoper</find> + <find>with_reload</find> + <find>deploy</find> + <find>vmdetail</find> + <find>TokenOperationView</find> + <find>deployope</find> + <find>deployOpe</find> + <find>vm_ops</find> + <find>w</find> + <find>wakeup</find> + <find>sleep</find> + <find>RUNNING</find> + <find>'RUNNING'</find> + <find>Deploy</find> + <find>DeployOpe</find> + <find>rebootoper</find> + <find>shutoff</find> + <find>operationview</find> + <find>fav</find> + <find>favou</find> + <find>favouritevi</find> </findStrings> + <replaceStrings> + <replace>'ACTIVE'</replace> + </replaceStrings> </component> <component name="Git.Settings"> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> @@ -308,12 +180,13 @@ <option value="$PROJECT_DIR$/circle/openstack_api/nova.py" /> <option value="$PROJECT_DIR$/circle/openstack_api/glance.py" /> <option value="$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail.html" /> - <option value="$PROJECT_DIR$/circle/dashboard/urls.py" /> - <option value="$PROJECT_DIR$/circle/vm/models/instance.py" /> - <option value="$PROJECT_DIR$/circle/dashboard/views/util.py" /> <option value="$PROJECT_DIR$/circle/acl/models.py" /> - <option value="$PROJECT_DIR$/circle/dashboard/views/vm.py" /> + <option value="$PROJECT_DIR$/circle/dashboard/views/util.py" /> + <option value="$PROJECT_DIR$/circle/vm/models/instance.py" /> <option value="$PROJECT_DIR$/circle/vm/operations.py" /> + <option value="$PROJECT_DIR$/circle/common/operations.py" /> + <option value="$PROJECT_DIR$/circle/dashboard/views/vm.py" /> + <option value="$PROJECT_DIR$/circle/dashboard/urls.py" /> </list> </option> </component> @@ -324,9 +197,9 @@ <sorting>DEFINITION_ORDER</sorting> </component> <component name="ProjectFrameBounds"> - <option name="x" value="1918" /> + <option name="x" value="-2" /> <option name="y" value="-1" /> - <option name="width" value="962" /> + <option name="width" value="1924" /> <option name="height" value="1063" /> </component> <component name="ProjectInspectionProfilesVisibleTreeState"> @@ -366,6 +239,7 @@ <foldersAlwaysOnTop value="true" /> </navigator> <panes> + <pane id="Scope" /> <pane id="ProjectPane"> <subPane> <expand> @@ -388,23 +262,19 @@ <item name="cloud" type="b2602c69:ProjectViewProjectNode" /> <item name="cloud" type="462c0819:PsiDirectoryNode" /> <item name="circle" type="462c0819:PsiDirectoryNode" /> - <item name="openstack_auth" type="462c0819:PsiDirectoryNode" /> + <item name="acl" type="462c0819:PsiDirectoryNode" /> + <item name="management" type="462c0819:PsiDirectoryNode" /> </path> <path> <item name="cloud" type="b2602c69:ProjectViewProjectNode" /> <item name="cloud" type="462c0819:PsiDirectoryNode" /> <item name="circle" type="462c0819:PsiDirectoryNode" /> - <item name="vm" type="462c0819:PsiDirectoryNode" /> - </path> - <path> - <item name="cloud" type="b2602c69:ProjectViewProjectNode" /> - <item name="External Libraries" type="cb654da1:ExternalLibrariesNode" /> + <item name="dashboard" type="462c0819:PsiDirectoryNode" /> </path> </expand> <select /> </subPane> </pane> - <pane id="Scope" /> <pane id="Scratches" /> </panes> </component> @@ -414,7 +284,7 @@ <property name="settings.editor.selected.configurable" value="preferences.keymap" /> <property name="NewWatcherDialog.advanced.open" value="true" /> <property name="DefaultHtmlFileTemplate" value="HTML File" /> - <property name="SearchEverywhereHistoryKey" value="Deploy	null	null Instance	null	null Vmdeta	null	null list_from	null	null aclupda	null	null base.htm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/base.html method	ACTION	GoToMenuEx index.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html base.ht	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/base.html base.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/base.html index.py	FILE	file:///home/h3yduck/cloud/circle/dashboard/views/index.py index.htm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html server	null	null Disk	null	null" /> + <property name="SearchEverywhereHistoryKey" value="sleep	null	null Deploy	null	null Instance	null	null Vmdeta	null	null list_from	null	null aclupda	null	null base.htm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/base.html method	ACTION	GoToMenuEx index.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html base.ht	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/base.html base.html	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/base.html index.py	FILE	file:///home/h3yduck/cloud/circle/dashboard/views/index.py index.htm	FILE	file:///home/h3yduck/cloud/circle/dashboard/templates/dashboard/index.html server	null	null Disk	null	null" /> </component> <component name="RecentsManager"> <key name="MoveFile.RECENT_KEYS"> @@ -475,28 +345,28 @@ <servers /> </component> <component name="ToolWindowManager"> - <frame x="1918" y="-1" width="962" height="1063" extended-state="0" /> + <frame x="-2" y="-1" width="1924" height="1063" extended-state="0" /> <editor active="true" /> <layout> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.327818" sideWeight="0.5021299" order="7" side_tool="true" content_ui="tabs" /> + <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32875264" sideWeight="0.4978701" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32875264" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.39852008" sideWeight="0.42438763" order="7" side_tool="true" content_ui="tabs" /> - <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32875264" sideWeight="0.4978701" order="2" side_tool="false" content_ui="tabs" /> - <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.397463" sideWeight="0.4318424" order="7" side_tool="true" content_ui="tabs" /> - <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3187773" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> + <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3689218" sideWeight="0.4339723" order="7" side_tool="true" content_ui="tabs" /> + <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.157082" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Docker" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" /> <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> + <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="SciView" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> + <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.43023255" sideWeight="0.5660277" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> - <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3689218" sideWeight="0.5681576" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> - <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> </layout> <layout-to-restore> @@ -536,11 +406,6 @@ <line>82</line> <option name="timeStamp" value="13" /> </line-breakpoint> - <line-breakpoint enabled="true" suspend="THREAD" type="python-line"> - <url>file://$PROJECT_DIR$/circle/vm/operations.py</url> - <line>157</line> - <option name="timeStamp" value="81" /> - </line-breakpoint> </breakpoints> <breakpoints-dialog> <breakpoints-dialog /> @@ -552,13 +417,18 @@ </properties> </breakpoint> </default-breakpoints> - <option name="time" value="82" /> + <option name="time" value="104" /> </breakpoint-manager> <watches-manager /> </component> <component name="debuggerHistoryManager"> <expressions id="evaluateExpression"> <expression> + <expression-string>json.dumps(response)</expression-string> + <language-id>Python</language-id> + <evaluation-mode>EXPRESSION</evaluation-mode> + </expression> + <expression> <expression-string>self</expression-string> <language-id>Python</language-id> <evaluation-mode>EXPRESSION</evaluation-mode> @@ -598,58 +468,9 @@ <language-id>Python</language-id> <evaluation-mode>EXPRESSION</evaluation-mode> </expression> - <expression> - <expression-string>activities = openstack_api.nova.instance_action_list(self.request, instance.os_server_id)</expression-string> - <language-id>Python</language-id> - <evaluation-mode>EXPRESSION</evaluation-mode> - </expression> </expressions> </component> <component name="editorHistoryManager"> - <entry file="file:///usr/lib/python2.7/importlib/__init__.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="408"> - <caret line="36" column="0" lean-forward="false" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/circle/dashboard/views/group.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="173"> - <caret line="36" column="0" lean-forward="false" selection-start-line="36" selection-start-column="0" selection-end-line="36" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/base.html"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="-7"> - <caret line="79" column="58" lean-forward="true" selection-start-line="79" selection-start-column="58" selection-end-line="79" selection-end-column="58" /> - </state> - </provider> - </entry> - <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/forms/models.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="275"> - <caret line="276" column="0" lean-forward="false" selection-start-line="276" selection-start-column="0" selection-end-line="276" selection-end-column="0" /> - </state> - </provider> - </entry> - <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/db/models/base.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="299"> - <caret line="1258" column="0" lean-forward="true" selection-start-line="1258" selection-start-column="0" selection-end-line="1258" selection-end-column="0" /> - <folding /> - </state> - </provider> - </entry> - <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/db/models/manager.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="306"> - <caret line="174" column="20" lean-forward="false" selection-start-line="174" selection-start-column="20" selection-end-line="174" selection-end-column="20" /> - </state> - </provider> - </entry> - <entry file="file://$PROJECT_DIR$/circle/vm/managers/os_instance_manager.py" /> <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/braces/views/_access.py"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="419"> @@ -694,13 +515,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/dashboard/views/__init__.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="187"> - <caret line="11" column="0" lean-forward="true" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/circle/openstack_auth/plugin/base.py"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="317"> @@ -708,13 +522,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/dashboard/views/index.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="181"> - <caret line="40" column="42" lean-forward="false" selection-start-line="40" selection-start-column="42" selection-end-line="40" selection-end-column="42" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/index-vm.html"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="595"> @@ -764,13 +571,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/openstack_api/nova.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="181"> - <caret line="1043" column="4" lean-forward="false" selection-start-line="1043" selection-start-column="4" selection-end-line="1043" selection-end-column="4" /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/vm-detail/_activity-timeline.html"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="-357"> @@ -799,13 +599,6 @@ </state> </provider> </entry> - <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/core/handlers/exception.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="181"> - <caret line="40" column="0" lean-forward="false" selection-start-line="40" selection-start-column="0" selection-end-line="40" selection-end-column="0" /> - </state> - </provider> - </entry> <entry file="file:///usr/lib/python2.7/threading.py"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="181"> @@ -848,13 +641,6 @@ </state> </provider> </entry> - <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/core/handlers/base.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="173"> - <caret line="123" column="0" lean-forward="false" selection-start-line="123" selection-start-column="0" selection-end-line="123" selection-end-column="0" /> - </state> - </provider> - </entry> <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/views/generic/base.py"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="275"> @@ -863,14 +649,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/dashboard/urls.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="3706"> - <caret line="226" column="18" lean-forward="false" selection-start-line="226" selection-start-column="18" selection-end-line="226" selection-end-column="18" /> - <folding /> - </state> - </provider> - </entry> <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/views/generic/detail.py"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="198"> @@ -879,14 +657,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/acl/models.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="2601"> - <caret line="164" column="19" lean-forward="false" selection-start-line="164" selection-start-column="19" selection-end-line="164" selection-end-column="19" /> - <folding /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/circle/dashboard/templates/dashboard/operate.html"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> @@ -894,14 +664,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/dashboard/views/vm.py"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="4488"> - <caret line="307" column="14" lean-forward="false" selection-start-line="307" selection-start-column="14" selection-end-line="307" selection-end-column="14" /> - <folding /> - </state> - </provider> - </entry> <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/contrib/auth/models.py"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="190"> @@ -933,45 +695,171 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/vm/models/instance.py"> + <entry file="file://$PROJECT_DIR$/circle/vm/models/activity.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="4624"> - <caret line="310" column="0" lean-forward="false" selection-start-line="310" selection-start-column="0" selection-end-line="310" selection-end-column="0" /> + <state relative-caret-position="1598"> + <caret line="111" column="0" lean-forward="false" selection-start-line="111" selection-start-column="0" selection-end-line="111" selection-end-column="0" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/vm/models/activity.py"> + <entry file="file://$PROJECT_DIR$/circle/acl/models.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1598"> - <caret line="111" column="0" lean-forward="false" selection-start-line="111" selection-start-column="0" selection-end-line="111" selection-end-column="0" /> + <state relative-caret-position="420"> + <caret line="150" column="55" lean-forward="true" selection-start-line="150" selection-start-column="55" selection-end-line="150" selection-end-column="55" /> <folding /> </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/circle/vm/operations.py"> + <entry file="file://$PROJECT_DIR$/circle/vm/tasks/local_tasks.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="326"> + <caret line="33" column="30" lean-forward="true" selection-start-line="33" selection-start-column="30" selection-end-line="33" selection-end-column="30" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/.PyCharm2017.3/system/python_stubs/-66389823/__builtin__.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="190"> + <caret line="518" column="4" lean-forward="false" selection-start-line="518" selection-start-column="4" selection-end-line="518" selection-end-column="4" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/views/decorators/http.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="527"> + <caret line="39" column="0" lean-forward="false" selection-start-line="39" selection-start-column="0" selection-end-line="39" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/core/handlers/base.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="411"> + <caret line="248" column="0" lean-forward="false" selection-start-line="248" selection-start-column="0" selection-end-line="248" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/circle/openstack_api/nova.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="190"> + <caret line="544" column="4" lean-forward="false" selection-start-line="544" selection-start-column="4" selection-end-line="544" selection-end-column="4" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/utils/functional.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="199"> + <caret line="66" column="0" lean-forward="false" selection-start-line="66" selection-start-column="0" selection-end-line="66" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/circle/dashboard/views/index.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="190"> + <caret line="40" column="0" lean-forward="false" selection-start-line="40" selection-start-column="0" selection-end-line="40" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/utils/autoreload.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="2057"> - <caret line="162" column="0" lean-forward="false" selection-start-line="162" selection-start-column="0" selection-end-line="162" selection-end-column="0" /> + <state relative-caret-position="171"> + <caret line="227" column="0" lean-forward="false" selection-start-line="227" selection-start-column="0" selection-end-line="227" selection-end-column="0" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$APPLICATION_HOME_DIR$/helpers/pydev/_pydev_bundle/pydev_monkey.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="163"> + <caret line="588" column="0" lean-forward="false" selection-start-line="588" selection-start-column="0" selection-end-line="588" selection-end-column="0" /> <folding /> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/circle/common/operations.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="2261"> - <caret line="140" column="0" lean-forward="false" selection-start-line="140" selection-start-column="0" selection-end-line="140" selection-end-column="0" /> + <state relative-caret-position="214"> + <caret line="50" column="11" lean-forward="false" selection-start-line="50" selection-start-column="11" selection-end-line="50" selection-end-column="11" /> <folding /> </state> </provider> </entry> + <entry file="file://$USER_HOME$/.virtualenvs/cloud/local/lib/python2.7/site-packages/django/core/handlers/exception.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="494"> + <caret line="59" column="37" lean-forward="false" selection-start-line="59" selection-start-column="37" selection-end-line="59" selection-end-column="37" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/circle/vm/operations.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="163"> + <caret line="144" column="0" lean-forward="false" selection-start-line="144" selection-start-column="0" selection-end-line="144" selection-end-column="0" /> + <folding> + <element signature="e#732#788#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> <entry file="file://$PROJECT_DIR$/circle/dashboard/views/util.py"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="629"> - <caret line="105" column="79" lean-forward="true" selection-start-line="105" selection-start-column="79" selection-end-line="105" selection-end-column="79" /> + <state relative-caret-position="265"> + <caret line="302" column="22" lean-forward="false" selection-start-line="302" selection-start-column="22" selection-end-line="302" selection-end-column="22" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/circle/vm/models/instance.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="197"> + <caret line="334" column="0" lean-forward="true" selection-start-line="334" selection-start-column="0" selection-end-line="334" selection-end-column="0" /> <folding /> </state> </provider> </entry> + <entry file="file://$PROJECT_DIR$/circle/dashboard/views/__init__.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="187"> + <caret line="11" column="5" lean-forward="false" selection-start-line="11" selection-start-column="5" selection-end-line="11" selection-end-column="5" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/circle/dashboard/models.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="205"> + <caret line="86" column="27" lean-forward="false" selection-start-line="86" selection-start-column="27" selection-end-line="86" selection-end-column="27" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/circle/dashboard/urls.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="163"> + <caret line="101" column="35" lean-forward="true" selection-start-line="101" selection-start-column="35" selection-end-line="101" selection-end-column="35" /> + <folding> + <element signature="e#732#770#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/circle/dashboard/views/vm.py"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="350"> + <caret line="1308" column="56" lean-forward="false" selection-start-line="1308" selection-start-column="56" selection-end-line="1308" selection-end-column="56" /> + <folding> + <element signature="e#731#787#0" expanded="true" /> + </folding> + </state> + </provider> + </entry> </component> </project> \ No newline at end of file diff --git a/circle/acl/models.py b/circle/acl/models.py index d9aa4ce..ff82383 100644 --- a/circle/acl/models.py +++ b/circle/acl/models.py @@ -76,20 +76,10 @@ class AclBase(Model): object_level_set = GenericRelation(ObjectLevel) def clone_acl(self, other): - """Clone full ACL from other object.""" - assert self.id != other.id or type(self) != type(other) - self.object_level_set.clear() - for i in other.object_level_set.all(): - ol = self.object_level_set.create(level=i.level) - for j in i.users.all(): - ol.users.add(j) - for j in i.groups.all(): - ol.groups.add(j) + pass @classmethod def get_level_object(cls, level): - - """Get Level object for this model by codename.""" ct = ContentType.objects.get_for_model(cls) return Level.objects.get(codename=level, content_type=ct) @@ -110,104 +100,28 @@ class AclBase(Model): raise AttributeError('"whom" must be a User or Group object.') def set_user_level(self, user, level): - - """Set level of object for a user. - - :param whom: user the level is set for - :type whom: User - :param level: codename of level to set, or None - :type level: Level or str or unicode or NoneType - """ - logger.info('%s.set_user_level(%s, %s) called', - *[unicode(p) for p in [self, user, level]]) - if level is None: - pk = None - else: - if isinstance(level, basestring): - level = self.get_level_object(level) - if not self.object_level_set.filter(level_id=level.pk).exists(): - self.object_level_set.create(level=level) - pk = level.pk - for i in self.object_level_set.all(): - if i.level_id != pk: - i.users.remove(user) - else: - i.users.add(user) - i.save() + #TODO: delete + pass def set_group_level(self, group, level): - - """Set level of object for a user. - - :param whom: user the level is set for - :type whom: User or unicode or str - :param level: codename of level to set - :type level: str or unicode - """ - logger.info('%s.set_group_level(%s, %s) called', - *[unicode(p) for p in [self, group, level]]) - if level is None: - pk = None - else: - if isinstance(level, basestring): - level = self.get_level_object(level) - if not self.object_level_set.filter(level_id=level.pk).exists(): - self.object_level_set.create(level=level) - pk = level.pk - for i in self.object_level_set.all(): - if i.level_id != pk: - i.groups.remove(group) - else: - i.groups.add(group) - i.save() + #TODO: delete + pass def has_level(self, user, level, group_also=True): - return True - + #TODO: implement logger.debug('%s.has_level(%s, %s, %s) called', *[unicode(p) for p in [self, user, level, group_also]]) - if user is None or not user.is_authenticated(): - return False - if getattr(user, 'is_superuser', False): - logger.debug('- superuser granted') - return True - if isinstance(level, basestring): - level = self.get_level_object(level) - logger.debug("- level set by str: %s", unicode(level)) - - object_levels = self.object_level_set.filter( - level__weight__gte=level.weight).all() - groups = user.groups.values_list('id', flat=True) if group_also else [] - for i in object_levels: - if i.users.filter(pk=user.pk).exists(): - return True - if group_also and i.groups.filter(pk__in=groups).exists(): - return True - return False + return True def get_users_with_level(self, **kwargs): + # TODO: implement logger.debug('%s.get_users_with_level() called', unicode(self)) - object_levels = (self.object_level_set.filter(**kwargs).select_related( - 'level').prefetch_related('users').all()) - users = [] - for object_level in object_levels: - name = object_level.level.codename - olusers = object_level.users.all() - users.extend([(u, name) for u in olusers]) - logger.debug('- %s: %s' % (name, [u.username for u in olusers])) - return users + return [] def get_groups_with_level(self): + # TODO: implement logger.debug('%s.get_groups_with_level() called', unicode(self)) - object_levels = (self.object_level_set.select_related( - 'level').prefetch_related('groups').all()) - groups = [] - for object_level in object_levels: - name = object_level.level.codename - olgroups = object_level.groups.all() - groups.extend([(g, name) for g in olgroups]) - logger.debug('- %s: %s' % (name, [g.name for g in olgroups])) - return groups + return [] @classmethod def get_objects_with_level(cls, level, user, diff --git a/circle/circle/db.sqlite3 b/circle/circle/db.sqlite3 index 6dfce05..c7b0b85 100644 Binary files a/circle/circle/db.sqlite3 and b/circle/circle/db.sqlite3 differ diff --git a/circle/common/operations.py b/circle/common/operations.py index 443cc87..a3b7cfb 100644 --- a/circle/common/operations.py +++ b/circle/common/operations.py @@ -26,32 +26,15 @@ from .models import (activity_context, has_suffix, humanize_exception, logger = getLogger(__name__) - -class SubOperationMixin(object): - required_perms = () - - def create_activity(self, parent, user, kwargs): - if not parent: - raise TypeError("SubOperation can only be called with " - "parent_activity specified.") - return super(SubOperationMixin, self).create_activity( - parent, user, kwargs) - - class Operation(object): """Base class for VM operations. """ - async_queue = 'localhost.man' required_perms = None superuser_required = False do_not_call_in_templates = True abortable = False has_percentage = False - @classmethod - def get_activity_code_suffix(cls): - return cls.id - def __call__(self, **kwargs): return self.call(**kwargs) @@ -63,10 +46,12 @@ class Operation(object): def __unicode__(self): return self.name - def __prelude(self, kwargs): + def __prelude(self, request, kwargs): """This method contains the shared prelude of call and async. """ - defaults = {'parent_activity': None, 'system': False, 'user': None} + self._operation.im_self.get_from_os(request) + + defaults = {'system': False, 'user': None} allargs = dict(defaults, **kwargs) # all arguments auxargs = allargs.copy() # auxiliary (i.e. only for _operation) args @@ -75,11 +60,8 @@ class Operation(object): skip_auth_check = auxargs.pop('system') user = auxargs.pop('user') - parent_activity = auxargs.pop('parent_activity') - if parent_activity and user is None and not skip_auth_check: - user = allargs['user'] = parent_activity.user - if user is None: # parent was a system call - skip_auth_check = True + if user is None: # parent was a system call + skip_auth_check = True # check for unexpected keyword arguments argspec = getargspec(self._operation) @@ -93,12 +75,9 @@ class Operation(object): self.check_auth(user) self.check_precond() - activity = self.create_activity( - parent=parent_activity, user=user, kwargs=kwargs) - - return activity, allargs, auxargs + return allargs, auxargs - def _exec_op(self, allargs, auxargs): + def _exec_op(self, request, allargs, auxargs): """Execute the operation inside the specified activity's context. """ # compile arguments for _operation @@ -110,13 +89,7 @@ class Operation(object): if k in argspec.args} arguments.update(auxargs) - with activity_context(allargs['activity'], on_abort=self.on_abort, - on_commit=self.on_commit) as act: - retval = self._operation(**arguments) - if (act.result is None and isinstance( - retval, (basestring, int, HumanReadableObject))): - act.result = retval - return retval + return self._operation(request, **arguments) def _operation(self, **kwargs): """This method is the operation's particular implementation. @@ -125,25 +98,7 @@ class Operation(object): """ raise NotImplementedError - def async(self, **kwargs): - """Execute the operation asynchronously. - - Only a quick, preliminary check is ran before creating the associated - activity and queuing the job. - - The returned value is the handle for the asynchronous job. - - For more information, check the synchronous call's documentation. - """ - logger.info("%s called asynchronously on %s with the following " - "parameters: %r", self.__class__.__name__, self.subject, - kwargs) - activity, allargs, auxargs = self.__prelude(kwargs) - return self.async_operation.apply_async( - args=(self.id, self.subject.pk, activity.pk, allargs, auxargs, ), - queue=self.async_queue) - - def call(self, **kwargs): + def call(self, request, **kwargs): """Execute the operation (synchronously). Anticipated keyword arguments: @@ -159,9 +114,8 @@ class Operation(object): logger.info("%s called (synchronously) on %s with the following " "parameters: %r", self.__class__.__name__, self.subject, kwargs) - activity, allargs, auxargs = self.__prelude(kwargs) - allargs['activity'] = activity - return self._exec_op(allargs, auxargs) + allargs, auxargs = self.__prelude(request, kwargs) + return self._exec_op(request, allargs, auxargs) def check_precond(self): pass @@ -185,11 +139,8 @@ class Operation(object): def check_auth(self, user): """Check if user is permitted to run this operation on this instance """ - - self.check_perms(user) - - def create_activity(self, parent, user, kwargs): - raise NotImplementedError + #TODO: implement + pass def on_abort(self, activity, error): """This method is called when the operation aborts (i.e. raises an @@ -197,18 +148,6 @@ class Operation(object): """ pass - def get_activity_name(self, kwargs): - try: - return self.activity_name - except AttributeError: - try: - return self.name._proxy____args[0] # ewww! - except AttributeError: - raise ImproperlyConfigured( - "Set Operation.activity_name to an ugettext_nooped " - "string or a create_readable call, or override " - "get_activity_name to create a name dynamically") - def on_commit(self, activity): """This method is called when the operation executes successfully. """ diff --git a/circle/dashboard/urls.py b/circle/dashboard/urls.py index 16197f9..190ed12 100644 --- a/circle/dashboard/urls.py +++ b/circle/dashboard/urls.py @@ -18,7 +18,7 @@ from __future__ import absolute_import from dashboard.views.autocomplete import AclUserGroupAutocomplete, AclUserAutocomplete -from dashboard.views.vm import VmDetailView, VmList, VmCreate, vm_activity, vm_ops +from dashboard.views.vm import VmDetailView, VmList, VmCreate, vm_activity, vm_ops, FavouriteView from django.conf.urls import url from .views import ( @@ -99,8 +99,8 @@ urlpatterns = [ # url(r'^node/activity/(?P<pk>\d+)/$', NodeActivityDetail.as_view(), # name='dashboard.views.node-activity'), # - # url(r'^favourite/$', FavouriteView.as_view(), - # name='dashboard.views.favourite'), + url(r'^favourite/$', FavouriteView.as_view(), + name='dashboard.views.favourite'), # url(r'^group/delete/(?P<pk>\d+)/$', GroupDelete.as_view(), # name="dashboard.views.delete-group"), # url(r'^group/list/$', GroupList.as_view(), diff --git a/circle/dashboard/views/util.py b/circle/dashboard/views/util.py index f177454..7f4e180 100644 --- a/circle/dashboard/views/util.py +++ b/circle/dashboard/views/util.py @@ -294,7 +294,7 @@ class OperationView(RedirectToLoginMixin, DetailView): result = None done = False try: - task = self.get_op().async(user=request.user, **extra) + task = self.get_op().call(request, user=request.user, **extra) except HumanReadableException as e: e.send_message(request) logger.exception("Could not start operation") diff --git a/circle/dashboard/views/vm.py b/circle/dashboard/views/vm.py index c838755..7a9f662 100644 --- a/circle/dashboard/views/vm.py +++ b/circle/dashboard/views/vm.py @@ -21,6 +21,7 @@ import logging from collections import OrderedDict import openstack_api +from dashboard.models import Favourite from django.conf import settings from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixin @@ -110,8 +111,6 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView): context = super(VmDetailView, self).get_context_data(**kwargs) instance = context['instance'] user = self.request.user - is_operator = instance.has_level(user, "operator") - is_owner = instance.has_level(user, "owner") ops = get_operations(instance, user) hide_tutorial = self.request.COOKIES.get( "hide_tutorial_for_%s" % instance.pk) == "True" @@ -155,9 +154,7 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView): # context['ipv6_port'] = instance.get_connect_port(use_ipv6=True) # resources forms - can_edit = ( - instance.has_level(user, "owner") and - self.request.user.has_perm("vm.change_resources")) + can_edit = True context['resources_form'] = VmResourcesForm( can_edit=can_edit, instance=instance) @@ -173,11 +170,7 @@ class VmDetailView(LoginRequiredMixin, GraphMixin, DetailView): context['client_download'] = self.request.COOKIES.get( 'downloaded_client') # can link template - context['can_link_template'] = instance.template and is_operator - - # is operator/owner - context['is_operator'] = is_operator - context['is_owner'] = is_owner + context['can_link_template'] = instance.template # operation also allows RUNNING (if with_shutdown is present) context['save_resources_enabled'] = instance.status in ( @@ -307,7 +300,7 @@ def get_operations(instance, user): try: op = v.get_op_by_object(instance) # op.check_auth(user) - # op.check_precond() + op.check_precond() except PermissionDenied as e: logger.debug('Not showing operation %s for %s: %s', k, instance, unicode(e)) @@ -743,26 +736,24 @@ vm_ops = OrderedDict([ ('deploy', VmDeployView), ('wake_up', VmOperationView.factory( op='wake_up', icon='sun-o', effect='success')), - # ('sleep', VmOperationView.factory( - # extra_bases=[TokenOperationView], - # op='sleep', icon='moon-o', effect='info')), + ('sleep', VmOperationView.factory( + op='sleep', icon='moon-o', effect='info')), # ('migrate', VmMigrateView), # ('save_as_template', VmSaveView), - # ('reboot', VmOperationView.factory( - # op='reboot', icon='refresh', effect='warning')), + ('reboot', VmOperationView.factory( + op='reboot', icon='refresh', effect='warning')), # ('reset', VmOperationView.factory( # op='reset', icon='bolt', effect='warning')), # ('shutdown', VmOperationView.factory( # op='shutdown', icon='power-off', effect='warning')), - # ('shut_off', VmOperationView.factory( - # op='shut_off', icon='plug', effect='warning')), + ('shut_off', VmOperationView.factory( + op='shut_off', icon='plug', effect='warning')), # ('recover', VmOperationView.factory( # op='recover', icon='medkit', effect='warning')), # ('nostate', VmStateChangeView), # ('redeploy', RedeployView), - # ('destroy', VmOperationView.factory( - # extra_bases=[TokenOperationView], - # op='destroy', icon='times', effect='danger')), + ('destroy', VmOperationView.factory( + op='destroy', icon='times', effect='danger')), # ('create_disk', VmCreateDiskView), # ('download_disk', VmDownloadDiskView), # ('resize_disk', VmDiskModifyView.factory( @@ -790,8 +781,8 @@ vm_ops = OrderedDict([ # )), # ('rename', VmRenameView), ]) -# -# + + def _get_activity_icon(act): op = act.get_operation() if op and op.id in vm_ops: @@ -1265,7 +1256,7 @@ def vm_activity(request, pk): # activities = activities[:10] response['connect_uri'] = instance.get_connect_uri() - response['human_readable_status'] = instance.get_status_display() + response['human_readable_status'] = '#TODO' #instance.get_status_display() response['status'] = instance.status response['icon'] = instance.get_status_icon() latest = instance.get_latest_activity_in_progress() @@ -1275,8 +1266,8 @@ def vm_activity(request, pk): context = { 'instance': instance, - # 'activities': activities, - # 'show_show_all': show_show_all, + 'activities': (), + 'show_show_all': False, 'ops': get_operations(instance, request.user), } @@ -1299,19 +1290,19 @@ def vm_activity(request, pk): ) # # -# class FavouriteView(TemplateView): -# -# def post(self, *args, **kwargs): -# user = self.request.user -# vm = Instance.objects.get(pk=self.request.POST.get("vm")) -# if not vm.has_level(user, 'user'): -# raise PermissionDenied() -# try: -# Favourite.objects.get(instance=vm, user=user).delete() -# return HttpResponse("Deleted.") -# except Favourite.DoesNotExist: -# Favourite(instance=vm, user=user).save() -# return HttpResponse("Added.") +class FavouriteView(TemplateView): + + def post(self, *args, **kwargs): + user = self.request.user + vm = Instance.objects.get(pk=self.request.POST.get("vm")) + if not vm.has_level(user, 'user'): + raise PermissionDenied() + try: + Favourite.objects.get(instance=vm, user=user).delete() + return HttpResponse("Deleted.") + except Favourite.DoesNotExist: + Favourite(instance=vm, user=user).save() + return HttpResponse("Added.") # # # class TransferInstanceOwnershipConfirmView(TransferOwnershipConfirmView): diff --git a/circle/vm/migrations/0006_remove_instance_name.py b/circle/vm/migrations/0006_remove_instance_name.py new file mode 100644 index 0000000..f1f1dfb --- /dev/null +++ b/circle/vm/migrations/0006_remove_instance_name.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.6 on 2018-02-22 09:53 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('vm', '0005_remove_instance_owner'), + ] + + operations = [ + migrations.RemoveField( + model_name='instance', + name='name', + ), + ] diff --git a/circle/vm/models/instance.py b/circle/vm/models/instance.py index c137071..8d87ed2 100644 --- a/circle/vm/models/instance.py +++ b/circle/vm/models/instance.py @@ -209,7 +209,7 @@ class InstanceTemplate(AclBase, VirtualMachineDescModel, TimeStampedModel): return 'template.%d' % self.pk -class Instance(AclBase, OperatedMixin, TimeStampedModel): +class Instance(OperatedMixin, TimeStampedModel): """Virtual machine instance. """ diff --git a/circle/vm/operations.py b/circle/vm/operations.py index 6d19128..9c79acf 100644 --- a/circle/vm/operations.py +++ b/circle/vm/operations.py @@ -27,6 +27,7 @@ from tarfile import TarFile, TarInfo import time from urlparse import urlsplit +import openstack_api from django.core.exceptions import PermissionDenied, SuspiciousOperation from django.core.urlresolvers import reverse from django.utils import timezone @@ -42,7 +43,7 @@ from celery.exceptions import TimeLimitExceeded, TimeoutError from common.models import ( create_readable, humanize_exception, HumanReadableException ) -from common.operations import Operation, register_operation, SubOperationMixin +from common.operations import Operation, register_operation from manager.scheduler import SchedulerError from .tasks.local_tasks import ( abortable_async_instance_operation, abortable_async_node_operation, @@ -96,7 +97,6 @@ class AbortableRemoteOperationMixin(object): class InstanceOperation(Operation): acl_level = 'owner' - async_operation = abortable_async_instance_operation host_cls = Instance concurrency_check = True accept_states = None @@ -108,9 +108,6 @@ class InstanceOperation(Operation): self.instance = instance def check_precond(self): - return - if self.instance.destroyed_at: - raise self.instance.InstanceDestroyedError(self.instance) if self.accept_states: if self.instance.status not in self.accept_states: logger.debug("precond failed for %s: %s not in %s", @@ -139,34 +136,14 @@ class InstanceOperation(Operation): not user.is_superuser): raise self.instance.WrongStateError(self.instance) - def create_activity(self, parent, user, kwargs): - name = self.get_activity_name(kwargs) - if parent: - if parent.instance != self.instance: - raise ValueError("The instance associated with the specified " - "parent activity does not match the instance " - "bound to the operation.") - if parent.user != user: - raise ValueError("The user associated with the specified " - "parent activity does not match the user " - "provided as parameter.") - - return parent.create_sub( - code_suffix=self.get_activity_code_suffix(), - readable_name=name, resultant_state=self.resultant_state) - else: - return InstanceActivity.create( - code_suffix=self.get_activity_code_suffix(), - instance=self.instance, - readable_name=name, user=user, - concurrency_check=self.concurrency_check, - resultant_state=self.resultant_state) - def is_preferred(self): """If this is the recommended op in the current state of the instance. """ return False + def get_from_os(self, request): + self.instance.get_from_os(request) + class RemoteInstanceOperation(RemoteOperationMixin, InstanceOperation): @@ -180,7 +157,7 @@ class RemoteInstanceOperation(RemoteOperationMixin, InstanceOperation): class EnsureAgentMixin(object): - accept_states = ('RUNNING', ) + accept_states = ('ACTIVE', ) def check_precond(self): super(EnsureAgentMixin, self).check_precond() @@ -211,7 +188,7 @@ class AddInterfaceOperation(InstanceOperation): description = _("Add a new network interface for the specified VLAN to " "the VM.") required_perms = () - accept_states = ('STOPPED', 'PENDING', 'RUNNING') + accept_states = ('STOPPED', 'PENDING', 'ACTIVE') def rollback(self, net, activity): with activity.sub_activity( @@ -255,7 +232,7 @@ class CreateDiskOperation(InstanceOperation): name = _("create disk") description = _("Create and attach empty disk to the virtual machine.") required_perms = ('storage.create_empty_disk', ) - accept_states = ('STOPPED', 'PENDING', 'RUNNING') + accept_states = ('STOPPED', 'PENDING', 'ACTIVE') def _operation(self, user, size, activity, name=None): from storage.models import Disk @@ -293,7 +270,7 @@ class ResizeDiskOperation(RemoteInstanceOperation): description = _("Resize the virtual disk image. " "Size must be greater value than the actual size.") required_perms = ('storage.resize_disk', ) - accept_states = ('RUNNING', ) + accept_states = ('ACTIVE', ) async_queue = "localhost.man.slow" remote_queue = ('vm', 'slow') task = vm_tasks.resize_disk @@ -327,7 +304,7 @@ class DownloadDiskOperation(InstanceOperation): abortable = True has_percentage = True required_perms = ('storage.download_disk', ) - accept_states = ('STOPPED', 'PENDING', 'RUNNING') + accept_states = ('STOPPED', 'PENDING', 'ACTIVE') async_queue = "localhost.man.slow" def _operation(self, user, url, task, activity, name=None): @@ -359,9 +336,14 @@ class DeployOperation(InstanceOperation): name = _("deploy") description = _("Deploy and start the virtual machine (including storage " "and network configuration).") + accept_states = ('SHUTOFF') - def _operation(self, activity, node=None): - print("deploying vm") + def is_preferred(self): + return (not self.instance.is_base and + self.instance.status == self.instance.STATUS.SHUTOFF) + + def _operation(self, request, node=None): + openstack_api.nova.server_start(request, self.instance.os_server_id) @register_operation class DestroyOperation(InstanceOperation): @@ -376,57 +358,7 @@ class DestroyOperation(InstanceOperation): activity.resultant_state = None def _operation(self, activity, system): - # Destroy networks - with activity.sub_activity( - 'destroying_net', - readable_name=ugettext_noop("destroy network")): - if self.instance.node: - self.instance.shutdown_net() - self.instance.destroy_net() - - if self.instance.node: - self.instance._delete_vm(parent_activity=activity) - - # Destroy disks - with activity.sub_activity( - 'destroying_disks', - readable_name=ugettext_noop("destroy disks")): - self.instance.destroy_disks() - - # Delete mem. dump if exists - try: - self.instance._delete_mem_dump(parent_activity=activity) - except: - pass - - # Clear node and VNC port association - self.instance.yield_node() - self.instance.yield_vnc_port() - - self.instance.destroyed_at = timezone.now() - self.instance.save() - - @register_operation - class DeleteVmOperation(SubOperationMixin, RemoteInstanceOperation): - id = "_delete_vm" - name = _("destroy virtual machine") - task = vm_tasks.destroy - # if e.libvirtError and "Domain not found" in str(e): - - @register_operation - class DeleteMemDumpOperation(RemoteOperationMixin, SubOperationMixin, - InstanceOperation): - id = "_delete_mem_dump" - name = _("removing memory dump") - task = storage_tasks.delete_dump - - def _get_remote_queue(self): - return self.instance.mem_dump['datastore'].get_remote_queue_name( - "storage", "fast") - - def _get_remote_args(self, **kwargs): - return [self.instance.mem_dump['path']] - + pass @register_operation class MigrateOperation(RemoteInstanceOperation): @@ -436,7 +368,7 @@ class MigrateOperation(RemoteInstanceOperation): "keeping its full state.") required_perms = () superuser_required = True - accept_states = ('RUNNING', ) + accept_states = ('ACTIVE', ) async_queue = "localhost.man.slow" task = vm_tasks.migrate remote_queue = ("vm", "slow") @@ -489,20 +421,15 @@ class MigrateOperation(RemoteInstanceOperation): @register_operation -class RebootOperation(RemoteInstanceOperation): +class RebootOperation(InstanceOperation): id = 'reboot' name = _("reboot") description = _("Warm reboot virtual machine by sending Ctrl+Alt+Del " "signal to its console.") - required_perms = () - accept_states = ('RUNNING', ) - task = vm_tasks.reboot + accept_states = ('ACTIVE', ) def _operation(self, activity): - super(RebootOperation, self)._operation() - if self.instance.has_agent: - activity.sub_activity('os_boot', readable_name=ugettext_noop( - "wait operating system loading"), interruptible=True) + pass @register_operation @@ -513,7 +440,7 @@ class RemoveInterfaceOperation(InstanceOperation): "address allocations, related firewall rules and " "hostnames.") required_perms = () - accept_states = ('STOPPED', 'PENDING', 'RUNNING') + accept_states = ('STOPPED', 'PENDING', 'ACTIVE') def _operation(self, activity, user, system, interface): if self.instance.is_running: @@ -573,7 +500,7 @@ class RemoveDiskOperation(InstanceOperation): description = _("Remove the specified disk from the virtual machine, and " "destroy the data.") required_perms = () - accept_states = ('STOPPED', 'PENDING', 'RUNNING') + accept_states = ('STOPPED', 'PENDING', 'ACTIVE') def _operation(self, activity, user, system, disk): if self.instance.is_running and disk.type not in ["iso"]: @@ -596,7 +523,7 @@ class ResetOperation(RemoteInstanceOperation): name = _("reset") description = _("Cold reboot virtual machine (power cycle).") required_perms = () - accept_states = ('RUNNING', ) + accept_states = ('ACTIVE', ) task = vm_tasks.reset def _operation(self, activity): @@ -617,7 +544,7 @@ class SaveAsTemplateOperation(InstanceOperation): has_percentage = True abortable = True required_perms = ('vm.create_template', ) - accept_states = ('RUNNING', 'STOPPED') + accept_states = ('ACTIVE', 'STOPPED') async_queue = "localhost.man.slow" def is_preferred(self): @@ -728,7 +655,7 @@ class ShutdownOperation(AbortableRemoteOperationMixin, "turn itself off in a period.") abortable = True required_perms = () - accept_states = ('RUNNING', ) + accept_states = ('ACTIVE', ) resultant_state = 'STOPPED' task = vm_tasks.shutdown remote_queue = ("vm", "slow") @@ -761,20 +688,10 @@ class ShutOffOperation(InstanceOperation): "so data loss is also possible. The effect of this " "operation is the same as interrupting the power supply " "of a physical machine.") - required_perms = () - accept_states = ('RUNNING', 'PAUSED') - resultant_state = 'STOPPED' - - def _operation(self, activity): - # Shutdown networks - with activity.sub_activity('shutdown_net', - readable_name=ugettext_noop( - "shutdown network")): - self.instance.shutdown_net() - - self.instance._delete_vm(parent_activity=activity) - self.instance.yield_node() + accept_states = ('ACTIVE', 'PAUSED') + def _operation(self, request): + openstack_api.nova.server_stop(request, self.instance.os_server_id) @register_operation class SleepOperation(InstanceOperation): @@ -788,10 +705,7 @@ class SleepOperation(InstanceOperation): "need a continous network connection may fail when " "resumed. In the meantime, the machine will only use " "storage resources, and keep network resources allocated.") - required_perms = () - accept_states = ('RUNNING', ) - resultant_state = 'SUSPENDED' - async_queue = "localhost.man.slow" + accept_states = ('ACTIVE', ) def is_preferred(self): return (not self.instance.is_base and @@ -804,25 +718,7 @@ class SleepOperation(InstanceOperation): activity.resultant_state = 'ERROR' def _operation(self, activity, system): - with activity.sub_activity('shutdown_net', - readable_name=ugettext_noop( - "shutdown network")): - self.instance.shutdown_net() - self.instance._suspend_vm(parent_activity=activity) - self.instance.yield_node() - - @register_operation - class SuspendVmOperation(SubOperationMixin, RemoteInstanceOperation): - id = "_suspend_vm" - name = _("suspend virtual machine") - task = vm_tasks.sleep - remote_queue = ("vm", "slow") - remote_timeout = 1000 - - def _get_remote_args(self, **kwargs): - return (super(SleepOperation.SuspendVmOperation, self) - ._get_remote_args(**kwargs) + - [self.instance.mem_dump['path']]) + pass @register_operation @@ -834,8 +730,6 @@ class WakeUpOperation(InstanceOperation): "virtual machine from this state.") required_perms = () accept_states = ('SUSPENDED', ) - resultant_state = 'RUNNING' - async_queue = "localhost.man.slow" def is_preferred(self): return self.instance.status == self.instance.STATUS.SUSPENDED @@ -847,36 +741,7 @@ class WakeUpOperation(InstanceOperation): activity.resultant_state = 'ERROR' def _operation(self, activity): - # Schedule vm - self.instance.allocate_vnc_port() - self.instance.allocate_node() - - # Resume vm - self.instance._wake_up_vm(parent_activity=activity) - - # Estabilish network connection (vmdriver) - with activity.sub_activity( - 'deploying_net', readable_name=ugettext_noop( - "deploy network")): - self.instance.deploy_net() - - try: - self.instance.renew(parent_activity=activity) - except: - pass - - @register_operation - class WakeUpVmOperation(SubOperationMixin, RemoteInstanceOperation): - id = "_wake_up_vm" - name = _("resume virtual machine") - task = vm_tasks.wake_up - remote_queue = ("vm", "slow") - remote_timeout = 1000 - - def _get_remote_args(self, **kwargs): - return (super(WakeUpOperation.WakeUpVmOperation, self) - ._get_remote_args(**kwargs) + - [self.instance.mem_dump['path']]) + pass @register_operation @@ -1226,7 +1091,7 @@ class ScreenshotOperation(RemoteInstanceOperation): "screensaver.") acl_level = "owner" required_perms = () - accept_states = ('RUNNING', ) + accept_states = ('ACTIVE', ) task = vm_tasks.screenshot @@ -1278,12 +1143,12 @@ class ResourcesOperation(InstanceOperation): description = _("Change resources of a stopped virtual machine.") acl_level = "owner" required_perms = ('vm.change_resources', ) - accept_states = ('STOPPED', 'PENDING', 'RUNNING') + accept_states = ('STOPPED', 'PENDING', 'ACTIVE') def _operation(self, user, activity, num_cores, ram_size, max_ram_size, priority, with_shutdown=False, task=None): - if self.instance.status == 'RUNNING' and not with_shutdown: + if self.instance.status == 'ACTIVE' and not with_shutdown: raise Instance.WrongStateError(self.instance) try: @@ -1427,88 +1292,7 @@ class AgentStartedOperation(InstanceOperation): i.finish(True) def _operation(self, user, activity, old_version=None, agent_system=None): - with activity.sub_activity('starting', concurrency_check=False, - readable_name=ugettext_noop('starting')): - pass - - self.finish_agent_wait() - - self.instance._change_ip(parent_activity=activity) - self.instance._restart_networking(parent_activity=activity) - - new_version = settings.AGENT_VERSION - if new_version and old_version and new_version != old_version: - try: - self.instance.update_agent( - parent_activity=activity, agent_system=agent_system) - except TimeoutError: - pass - else: - activity.sub_activity( - 'agent_wait', readable_name=ugettext_noop( - "wait agent restarting"), interruptible=True) - return # agent is going to restart - - if not self.initialized: - try: - self.measure_boot_time() - except: - logger.exception('Unhandled error in measure_boot_time()') - self.instance._cleanup(parent_activity=activity) - self.instance.password_reset( - parent_activity=activity, password=self.instance.pw) - self.instance.install_keys(parent_activity=activity) - self.instance._set_time(parent_activity=activity) - self.instance._set_hostname(parent_activity=activity) - - @register_operation - class CleanupOperation(SubOperationMixin, RemoteAgentOperation): - id = '_cleanup' - name = _("cleanup") - task = agent_tasks.cleanup - - @register_operation - class SetTimeOperation(SubOperationMixin, RemoteAgentOperation): - id = '_set_time' - name = _("set time") - task = agent_tasks.set_time - - def _get_remote_args(self, **kwargs): - cls = AgentStartedOperation.SetTimeOperation - return (super(cls, self)._get_remote_args(**kwargs) + - [time.time()]) - - @register_operation - class SetHostnameOperation(SubOperationMixin, RemoteAgentOperation): - id = '_set_hostname' - name = _("set hostname") - task = agent_tasks.set_hostname - - def _get_remote_args(self, **kwargs): - cls = AgentStartedOperation.SetHostnameOperation - return (super(cls, self)._get_remote_args(**kwargs) + - [self.instance.short_hostname]) - - @register_operation - class RestartNetworkingOperation(SubOperationMixin, RemoteAgentOperation): - id = '_restart_networking' - name = _("restart networking") - task = agent_tasks.restart_networking - - @register_operation - class ChangeIpOperation(SubOperationMixin, RemoteAgentOperation): - id = '_change_ip' - name = _("change ip") - task = agent_tasks.change_ip - - def _get_remote_args(self, **kwargs): - hosts = Host.objects.filter(interface__instance=self.instance) - interfaces = {str(host.mac): host.get_network_config() - for host in hosts} - cls = AgentStartedOperation.ChangeIpOperation - return (super(cls, self)._get_remote_args(**kwargs) + - [interfaces, settings.FIREWALL_SETTINGS['rdns_ip']]) - + pass @register_operation class UpdateAgentOperation(RemoteAgentOperation): @@ -1627,7 +1411,7 @@ class MountStoreOperation(EnsureAgentMixin, InstanceOperation): queue=queue, args=(inst.vm_name, host, username, password)) -class AbstractDiskOperation(SubOperationMixin, RemoteInstanceOperation): +class AbstractDiskOperation(RemoteInstanceOperation): required_perms = () def _get_remote_args(self, disk, **kwargs): @@ -1663,7 +1447,7 @@ class DetachDisk(DetachMixin, AbstractDiskOperation): task = vm_tasks.detach_disk -class AbstractNetworkOperation(SubOperationMixin, RemoteInstanceOperation): +class AbstractNetworkOperation(RemoteInstanceOperation): required_perms = () def _get_remote_args(self, interface, **kwargs): -- libgit2 0.26.0