Monday, 17 October 2011

Drop all tables in a MySQL database

If you whant to drop all tables from one MySQL DB without droping the DB, you can use this command:
mysqldump -u[USERNAME] -p[PASSWORD] --add-drop-table --no-data [DATABASE] | grep ^DROP | mysql -u[USERNAME] -p[PASSWORD] [DATABASE]

Possibly Related Posts

Saturday, 8 October 2011

VDI is not Available - Xenserver error

In order to recover the VM you have to:

1. Run XE VDI-LIST and determine the UUID of the VM giving you the problem, like this:

xe vdi-list | grep -i <VM-NAME> -B2 -A2
2. Once you have the UUID run:

xe vdi-forget uuid=<VDI-UUID>
3. Rescan the SR with:
xe sr-scan uuid=<SR-UUID>
4. Now, in XenCenter, go to the VM and click on the Storage tab. You should see it empty. Then click on attach and first entry on the list should be NO NAME. Attach it to the VM, wait about 30 seconds, then power it up!

5. In most cases it should be up and running. If you are still getting errors then wait a minute and try it again. If still not working repeat the previous steps.

Possibly Related Posts

Friday, 7 October 2011

Some VM's are missing after Xenserver failure

Without enabled HA feature there is no mechanism enabled which checks if the host which went down had any VMs running at the time of the failure. There is no mechanism which updates the database with the informatio​n that the VMs which were running on the failing host should be marked as halted after the crash.

So, when you do not have the possibilit​y to enable HA you can do the following to make the VMs available in XenCenter again:

1. Locate the VMs which were running on the failed host with the following command:
xe vm-list resident-o​n=<UUID of the XenServer host> --multiple
You can determine the UUID of the host which failed by running the `xe host-list`​ command.

2. reset the power status of the VMs to halted using the following command:
xe vm-reset-p​owerstate vm=<Nam​e of VM received from the command in step 1> force=true​

(repeat this step for all VMs which were running on the failed host)

Once you reset the powerstate​ of the VM using the above command, the VM should appear in XenCenter again and can be started on another XenServer host.

NOTE: make sure that the VM you reset to halted using the vm-reset-p​owerstate command is actually powered off (e.g. because it was running on a XenServer which really failed) and not running on any other XenServer.​ Do NOT use this command while simulating​ the failure of a XenServer by stopping only the network of the host.

Possibly Related Posts

XenServer Pool, Master host failure

Every member of a resource pool contains all the information necessary to take over the role of master if required. When a master node fails, the following sequence of events occurs:

1. The members realize that communication has been lost and each tries to reconnect for sixty seconds.

2. Each member then puts itself into emergency mode, whereby the member XenServer hosts will only accept the pool-emergency commands:
xe pool-emergency-reset-master
and
xe pool-emergency-transition-to-master
If the master comes back up at this point, it re-establishes communication with its members, the members leave emergency mode, and operation returns to normal.
However if the master is really dead, choose one of the remaining members and run the command:
xe pool-emergency-transition-to-master
on it. Once it has become the master, issue the command:
xe pool-recover-slaves
and the members will now point to the new master.
If you repair or replace the server that was the original master, you can simply bring it up, install the XenServer host software, and add it to the pool.

Possibly Related Posts

Tuesday, 4 October 2011

How to install Android SDK without internet connection

The magic URL is:
http://dl-ssl.google.com/android/repository/repository.xml
That is the XML file from which the URL for downloading the SDK packages are obtained.

For e.g. if you want to download Mac version of Android SDK for version 2.0, you could look up that XML file. You will find a block under tag SDK 2.0 like this:
<sdk:archive arch="any" os="macosx"><sdk:size>74956356</sdk:size>
<sdk:checksum type="sha1">2a866d0870dbba18e0503cd41e5fae988a21b314</sdk:checksum>
<sdk:url>android-2.0_r01-macosx.zip</sdk:url></sdk:archive>
So the URL would be:
http://dl-ssl.google.com/android/repository/android-2.0_r01-macosx.zip

Possibly Related Posts