Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
67f0c17d
authored
Nov 11, 2013
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: Fixing memory size and adding __unicode__ to InstanceActivity
parent
ef00c6b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
circle/vm/models.py
+11
-4
No files found.
circle/vm/models.py
View file @
67f0c17d
...
...
@@ -16,10 +16,11 @@ from django.utils.translation import ugettext_lazy as _
from
model_utils.models
import
TimeStampedModel
from
taggit.managers
import
TaggableManager
from
common.models
import
ActivityModel
,
activitycontextimpl
from
.tasks
import
local_tasks
,
vm_tasks
,
net_tasks
from
firewall.models
import
Vlan
,
Host
from
storage.models
import
Disk
from
.tasks
import
local_tasks
,
vm_tasks
,
net_tasks
from
common.models
import
ActivityModel
,
activitycontextimpl
from
django.core
import
signing
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -501,8 +502,8 @@ class Instance(VirtualMachineDescModel, TimeStampedModel):
return
{
'name'
:
self
.
vm_name
,
'vcpu'
:
self
.
num_cores
,
'memory'
:
self
.
ram_size
*
1024
,
# convert from MiB to KiB
'memory_max'
:
self
.
max_ram_size
*
1024
,
# convert from MiB to KiB
'memory'
:
int
(
self
.
ram_size
)
*
1024
,
# convert from MiB to KiB
'memory_max'
:
int
(
self
.
max_ram_size
)
*
1024
,
# convert from MiB to KiB
'cpu_share'
:
self
.
priority
,
'arch'
:
self
.
arch
,
'boot_menu'
:
self
.
boot_menu
,
...
...
@@ -756,6 +757,12 @@ class InstanceActivity(ActivityModel):
help_text
=
_
(
'Instance this activity works on.'
),
verbose_name
=
_
(
'instance'
))
def
__unicode__
(
self
):
if
self
.
parent
:
return
self
.
parent
.
activity_code
+
"("
+
self
.
instance
.
name
+
")"
+
"->"
+
self
.
activity_code
else
:
return
self
.
activity_code
+
"("
+
self
.
instance
.
name
+
")"
@classmethod
def
create
(
cls
,
code_suffix
,
instance
,
task_uuid
=
None
,
user
=
None
):
act
=
cls
(
activity_code
=
'vm.Instance.'
+
code_suffix
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment