Well, after many months of squeezing time to review and study, I have passed my VCP exam. I did use the blueprint, but there were some things on the test I was not expecting, so expect the unexpected, however you are supposed to accomplish that. I will not reveal any questions/answers that was on the test, so don't bother asking.
I am now throwing a small party in my head in my favor. :)
Thursday, April 2, 2009
Monday, March 9, 2009
Converting Ubuntu Linux from VM Workstation to ESX
Last week I had the need to convert an Ubuntu Server installation that I was running under VMWare Workstation 6 to ESX 3.5 update 2. To my dismay, it did not work at first try. The main thing I can impart on this is to make sure you have GCC and the Linux Headers installed before you try to clone or convert the VM. I used the coldclone.iso to convert this machine, which worked great. Here are my steps:
1) Install gcc+ using the 'sudo apt-get install gcc', the latest version seems to work fine.2) Install the linux headers using 'sudo apt-get install linux-headers-$(uname-r)', this will install the headers for the kernel you are currently running.
3) Set the coldclone.iso as the CDROM for your VM Workstation instance and boot to it.
4) Go through all the normal proceedures for cloning a machine with VM Converter. The only change to this is, make sure the 'Power on this Virtual Machine' option is unchecked.
5) Get a soda or coffee while this is converting, sit and enjoy.
6) Once the conversion is complete, go into VCenter or ESX and set the machine type as Ubuntu (32 or 64, whichever you are using).
7) Boot the newly cloned machine on the ESX host.
8) Log into Linux (you didn't forget your password, did you?)
9) I have not tested with the VMW6 tools installed, I installed the ESX tools, so right-click the machine and select Install/Upgrade VMWare Tools.
10) In the Linux machine, issue 'mount /dev/scd0' (or whatever your CDROM happens to be), if you do not know, you can look in /etc/fstab for a clue.
11) Un-Tar the tools to a folder.
12) Launch the vmware-install.pl and take the defaults and select yes to compiling the tools for your kernel (You did install GCC and the Linux Headers from steps 1 and 2, right?).
13) Once the tools are installed, your networking still won't work, this is because the MAC changed between your VMW and ESX installations. To correct this , keep reading :)
14) Issue 'sudo /etc/init.d/networking stop' and 'sudo /etc/udev stop'
15) Edit /etc/udev/rules.d/70-persistent-net.rules file.
16) Notice you have two NICs in there, eth1 will generally be the new one that the VMWare tools generated. All that is needed is to delete the old eth0 (the entire line) and rename any entry in the second line from eth'x' to eth0.
17) Issue 'sudo /etc/init.d/udev start' and 'sudo /etc/init.d/networking start'.
18) That's a lot of work, now what was I going to do with this box anyhow?
The biggest catch in this whole process is that I didn't even think about the MAC changing, so I chased my tail a bit until I caught on. So, now this is done, have happy 'nixing.
Labels:
Converter,
Linux,
p2v,
Ubuntu,
VMWare ESX,
VMWare Workstation
Tuesday, March 3, 2009
Converting Windows Virtual Server Images
Apparently converting a Windows Virtual Server guest to VMWare is not as easy for me as I have read about in other articles.
I had a vendor provided virtual server that, initially, I attempted to P2V like anyone would from a non-VMWare (physical or virtual) to ESX.
After a couple of trys, this failed miserably at 2 to 5 percent AND left orphaned VMX and VMDK files.
Attempt #2 was done using the standalone VMWare convertwer attaching to the Windows virtual guest. Although this seemed to work a bit better (I was able to see 6%), it still crashed on me in the same manor.
Attempt #3 is the one that is working right now, we shall see if it completes. I was able to import the Windows VMC/VHD into VMWare Workstation and now I am converting it to the ESX server.
While this has been a learning curve for me, the conversion is running at 36% right now, and at least I can still say, it's still running.
If anyone has a better method for these conversions, let me know.
I had a vendor provided virtual server that, initially, I attempted to P2V like anyone would from a non-VMWare (physical or virtual) to ESX.
After a couple of trys, this failed miserably at 2 to 5 percent AND left orphaned VMX and VMDK files.
Attempt #2 was done using the standalone VMWare convertwer attaching to the Windows virtual guest. Although this seemed to work a bit better (I was able to see 6%), it still crashed on me in the same manor.
Attempt #3 is the one that is working right now, we shall see if it completes. I was able to import the Windows VMC/VHD into VMWare Workstation and now I am converting it to the ESX server.
While this has been a learning curve for me, the conversion is running at 36% right now, and at least I can still say, it's still running.
If anyone has a better method for these conversions, let me know.
VMWare VIMA and Snapshots ...
VMWare is something I have been working with for a bit, but I run into the same issue over and over, the limitation of the VCenter scheduler. While it is a great tool, we must revert to scripting more times than not to get the results we desire.
My specific issue was to use VIMA to find all snapshots for specific hosts whithin a VI3 HA cluster, which we all know, if DRS is set to Fully Automated, we will never know which host a particular VM is running on, whithout looking of course. Well, I am no expert programmer, but I have pieced together a perl script from the examples and internet sources that will loop through all hosts managed by VIMA and search for specific VMs and once it locates a VM, it will list what host it is located on and all snapshots for that VM.
For use in your specific environment, just change the array @SArray (it's commented, so it is easy to find).
This script was only tested on a small six host ESX HA configuration, so any more than that, I cannot say what the performance will be like, and like any home brewed scripts, use at your own risk, I cannot be held liable for damage that this script may create by testing in a production environment. Remember, this script was frankensteined for VIMA, I'm sure it can be modded for running on other platforms.
Script below:
#!/usr/bin/perl -w
#
#
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../";
use VMware::VIRuntime;
# import the fastpass lib
use VMware::VIFPLib;
$SIG{__DIE__} = sub{Util::disconnect()};
$Util::script_version = "1.0";
my %opts = (
aboutservice => {
type => "=s",
help => "Information about the service",
required => 0,
default => 'all',
},
aboutviperl => {
type => "=s",
help => "Information about the viPerl toolkit",
required => 0,
default =>'version',
},
'expand' => {
type => ":s",
help => "If provided, will list additional information about the snapshots.",
required => 0,
default => "false"
}
);
#Change the array below to your list of servers
my @SArray = qw(server1 server2 server3);
Opts::add_options(%opts);
Opts::parse();
if (Opts::option_is_set('aboutviperl')) {
get_toolkitversion();
} else {
Opts::set_option("passthroughauth", 1);
Opts::validate(\&validate);
#Instead of util::connect(), use login_by_fastpass()
#Util::connect();
# Get list of fastpass targets using enumerate_targets()
my @targets = VIFPLib::enumerate_targets();
foreach my $target(@targets) {
#print "Version on $target: \n";
#print "--------------------------------------------------------------------------------\n";
#connect to the lib using fastpass
VIFPLib::login_by_fastpass($target);
foreach my $SArray(@SArray) {
my $VMs = Vim::find_entity_views( view_type => 'VirtualMachine' );
foreach my $vm (@$VMs) {
if ($SArray eq $vm->name) {
print "$SArray located on $target \n";
if ($vm->snapshot) {
foreach (@{$vm->snapshot->rootSnapshotList}) {
printSnaps ($_, 2);
}
}
print "--------------------------------------------------------------------------------\n";
}
}
}
Util::disconnect();
}
}
sub printSnaps {
my ($snapshotTree, $indent) = @_;
if ($indent < indent =" 2;">name
. " " x ($indent + 3) . "Created: " . $snapshotTree->createTime . "\n";
# if requested, display some additional information
if (Opts::get_option('expand') ne "false") {
print " " x ($indent + 3) . "Quiesced: " . $snapshotTree->quiesced
. " " x ($indent + 3) . "State: " . $snapshotTree->state->val
. " " x ($indent + 3) . "Description: " . $snapshotTree->description;
}
# recurse through the tree of snaps
if ($snapshotTree->childSnapshotList) {
# loop through any children that may exist
foreach (@{$snapshotTree->childSnapshotList}) {
printSnaps($_, $indent + 2);
}
}
}
sub validate {
my $valid = 1;
if (Opts::option_is_set('aboutservice')) {
my $service_option = Opts::get_option('aboutservice');
if(!(($service_option eq 'apiinfo')($service_option eq 'product')
($service_option eq 'version')($service_option eq 'ostype')
($service_option eq 'all'))) {
Util::trace(0, "Invalid aboutservice option "
. "supported options are apiinfo,product,version,ostype,all \n");
$valid = 0;
}
}
if (Opts::option_is_set('aboutviperl')) {
my $viperl_option = Opts::get_option('aboutviperl');
if(!($viperl_option eq 'version')) {
Util::trace(0, "Invalid aboutviperl option "
. "supported options is version\n");
$valid = 0;
}
}
return $valid;
}
Sorry the script is so flat, I had some issues with spacing and tabbing in the blog editor. I will work the kinks out for next time.
My next step in this process is to add in functionality to remove old snapshots automatically so I do not have to manually prune old snaps out.
Till next time...
My specific issue was to use VIMA to find all snapshots for specific hosts whithin a VI3 HA cluster, which we all know, if DRS is set to Fully Automated, we will never know which host a particular VM is running on, whithout looking of course. Well, I am no expert programmer, but I have pieced together a perl script from the examples and internet sources that will loop through all hosts managed by VIMA and search for specific VMs and once it locates a VM, it will list what host it is located on and all snapshots for that VM.
For use in your specific environment, just change the array @SArray (it's commented, so it is easy to find).
This script was only tested on a small six host ESX HA configuration, so any more than that, I cannot say what the performance will be like, and like any home brewed scripts, use at your own risk, I cannot be held liable for damage that this script may create by testing in a production environment. Remember, this script was frankensteined for VIMA, I'm sure it can be modded for running on other platforms.
Script below:
#!/usr/bin/perl -w
#
#
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../";
use VMware::VIRuntime;
# import the fastpass lib
use VMware::VIFPLib;
$SIG{__DIE__} = sub{Util::disconnect()};
$Util::script_version = "1.0";
my %opts = (
aboutservice => {
type => "=s",
help => "Information about the service",
required => 0,
default => 'all',
},
aboutviperl => {
type => "=s",
help => "Information about the viPerl toolkit",
required => 0,
default =>'version',
},
'expand' => {
type => ":s",
help => "If provided, will list additional information about the snapshots.",
required => 0,
default => "false"
}
);
#Change the array below to your list of servers
my @SArray = qw(server1 server2 server3);
Opts::add_options(%opts);
Opts::parse();
if (Opts::option_is_set('aboutviperl')) {
get_toolkitversion();
} else {
Opts::set_option("passthroughauth", 1);
Opts::validate(\&validate);
#Instead of util::connect(), use login_by_fastpass()
#Util::connect();
# Get list of fastpass targets using enumerate_targets()
my @targets = VIFPLib::enumerate_targets();
foreach my $target(@targets) {
#print "Version on $target: \n";
#print "--------------------------------------------------------------------------------\n";
#connect to the lib using fastpass
VIFPLib::login_by_fastpass($target);
foreach my $SArray(@SArray) {
my $VMs = Vim::find_entity_views( view_type => 'VirtualMachine' );
foreach my $vm (@$VMs) {
if ($SArray eq $vm->name) {
print "$SArray located on $target \n";
if ($vm->snapshot) {
foreach (@{$vm->snapshot->rootSnapshotList}) {
printSnaps ($_, 2);
}
}
print "--------------------------------------------------------------------------------\n";
}
}
}
Util::disconnect();
}
}
sub printSnaps {
my ($snapshotTree, $indent) = @_;
if ($indent < indent =" 2;">name
. " " x ($indent + 3) . "Created: " . $snapshotTree->createTime . "\n";
# if requested, display some additional information
if (Opts::get_option('expand') ne "false") {
print " " x ($indent + 3) . "Quiesced: " . $snapshotTree->quiesced
. " " x ($indent + 3) . "State: " . $snapshotTree->state->val
. " " x ($indent + 3) . "Description: " . $snapshotTree->description;
}
# recurse through the tree of snaps
if ($snapshotTree->childSnapshotList) {
# loop through any children that may exist
foreach (@{$snapshotTree->childSnapshotList}) {
printSnaps($_, $indent + 2);
}
}
}
sub validate {
my $valid = 1;
if (Opts::option_is_set('aboutservice')) {
my $service_option = Opts::get_option('aboutservice');
if(!(($service_option eq 'apiinfo')($service_option eq 'product')
($service_option eq 'version')($service_option eq 'ostype')
($service_option eq 'all'))) {
Util::trace(0, "Invalid aboutservice option "
. "supported options are apiinfo,product,version,ostype,all \n");
$valid = 0;
}
}
if (Opts::option_is_set('aboutviperl')) {
my $viperl_option = Opts::get_option('aboutviperl');
if(!($viperl_option eq 'version')) {
Util::trace(0, "Invalid aboutviperl option "
. "supported options is version\n");
$valid = 0;
}
}
return $valid;
}
Sorry the script is so flat, I had some issues with spacing and tabbing in the blog editor. I will work the kinks out for next time.
My next step in this process is to add in functionality to remove old snapshots automatically so I do not have to manually prune old snaps out.
Till next time...
Subscribe to:
Comments (Atom)