Skip to content

Commit

Permalink
F#3244: Better mixed modes
Browse files Browse the repository at this point in the history
  • Loading branch information
xorel committed Aug 6, 2019
1 parent e5e1699 commit 8b3d8bc
Show file tree
Hide file tree
Showing 25 changed files with 1,205 additions and 362 deletions.
2 changes: 1 addition & 1 deletion include/VirtualMachineDisk.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class VirtualMachineDisk : public VirtualMachineAttribute
/**
* Return the TM_MAD_SYSTEM attribute
*/
std::string get_tm_mad_system();
std::string get_tm_mad_system() const;

/* ---------------------------------------------------------------------- */
/* Image Manager Interface */
Expand Down
12 changes: 11 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1230,8 +1230,10 @@ TM_FS_LVM_ETC_FILES="src/tm_mad/fs_lvm/fs_lvm.conf"


TM_QCOW2_FILES="src/tm_mad/qcow2/clone \
src/tm_mad/qcow2/clone.ssh \
src/tm_mad/qcow2/delete \
src/tm_mad/qcow2/ln \
src/tm_mad/qcow2/ln.ssh \
src/tm_mad/qcow2/monitor \
src/tm_mad/qcow2/mkswap \
src/tm_mad/qcow2/mkimage \
Expand All @@ -1241,11 +1243,13 @@ TM_QCOW2_FILES="src/tm_mad/qcow2/clone \
src/tm_mad/qcow2/postmigrate \
src/tm_mad/qcow2/failmigrate \
src/tm_mad/qcow2/mvds \
src/tm_mad/qcow2/mvds.ssh \
src/tm_mad/qcow2/snap_create \
src/tm_mad/qcow2/snap_create_live \
src/tm_mad/qcow2/snap_delete \
src/tm_mad/qcow2/snap_revert \
src/tm_mad/qcow2/cpds \
src/tm_mad/qcow2/cpds.ssh \
src/tm_mad/qcow2/resize"

TM_SSH_FILES="src/tm_mad/ssh/clone \
Expand Down Expand Up @@ -1288,10 +1292,14 @@ TM_DUMMY_FILES="src/tm_mad/dummy/clone \
src/tm_mad/dummy/resize"

TM_CEPH_FILES="src/tm_mad/ceph/clone \
src/tm_mad/ceph/clone.ssh \
src/tm_mad/ceph/ln \
src/tm_mad/ceph/ln.ssh \
src/tm_mad/ceph/mv \
src/tm_mad/ceph/mvds \
src/tm_mad/ceph/mvds.ssh \
src/tm_mad/ceph/cpds \
src/tm_mad/ceph/cpds.ssh \
src/tm_mad/ceph/premigrate \
src/tm_mad/ceph/postmigrate \
src/tm_mad/ceph/snap_create \
Expand All @@ -1300,11 +1308,13 @@ TM_CEPH_FILES="src/tm_mad/ceph/clone \
src/tm_mad/ceph/snap_revert \
src/tm_mad/ceph/failmigrate \
src/tm_mad/ceph/delete \
src/tm_mad/ceph/delete.ssh \
src/tm_mad/ceph/context \
src/tm_mad/ceph/mkimage \
src/tm_mad/ceph/monitor \
src/tm_mad/ceph/mkswap \
src/tm_mad/ceph/resize"
src/tm_mad/ceph/resize \
src/tm_mad/ceph/resize.ssh"

TM_DEV_FILES="src/tm_mad/dev/clone \
src/tm_mad/dev/ln \
Expand Down
140 changes: 113 additions & 27 deletions src/tm/TransferManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ int TransferManager::prolog_transfer_command(
string size;
string format;
string tm_mad;
string tm_mad_system;
string ds_id;

int disk_id = disk->get_disk_id();
Expand Down Expand Up @@ -416,21 +417,27 @@ int TransferManager::prolog_transfer_command(

one_util::toupper(clon);

std::string tsys = disk->get_tm_mad_system();
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}

// -----------------------------------------------------------------
// CLONE or LINK disk images
// -----------------------------------------------------------------

// <CLONE|LN> tm_mad fe:SOURCE host:remote_system_ds/disk.i vmid dsid
// <CLONE|LN>(.tm_mad_system) tm_mad fe:SOURCE host:remote_system_ds/disk.i vmid dsid"
if (clon == "YES")
{
xfr << "CLONE ";
xfr << "CLONE";
}
else
{
xfr << "LN ";
xfr << "LN";
}

xfr << tm_mad << " ";
xfr << tm_mad_system << " " << tm_mad << " ";

if ( source.find(":") == string::npos ) //Regular file
{
Expand Down Expand Up @@ -722,6 +729,7 @@ void TransferManager::prolog_migr_action(int vid)
string xfr_name;

string tm_mad;
string tm_mad_system;
string vm_tm_mad;

int ds_id;
Expand Down Expand Up @@ -791,9 +799,17 @@ void TransferManager::prolog_migr_action(int vid)
}
}

//MV tm_mad prev_host:remote_system_dir/disk.i host:remote_system_dir/disk.i vmid dsid(image)
xfr << "MV "
<< tm_mad << " "
(*disk)->vector_value("TM_MAD");
string tsys = (*disk)->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}

//MV(.tm_mad_system) tm_mad prev_host:remote_system_dir/disk.i host:remote_system_dir/disk.i vmid dsid(image)
xfr << "MV"
<< tm_mad_system
<< " " << tm_mad << " "
<< vm->get_previous_hostname() << ":"
<< vm->get_previous_system_dir() << "/disk." << disk_id << " "
<< vm->get_hostname() << ":"
Expand Down Expand Up @@ -852,6 +868,7 @@ void TransferManager::prolog_resume_action(int vid)
string xfr_name;

string tm_mad;
string tm_mad_system;
string vm_tm_mad;
string token_password;

Expand Down Expand Up @@ -926,9 +943,17 @@ void TransferManager::prolog_resume_action(int vid)
}
}

//MV tm_mad fe:system_dir/disk.i host:remote_system_dir/disk.i vmid dsid(image)
xfr << "MV "
<< tm_mad << " "
(*disk)->vector_value("TM_MAD");
string tsys = (*disk)->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}

//MV(.tm_mad_system) tm_mad fe:system_dir/disk.i host:remote_system_dir/disk.i vmid dsid(image)
xfr << "MV"
<< tm_mad_system
<< " " << tm_mad << " "
<< nd.get_nebula_hostname() << ":"
<< vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_hostname() << ":"
Expand Down Expand Up @@ -1102,6 +1127,7 @@ void TransferManager::epilog_transfer_command(
{
string save = disk->vector_value("SAVE");
int disk_id = disk->get_disk_id();
string tm_mad_system;

if ( one_util::toupper(save) == "YES" )
{
Expand All @@ -1121,9 +1147,14 @@ void TransferManager::epilog_transfer_command(
return;
}

//MVDS tm_mad hostname:remote_system_dir/disk.0 <fe:SOURCE|SOURCE> vmid dsid
xfr << "MVDS "
<< tm_mad << " "
string tsys = disk->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}
//MVDS(.tm_mad_system) tm_mad hostname:remote_system_dir/disk.0 <fe:SOURCE|SOURCE> vmid dsid
xfr << "MVDS" << tm_mad_system
<< " " << tm_mad << " "
<< host << ":" << vm->get_system_dir() << "/disk." << disk_id << " "
<< source << " "
<< vm->get_oid() << " "
Expand All @@ -1148,10 +1179,17 @@ void TransferManager::epilog_transfer_command(
vv_rc = disk->vector_value("DATASTORE_ID", ds_id_i);
}

string tsys = disk->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}

if ( !tm_mad.empty() && vv_rc == 0)
{
//DELETE tm_mad hostname:remote_system_dir/disk.i vmid ds_id
xfr << "DELETE "
//DELETE(.tm_mad_system) tm_mad hostname:remote_system_dir/disk.i vmid ds_id
xfr << "DELETE"
<< tm_mad_system << " "
<< tm_mad << " "
<< host << ":" << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
Expand Down Expand Up @@ -1278,6 +1316,7 @@ void TransferManager::epilog_stop_action(int vid)

string xfr_name;
string tm_mad;
string tm_mad_system;
string vm_tm_mad;

int ds_id;
Expand Down Expand Up @@ -1346,9 +1385,16 @@ void TransferManager::epilog_stop_action(int vid)
}
}

string tsys = (*disk)->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}

//MV tm_mad host:remote_system_dir/disk.i fe:system_dir/disk.i vmid dsid(image)
xfr << "MV "
<< tm_mad << " "
xfr << "MV"
<< tm_mad_system
<< " " << tm_mad << " "
<< vm->get_hostname() << ":"
<< vm->get_system_dir() << "/disk." << disk_id << " "
<< nd.get_nebula_hostname() << ":"
Expand Down Expand Up @@ -1409,6 +1455,7 @@ int TransferManager::epilog_delete_commands(VirtualMachine *vm,

string vm_tm_mad;
string tm_mad;
string tm_mad_system;
string host;
string system_dir;

Expand Down Expand Up @@ -1487,11 +1534,17 @@ int TransferManager::epilog_delete_commands(VirtualMachine *vm,
}
}

//DELETE tm_mad host:remote_system_dir/disk.i vmid dsid(image)
string tsys = (*disk)->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}

//DELETE tm_mad(.tm_mad_system) host:remote_system_dir/disk.i vmid dsid(image)
// *local* DELETE tm_mad fe:system_dir/disk.i vmid dsid(image)
// *prev* DELETE tm_mad prev_host:remote_system_dir/disk.i vmid ds_id(image)
xfr << "DELETE "
<< tm_mad << " "
xfr << "DELETE" << tm_mad_system
<< " " << tm_mad << " "
<< host << ":"
<< system_dir << "/disk." << disk_id << " "
<< vm->get_oid() << " "
Expand Down Expand Up @@ -1898,6 +1951,8 @@ void TransferManager::saveas_hot_action(int vid)
string snap_id;
string tm_mad;
string ds_id;
string tsys;
string tm_mad_system;

ostringstream os;

Expand All @@ -1906,6 +1961,7 @@ void TransferManager::saveas_hot_action(int vid)

VirtualMachine * vm;
const TransferManagerDriver * tm_md;
VirtualMachineDisk * disk;

Nebula& nd = Nebula::instance();

Expand Down Expand Up @@ -1944,9 +2000,19 @@ void TransferManager::saveas_hot_action(int vid)
goto error_file;
}

disk = vm->get_disk(disk_id);
if (disk != 0)
{
tsys = disk->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}
}

//CPDS tm_mad hostname:remote_system_dir/disk.0 source snapid vmid dsid
xfr << "CPDS "
<< tm_mad << " "
xfr << "CPDS" << tm_mad_system
<< " " << tm_mad << " "
<< vm->get_hostname() << ":"
<< vm->get_system_dir() << "/disk." << disk_id << " "
<< src << " "
Expand Down Expand Up @@ -2015,9 +2081,12 @@ int TransferManager::snapshot_transfer_command(
VirtualMachine * vm, const char * snap_action, ostream& xfr)
{
string tm_mad;
string tsys;
string tm_mad_system;
int ds_id;
int disk_id;
int snap_id;
VirtualMachineDisk * disk;

if (vm->get_snapshot_disk(ds_id, tm_mad, disk_id, snap_id) == -1)
{
Expand All @@ -2026,8 +2095,18 @@ int TransferManager::snapshot_transfer_command(
return -1;
}

//SNAP_CREATE tm_mad host:remote_system_dir/disk.0 snapid vmid dsid
xfr << snap_action << " "
disk = vm->get_disk(disk_id);
if (disk != 0)
{
tsys = disk->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}
}

//SNAP_CREATE(.tm_mad_system) tm_mad host:remote_system_dir/disk.0 snapid vmid dsid
xfr << snap_action << tm_mad_system << " "
<< tm_mad << " "
<< vm->get_hostname() << ":"
<< vm->get_system_dir() << "/disk." << disk_id << " "
Expand Down Expand Up @@ -2141,6 +2220,7 @@ void TransferManager::resize_command(VirtualMachine * vm,
const VirtualMachineDisk * disk, ostream& xfr)
{
string tm_mad;
string tm_mad_system;
string ds_id;

if ( disk->is_volatile() )
Expand All @@ -2154,9 +2234,15 @@ void TransferManager::resize_command(VirtualMachine * vm,
ds_id = disk->vector_value("DATASTORE_ID");
}

//RESIZE tm_mad host:remote_system_dir/disk.i size vmid dsid
xfr << "RESIZE "
<< tm_mad << " "
string tsys = disk->vector_value("TM_MAD_SYSTEM");
if (!tsys.empty())
{
tm_mad_system = "." + tsys;
}

//RESIZE.(tm_mad_system) tm_mad host:remote_system_dir/disk.i size vmid dsid
xfr << "RESIZE" << tm_mad_system
<< " " << tm_mad << " "
<< vm->get_hostname() << ":"
<< vm->get_system_dir()<< "/disk."<< disk->vector_value("DISK_ID")<< " "
<< disk->vector_value("SIZE") << " "
Expand Down
Loading

1 comment on commit 8b3d8bc

@GitCop
Copy link

@GitCop GitCop commented on 8b3d8bc Aug 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

  • Subject needs to conform to "%{type} #%{issue_number}: %{description}"

Guidelines are available at https://github.com/OpenNebula/one/blob/master/share/doc/dev/COMMIT_MESSAGES.md


This message was auto-generated by https://gitcop.com

Please sign in to comment.