Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
interface-openstack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
4
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
ac71d0e6
authored
May 13, 2019
by
Belákovics Ádám
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'vm' of
https://git.ik.bme.hu/RECIRCLE/interface-openstack
into DEV
parents
288ccc7b
0be24b70
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
implementation/vm/instance.py
+7
-5
main.py
+9
-3
No files found.
implementation/vm/instance.py
View file @
ac71d0e6
...
...
@@ -190,8 +190,11 @@ class OSVirtualMachineManager(InstanceInterface):
def
attach_volume
(
self
,
server_id
,
volume_id
,
device
=
None
):
self
.
openstack
.
compute
.
create_volume_attachment
(
server_id
,
{
"volumeId"
:
volume_id
,
"device"
:
device
# server = interface.openstack.compute.get_server("8e94c162-f8ed-4872-b9e5-50bf33040b5b")
#
# print(server) "device": device
})
@openstackError
def
detach_volume
(
self
,
server_id
,
volume_id
,
device
=
None
):
self
.
openstack
.
compute
.
delete_volume_attachment
(
server_id
,
...
...
@@ -199,17 +202,16 @@ class OSVirtualMachineManager(InstanceInterface):
"device"
:
device
})
def
convert_server_to_instance
(
self
,
server
):
if
not
server
.
image
:
image_id
=
None
else
:
image_id
=
server
.
image
.
id
image_id
=
server
.
image
_
id
return
Instance
(
id
=
server
.
id
,
flavor
=
server
.
flavor
.
id
,
flavor
=
server
.
flavor
_
id
,
name
=
server
.
name
,
image_id
=
image_id
,
disks
=
server
.
volumes
,
disks
=
server
.
attached_
volumes
,
status
=
server
.
status
,
launched_at
=
server
.
launched_at
,
terminated_at
=
server
.
terminated_at
,
...
...
main.py
View file @
ac71d0e6
...
...
@@ -23,14 +23,20 @@ print('#'*40)
# interface.create_vm_from_template('new_server', resource, "cirros-0.4.0-x86_64-disk")
# interface.stop_vm('a6bc504f-a422-4492-b429-e5dad2df12f4')
# server = interface.get_vm("8e94c162-f8ed-4872-b9e5-50bf33040b5b")
# server = interface.openstack.compute.get_server("8e94c162-f8ed-4872-b9e5-50bf33040b5b")
#
# print(server)
# print(interface.delete_flavor("flavorTest"))
for
flavor
in
interface
.
list_flavors
():
print
(
flavor
.
JSON
())
# print(interface.create_base_vm("BaseTest", "2", networks, block_dev_map))
for
vm
in
interface
.
list_all_vm
():
print
(
vm
.
JSON
())
print
(
"*"
*
50
)
print
(
interface
.
create_base_vm
(
"BaseTest"
,
"2"
,
networks
,
block_dev_map
)
.
JSON
())
# print(interface.convert_server_to_instance(server).JSON())
...
...
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