Useful Tips and Tricks

This is a work in progress and most data is in bits-and pieces. Some of it is sketchy. Please help improve the article further. It's a wiki and self-organizing so everyone is encouraged to contribute and improve the knowledge base.

1.To list all the queries hitting the CloudStack database

For seeing this one must enable the general query log of mysql

mysql> show variableslike '%log%';mysql> set global general_log=ON;


 The default location of the general query log on most distributions is /var/run/mysqld/mysqld.log

alternatively edit `/etc/my.cnf` adding

general-log

And if you are looking just for slow queries, add the following:
slow-query-log
slow_query_log_file=/location/of/your/slow.log
slow_query_log=1
long_query_time=<your choice of value>

2. Unable To Migrate the Instances which are with vCenter

Check if vMotion is enabled [http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1036145]

To enable vMotion

1) Login to vCenter Server using the vSphere Client.
2) Click the ESX host.
3) Click the Configuration tab.
4) Under the Hardwaresection, click Networking.
5) Click Propertiesfor the virtual switchwhere a VMkernel port has been configured.
6) In the dialog box that opens,select vmkernelin the Ports taband click Edit.
7)To enable vMotion,select Enablednext to vMotionand click OK.

3. How to get the CloudStack version from database?

mysql>select *from cloud.versionorder by iddesc limit 1;

id

version

updated            

step    

2

3.0.1  

2012-04-03 06:42:06

Complete

4. How to get the complete details of a vm instance?

mysql>select *from cloud.vm_instance;

5. How to enable trace logging for a particular class in CloudStack?

Add the following lines to /etc/cloud/management/log4j-cloud.xml

<category name="namespace.of.your.class">
<priority value="TRACE"/>
</category>

where namespace.of.your.class is the something like com.cloud.utils for example

6. How to enable the ssh in vmware esx server?

• Edit the configuration filefor SSH with the command:nano /etc/ssh/sshd_config• Find the line that starts with PermitRootLogin and change the no to yes. You can findthis line about2 pages down from the top. Save the file by first pressing Ctrl-O and then Enter.. Exit with Ctrl-X.• Restart the sshd service with the command: service sshd restart
 Or
  • Access Vcenter => Hosts & Clusters -> ESXi Server -> Configuration -> Select'Security Profile' Under software . • Select SSH and start the process

7. Possible causes for Host to get into Alert State are :

1) Ping times out
2) Network connectivity is lost
3) Primary storage didn't mount correctly
4) Heart beat has failed

8.  Failed to deploy Virtual Router : Reasons

1) No capacity in hypervisor - CPU/Memory
2) No ip address(public) availability
3) No storage space available
4) System vm template has not been properly downloaded to primary storagewhile deploying first vm in account

9.  How to enable innodb status to capture relevant db information?

1) To enable innodb logging, on every management server in the"db.properties" file add "includeInnodbStatusInDeadlockExceptions=true " to the"db.cloud.url.params" property

10. KVM   How to revert libvirt from latest version to old version Cent OS 6.1 KVM

1) Move all cent os repos to /oldrepos folder from yum.repos.d
2) yum erase qemu*
3) rm -rf /var/cache/yum/x86_64/6/cloud-temp/
4) yum clean all
5) yum erase libvirt-client6) yum install libvirt

11.  How to access router ?

1) Login to the host where Router VM is available2) Take the Link Local IP3) ssh -i ~/.ssh/id_rsa.cloud -p3922 vr-link-local-ip

12.  How to mount ISO and create Rhel repo ?

1) mkdir /root/nfssailaja
2) mount -t nfs10.102.123.240:/nfs-iso-lib/ /root/nfssailaja/
3) mount -o loop /root/nfssailaja/rhel-server-6.2-x86_64-dvd.iso /media/
4) Create /etc/yum.repos.d/rhel6.repo with below contents
 rhel
name=rhel6
baseurl=file:///media
enabled=1
gpgcheck=0

13.  Define the conserve mode which comes with network offering ?

Ans: Conserve mode meaning, we want to conserve thepublic IP address. soif it is on , then we can use onepublic ip addrfor multiple purposes like pf, lb,static nat, source nat etc.if it is off, then onepublic ip serves only one purpose.

14. How to get Virt-manager working ?

yum groupinstall"X Window System"

15 .KVM host cleanup steps?

1. Unmount all Primary storages
2. Uninstall Agent
3. Remove cloud-temp :cd /var/cache/yum/x86_64/
4.  rm cloud-temp
5.  pwd/var/cache/yum/x86_64/6Server
6. yum erase qemu-kvmvirsh command : list --all =>this will list all the instances created with tht hypervisordestroy <domain id>remove all linked folder with /mnt

16. Xenserver cleanup steps?

1. Destroy all VM's : xe vm-uninstall --multiple --force
2. Remove all VLAN's : cd /opt/xensource/bin ; sh cloud-clean-vlan.sh
3. xe vif-unplug uuid=9e70d7f3-6b6e-9dac-36ba-9b421c8ec2dc3. xe vif-destroy uuid=9e70d7f3-6b6e-9dac-36ba-9b421c8ec2dc
4. xe network-destroy uuid=c03efe07-b963-5b7d-bb5f-a0294f4682fa

17.  How to write into the attached volumes of cloudstack intances ?

1. fdisk /dev/sd*
2. press"n" ->"p" ->"w" to write changes
3. mkfs.ext3 /dev/sd*1
4. mount /dev/sd*1 <targetDir>


18.  How to Enable HTTPS for CloudStack Web Interface?

Refer the documented information @ http://support.citrix.com/article/CTX132008

19. How to deploy CS UserVMs with User-data?

      First we need to encrypt the user data in Base64 format and later should be in URL encoded format.

eg: deploy a VM with user data "customer-data" and your

       API  request  should be like  "http://localhost:8096/client/?command=deployVirtualMachine&serviceofferingid=1&templateid=202&zoneid=1&userdata=Y3VzdG9tZXJWTQ%3D%3D

20.  How to add Rhel5 repo?

1. mkdir /root/nfssailaja
2. mount -t nfs10.102.123.240:/nfs-iso-lib/ /root/nfssailaja/
3. mount -o loop /root/nfssailaja/rhel-server-5-x86_64-dvd.iso /media/
4. vi /etc/yum.repos.d/rhel6.repo and add below contents :

 rhelname=rhel5
baseurl=file:///media/Server
enabled=1
gpgcheck=0 
Note: repomd.xml file is located under Server folder.

21.  How can I allocate a specific IP when I create an instance

1. Edit the vm ip in /var/run/cloud/<vm-name>.log file in host and  restart the vm. This should update the security group rules in host.

2. Change VM ipaddress in db(nics table)3. Stop the vm4. Reboot the router5. Start the vm.

22. How to get more detailed description of a mysql db related error

mysql> SHOW ENGINE INNODB STATUS;

23.  How to find if Xen PV drivers are installed on the instance?

1.Access VM console
2. Run lspci


24.  How to redirect SQL query results to a file ?

1. Use -e option with mysql command
2. Ex :  mysql -u root -ppassword cloud -e "select * from mysql.general_log" >> /mysqldetils1.log

25. How to retrieve only the desired results from mysql select statement results (limit the results)? 

1. SELECT * FROM TableName LIMIT10;

2. Ex : mysql> select * from mysql.general_log LIMIT 10;

26.  SSVM/CPVM are not working after DB dump from Management server 1 to Management Server2 ?

1. Access SSVM from Hypervisor and run /usr/local/cloud/systemvm/ssvm-check.sh
2. Or open /var/log/cloud/cloud.out for errors.  IF there are connectivity issues then open /var/cache/cloud/cmdline/ and check Management server IP.
3. Change it to new Management server IP
4. Stop and start cloud server (/etc/init.d/cloud stop then /etc/init.d/cloud start ) . Check cloud.out log .
4. @ CPVM also perform step 2 , 3 & 4
5. Now template download/View console will work with no issues.


27. How to install VMWare tools on a guest VM?

1.  Attach VMware tools ISO to the instance from Cloudstack

2. It would have got moved /dev/cdrom on your Cent OS

3. Access Instance and perform below steps

 a. mkdir /sailaja

 b. mount /dev/cdrom /sailaja  (It gets mounted in a Read Only mode)

 c. cd /sailaja/

 d.  ls
     manifest.txt  VMwareTools-8.6.5-621624.tar.gz

4. Copy the tar file to any other folder  and extract it (tar zxf /mnt/cdrom/VMwareTools-5.0.0-<xxxx>.tar.gz)

5. Install the tools

a.  .cd vmware-tools-distrib

b. ./vmware-install.pl


28:How to install Xen tools on a guest VM?


@http://www.robertskinner.com/2013/07/how-to-install-xenserver-tools-on-linux.html

[root@xenserver]# cd /mnt
[root@xenserver]# ls
[root@xenserver]# mkdir xs-tools
[root@xenserver]# mount /dev/xvdd /mnt/xs-tools/
mount: block device /dev/xvdd is write-protected, mounting read-only
[root@xenserver]# cd /mnt/xs-tools/Linux/
[root@xenserver]# bash install.sh
  • No labels