1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-26 09:57:23 +03:00

feature #4155: Remove :detach & :suspend strategies for disk snapshots

for VMs in ACTIVE-RUNNING. Also revert needs to be performed in
poweroff. DISK_SNAPSHOT_REVERT state has been removed.
This commit is contained in:
Ruben S. Montero 2016-03-22 23:07:35 +01:00
parent 2fe760218e
commit f581fae756
15 changed files with 36 additions and 439 deletions

View File

@ -165,7 +165,7 @@ public:
DISK_SNAPSHOT_REVERT_SUSPENDED = 55,
DISK_SNAPSHOT_DELETE_SUSPENDED = 56,
DISK_SNAPSHOT = 57,
DISK_SNAPSHOT_REVERT = 58,
//DISK_SNAPSHOT_REVERT = 58,
DISK_SNAPSHOT_DELETE = 59,
PROLOG_MIGRATE_UNKNOWN = 60,
PROLOG_MIGRATE_UNKNOWN_FAILURE = 61
@ -231,7 +231,6 @@ public:
else if ( st == "DISK_SNAPSHOT_REVERT_SUSPENDED") { state = DISK_SNAPSHOT_REVERT_SUSPENDED; }
else if ( st == "DISK_SNAPSHOT_DELETE_SUSPENDED") { state = DISK_SNAPSHOT_DELETE_SUSPENDED; }
else if ( st == "DISK_SNAPSHOT") { state = DISK_SNAPSHOT; }
else if ( st == "DISK_SNAPSHOT_REVERT") { state = DISK_SNAPSHOT_REVERT; }
else if ( st == "DISK_SNAPSHOT_DELETE") { state = DISK_SNAPSHOT_DELETE; }
else if ( st == "PROLOG_MIGRATE_UNKNOWN") { state = PROLOG_MIGRATE_UNKNOWN; }
else if ( st == "PROLOG_MIGRATE_UNKNOWN_FAILURE") { state = PROLOG_MIGRATE_UNKNOWN_FAILURE; }
@ -300,7 +299,6 @@ public:
case DISK_SNAPSHOT_REVERT_SUSPENDED: st = "DISK_SNAPSHOT_REVERT_SUSPENDED"; break;
case DISK_SNAPSHOT_DELETE_SUSPENDED: st = "DISK_SNAPSHOT_DELETE_SUSPENDED"; break;
case DISK_SNAPSHOT: st = "DISK_SNAPSHOT"; break;
case DISK_SNAPSHOT_REVERT: st = "DISK_SNAPSHOT_REVERT"; break;
case DISK_SNAPSHOT_DELETE: st = "DISK_SNAPSHOT_DELETE"; break;
case PROLOG_MIGRATE_UNKNOWN: st = "PROLOG_MIGRATE_UNKNOWN"; break;
case PROLOG_MIGRATE_UNKNOWN_FAILURE: st = "PROLOG_MIGRATE_UNKNOWN_FAILURE"; break;

View File

@ -67,8 +67,7 @@ public:
SNAPSHOT_CREATE,
SNAPSHOT_REVERT,
SNAPSHOT_DELETE,
DISK_SNAPSHOT_CREATE,
DISK_SNAPSHOT_REVERT
DISK_SNAPSHOT_CREATE
};
/**
@ -432,13 +431,6 @@ private:
*/
void disk_snapshot_create_action(int vid);
/**
* Reverts to a disk snapshot.
*
* @param vid the id of the VM.
*/
void disk_snapshot_revert_action(int vid);
/**
* This function cancels the current driver operation
*/

View File

@ -384,19 +384,6 @@ private:
write_drv("DISKSNAPSHOTCREATE", oid, drv_msg);
}
/**
* Sends a disk snapshot revert request to the MAD:
* "DISKSNAPSHOTREVERT ID XML_DRV_MSG"
* @param oid the virtual machine id.
* @param drv_msg xml data for the mad operation
*/
void disk_snapshot_revert (
const int oid,
const string& drv_msg) const
{
write_drv("DISKSNAPSHOTREVERT", oid, drv_msg);
}
/**
* Sends a request to update the VM security groups:
* "UPDATESG ID XML_DRV_MSG"

View File

@ -446,11 +446,6 @@ IM_MAD = [
# An example: "-l migrate=migrate_local,save"
# -p more than one action per host in parallel, needs support from hypervisor
# -s <shell> to execute remote commands, bash by default
# -d default snapshot strategy. It can be either 'detach' or 'suspend'. It
# defaults to 'suspend'.
# -i try to do live-snapshot if available. Currently supported only for kvm
# with qcow2 as the datastore TM_MAD. If not available, it will fallback
# on the default (-d)
#
# Note: You can use type = "qemu" to use qemu emulated guests, e.g. if your
# CPU does not have virtualization extensions or use nested Qemu-KVM hosts
@ -458,7 +453,7 @@ IM_MAD = [
VM_MAD = [
name = "kvm",
executable = "one_vmm_exec",
arguments = "-t 15 -r 0 -i kvm",
arguments = "-t 15 -r 0 kvm",
default = "vmm_exec/vmm_exec_kvm.conf",
type = "kvm",
imported_vms_actions = "shutdown, shutdown-hard, hold, release, suspend,

View File

@ -826,7 +826,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
disk_snapshot_revert_desc = <<-EOT.unindent
Reverts disk state to a previously taken snapshot.
States: RUNNING, POWEROFF, SUSPENDED
States: POWEROFF, SUSPENDED
EOT
command :"disk-snapshot-revert", disk_snapshot_revert_desc,

View File

@ -1921,8 +1921,7 @@ int DispatchManager::disk_snapshot_revert(
VirtualMachine::LcmState lstate = vm->get_lcm_state();
if ((state !=VirtualMachine::POWEROFF || lstate !=VirtualMachine::LCM_INIT)&&
(state !=VirtualMachine::SUSPENDED|| lstate !=VirtualMachine::LCM_INIT)&&
(state !=VirtualMachine::ACTIVE || lstate !=VirtualMachine::RUNNING))
(state !=VirtualMachine::SUSPENDED|| lstate !=VirtualMachine::LCM_INIT))
{
oss << "Could not revert to disk snapshot for VM " << vid
<< ", wrong state " << vm->state_str() << ".";
@ -1960,11 +1959,6 @@ int DispatchManager::disk_snapshot_revert(
vm->set_state(VirtualMachine::DISK_SNAPSHOT_REVERT_SUSPENDED);
break;
case VirtualMachine::ACTIVE:
vm->set_state(VirtualMachine::ACTIVE);
vm->set_state(VirtualMachine::DISK_SNAPSHOT_REVERT);
break;
default: break;
}
@ -1972,19 +1966,7 @@ int DispatchManager::disk_snapshot_revert(
vm->unlock();
switch(state)
{
case VirtualMachine::POWEROFF:
case VirtualMachine::SUSPENDED:
tm->trigger(TransferManager::SNAPSHOT_REVERT, vid);
break;
case VirtualMachine::ACTIVE:
vmm->trigger(VirtualMachineManager::DISK_SNAPSHOT_REVERT, vid);
break;
default: break;
}
tm->trigger(TransferManager::SNAPSHOT_REVERT, vid);
return 0;
}

View File

@ -974,7 +974,6 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag
break;
case VirtualMachine::DISK_SNAPSHOT:
case VirtualMachine::DISK_SNAPSHOT_REVERT:
vm->clear_snapshot_disk();
vmpool->update(vm);
@ -1262,7 +1261,6 @@ void LifeCycleManager::recover(VirtualMachine * vm, bool success)
case VirtualMachine::DISK_SNAPSHOT_REVERT_SUSPENDED:
case VirtualMachine::DISK_SNAPSHOT_DELETE_SUSPENDED:
case VirtualMachine::DISK_SNAPSHOT:
case VirtualMachine::DISK_SNAPSHOT_REVERT:
case VirtualMachine::DISK_SNAPSHOT_DELETE:
if (success)
{
@ -1489,7 +1487,6 @@ void LifeCycleManager::retry(VirtualMachine * vm)
case VirtualMachine::DISK_SNAPSHOT_REVERT_SUSPENDED:
case VirtualMachine::DISK_SNAPSHOT_DELETE_SUSPENDED:
case VirtualMachine::DISK_SNAPSHOT:
case VirtualMachine::DISK_SNAPSHOT_REVERT:
case VirtualMachine::DISK_SNAPSHOT_DELETE:
case VirtualMachine::RUNNING:
case VirtualMachine::UNKNOWN:
@ -1619,7 +1616,6 @@ void LifeCycleManager::updatesg_action(int sgid)
case VirtualMachine::HOTPLUG_SNAPSHOT:
case VirtualMachine::HOTPLUG_SAVEAS:
case VirtualMachine::DISK_SNAPSHOT:
case VirtualMachine::DISK_SNAPSHOT_REVERT:
case VirtualMachine::DISK_SNAPSHOT_DELETE:
is_update = true;
break;

View File

@ -1832,7 +1832,6 @@ void LifeCycleManager::disk_snapshot_success(int vid)
switch (state)
{
case VirtualMachine::DISK_SNAPSHOT:
case VirtualMachine::DISK_SNAPSHOT_REVERT:
vm->set_state(VirtualMachine::RUNNING);
case VirtualMachine::DISK_SNAPSHOT_POWEROFF:
case VirtualMachine::DISK_SNAPSHOT_SUSPENDED:
@ -1978,7 +1977,6 @@ void LifeCycleManager::disk_snapshot_failure(int vid)
vm->delete_disk_snapshot(disk_id, snap_id, &ds_quotas, &vm_quotas);
break;
case VirtualMachine::DISK_SNAPSHOT_REVERT:
case VirtualMachine::DISK_SNAPSHOT_DELETE:
vm->set_state(VirtualMachine::RUNNING);
case VirtualMachine::DISK_SNAPSHOT_DELETE_POWEROFF:

View File

@ -49,7 +49,6 @@ class VirtualMachineDriver < OpenNebulaDriver
:attach_nic => "ATTACHNIC",
:detach_nic => "DETACHNIC",
:disk_snapshot_create => "DISKSNAPSHOTCREATE",
:disk_snapshot_revert => "DISKSNAPSHOTREVERT",
:update_sg => "UPDATESG"
}
@ -108,7 +107,6 @@ class VirtualMachineDriver < OpenNebulaDriver
register_action(ACTION[:attach_nic].to_sym, method("attach_nic"))
register_action(ACTION[:detach_nic].to_sym, method("detach_nic"))
register_action(ACTION[:disk_snapshot_create].to_sym, method("disk_snapshot_create"))
register_action(ACTION[:disk_snapshot_revert].to_sym, method("disk_snapshot_revert"))
register_action(ACTION[:update_sg].to_sym, method("update_sg"))
end
@ -219,11 +217,6 @@ class VirtualMachineDriver < OpenNebulaDriver
send_message(ACTION[:disk_snapshot_create],RESULT[:failure],id,error)
end
def disk_snapshot_revert(id, drv_message)
error = "Action not implemented by driver #{self.class}"
send_message(ACTION[:disk_snapshot_revert],RESULT[:failure],id,error)
end
def update_sg(id, drv_message)
error = "Action not implemented by driver #{self.class}"
send_message(ACTION[:update_sg],RESULT[:failure],id,error)

View File

@ -111,7 +111,6 @@ module OpenNebula
DISK_SNAPSHOT_REVERT_SUSPENDED
DISK_SNAPSHOT_DELETE_SUSPENDED
DISK_SNAPSHOT
DISK_SNAPSHOT_REVERT
DISK_SNAPSHOT_DELETE
PROLOG_MIGRATE_UNKNOWN
PROLOG_MIGRATE_UNKNOWN_FAILURE
@ -188,7 +187,6 @@ module OpenNebula
"DISK_SNAPSHOT_REVERT_SUSPENDED"=> "snap",
"DISK_SNAPSHOT_DELETE_SUSPENDED"=> "snap",
"DISK_SNAPSHOT" => "snap",
"DISK_SNAPSHOT_REVERT" => "snap",
"DISK_SNAPSHOT_DELETE" => "snap",
"PROLOG_MIGRATE_UNKNOWN" => "migr",
"PROLOG_MIGRATE_UNKNOWN_FAILURE" => "fail"

View File

@ -107,7 +107,6 @@ define(function(require) {
"DISK_SNAPSHOT_REVERT_SUSPENDED",
"DISK_SNAPSHOT_DELETE_SUSPENDED",
"DISK_SNAPSHOT",
"DISK_SNAPSHOT_REVERT",
"DISK_SNAPSHOT_DELETE",
"PROLOG_MIGRATE_UNKNOWN",
"PROLOG_MIGRATE_UNKNOWN_FAILURE",
@ -172,7 +171,7 @@ define(function(require) {
DISK_SNAPSHOT_REVERT_SUSPENDED : 55,
DISK_SNAPSHOT_DELETE_SUSPENDED : 56,
DISK_SNAPSHOT : 57,
DISK_SNAPSHOT_REVERT : 58,
//DISK_SNAPSHOT_REVERT : 58,
DISK_SNAPSHOT_DELETE : 59,
PROLOG_MIGRATE_UNKNOWN : 60,
PROLOG_MIGRATE_UNKNOWN_FAILURE : 61

View File

@ -55,7 +55,7 @@ define(function(require) {
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.PROLOG ] = [];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.BOOT ] = [];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.RUNNING ] =
["VM.shutdown", "VM.shutdown_hard", "VM.stop", "VM.suspend", "VM.reboot", "VM.reboot_hard", "VM.resched", "VM.unresched", "VM.poweroff", "VM.poweroff_hard", "VM.undeploy", "VM.undeploy_hard", "VM.migrate", "VM.migrate_live", "VM.attachdisk", "VM.detachdisk", "VM.attachnic", "VM.detachnic", "VM.disk_saveas", "VM.disk_snapshot_create", "VM.disk_snapshot_revert", "VM.disk_snapshot_delete"];
["VM.shutdown", "VM.shutdown_hard", "VM.stop", "VM.suspend", "VM.reboot", "VM.reboot_hard", "VM.resched", "VM.unresched", "VM.poweroff", "VM.poweroff_hard", "VM.undeploy", "VM.undeploy_hard", "VM.migrate", "VM.migrate_live", "VM.attachdisk", "VM.detachdisk", "VM.attachnic", "VM.detachnic", "VM.disk_saveas", "VM.disk_snapshot_create", "VM.disk_snapshot_delete"];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.MIGRATE ] = [];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.SAVE_STOP ] = [];
LCM_STATE_ACTIONS[ OpenNebulaVM.LCM_STATES.SAVE_SUSPEND ] = [];

View File

@ -203,10 +203,6 @@ void VirtualMachineManager::trigger(Actions action, int _vid)
aname = "DISK_SNAPSHOT_CREATE";
break;
case DISK_SNAPSHOT_REVERT:
aname = "DISK_SNAPSHOT_REVERT";
break;
default:
delete vid;
return;
@ -326,10 +322,6 @@ void VirtualMachineManager::do_action(const string &action, void * arg)
{
disk_snapshot_create_action(vid);
}
else if (action == "DISK_SNAPSHOT_REVERT")
{
disk_snapshot_revert_action(vid);
}
else if (action == ACTION_TIMER)
{
timer_action();
@ -2351,122 +2343,6 @@ error_common:
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void VirtualMachineManager::disk_snapshot_revert_action(int vid)
{
VirtualMachine * vm;
const VirtualMachineManagerDriver * vmd;
ostringstream os;
string vm_tmpl;
string* drv_msg;
string vm_tm_mad;
string snap_cmd;
string disk_path;
string tm_mad;
int ds_id, disk_id, snap_id;
int rc;
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();
vm = vmpool->get(vid,true);
if (vm == 0)
{
return;
}
if (!vm->hasHistory())
{
goto error_history;
}
vmd = get(vm->get_vmm_mad());
if ( vmd == 0 )
{
goto error_driver;
}
if ( vm->get_snapshot_disk(ds_id, tm_mad, disk_id, snap_id) != 0 )
{
goto error_disk;
}
rc = tm->snapshot_transfer_command(vm, "SNAP_REVERT", os);
snap_cmd = os.str();
os.str("");
if ( snap_cmd.empty() || rc != 0 )
{
goto error_no_tm_command;
}
os << vm->get_remote_system_dir() << "/disk." << disk_id;
disk_path = os.str();
// Invoke driver method
drv_msg = format_message(
vm->get_hostname(),
vm->get_vnm_mad(),
"",
"",
vm->get_deploy_id(),
"",
"",
vm->get_checkpoint_file(),
snap_cmd,
"",
disk_path,
vm->to_xml(vm_tmpl),
vm->get_ds_id(),
-1);
vmd->disk_snapshot_revert(vid, *drv_msg);
vm->unlock();
delete drv_msg;
return;
error_disk:
os << "disk_snapshot_revert, could not find disk to revert snapshot";
goto error_common;
error_history:
os << "disk_snapshot_revert, VM has no history";
goto error_common;
error_driver:
os << "disk_snapshot_revert, error getting driver " << vm->get_vmm_mad();
goto error_common;
error_no_tm_command:
os << "Cannot set disk for snapshot.";
goto error_common;
error_common:
Nebula &ne = Nebula::instance();
LifeCycleManager * lcm = ne.get_lcm();
lcm->trigger(LifeCycleManager::DISK_SNAPSHOT_FAILURE, vid);
vm->log("VMM", Log::ERROR, os);
vm->unlock();
return;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void VirtualMachineManager::attach_nic_action(
int vid)
{

View File

@ -164,12 +164,6 @@ class DummyDriver < VirtualMachineDriver
send_message(ACTION[:disk_snapshot_create], result, id, "dummy-snap")
end
def disk_snapshot_revert(id, drv_message)
result = retrieve_result("disk_snapshot_revert")
send_message(ACTION[:disk_snapshot_revert], result, id)
end
def cleanup(id, drv_message)
result = retrieve_result("cleanup")

View File

@ -959,199 +959,40 @@ class ExecDriver < VirtualMachineDriver
end
#
# DISKSNAPSHOTCREATE action, takes a snapshot of a disk
# DISKSNAPSHOTCREATE action, takes a snapshot of a dis
#
def disk_snapshot_create(id, drv_message)
snap_action = prepare_snap_action(id, drv_message,
:disk_snapshot_create)
action = snap_action[:action]
strategy = snap_action[:strategy]
drv_message = snap_action[:drv_message]
target = snap_action[:target]
target_index = snap_action[:target_index]
xml_data = snap_action[:xml_data]
xml_data = decode(drv_message)
action = ACTION[:disk_snapshot_create]
# Check that live snapshot is supported
vmm_driver_path = 'VM/HISTORY_RECORDS/HISTORY/VMMMAD'
tm_driver_path = "VM/TEMPLATE/DISK[DISK_SNAPSHOT_ACTIVE='YES']/TM_MAD"
vmm_driver = ensure_xpath(xml_data, id, action, vmm_driver_path)||return
tm_driver = ensure_xpath(xml_data, id, action, tm_driver_path) ||return
if !LIVE_DISK_SNAPSHOTS.include?("#{vmm_driver}-#{tm_driver}")
send_message(action, RESULT[:failure], id,
"Cannot perform a live #{action} operation")
return
end
# Get TM command
tm_command = ensure_xpath(xml_data, id, action, 'TM_COMMAND') || return
# Build the process
case strategy
when :live
tm_command_split = tm_command.split
tm_command_split[0] += "_LIVE"
tm_command_split = tm_command.split
tm_command_split[0] += "_LIVE"
steps = [
{
:driver => :tm,
:action => :tm_snap_create_live,
:parameters => tm_command_split
}
]
action = VmmAction.new(self, id, :disk_snapshot_create, drv_message)
when :detach
steps = [
# detach_disk or save
{
:driver => :vmm,
:action => :detach_disk,
:parameters => [:deploy_id, :disk_target_path, target,
target_index]
},
# run TM
{
:driver => :tm,
:action => :tm_snap_create,
:parameters => tm_command.split,
:no_fail => true
},
# attach_disk or restore
{
:driver => :vmm,
:action => :attach_disk,
:parameters => [:deploy_id, :disk_target_path, target,
target_index, drv_message]
}
]
when :suspend
steps = [
# detach_disk or save
{
:driver => :vmm,
:action => :save,
:parameters => [:deploy_id, :checkpoint_file, :host]
},
# network drivers (clean)
{
:driver => :vnm,
:action => :clean
},
# run TM
{
:driver => :tm,
:action => :tm_snap_create,
:parameters => tm_command.split,
:no_fail => true
},
# network drivers (pre)
{
:driver => :vnm,
:action => :pre
},
# attach_disk or restore
{
:driver => :vmm,
:action => :restore,
:parameters => [:checkpoint_file, :host, :deploy_id]
},
# network drivers (post)
{
:driver => :vnm,
:action => :post,
:parameters => [:deploy_id],
:fail_actions => [
{
:driver => :vmm,
:action => :cancel,
:parameters => [:deploy_id, :host]
}
]
}
]
else
return
end
action.run(steps)
end
#
# DISKSNAPSHOTREVERT action, takes a snapshot of a disk
#
def disk_snapshot_revert(id, drv_message)
snap_action = prepare_snap_action(id, drv_message,
:disk_snapshot_revert)
action = snap_action[:action]
strategy = @options[:snapshots_strategy]
drv_message = snap_action[:drv_message]
target = snap_action[:target]
target_index = snap_action[:target_index]
xml_data = snap_action[:xml_data]
# Get TM command
tm_command = ensure_xpath(xml_data, id, action, 'TM_COMMAND') || return
case strategy
when :detach
steps = [
# Save VM state / detach the disk
{
:driver => :vmm,
:action => :detach_disk,
:parameters => [:deploy_id, :disk_target_path, target, target_index]
},
# Do the snapshot
{
:driver => :tm,
:action => :tm_snap_revert,
:parameters => tm_command.split,
:no_fail => true,
},
# Restore VM / attach the disk
{
:driver => :vmm,
:action => :attach_disk,
:parameters => [:deploy_id, :disk_target_path, target, target_index,
drv_message]
}
]
when :suspend
steps = [
# Save VM state / detach the disk
{
:driver => :vmm,
:action => :save,
:parameters => [:deploy_id, :checkpoint_file, :host]
},
# network drivers (clean)
{
:driver => :vnm,
:action => :clean
},
# Do the snapshot
{
:driver => :tm,
:action => :tm_snap_revert,
:parameters => tm_command.split,
:no_fail => true,
},
# network drivers (pre)
{
:driver => :vnm,
:action => :pre
},
# Restore VM / attach the disk
{
:driver => :vmm,
:action => :restore,
:parameters => [:checkpoint_file, :host, :deploy_id]
},
# network drivers (post)
{
:driver => :vnm,
:action => :post,
:parameters => [:deploy_id],
:fail_actions => [
{
:driver => :vmm,
:action => :cancel,
:parameters => [:deploy_id, :host]
}
]
}
]
else
return
end
steps = [
{
:driver => :tm,
:action => :tm_snap_create_live,
:parameters => tm_command_split
}
]
action.run(steps)
end
@ -1190,48 +1031,6 @@ private
nil
end
end
def prepare_snap_action(id, drv_message, action)
xml_data = decode(drv_message)
# Make sure disk target has been defined
target_xpath = "VM/TEMPLATE/DISK[DISK_SNAPSHOT_ACTIVE='YES']/TARGET"
target = ensure_xpath(xml_data, id, ACTION[action],
target_xpath) || return
target_index = target.downcase[-1..-1].unpack('c').first - 97
# Always send ATTACH='YES' for the selected target in case it will end
# up being a 'detach' strategy
disk = xml_data.elements[target_xpath].parent
attach = REXML::Element.new('ATTACH')
attach.add_text('YES')
disk.add(attach)
drv_message = Base64.encode64(xml_data.to_s)
action = VmmAction.new(self, id, action, drv_message)
# Determine the strategy
vmm_driver_path = 'VM/HISTORY_RECORDS/HISTORY/VMMMAD'
tm_driver_path = "VM/TEMPLATE/DISK[DISK_SNAPSHOT_ACTIVE='YES']/TM_MAD"
vmm_driver = ensure_xpath(xml_data, id, action, vmm_driver_path) || return
tm_driver = ensure_xpath(xml_data, id, action, tm_driver_path) || return
strategy = @options[:snapshots_strategy]
if @options[:live_snapshots] && LIVE_DISK_SNAPSHOTS.include?("#{vmm_driver}-#{tm_driver}")
strategy = :live
end
{
:action => action,
:strategy => strategy,
:drv_message => drv_message,
:target => target,
:target_index => target_index,
:xml_data => xml_data
}
end
end
################################################################################
@ -1251,9 +1050,7 @@ opts = GetoptLong.new(
[ '--threads', '-t', GetoptLong::OPTIONAL_ARGUMENT ],
[ '--local', '-l', GetoptLong::REQUIRED_ARGUMENT ],
[ '--shell', '-s', GetoptLong::REQUIRED_ARGUMENT ],
[ '--parallel', '-p', GetoptLong::NO_ARGUMENT ],
[ '--live-snapshots', '-i', GetoptLong::NO_ARGUMENT ],
[ '--default-snapshots', '-d', GetoptLong::REQUIRED_ARGUMENT ]
[ '--parallel', '-p', GetoptLong::NO_ARGUMENT ]
)
hypervisor = ''
@ -1262,8 +1059,6 @@ threads = 15
shell = 'bash'
local_actions = {}
single_host = true
live_snapshots = false
snapshots_strategy = :suspend # Either :detach or :suspend
begin
opts.each do |opt, arg|
@ -1278,10 +1073,6 @@ begin
shell = arg
when '--parallel'
single_host = false
when '--default-snapshots'
snapshots_strategy = arg.to_sym
when '--live-snapshots'
live_snapshots = true
end
end
rescue Exception => e
@ -1299,8 +1090,6 @@ exec_driver = ExecDriver.new(hypervisor,
:retries => retries,
:local_actions => local_actions,
:shell => shell,
:single_host => single_host,
:snapshots_strategy => snapshots_strategy,
:live_snapshots => live_snapshots)
:single_host => single_host)
exec_driver.start_driver