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
itminedu
synnefo
Commits
a8732cfd
Commit
a8732cfd
authored
Oct 17, 2013
by
Christos
Committed by
Christos Stavrakakis
Mar 31, 2014
Browse files
cyclades: Add SnapshotInstance RAPI method
Extend Ganeti RAPI client with 'SnapshotInstane' method.
parent
b1cdaeab
Changes
2
Hide whitespace changes
Inline
Side-by-side
snf-cyclades-app/synnefo/logic/backend.py
View file @
a8732cfd
...
...
@@ -1051,6 +1051,13 @@ def detach_volume(vm, volume):
return
client
.
ModifyInstance
(
**
kwargs
)
def
snapshot_instance
(
vm
,
snapshot_name
):
#volume = instance.volumes.all()[0]
with
pooled_rapi_client
(
vm
)
as
client
:
return
client
.
SnapshotInstance
(
instance
=
vm
.
backend_vm_id
,
snapshot_name
=
snapshot_name
)
def
get_instances
(
backend
,
bulk
=
True
):
with
pooled_rapi_client
(
backend
)
as
c
:
return
c
.
GetInstances
(
bulk
=
bulk
)
...
...
snf-cyclades-app/synnefo/logic/rapi.py
View file @
a8732cfd
...
...
@@ -546,6 +546,30 @@ class GanetiRapiClient(object): # pylint: disable=R0904
(
"/%s/instances/%s/deactivate-disks"
%
(
GANETI_RAPI_VERSION
,
instance
)),
None
,
None
)
def
SnapshotInstance
(
self
,
instance
,
snapshot_name
,
dry_run
=
False
):
"""Replaces disks on an instance.
@type instance: str
@param instance: instance whose disks to replace
@type snapshot_name: str
@param snapshot_name: name of the new snapshot
@rtype: string
@return: job id
"""
body
=
{
"disks"
:
[(
0
,
{
"snapshot_name"
:
snapshot_name
})],
}
query
=
[]
_AppendDryRunIf
(
query
,
dry_run
)
return
self
.
_SendRequest
(
HTTP_PUT
,
(
"/%s/instances/%s/snapshot"
%
(
GANETI_RAPI_VERSION
,
instance
)),
query
,
body
)
def
RecreateInstanceDisks
(
self
,
instance
,
disks
=
None
,
nodes
=
None
):
"""Recreate an instance's disks.
...
...
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