Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
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
Show 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 _
...
@@ -16,10 +16,11 @@ from django.utils.translation import ugettext_lazy as _
from
model_utils.models
import
TimeStampedModel
from
model_utils.models
import
TimeStampedModel
from
taggit.managers
import
TaggableManager
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
firewall.models
import
Vlan
,
Host
from
storage.models
import
Disk
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__
)
logger
=
logging
.
getLogger
(
__name__
)
...
@@ -501,8 +502,8 @@ class Instance(VirtualMachineDescModel, TimeStampedModel):
...
@@ -501,8 +502,8 @@ class Instance(VirtualMachineDescModel, TimeStampedModel):
return
{
return
{
'name'
:
self
.
vm_name
,
'name'
:
self
.
vm_name
,
'vcpu'
:
self
.
num_cores
,
'vcpu'
:
self
.
num_cores
,
'memory'
:
self
.
ram_size
*
1024
,
# convert from MiB to KiB
'memory'
:
int
(
self
.
ram_size
)
*
1024
,
# convert from MiB to KiB
'memory_max'
:
self
.
max_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
,
'cpu_share'
:
self
.
priority
,
'arch'
:
self
.
arch
,
'arch'
:
self
.
arch
,
'boot_menu'
:
self
.
boot_menu
,
'boot_menu'
:
self
.
boot_menu
,
...
@@ -756,6 +757,12 @@ class InstanceActivity(ActivityModel):
...
@@ -756,6 +757,12 @@ class InstanceActivity(ActivityModel):
help_text
=
_
(
'Instance this activity works on.'
),
help_text
=
_
(
'Instance this activity works on.'
),
verbose_name
=
_
(
'instance'
))
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
@classmethod
def
create
(
cls
,
code_suffix
,
instance
,
task_uuid
=
None
,
user
=
None
):
def
create
(
cls
,
code_suffix
,
instance
,
task_uuid
=
None
,
user
=
None
):
act
=
cls
(
activity_code
=
'vm.Instance.'
+
code_suffix
,
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