[gnome-boxes/wip/clone: 11/16] machine: Add cloning API
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/clone: 11/16] machine: Add cloning API
- Date: Tue, 3 May 2016 23:17:54 +0000 (UTC)
commit 705731cf1067194dab02cfe6e5055fffb5c11ebd
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue May 3 21:53:31 2016 +0100
machine: Add cloning API
Add abstract method clone() and abstract property can_clone. Currently
this is not implemented by any Machine subclass, i-e can_clone property
is set to false by all subclasses.
src/libvirt-machine.vala | 3 +++
src/machine.vala | 2 ++
src/ovirt-machine.vala | 2 ++
src/remote-machine.vala | 3 +++
4 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index 280b32b..295ef71 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -33,6 +33,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
public override bool suspend_at_exit { get { return connection == App.app.default_connection &&
!run_in_bg; } }
public override bool can_save { get { return !saving && state != MachineState.SAVED && !importing; } }
public override bool can_restart { get { return state == MachineState.RUNNING || state ==
MachineState.SAVED; } }
+ public override bool can_clone { get { return false; } }
protected override bool should_autosave {
get {
return (base.should_autosave &&
@@ -681,6 +682,8 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
try_shutdown ();
}
+ public override async void clone () {}
+
public string? get_ip_address () {
if (system_virt_connection == null || !is_on)
return null;
diff --git a/src/machine.vala b/src/machine.vala
index 61f664f..5903200 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -16,6 +16,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
public virtual bool can_save { get { return false; } }
public abstract bool can_restart { get; }
+ public abstract bool can_clone { get; }
public bool can_delete { get; protected set; default = true; }
public bool under_construction { get; protected set; default = false; }
@@ -359,6 +360,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
public abstract async void connect_display (ConnectFlags flags) throws GLib.Error;
public abstract void restart ();
+ public abstract async void clone ();
public virtual void disconnect_display () {
if (display == null)
diff --git a/src/ovirt-machine.vala b/src/ovirt-machine.vala
index 807d1d0..20896ab 100644
--- a/src/ovirt-machine.vala
+++ b/src/ovirt-machine.vala
@@ -4,6 +4,7 @@ using Gtk;
private class Boxes.OvirtMachine: Boxes.Machine {
public override bool can_restart { get { return false; } }
+ public override bool can_clone { get { return false; } }
private Ovirt.Vm vm;
private Ovirt.Proxy proxy;
@@ -79,6 +80,7 @@ private class Boxes.OvirtMachine: Boxes.Machine {
}
public override void restart () {} // See FIXME on RemoteMachine.restart
+ public override async void clone () {}
private void update_info () {
var uri = Xml.URI.parse (source.uri);
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 26809f5..6ff0e7c 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -3,6 +3,7 @@ using Gtk;
private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
public override bool can_restart { get { return false; } }
+ public override bool can_clone { get { return false; } }
public RemoteMachine (CollectionSource source) throws Boxes.Error {
if (source.source_type != "spice" &&
@@ -99,6 +100,8 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
// restart and this method is currently used for that purpose only.
public override void restart () {}
+ public override async void clone () {}
+
private void update_info () {
var uri = Xml.URI.parse (source.uri);
if (uri == null || uri.server == name) // By default server is chosen as name
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]