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
d0f25354
Commit
d0f25354
authored
Oct 23, 2019
by
Kristian Feldsam
Browse files
Images locking and backup info added
Signed-off-by:
Kristián Feldsam
<
feldsam@gmail.com
>
parent
dc53aae0
Changes
1
Hide whitespace changes
Inline
Side-by-side
backup.py
View file @
d0f25354
#!/usr/bin/env python
import
argparse
import
pprint
import
datetime
import
time
import
config
import
pyone
...
...
@@ -50,6 +51,15 @@ for image_key in images:
if
datastore
.
TM_MAD
!=
'3par'
:
continue
# set info abut backup start to image template
one
.
image
.
update
(
image
.
ID
,
'BACKUP_IN_PROGRESS=YES BACKUP_FINISHED_UNIX=--- BACKUP_FINISHED_HUMAN=--- BACKUP_STARTED_UNIX=%d BACKUP_STARTED_HUMAN="%s"'
%
(
int
(
time
.
time
()),
datetime
.
datetime
.
now
().
ctime
()),
1
)
# lock image
if
config
.
LOCK_RESOURCES
:
if
args
.
verbose
:
print
'Locking image %d:%s'
%
(
image
.
ID
,
image
.
NAME
)
one
.
image
.
lock
(
image
.
ID
,
4
)
# persistent and attached to VM
if
image
.
PERSISTENT
==
1
and
image
.
RUNNING_VMS
>
0
:
vmId
=
image
.
VMS
.
ID
[
0
]
...
...
@@ -78,7 +88,6 @@ for image_key in images:
print
ex
continue
break
# persistent not attached
elif
image
.
PERSISTENT
==
1
:
if
args
.
verbose
:
...
...
@@ -89,6 +98,14 @@ for image_key in images:
if
args
.
verbose
:
print
'Backup non-persistent image %d:%s'
%
(
image
.
ID
,
image
.
NAME
)
# unlock image
if
config
.
LOCK_RESOURCES
:
if
args
.
verbose
:
print
'Unlocking image %d:%s'
%
(
image
.
ID
,
image
.
NAME
)
one
.
image
.
unlock
(
image
.
ID
)
# set info abut backup start to image template
one
.
image
.
update
(
image
.
ID
,
'BACKUP_IN_PROGRESS=NO BACKUP_FINISHED_UNIX=%d BACKUP_FINISHED_HUMAN="%s"'
%
(
int
(
time
.
time
()),
datetime
.
datetime
.
now
().
ctime
()),
1
)
# disconnect form 3PAR
_3par
.
logout
()
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