Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2564bc5d
authored
Nov 15, 2013
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm: fix tags
parent
046c28f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
circle/vm/models.py
+9
-5
No files found.
circle/vm/models.py
View file @
2564bc5d
...
@@ -17,10 +17,10 @@ from model_utils.models import TimeStampedModel
...
@@ -17,10 +17,10 @@ from model_utils.models import TimeStampedModel
from
taggit.managers
import
TaggableManager
from
taggit.managers
import
TaggableManager
from
.tasks
import
local_tasks
,
vm_tasks
,
net_tasks
from
.tasks
import
local_tasks
,
vm_tasks
,
net_tasks
from
acl.models
import
AclBase
from
common.models
import
ActivityModel
,
activitycontextimpl
from
firewall.models
import
Vlan
,
Host
from
firewall.models
import
Vlan
,
Host
from
storage.models
import
Disk
from
storage.models
import
Disk
from
common.models
import
ActivityModel
,
activitycontextimpl
from
acl.models
import
AclBase
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
pwgen
=
User
.
objects
.
make_random_password
pwgen
=
User
.
objects
.
make_random_password
...
@@ -77,7 +77,7 @@ class VirtualMachineDescModel(BaseResourceConfigModel):
...
@@ -77,7 +77,7 @@ class VirtualMachineDescModel(BaseResourceConfigModel):
'Show boot device selection menu on boot.'
))
'Show boot device selection menu on boot.'
))
raw_data
=
TextField
(
verbose_name
=
_
(
'raw_data'
),
blank
=
True
,
help_text
=
_
(
raw_data
=
TextField
(
verbose_name
=
_
(
'raw_data'
),
blank
=
True
,
help_text
=
_
(
'Additional libvirt domain parameters in XML format.'
))
'Additional libvirt domain parameters in XML format.'
))
tags
=
TaggableManager
()
tags
=
TaggableManager
(
blank
=
True
,
verbose_name
=
_
(
"tags"
)
)
class
Meta
:
class
Meta
:
abstract
=
True
abstract
=
True
...
@@ -102,7 +102,7 @@ class Node(TimeStampedModel):
...
@@ -102,7 +102,7 @@ class Node(TimeStampedModel):
enabled
=
BooleanField
(
verbose_name
=
_
(
'enabled'
),
default
=
False
,
enabled
=
BooleanField
(
verbose_name
=
_
(
'enabled'
),
default
=
False
,
help_text
=
_
(
'Indicates whether the node can '
help_text
=
_
(
'Indicates whether the node can '
'be used for hosting.'
))
'be used for hosting.'
))
tags
=
TaggableManager
()
tags
=
TaggableManager
(
blank
=
True
,
verbose_name
=
_
(
"tags"
)
)
class
Meta
:
class
Meta
:
permissions
=
()
permissions
=
()
...
@@ -350,7 +350,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -350,7 +350,7 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
@classmethod
@classmethod
def
create_from_template
(
cls
,
template
,
owner
,
disks
=
None
,
networks
=
None
,
def
create_from_template
(
cls
,
template
,
owner
,
disks
=
None
,
networks
=
None
,
**
kwargs
):
tags
=
None
,
**
kwargs
):
"""Create a new instance based on an InstanceTemplate.
"""Create a new instance based on an InstanceTemplate.
Can also specify parameters as keyword arguments which should override
Can also specify parameters as keyword arguments which should override
...
@@ -361,6 +361,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -361,6 +361,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
networks
=
(
template
.
interface_set
.
all
()
if
networks
is
None
networks
=
(
template
.
interface_set
.
all
()
if
networks
is
None
else
networks
)
else
networks
)
tags
=
template
.
tags
.
all
()
if
tags
is
None
else
tags
# prepare parameters
# prepare parameters
kwargs
[
'template'
]
=
template
kwargs
[
'template'
]
=
template
kwargs
[
'owner'
]
=
owner
kwargs
[
'owner'
]
=
owner
...
@@ -389,6 +391,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
...
@@ -389,6 +391,8 @@ class Instance(AclBase, VirtualMachineDescModel, TimeStampedModel):
# TODO fix this port fw
# TODO fix this port fw
i
.
host
.
add_port
(
proto
,
private
=
port
)
i
.
host
.
add_port
(
proto
,
private
=
port
)
inst
.
tags
.
add
(
*
tags
)
return
inst
return
inst
@permalink
@permalink
...
...
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