Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
vmdriver
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
104ebd1a
authored
Apr 25, 2016
by
Czémán Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fix
parent
bc83f8c2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
15 deletions
+4
-15
ceph.py
+1
-4
vm.py
+1
-6
vmdriver.py
+2
-5
No files found.
ceph.py
View file @
104ebd1a
...
@@ -36,10 +36,7 @@ class CephConnection:
...
@@ -36,10 +36,7 @@ class CephConnection:
def
sudo
(
*
args
):
def
sudo
(
*
args
):
try
:
subprocess
.
check_output
([
"/bin/sudo"
]
+
list
(
args
))
subprocess
.
check_output
([
"/bin/sudo"
]
+
list
(
args
))
except
subprocess
.
CalledProcessError
as
e
:
raise
Exception
(
e
)
def
map_rbd
(
ceph_path
,
local_path
):
def
map_rbd
(
ceph_path
,
local_path
):
...
...
vm.py
View file @
104ebd1a
...
@@ -241,14 +241,9 @@ class VMDisk(object):
...
@@ -241,14 +241,9 @@ class VMDisk(object):
class
CephVMDisk
(
VMDisk
):
class
CephVMDisk
(
VMDisk
):
'''
Virtual MAchine disk over Ceph block representing class
'''
Class representing Virtual Machine disk over a Ceph block device
'''
'''
hosts
=
None
protocol
=
None
ceph_user
=
None
secret_uuid
=
None
def
__init__
(
self
,
def
__init__
(
self
,
source
,
source
,
hosts
,
hosts
,
...
...
vmdriver.py
View file @
104ebd1a
...
@@ -318,7 +318,6 @@ def suspend(name):
...
@@ -318,7 +318,6 @@ def suspend(name):
Return the domain info dict.
Return the domain info dict.
"""
"""
domain
=
lookupByName
(
name
)
domain
=
lookupByName
(
name
)
domain
.
suspend
()
domain
.
suspend
()
return
_parse_info
(
domain
.
info
())
return
_parse_info
(
domain
.
info
())
...
@@ -333,7 +332,7 @@ def save(name, data_store_type, dir, filename):
...
@@ -333,7 +332,7 @@ def save(name, data_store_type, dir, filename):
if
data_store_type
==
"ceph_block"
:
if
data_store_type
==
"ceph_block"
:
ceph
.
save
(
domain
,
dir
,
filename
)
ceph
.
save
(
domain
,
dir
,
filename
)
else
:
else
:
path
=
dir
+
"/"
+
filename
path
=
os
.
path
.
join
(
dir
,
filename
)
domain
.
save
(
path
)
domain
.
save
(
path
)
...
@@ -351,7 +350,7 @@ def restore(name, data_store_type, dir, filename):
...
@@ -351,7 +350,7 @@ def restore(name, data_store_type, dir, filename):
if
data_store_type
==
"ceph_block"
:
if
data_store_type
==
"ceph_block"
:
ceph
.
restore
(
Connection
.
get
(),
dir
,
filename
)
ceph
.
restore
(
Connection
.
get
(),
dir
,
filename
)
else
:
else
:
path
=
dir
+
"/"
+
filename
path
=
os
.
path
.
join
(
dir
,
filename
)
Connection
.
get
()
.
restore
(
path
)
Connection
.
get
()
.
restore
(
path
)
return
domain_info
(
name
)
return
domain_info
(
name
)
...
@@ -564,7 +563,6 @@ def migrate(name, host, live=False):
...
@@ -564,7 +563,6 @@ def migrate(name, host, live=False):
def
attach_disk
(
name
,
disk_desc
):
def
attach_disk
(
name
,
disk_desc
):
""" Attach Disk to a running virtual machine. """
""" Attach Disk to a running virtual machine. """
domain
=
lookupByName
(
name
)
domain
=
lookupByName
(
name
)
disk
=
None
if
disk_desc
[
"data_store_type"
]
==
"ceph_block"
:
if
disk_desc
[
"data_store_type"
]
==
"ceph_block"
:
disk
=
CephVMDisk
.
deserialize
(
disk_desc
)
disk
=
CephVMDisk
.
deserialize
(
disk_desc
)
else
:
else
:
...
@@ -578,7 +576,6 @@ def attach_disk(name, disk_desc):
...
@@ -578,7 +576,6 @@ def attach_disk(name, disk_desc):
def
detach_disk
(
name
,
disk_desc
):
def
detach_disk
(
name
,
disk_desc
):
""" Detach disk from a running virtual machine. """
""" Detach disk from a running virtual machine. """
domain
=
lookupByName
(
name
)
domain
=
lookupByName
(
name
)
disk
=
None
if
disk_desc
[
"data_store_type"
]
==
"ceph_block"
:
if
disk_desc
[
"data_store_type"
]
==
"ceph_block"
:
disk
=
CephVMDisk
.
deserialize
(
disk_desc
)
disk
=
CephVMDisk
.
deserialize
(
disk_desc
)
else
:
else
:
...
...
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