Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FeldHost Public Projects
OpenNebula 3PAR Backup
Commits
45083330
Commit
45083330
authored
Oct 22, 2019
by
Kristian Feldsam
Browse files
3PAR - Added flush and unexport
Signed-off-by:
Kristián Feldsam
<
feldsam@gmail.com
>
parent
33a16a8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
drivers/_3par.py
View file @
45083330
...
...
@@ -54,6 +54,21 @@ def export_vv(name, host):
time
.
sleep
(
5
)
def
unexport_vv
(
name
,
host
):
# check if VLUN exists
found
=
False
vluns
=
cl
.
getHostVLUNs
(
host
)
for
vlun
in
vluns
:
if
vlun
.
get
(
'volumeName'
)
==
name
:
found
=
True
break
if
found
==
False
:
return
cl
.
deleteVLUN
(
name
,
vlun
.
get
(
'lun'
),
host
)
def
backup_live
(
one
,
image
,
data_store
,
vm
,
vm_disk_id
,
verbose
):
# create live snapshot of image
if
verbose
:
...
...
@@ -98,8 +113,24 @@ def backup_live(one, image, data_store, vm, vm_disk_id, verbose):
try
:
subprocess
.
check_call
(
'%s/sh/discover_lun.sh %d %s'
%
(
base_path
,
lun_no
,
wwn
),
shell
=
True
)
except
subprocess
.
CalledProcessError
as
ex
:
raise
Exception
(
'Can not discover LUN on host: %s'
,
ex
)
raise
Exception
(
'Can not discover LUN'
,
ex
)
# backup
# TODO
if
verbose
:
print
'TODO: Backuping image....'
# flush volume
if
verbose
:
print
'Flushing LUN...'
try
:
subprocess
.
check_call
(
'%s/sh/flush_lun.sh %s'
%
(
base_path
,
wwn
),
shell
=
True
)
except
subprocess
.
CalledProcessError
as
ex
:
raise
Exception
(
'Can not flush LUN'
,
ex
)
# unexport volume
if
verbose
:
print
'Unexporting snapshot from backup server...'
unexport_vv
(
snap_name
,
config
.
EXPORT_HOST
)
sh/flush_lun.sh
0 → 100755
View file @
45083330
#!/usr/bin/env bash
SCRIPT_PATH
=
$(
dirname
$0
)
.
${
SCRIPT_PATH
}
/helper_scripts.sh
WWN
=
$1
FLUSH_CMD
=
$(
cat
<<
EOF
set -e
$(
remove_lun
"
$WWN
"
)
EOF
)
exec_and_log
"
$FLUSH_CMD
"
\
"Error flushing LUN
$WWN
"
exit
0
\ No newline at end of file
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