1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-04-05 21:15:25 +00:00

Compare commits

..

No commits in common. "7b33f511cf80de636221b5369f318f0c3b84317b" and "2dc40480535e75b91e9557f9e841ff8c90a4bb5f" have entirely different histories.

3 changed files with 11 additions and 29 deletions

View file

@ -17,20 +17,16 @@
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane tab-pane-bordered active" id="takesnapshot">
{% if instance.status != 5 %}
<p>{% trans "With running machine, internal snapshots may take more than an hour, depending on how much memory has on your instance and how large the disk is." %} </p>
<p class="text-danger">{% trans "Live snapshot could cause server timeout and instance might be paused!!!" %}</p>
{% else %}
<p>{% trans "Create an internal snapshot" %}</p>
{% endif %}
<p>{% trans "This may take more than an hour, depending on how much content is on your instance and how large the disk is. It could cause web server timeout.." %}</p>
<form action="{% url 'instances:snapshot' instance.id %}" method="post" role="form" aria-label="Create snapshot form">
{% csrf_token %}
<div class="input-group mb-3">
<input type="text" class="form-control form-control-lg" name="name" placeholder="{% trans "Snapshot Name" %}" maxlength="14">
<span class="input-group-text">|</span>
<input type="text" class="form-control form-control-lg" name="description" placeholder="{% trans "Snapshot Description" %}" maxlength="45">
<input type="text" class="form-control form-control-lg" name="name" placeholder="{% trans "Enter Snapshot Name" %}" maxlength="14">
<input type="submit" class="btn btn-lg btn-success float-end" name="snapshot" value="{% trans "Take Snapshot" %}" onclick="showPleaseWaitDialog();">
</div>
</form>
<div class="clearfix"></div>
</div>
@ -40,17 +36,15 @@
<div class="table-responsive">
<table class="table">
<thead>
<th scope="col">{% trans "Date" %}</th>
<th scope="col">{% trans "Name" %}</th>
<th scope="col">{% trans "Description" %}</th>
<th scope="col">{% trans "Date" %}</th>
<th scope="colgroup" colspan="2">{% trans "Action" %}</th>
</thead>
<tbody>
{% for snap in instance.snapshots %}
<tr>
<td>{{ snap.date|date:"M d H:i:s" }}</td>
<td><strong>{{ snap.name }}</strong></td>
<td>{{ snap.description }}</td>
<td>{{ snap.date|date:"M d H:i:s" }}</td>
<td style="width:30px;">
<form action="{% url 'instances:revert_snapshot' instance.id %}" method="post" role="form" aria-label="Restore snapshot form">
{% csrf_token %}

View file

@ -816,8 +816,7 @@ def snapshot(request, pk):
if allow_admin_or_not_template and request.user.has_perm("instances.snapshot_instances"):
name = request.POST.get("name", "")
desc = request.POST.get("description", "")
instance.proxy.create_snapshot(name, desc)
instance.proxy.create_snapshot(name)
msg = _("Create snapshot: %(snap)s") % {"snap": name}
addlogmsg(request.user.username, instance.compute.name, instance.name, msg)
return redirect(request.META.get("HTTP_REFERER") + "#managesnapshot")

View file

@ -1207,16 +1207,12 @@ class wvmInstance(wvmConnect):
def _snapshotCreateXML(self, xml, flag):
self.instance.snapshotCreateXML(xml, flag)
def create_snapshot(self, name, desc=None):
state = 'shutoff' if self.get_status()==5 else 'running'
def create_snapshot(self, name):
xml = """<domainsnapshot>
<name>%s</name>
<description>%s</description>
<state>%s</state>
<state>shutoff</state>
<creationTime>%d</creationTime>""" % (
name,
desc,
state,
time.time(),
)
self.change_snapshot_xml()
@ -1239,15 +1235,8 @@ class wvmInstance(wvmConnect):
snapshot_list = self.instance.snapshotListNames(0)
for snapshot in snapshot_list:
snap = self.instance.snapshotLookupByName(snapshot, 0)
snap_description = util.get_xml_path(snap.getXMLDesc(0), "/domainsnapshot/description")
snap_time_create = util.get_xml_path(snap.getXMLDesc(0), "/domainsnapshot/creationTime")
snapshots.append(
{
"date": datetime.fromtimestamp(int(snap_time_create)),
"name": snapshot,
"description": snap_description,
}
)
snapshots.append({"date": datetime.fromtimestamp(int(snap_time_create)), "name": snapshot})
return snapshots
def snapshot_delete(self, snapshot):