Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
806ecf3e
authored
Mar 12, 2018
by
Szabolcs Gelencser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initial implementation of add interface operation
parent
ba26b3e5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
12 deletions
+14
-12
.idea/workspace.xml
+0
-0
circle/dashboard/forms.py
+2
-2
circle/dashboard/views/vm.py
+7
-7
circle/openstack_api/nova.py
+3
-0
circle/vm/operations.py
+2
-3
No files found.
.idea/workspace.xml
View file @
806ecf3e
This diff is collapsed.
Click to expand it.
circle/dashboard/forms.py
View file @
806ecf3e
...
@@ -997,8 +997,8 @@ class VmAddInterfaceForm(OperationForm):
...
@@ -997,8 +997,8 @@ class VmAddInterfaceForm(OperationForm):
choices
=
kwargs
.
pop
(
'choices'
)
choices
=
kwargs
.
pop
(
'choices'
)
super
(
VmAddInterfaceForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
VmAddInterfaceForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
field
=
forms
.
Model
ChoiceField
(
field
=
forms
.
ChoiceField
(
queryset
=
choices
,
required
=
False
,
choices
=
choices
,
required
=
False
,
label
=
self
.
label
)
label
=
self
.
label
)
if
not
choices
:
if
not
choices
:
field
.
widget
.
attrs
[
'disabled'
]
=
'disabled'
field
.
widget
.
attrs
[
'disabled'
]
=
'disabled'
...
...
circle/dashboard/views/vm.py
View file @
806ecf3e
...
@@ -350,13 +350,13 @@ class VmAddInterfaceView(FormOperationMixin, VmOperationView):
...
@@ -350,13 +350,13 @@ class VmAddInterfaceView(FormOperationMixin, VmOperationView):
with_reload
=
True
with_reload
=
True
def
get_form_kwargs
(
self
):
def
get_form_kwargs
(
self
):
inst
=
self
.
get_op
()
.
instance
context
=
super
(
VmAddInterfaceView
,
self
)
.
get_form_kwargs
()
choices
=
Vlan
.
get_objects_with_level
(
networks
=
openstack_api
.
neutron
.
network_list_for_tenant
(
self
.
request
,
self
.
request
.
user
.
tenant_id
)
"user"
,
self
.
request
.
user
)
.
exclude
(
choices
=
((
n
.
id
,
n
.
name
)
for
n
in
networks
)
vm_interface__instance__in
=
[
inst
])
context
.
update
({
val
=
super
(
VmAddInterfaceView
,
self
)
.
get_form_kwargs
()
'choices'
:
choices
val
.
update
({
'choices'
:
choices
})
})
return
val
return
context
#
#
# class VmDiskModifyView(FormOperationMixin, VmOperationView):
# class VmDiskModifyView(FormOperationMixin, VmOperationView):
...
...
circle/openstack_api/nova.py
View file @
806ecf3e
...
@@ -159,6 +159,9 @@ class Server(base.APIResourceWrapper):
...
@@ -159,6 +159,9 @@ class Server(base.APIResourceWrapper):
def
host_server
(
self
):
def
host_server
(
self
):
return
getattr
(
self
,
'OS-EXT-SRV-ATTR:host'
,
''
)
return
getattr
(
self
,
'OS-EXT-SRV-ATTR:host'
,
''
)
def
__repr__
(
self
):
return
self
.
name
class
Hypervisor
(
base
.
APIDictWrapper
):
class
Hypervisor
(
base
.
APIDictWrapper
):
"""Simple wrapper around novaclient.hypervisors.Hypervisor."""
"""Simple wrapper around novaclient.hypervisors.Hypervisor."""
...
...
circle/vm/operations.py
View file @
806ecf3e
...
@@ -186,9 +186,8 @@ class AddInterfaceOperation(InstanceOperation):
...
@@ -186,9 +186,8 @@ class AddInterfaceOperation(InstanceOperation):
accept_states
=
(
'SHUTOFF'
,
'ACTIVE'
)
#TODO: try other states
accept_states
=
(
'SHUTOFF'
,
'ACTIVE'
)
#TODO: try other states
os_policy_actions
=
((
"compute"
,
"compute:attach_interface"
),)
os_policy_actions
=
((
"compute"
,
"compute:attach_interface"
),)
def
_operation
(
self
,
activity
,
user
,
system
,
vlan
,
managed
=
None
):
def
_operation
(
self
,
request
,
user
,
system
,
vlan
,
managed
=
None
):
print
(
"Adding interface"
)
openstack_api
.
nova
.
interface_attach
(
request
,
self
.
instance
,
net_id
=
vlan
)
@register_operation
@register_operation
class
CreateDiskOperation
(
InstanceOperation
):
class
CreateDiskOperation
(
InstanceOperation
):
...
...
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