<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.openstack.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vui</id>
		<title>OpenStack - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.openstack.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Vui"/>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/wiki/Special:Contributions/Vui"/>
		<updated>2026-06-27T10:49:12Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=NovaVMware/DeveloperGuide&amp;diff=30970</id>
		<title>NovaVMware/DeveloperGuide</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=NovaVMware/DeveloperGuide&amp;diff=30970"/>
				<updated>2013-09-28T05:03:45Z</updated>
		
		<summary type="html">&lt;p&gt;Vui: /* Specifying correct adapter type when uploading and image to glance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Developer's DevStack + vSphere Guide=&lt;br /&gt;
&lt;br /&gt;
This is a short guide for developers interested in working on OpenStack and [[vSphere]] (ESX, [[ESXi]], and [[vCenter]]) drivers.&lt;br /&gt;
&lt;br /&gt;
==vSphere Environment and Inventory==&lt;br /&gt;
&lt;br /&gt;
Set up a vSphere 5.1 (or better) developer's environment. For development purposes, you'll need to have one of this inventory type:&lt;br /&gt;
&lt;br /&gt;
[[File:VCenter cluster inventory.png|framed|none|inventory with a DRS cluster]]&lt;br /&gt;
&lt;br /&gt;
Note: The cluster should be DRS enabled with &amp;quot;Fully automated&amp;quot; placement turned on. Also, if you can't get two or more ESX hosts to work with, you can still work with one host in the cluster, but you won't be able to observe VM placement behaviors since there won't be anywhere to place the VMs except for the solitary host.&lt;br /&gt;
&lt;br /&gt;
=Development Environment=&lt;br /&gt;
== Get an Ubuntu 12.04 (suggested) VM setup==&lt;br /&gt;
This Ubuntu workstation can run as a VM itself, but it should have public internet access (ideally direct, but http proxy is workable if you don’t need to commit code back to OpenStack if you do, see the troubleshooting page for steps that ''may'' help).  It should also have a reasonably high bandwidth link to the the vSphere hosts, as it will need to stream images from the Ubuntu workstation to the vSphere host. &lt;br /&gt;
&lt;br /&gt;
We suggest your Ubuntu workstation have&lt;br /&gt;
* at least 10 GB disk, with 20+ GB being ideal. &lt;br /&gt;
* at least one vCPU, with 2 being ideal.&lt;br /&gt;
* 4 GB of RAM.&lt;br /&gt;
&lt;br /&gt;
=== optional setup ===&lt;br /&gt;
If you are using a remote workstation (not running locally on your physical computer) you may have to follow some of the extra steps under [[NovaVMware/DeveloperGuide#Networking_Troubleshooting|Network Troubleshooting]]&lt;br /&gt;
&lt;br /&gt;
==install Devstack (http://devstack.org/) in your new VM==&lt;br /&gt;
Once booted, run: &lt;br /&gt;
 sudo apt-get install git&lt;br /&gt;
 git clone http://github.com/openstack-dev/devstack.git&lt;br /&gt;
 cd devstack&lt;br /&gt;
&lt;br /&gt;
=Setup localrc for DevStack=&lt;br /&gt;
create a file named “localrc” in your devstack directory with the content shown below (for each item with $variable_name, you will need to enter values specific to your environment, the rest you can just leave as is).  &lt;br /&gt;
&lt;br /&gt;
file ~/devstack/''localrc''&lt;br /&gt;
 ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-cpu,n-net,n-cond,n-sch,rabbit,mysql,horizon&lt;br /&gt;
 VIRT_DRIVER=vsphere&lt;br /&gt;
 VMWAREAPI_IP='''$your_vCenter_ip_address'''&lt;br /&gt;
 VMWAREAPI_USER=root&lt;br /&gt;
 VMWAREAPI_PASSWORD='''$password_goes_here'''&lt;br /&gt;
 VMWAREAPI_CLUSTER='''$your_cluster_name'''&lt;br /&gt;
 DATABASE_PASSWORD=nova&lt;br /&gt;
 RABBIT_PASSWORD=nova&lt;br /&gt;
 SERVICE_TOKEN=nova&lt;br /&gt;
 SERVICE_PASSWORD=nova&lt;br /&gt;
 ADMIN_PASSWORD=nova&lt;br /&gt;
 HOST_IP='''$your_development_vm_ip'''&lt;br /&gt;
&lt;br /&gt;
Note: if you would like to use a specific datastore then configure ''VMWAREAPI_DATASTORE_REGEX''&lt;br /&gt;
&lt;br /&gt;
Note: omit the line ''VMWAREAPI_CLUSTER'' if you are using the ''trivial'' inventory example.&lt;br /&gt;
&lt;br /&gt;
Note: If you want the logs to be written to disk (not just accessible via screen), use the define SCREEN_LOGDIR to point to path &lt;br /&gt;
where you want to the logs to reside.  For example&lt;br /&gt;
&lt;br /&gt;
SCREEN_LOGDIR=/var/log&lt;br /&gt;
&lt;br /&gt;
=start stack (first time)=&lt;br /&gt;
 ./stack.sh&lt;br /&gt;
This will take a long time the first time, as it pulls down all code and dependencies.&lt;br /&gt;
Note: may fail on first start.&lt;br /&gt;
&lt;br /&gt;
=Credentials and Environment Variables=&lt;br /&gt;
get the OpenStack API credentials in your environment variables:&lt;br /&gt;
&lt;br /&gt;
 $ source openrc demo demo&lt;br /&gt;
&lt;br /&gt;
This is needed anytime you make a call using an openstack CLI client like ‘nova’, ‘glance’, or ‘quantum’.  You can rerun this at any time from the devstack directory if you need to re-login in at a later point.  If you want admin credentials then use admin ($ source openrc admin admin)&lt;br /&gt;
&lt;br /&gt;
=Glance Initial Setup=&lt;br /&gt;
Get a VMDK to use as a disk image and upload it to OpenStack using the Glance API.  The latest code (mid-Aug) has a change which uploads the image when you 1st run devstack.  After glance starts, run the following command to see if you have a pre-configured image in glance&lt;br /&gt;
&lt;br /&gt;
$ glance image-list&lt;br /&gt;
&lt;br /&gt;
==Get an initial VMDK to work with==&lt;br /&gt;
There are a lot of “gotchas” around what VMDK disks work with OpenStack + vSphere, so we strongly suggest using the provided image to start.  In the Appendix there is information about creating/converting your own images.  &lt;br /&gt;
&lt;br /&gt;
download the image 1 GB debian disk image (user/password to login this image after booting is nicira/nicira).  &lt;br /&gt;
 http://partnerweb.vmware.com/programs/vmdkimage/debian-2.6.32-i686.vmdk &lt;br /&gt;
Place the file under your home directory &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;~/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: if you are using nested hyper-visors you will need to obtain a 32bit image to use or troubleshoot: how to enable nested ESXi &amp;amp; other Hypervisors in vSphere 5.1 - See more at: http://www.virtuallyghetto.com/2012/08/how-to-enable-nested-esxi-other.html#sthash.NJ2VNiwt.dpuf&lt;br /&gt;
&lt;br /&gt;
==Upload your VMDK to glance==&lt;br /&gt;
&lt;br /&gt;
 $ glance add name=&amp;quot;Debian&amp;quot; disk_format=vmdk container_format=bare is_public=true \&lt;br /&gt;
    --property vmware_disktype=&amp;quot;preallocated&amp;quot; &amp;lt; ~/debian-2.6.32-i686.vmdk&lt;br /&gt;
... or ...&lt;br /&gt;
 $ glance image-create --name Debian --is-public=True --container-format=bare \&lt;br /&gt;
    --disk-format=vmdk --property vmware-disktype=&amp;quot;preallocated&amp;quot; &amp;lt; ~/debian-2.6.32-i686.vmdk &lt;br /&gt;
&lt;br /&gt;
This will print out an &amp;lt;image-id&amp;gt; for use below.  If you forget it, you can always run “glance image-list” to see all existing images.&lt;br /&gt;
&lt;br /&gt;
There is also an IDE based image that can be used. &lt;br /&gt;
&lt;br /&gt;
 http://partnerweb.vmware.com/programs/vmdkimage/trend-tinyvm1-flat.vmdk&lt;br /&gt;
Note the vmware_adaptertype is set to &amp;quot;ide&amp;quot; and vmware_disktype is set to &amp;quot;thin&amp;quot;&lt;br /&gt;
 $ glance image-create --name trend-thin --is-public=True --container-format=bare --disk-format=vmdk --property vmware_disktype=&amp;quot;thin&amp;quot; --property vmware_adaptertype=&amp;quot;ide&amp;quot; &amp;lt; trend-tinyvm1-flat.vmdk&lt;br /&gt;
&lt;br /&gt;
=Nova Boot=&lt;br /&gt;
boot a VM using the “&amp;lt;image-id&amp;gt;” from above&lt;br /&gt;
&lt;br /&gt;
 $ nova boot --image &amp;lt;image-id&amp;gt; --flavor 1 test1&lt;br /&gt;
&lt;br /&gt;
Now you can interact with the image using other nova client commands.  &lt;br /&gt;
For example&lt;br /&gt;
 $ nova list&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
 | ID                                   | Name  | Status | Task State | Power State | Networks         |&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
 | 9bb724bf-298d-4a63-a653-dab7fcbd9ac7 | test1 | ACTIVE  | None       | NOSTATE     | private=10.0.0.2 |&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
&lt;br /&gt;
Note: if your disk is big, it can take a VERY long time to stream the image from glance to your datastore (e.g., ~7 minutes for a 1 GB thick image).   This will happen only the first time a new image UUID is used on a datastore. You can monitor progress by viewing the size of the file in the vmware_base directory of the filestore.  &lt;br /&gt;
&lt;br /&gt;
Once this is done, you can view the VM using vCenter. The username/password for the above Debian image is nicira/nicira .&lt;br /&gt;
&lt;br /&gt;
You can access the OpenStack Web GUI (called horizon) by accessing your Ubuntu host on port 80, though currently VNC access via Horizon is broken (see: https://review.openstack.org/#/c/30036/ for a patch to fix this).&lt;br /&gt;
&lt;br /&gt;
=Using Screen=&lt;br /&gt;
Use screen to interact with individual openstack services&lt;br /&gt;
&lt;br /&gt;
 $ screen -x stack&lt;br /&gt;
&lt;br /&gt;
See: http://www.gnu.org/software/screen/manual/screen.html &amp;lt;- for how to use&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Control + a&amp;quot; enters command mode... enter this for each new command character&lt;br /&gt;
characters 0 through 9 switch tabs&lt;br /&gt;
** the 'd' character detaches the session&lt;br /&gt;
** the '[' character enters &amp;quot;copy mode&amp;quot; which allows you to navigate the screen trace and 'escape' escapes the copy mode.&lt;br /&gt;
** the '&amp;quot;' character shows a list of screens which you can navigate with the up and down arrows&lt;br /&gt;
&lt;br /&gt;
For example the nova-compute service runs on the n-cpu tab which is usually number 6. So to navigate to it, hit Ctrl+a then press '6' and you'll tab to it. You can then interact with the terminal for n-cpu.&lt;br /&gt;
&lt;br /&gt;
=Working the Development Environment=&lt;br /&gt;
If you want to reset your environment, run: &lt;br /&gt;
 ./unstack.sh &lt;br /&gt;
 ./stack.sh &lt;br /&gt;
&lt;br /&gt;
* This run of stack.sh will be faster (~1 minute) as it resets all database and service state, but does not need to re-download packages or source code.  &lt;br /&gt;
* After running ./unstack be sure to clean out all your datastores and delete any files left behind on accident. This will prevent a great number of problems people won't see in production environments. (For example: partially uploaded VMDK.)&lt;br /&gt;
&lt;br /&gt;
Note: the source code is not automatically updated when you reset your environment.  This is valuable, as you can manage your source code manually via git, having many branches, etc.  &lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
==Install python support libraries==&lt;br /&gt;
===apt-get libs===&lt;br /&gt;
 $ sudo apt-get install python-dev libmysqlclient-dev python-pip build-essential &lt;br /&gt;
 $ sudo apt-get install libxml2-dev libxslt1-dev libpq-dev&lt;br /&gt;
&lt;br /&gt;
===pip based tool installs===&lt;br /&gt;
 $ sudo pip install --upgrade pip &lt;br /&gt;
 $ sudo pip install --upgrade virtualenv&lt;br /&gt;
 $ sudo pip install MySQL-python&lt;br /&gt;
 $ sudo pip install tox&lt;br /&gt;
 $ sudo pip install python-subunit&lt;br /&gt;
&lt;br /&gt;
====pip proxy troubleshooting====&lt;br /&gt;
If you get connection refused here - try this&lt;br /&gt;
 export PIP_INDEX_URL=&amp;quot;http://pypi.openstack.org/openstack&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====Install OpenStack libs====&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ sudo pip install -i http://pypi.openstack.org/openstack  -r requirements.txt -r test-requirements.txt &lt;br /&gt;
&lt;br /&gt;
Note: make sure everything in the requires lists gets installed. Some installers have individual issues that you may have to clear one at a time. In particular lxslt has some issues that may require attention to properly clear.&lt;br /&gt;
&lt;br /&gt;
==Using TOX for testing==&lt;br /&gt;
See: https://wiki.openstack.org/wiki/ProjectTestingInterface&lt;br /&gt;
&lt;br /&gt;
Important tests to run before submitting for code review are&lt;br /&gt;
 tox -e py26,py27&lt;br /&gt;
 tox -e pep8&lt;br /&gt;
&lt;br /&gt;
As of this writing the run_tests.sh is the better way to run tests.&lt;br /&gt;
&lt;br /&gt;
== Using run_tests.sh for testing ==&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ ./run_tests.sh&lt;br /&gt;
... or ...&lt;br /&gt;
 $ ./run_tests.sh nova.tests.virt.vmwareapi&lt;br /&gt;
... to run only the vmware unit tests.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: If you want to use the python packages in your normal (non-virtual) environment then pass the -N flag&lt;br /&gt;
&lt;br /&gt;
==Code Coverage tests and information==&lt;br /&gt;
&lt;br /&gt;
=== with tox ===&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ tox -e cover  (code coverage)&lt;br /&gt;
&lt;br /&gt;
look under the cover directory for html reports on the code coverage for that module.  The file index.html contains the overall coverage report&lt;br /&gt;
&lt;br /&gt;
NOTE: tests may run 10, 20, or as long as 65 minutes (depending on your hardware, network, and system) and produce no output until they complete. This is normal. You system may become sluggish but should not lock up entirely, a system hang can be symptomatic of an improperly configured test environment. Tests will run on Mac OSX. 2 Cores with 2GB of RAM on an Ubuntu 12.04 machine that is properly configured should take between 10 and 20 minutes to complete.&lt;br /&gt;
&lt;br /&gt;
=== with run_tests.sh ===&lt;br /&gt;
  $ cd /opt/stack/nova&lt;br /&gt;
  $ ./run_tests.sh --coverage&lt;br /&gt;
&lt;br /&gt;
==Additional setup==&lt;br /&gt;
If you are on Ubuntu 12.04 and need to use Python 2.6 (which OpenStack needs for some test scripts) install the old version of python by doing the following:&lt;br /&gt;
&lt;br /&gt;
 $ sudo add-apt-repository ppa:fkrull/deadsnakes&lt;br /&gt;
 $ sudo apt-get update&lt;br /&gt;
 $ sudo apt-get install python2.6 python2.6-dev&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
''Some workplaces may have to use special networking and/or proxy settings and that these may change when you are mobile. Those issues can cause problems with apt-get, git and other parts of OpenStack. If you are in a place that needs special proxy rules, [https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy setup apt-get with a proxy]. You may also have to set [http://askubuntu.com/questions/158557/setting-proxy-from-terminal other proxy settings] depending on your company's particular firewall rules.''&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
You may have a situation where you need to monitor devstack's log files. Here's how you set up logging to file with the least amount of fuss.&lt;br /&gt;
&lt;br /&gt;
To set up logging of screen windows set the shell variable SCREEN_LOGDIR to the directory you want the log files to go. Log files will appear with names like ''screen-$SERVICE_NAME-$TIMESTAMP.log'' in that dir and symbolic link screen-$SERVICE_NAME.log will link to the latest log file. Logs are kept for as long specified in the LOGDAYS variable.&lt;br /&gt;
&lt;br /&gt;
Both SCREEN_LOGDIR and LOGDAYS are shell variables so you need to set them either in your shell or in localrc. Use shell commands if you only want the logs to work this one time. Use ''localrc'' if you always want to have log files appear.&lt;br /&gt;
&lt;br /&gt;
Assuming you have already made a directory...&lt;br /&gt;
&lt;br /&gt;
 $ mkdir ~/log&lt;br /&gt;
&lt;br /&gt;
Then, if you only want logs this one time, in your bash shell say...&lt;br /&gt;
&lt;br /&gt;
 $ export SCREEN_LOGDIR=~/log&lt;br /&gt;
 $ export LOGDAYS=2&lt;br /&gt;
&lt;br /&gt;
... or if you ''always'' want log files, in your localrc add the lines ...&lt;br /&gt;
&lt;br /&gt;
 SCREEN_LOGDIR=~/log&lt;br /&gt;
 LOGDAYS=2&lt;br /&gt;
&lt;br /&gt;
The stack.sh script will automatically rotate the log files for you.&lt;br /&gt;
&lt;br /&gt;
== MySQL issues ==&lt;br /&gt;
If you get stuck with Keystone try...&lt;br /&gt;
 $ mysql -u root -pnova&lt;br /&gt;
... if that doesn't work you probably have a broken mysql install. If you have problems getting mysql to behave, try purging the OpenStack version of the install and install the database manually. Here’s how to rip everything down and install mysql-server from scratch yourself.&lt;br /&gt;
&lt;br /&gt;
 $ ./unstack&lt;br /&gt;
 $ sudo apt-get purge mysql-server&lt;br /&gt;
... you may need to use the name mysql-server-5.5 instead ...&lt;br /&gt;
 $ sudo apt-get autoremove&lt;br /&gt;
 $ sudo apt-get install mysql-server-5.5&lt;br /&gt;
 $ sudo mysql_install_db&lt;br /&gt;
 $ sudo mysqladmin -u root password 'nova'&lt;br /&gt;
 $ sudo service mysql restart&lt;br /&gt;
 $ ./stack&lt;br /&gt;
&lt;br /&gt;
== Keystone Issues ==&lt;br /&gt;
If you get stuck when you are checking your keystone connection via curl then it’s your proxy settings.  Try setting the following in /etc/environment&lt;br /&gt;
 no_proxy=localhost,127.0.0.0/8,127.0.1.1,127.0.1.1*,local.home&lt;br /&gt;
&lt;br /&gt;
== General Database Issues ==&lt;br /&gt;
If you have trouble with testing or other database heavy activities you may need to follow:&lt;br /&gt;
 http://codeinthehole.com/writing/how-to-set-up-mysql-for-python-on-ubuntu/&lt;br /&gt;
&lt;br /&gt;
== rootwrap Issues ==&lt;br /&gt;
If networking suddenly stops working with an error like this&lt;br /&gt;
&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;/usr/bin/nova-rootwrap&amp;quot;, line 59, in &amp;lt;module&amp;gt;&lt;br /&gt;
     from nova.rootwrap import wrapper&lt;br /&gt;
 ImportError: No module named rootwrap&lt;br /&gt;
&lt;br /&gt;
Then something has added a broken rootwrap to /usr/bin.  Remove the /usr/bin/nova-rootwrap and it will use the correct one in /usr/local/bin&lt;br /&gt;
&lt;br /&gt;
=== Check if nova-compute is running ===&lt;br /&gt;
 $ screen -x&lt;br /&gt;
Note the tab n-cpu is running in. It is usually #6 but it could be a different tab on occasion. Tab to n-cpu's tab. '''ctl+a''' then '''6'''. If you see:&lt;br /&gt;
 $ cd /opt/stack/nova &amp;amp;&amp;amp; sg  '/usr/local/bin/nova-compute --config-file /etc/nova/nova.conf' || touch &amp;quot;/opt/stack/status/stack/n-cpu.failure&amp;quot;&lt;br /&gt;
 sg: group '/usr/local/bin/nova-compute --config-file /etc/nova/nova.conf' does not exist&lt;br /&gt;
 $&lt;br /&gt;
... then nova-compute did not start. You can manually start nova-compute by editing the command to read:&lt;br /&gt;
 $ cd /opt/stack/nova &amp;amp;&amp;amp; /usr/local/bin/nova-compute --config-file /etc/nova/nova.conf || touch &amp;quot;/opt/stack/status/stack/n-cpu.failure&amp;quot;&lt;br /&gt;
... which is permissible for development (but not for production).&lt;br /&gt;
&lt;br /&gt;
== Networking Troubleshooting ==&lt;br /&gt;
Remotely accessed workstations need to have an IP for you to SSH or VNC into in order to do work. These instructions mostly assume a ''locally accessible'' VM or physical machine. If you are working with a remotely hosted Ubuntu developer's workstation, you may have special networking concerns. If you find your use of nova-network is stealing your workstations IP in your environment (does not manifest in all environments so it's located here as a troubleshooting step) then set up a second interface for nova-network to use. &lt;br /&gt;
&lt;br /&gt;
=== Configure a fake networking interface ===&lt;br /&gt;
Configure a fake interface so that nova-network does not steal the real IP that you need to access the host remotely.  On Ubuntu: &lt;br /&gt;
&lt;br /&gt;
 $ sudo ip tuntap add dev tapfoo mode tap&lt;br /&gt;
 $ sudo ifconfig tapfoo $some_ip up &lt;br /&gt;
&lt;br /&gt;
NOTE: assign the interface an ip address that will be appropriate for your environment.&lt;br /&gt;
&lt;br /&gt;
Now that you have a fake ethernet interface, change your localrc and re-run ./stack.sh so that you can start nova-network on the new interface.&lt;br /&gt;
&lt;br /&gt;
add to your ''localrc'' file&lt;br /&gt;
 FLAT_INTERFACE=tapfoo&lt;br /&gt;
&lt;br /&gt;
=== Configure a Proxy ===&lt;br /&gt;
Some workplaces may have to use special networking and/or proxy settings and that these may change when you are mobile. Those issues can cause problems with apt-get, git and other parts of OpenStack. If you are in a place that needs special proxy rules, [https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy setup apt-get with a proxy]. You may also have to set [http://askubuntu.com/questions/158557/setting-proxy-from-terminal other proxy settings] depending on your company's particular firewall rules.&lt;br /&gt;
&lt;br /&gt;
=Appendix=&lt;br /&gt;
&lt;br /&gt;
==Converting Images==&lt;br /&gt;
&lt;br /&gt;
===Converting other disk images to vmdk using qemu-img=== &lt;br /&gt;
Disk images in several formats (e.g. qcow2) can be converted to the VMDK format usable by the vmware nova driver using the qemu-img utility.&lt;br /&gt;
&lt;br /&gt;
For example the following command can be used to convert a qcow2 Ubuntu Precise cloud image (downloadable from http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img):&lt;br /&gt;
 &amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; qemu-img convert -f raw ~/Downloads/precise-server-cloudimg-amd64-disk1.img -O vmdk precise-server-cloudimg-amd64-disk1.vmdk&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Converting a sparse vmdk to an ESX-compatible format=== &lt;br /&gt;
&lt;br /&gt;
Due to a bug (fixed with the following proposed [https://review.openstack.org/#/c/43994/ patch], currently under review) in how sparse vmdk disks are handled in the VC driver, &lt;br /&gt;
sparse disks have to be pre-converted to thin-provisioned or preallocated disks before they can be uploaded to glance to be used by the driver.&lt;br /&gt;
&lt;br /&gt;
There are several ways to perform such a conversion:&lt;br /&gt;
&lt;br /&gt;
====1. Using vSphere CLI (or sometimes called the remote CLI or rCLI) tools.====&lt;br /&gt;
&lt;br /&gt;
The latest version from the date this was written is 5.1 and the link is [https://my.vmware.com/web/vmware/details?downloadGroup=VSP510-VCLI-510&amp;amp;productId=285 here].&lt;br /&gt;
&lt;br /&gt;
Assuming that the sparse disk is made available on a datastore accessible by an ESX host, the following command converts it to preallocated format:&lt;br /&gt;
&lt;br /&gt;
 vmkfstools --server=ip_of_some_ESX_host -i /vmfs/volumes/datastore1/sparse.vmdk /vmfs/volumes/datastore1/converted.vmdk&lt;br /&gt;
&lt;br /&gt;
(note the vifs tool from the same CLI package can be used to upload the disk to be converted and downloaded the converted disk if necessary)&lt;br /&gt;
&lt;br /&gt;
====2. Using vmkfstools directly on the ESX host====&lt;br /&gt;
&lt;br /&gt;
If the SSH service is enabled on an ESX host, the sparse disk can be uploaded to the ESX datastore via scp, and the vmkfstools local to the ESX host can use used to perform the conversion: &lt;br /&gt;
&lt;br /&gt;
(After logging to the host via ssh)&lt;br /&gt;
 vmkfstools -i /vmfs/volumes/datastore1/sparse.vmdk /vmfs/volumes/datastore1/converted.vmdk&lt;br /&gt;
&lt;br /&gt;
====3. vmware-vdiskmanager====&lt;br /&gt;
&lt;br /&gt;
vmware-vdiskmanager is a utility that comes bundled with VMware Fusion and VMware Workstation. &lt;br /&gt;
Below is an example of converting a sparse disk to preallocated format:&lt;br /&gt;
&lt;br /&gt;
 '/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager' -r sparse.vmdk -t 4 converted.vmdk&lt;br /&gt;
&lt;br /&gt;
In all the above cases, the converted vmdk is actually a pair of files, the descriptor file &amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;.vmdk and the actual virtual disk data file &amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;-flat.vmdk. The file to be uploaded to glance is &amp;lt;b&amp;gt;&amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;-flat.vmdk&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
===Specifying correct adapter type when uploading and image to glance===&lt;br /&gt;
&lt;br /&gt;
Currently, there is a limitation that OS boot vmdk disks with an ide adapter type cannot be attached to a virtual SCSI controller, and likewise disks with one of the scsi adapter types (e.g. busLogic, lsiLogic) cannot be attached to the IDE controller. Therefore it is important when uploading an image to glance that the correct vmware_adaptertype property be set. In particular, vmdk disks converted from other formats via qemu-img will _always_ be a monolithic sparse vmdk with an IDE adapter type. So using the above example of the Precise Ubuntu image, after the qemu-img conversion and conversion to a preallocated disk, the command to upload the vmdk disk should be something like:&lt;br /&gt;
&lt;br /&gt;
   glance image-create --name precise-cloud --is-public=True --container-format=bare --disk-format=vmdk --property vmware_disktype=&amp;quot;preallocated&amp;quot; --property vmware_adaptertype=&amp;quot;ide&amp;quot; &amp;lt; converted-flat.vmdk&lt;br /&gt;
&lt;br /&gt;
====Obtaining the adapter type associated with a vmdk====&lt;br /&gt;
&lt;br /&gt;
If the vmdk is a monolithic file (such as one produced by the qemu-img conversion) the adapter type can be retrieved by &lt;br /&gt;
&lt;br /&gt;
   head -20 some_monolithic.vmdk&lt;br /&gt;
&lt;br /&gt;
and looking for the ddb.adapterType=XXX property&lt;br /&gt;
&lt;br /&gt;
If the vmdk has a descriptor/data file pair (foo.vmdk and foo-XXXX.vmdk). The descriptor file foo.vmdk can be examined for the same ddb.adapterType property)&lt;br /&gt;
&lt;br /&gt;
==List of Reviews in progress==&lt;br /&gt;
https://review.openstack.org/#/q/message:vmware+OR+message:vcenter+OR+message:vsphere+OR+message:esx+OR+message:vcdriver+OR+message:datastore,n,z&lt;/div&gt;</summary>
		<author><name>Vui</name></author>	</entry>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=NovaVMware/DeveloperGuide&amp;diff=30435</id>
		<title>NovaVMware/DeveloperGuide</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=NovaVMware/DeveloperGuide&amp;diff=30435"/>
				<updated>2013-09-20T07:05:13Z</updated>
		
		<summary type="html">&lt;p&gt;Vui: /* Converting Images */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Developer's DevStack + vSphere Guide=&lt;br /&gt;
&lt;br /&gt;
This is a short guide for developers interested in working on OpenStack and [[vSphere]] (ESX, [[ESXi]], and [[vCenter]]) drivers.&lt;br /&gt;
&lt;br /&gt;
==vSphere Environment and Inventory==&lt;br /&gt;
&lt;br /&gt;
Set up a vSphere 5.1 (or better) developer's environment. For development purposes, you'll need to have one of this inventory type:&lt;br /&gt;
&lt;br /&gt;
[[File:VCenter cluster inventory.png|framed|none|inventory with a DRS cluster]]&lt;br /&gt;
&lt;br /&gt;
Note: The cluster should be DRS enabled with &amp;quot;Fully automated&amp;quot; placement turned on. Also, if you can't get two or more ESX hosts to work with, you can still work with one host in the cluster, but you won't be able to observe VM placement behaviors since there won't be anywhere to place the VMs except for the solitary host.&lt;br /&gt;
&lt;br /&gt;
=Development Environment=&lt;br /&gt;
== Get an Ubuntu 12.04 (suggested) VM setup==&lt;br /&gt;
This Ubuntu workstation can run as a VM itself, but it should have public internet access (ideally direct, but http proxy is workable if you don’t need to commit code back to OpenStack if you do, see the troubleshooting page for steps that ''may'' help).  It should also have a reasonably high bandwidth link to the the vSphere hosts, as it will need to stream images from the Ubuntu workstation to the vSphere host. &lt;br /&gt;
&lt;br /&gt;
We suggest your Ubuntu workstation have&lt;br /&gt;
* at least 10 GB disk, with 20+ GB being ideal. &lt;br /&gt;
* at least one vCPU, with 2 being ideal.&lt;br /&gt;
* 4 GB of RAM.&lt;br /&gt;
&lt;br /&gt;
=== optional setup ===&lt;br /&gt;
If you are using a remote workstation (not running locally on your physical computer) you may have to follow some of the extra steps under [[NovaVMware/DeveloperGuide#Networking_Troubleshooting|Network Troubleshooting]]&lt;br /&gt;
&lt;br /&gt;
==install Devstack (http://devstack.org/) in your new VM==&lt;br /&gt;
Once booted, run: &lt;br /&gt;
 sudo apt-get install git&lt;br /&gt;
 git clone http://github.com/openstack-dev/devstack.git&lt;br /&gt;
 cd devstack&lt;br /&gt;
&lt;br /&gt;
=Setup localrc for DevStack=&lt;br /&gt;
create a file named “localrc” in your devstack directory with the content shown below (for each item with $variable_name, you will need to enter values specific to your environment, the rest you can just leave as is).  &lt;br /&gt;
&lt;br /&gt;
file ~/devstack/''localrc''&lt;br /&gt;
 ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-cpu,n-net,n-cond,n-sch,rabbit,mysql,horizon&lt;br /&gt;
 VIRT_DRIVER=vsphere&lt;br /&gt;
 VMWAREAPI_IP='''$your_vCenter_ip_address'''&lt;br /&gt;
 VMWAREAPI_USER=root&lt;br /&gt;
 VMWAREAPI_PASSWORD='''$password_goes_here'''&lt;br /&gt;
 VMWAREAPI_CLUSTER='''$your_cluster_name'''&lt;br /&gt;
 DATABASE_PASSWORD=nova&lt;br /&gt;
 RABBIT_PASSWORD=nova&lt;br /&gt;
 SERVICE_TOKEN=nova&lt;br /&gt;
 SERVICE_PASSWORD=nova&lt;br /&gt;
 ADMIN_PASSWORD=nova&lt;br /&gt;
 HOST_IP='''$your_development_vm_ip'''&lt;br /&gt;
&lt;br /&gt;
Note: if you would like to use a specific datastore then configure ''VMWAREAPI_DATASTORE_REGEX''&lt;br /&gt;
&lt;br /&gt;
Note: omit the line ''VMWAREAPI_CLUSTER'' if you are using the ''trivial'' inventory example.&lt;br /&gt;
&lt;br /&gt;
Note: If you want the logs to be written to disk (not just accessible via screen), use the define SCREEN_LOGDIR to point to path &lt;br /&gt;
where you want to the logs to reside.  For example&lt;br /&gt;
&lt;br /&gt;
SCREEN_LOGDIR=/var/log&lt;br /&gt;
&lt;br /&gt;
=start stack (first time)=&lt;br /&gt;
 ./stack.sh&lt;br /&gt;
This will take a long time the first time, as it pulls down all code and dependencies.&lt;br /&gt;
Note: may fail on first start.&lt;br /&gt;
&lt;br /&gt;
=Credentials and Environment Variables=&lt;br /&gt;
get the OpenStack API credentials in your environment variables:&lt;br /&gt;
&lt;br /&gt;
 $ source openrc demo demo&lt;br /&gt;
&lt;br /&gt;
This is needed anytime you make a call using an openstack CLI client like ‘nova’, ‘glance’, or ‘quantum’.  You can rerun this at any time from the devstack directory if you need to re-login in at a later point.  If you want admin credentials then use admin ($ source openrc admin admin)&lt;br /&gt;
&lt;br /&gt;
=Glance Initial Setup=&lt;br /&gt;
Get a VMDK to use as a disk image and upload it to OpenStack using the Glance API.  The latest code (mid-Aug) has a change which uploads the image when you 1st run devstack.  After glance starts, run the following command to see if you have a pre-configured image in glance&lt;br /&gt;
&lt;br /&gt;
$ glance image-list&lt;br /&gt;
&lt;br /&gt;
==Get an initial VMDK to work with==&lt;br /&gt;
There are a lot of “gotchas” around what VMDK disks work with OpenStack + vSphere, so we strongly suggest using the provided image to start.  In the Appendix there is information about creating/converting your own images.  &lt;br /&gt;
&lt;br /&gt;
download the image 1 GB debian disk image (user/password to login this image after booting is nicira/nicira).  &lt;br /&gt;
 http://partnerweb.vmware.com/programs/vmdkimage/debian-2.6.32-i686.vmdk &lt;br /&gt;
Place the file under your home directory &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;~/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: if you are using nested hyper-visors you will need to obtain a 32bit image to use or troubleshoot: how to enable nested ESXi &amp;amp; other Hypervisors in vSphere 5.1 - See more at: http://www.virtuallyghetto.com/2012/08/how-to-enable-nested-esxi-other.html#sthash.NJ2VNiwt.dpuf&lt;br /&gt;
&lt;br /&gt;
==Upload your VMDK to glance==&lt;br /&gt;
&lt;br /&gt;
 $ glance add name=&amp;quot;Debian&amp;quot; disk_format=vmdk container_format=bare is_public=true \&lt;br /&gt;
    --property vmware_disktype=&amp;quot;preallocated&amp;quot; &amp;lt; ~/debian-2.6.32-i686.vmdk&lt;br /&gt;
... or ...&lt;br /&gt;
 $ glance image-create --name Debian --is-public=True --container-format=bare \&lt;br /&gt;
    --disk-format=vmdk --property vmware-disktype=&amp;quot;preallocated&amp;quot; &amp;lt; ~/debian-2.6.32-i686.vmdk &lt;br /&gt;
&lt;br /&gt;
This will print out an &amp;lt;image-id&amp;gt; for use below.  If you forget it, you can always run “glance image-list” to see all existing images.&lt;br /&gt;
&lt;br /&gt;
There is also an IDE based image that can be used. &lt;br /&gt;
&lt;br /&gt;
 http://partnerweb.vmware.com/programs/vmdkimage/trend-tinyvm1-flat.vmdk&lt;br /&gt;
Note the vmware_adaptertype is set to &amp;quot;ide&amp;quot; and vmware_disktype is set to &amp;quot;thin&amp;quot;&lt;br /&gt;
 $ glance image-create --name trend-thin --is-public=True --container-format=bare --disk-format=vmdk --property vmware_disktype=&amp;quot;thin&amp;quot; --property vmware_adaptertype=&amp;quot;ide&amp;quot; &amp;lt; trend-tinyvm1-flat.vmdk&lt;br /&gt;
&lt;br /&gt;
=Nova Boot=&lt;br /&gt;
boot a VM using the “&amp;lt;image-id&amp;gt;” from above&lt;br /&gt;
&lt;br /&gt;
 $ nova boot --image &amp;lt;image-id&amp;gt; --flavor 1 test1&lt;br /&gt;
&lt;br /&gt;
Now you can interact with the image using other nova client commands.  &lt;br /&gt;
For example&lt;br /&gt;
 $ nova list&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
 | ID                                   | Name  | Status | Task State | Power State | Networks         |&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
 | 9bb724bf-298d-4a63-a653-dab7fcbd9ac7 | test1 | ACTIVE  | None       | NOSTATE     | private=10.0.0.2 |&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
&lt;br /&gt;
Note: if your disk is big, it can take a VERY long time to stream the image from glance to your datastore (e.g., ~7 minutes for a 1 GB thick image).   This will happen only the first time a new image UUID is used on a datastore. You can monitor progress by viewing the size of the file in the vmware_base directory of the filestore.  &lt;br /&gt;
&lt;br /&gt;
Once this is done, you can view the VM using vCenter. The username/password for the above Debian image is nicira/nicira .&lt;br /&gt;
&lt;br /&gt;
You can access the OpenStack Web GUI (called horizon) by accessing your Ubuntu host on port 80, though currently VNC access via Horizon is broken (see: https://review.openstack.org/#/c/30036/ for a patch to fix this).&lt;br /&gt;
&lt;br /&gt;
=Using Screen=&lt;br /&gt;
Use screen to interact with individual openstack services&lt;br /&gt;
&lt;br /&gt;
 $ screen -x stack&lt;br /&gt;
&lt;br /&gt;
See: http://www.gnu.org/software/screen/manual/screen.html &amp;lt;- for how to use&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Control + a&amp;quot; enters command mode... enter this for each new command character&lt;br /&gt;
characters 0 through 9 switch tabs&lt;br /&gt;
** the 'd' character detaches the session&lt;br /&gt;
** the '[' character enters &amp;quot;copy mode&amp;quot; which allows you to navigate the screen trace and 'escape' escapes the copy mode.&lt;br /&gt;
** the '&amp;quot;' character shows a list of screens which you can navigate with the up and down arrows&lt;br /&gt;
&lt;br /&gt;
For example the nova-compute service runs on the n-cpu tab which is usually number 6. So to navigate to it, hit Ctrl+a then press '6' and you'll tab to it. You can then interact with the terminal for n-cpu.&lt;br /&gt;
&lt;br /&gt;
=Working the Development Environment=&lt;br /&gt;
If you want to reset your environment, run: &lt;br /&gt;
 ./unstack.sh &lt;br /&gt;
 ./stack.sh &lt;br /&gt;
&lt;br /&gt;
* This run of stack.sh will be faster (~1 minute) as it resets all database and service state, but does not need to re-download packages or source code.  &lt;br /&gt;
* After running ./unstack be sure to clean out all your datastores and delete any files left behind on accident. This will prevent a great number of problems people won't see in production environments. (For example: partially uploaded VMDK.)&lt;br /&gt;
&lt;br /&gt;
Note: the source code is not automatically updated when you reset your environment.  This is valuable, as you can manage your source code manually via git, having many branches, etc.  &lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
==Install python support libraries==&lt;br /&gt;
===apt-get libs===&lt;br /&gt;
 $ sudo apt-get install python-dev libmysqlclient-dev python-pip build-essential &lt;br /&gt;
 $ sudo apt-get install libxml2-dev libxslt1-dev libpq-dev&lt;br /&gt;
&lt;br /&gt;
===pip based tool installs===&lt;br /&gt;
 $ sudo pip install --upgrade pip &lt;br /&gt;
 $ sudo pip install --upgrade virtualenv&lt;br /&gt;
 $ sudo pip install MySQL-python&lt;br /&gt;
 $ sudo pip install tox&lt;br /&gt;
 $ sudo pip install python-subunit&lt;br /&gt;
&lt;br /&gt;
====pip proxy troubleshooting====&lt;br /&gt;
If you get connection refused here - try this&lt;br /&gt;
 export PIP_INDEX_URL=&amp;quot;http://pypi.openstack.org/openstack&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====Install OpenStack libs====&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ sudo pip install -i http://pypi.openstack.org/openstack  -r requirements.txt -r test-requirements.txt &lt;br /&gt;
&lt;br /&gt;
Note: make sure everything in the requires lists gets installed. Some installers have individual issues that you may have to clear one at a time. In particular lxslt has some issues that may require attention to properly clear.&lt;br /&gt;
&lt;br /&gt;
==Using TOX for testing==&lt;br /&gt;
See: https://wiki.openstack.org/wiki/ProjectTestingInterface&lt;br /&gt;
&lt;br /&gt;
Important tests to run before submitting for code review are&lt;br /&gt;
 tox -e py26,py27&lt;br /&gt;
 tox -e pep8&lt;br /&gt;
&lt;br /&gt;
As of this writing the run_tests.sh is the better way to run tests.&lt;br /&gt;
&lt;br /&gt;
== Using run_tests.sh for testing ==&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ ./run_tests.sh&lt;br /&gt;
... or ...&lt;br /&gt;
 $ ./run_tests.sh nova.tests.virt.vmwareapi&lt;br /&gt;
... to run only the vmware unit tests.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: If you want to use the python packages in your normal (non-virtual) environment then pass the -N flag&lt;br /&gt;
&lt;br /&gt;
==Code Coverage tests and information==&lt;br /&gt;
&lt;br /&gt;
=== with tox ===&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ tox -e cover  (code coverage)&lt;br /&gt;
&lt;br /&gt;
look under the cover directory for html reports on the code coverage for that module.  The file index.html contains the overall coverage report&lt;br /&gt;
&lt;br /&gt;
NOTE: tests may run 10, 20, or as long as 65 minutes (depending on your hardware, network, and system) and produce no output until they complete. This is normal. You system may become sluggish but should not lock up entirely, a system hang can be symptomatic of an improperly configured test environment. Tests will run on Mac OSX. 2 Cores with 2GB of RAM on an Ubuntu 12.04 machine that is properly configured should take between 10 and 20 minutes to complete.&lt;br /&gt;
&lt;br /&gt;
=== with run_tests.sh ===&lt;br /&gt;
  $ cd /opt/stack/nova&lt;br /&gt;
  $ ./run_tests.sh --coverage&lt;br /&gt;
&lt;br /&gt;
==Additional setup==&lt;br /&gt;
If you are on Ubuntu 12.04 and need to use Python 2.6 (which OpenStack needs for some test scripts) install the old version of python by doing the following:&lt;br /&gt;
&lt;br /&gt;
 $ sudo add-apt-repository ppa:fkrull/deadsnakes&lt;br /&gt;
 $ sudo apt-get update&lt;br /&gt;
 $ sudo apt-get install python2.6 python2.6-dev&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
''Some workplaces may have to use special networking and/or proxy settings and that these may change when you are mobile. Those issues can cause problems with apt-get, git and other parts of OpenStack. If you are in a place that needs special proxy rules, [https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy setup apt-get with a proxy]. You may also have to set [http://askubuntu.com/questions/158557/setting-proxy-from-terminal other proxy settings] depending on your company's particular firewall rules.''&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
You may have a situation where you need to monitor devstack's log files. Here's how you set up logging to file with the least amount of fuss.&lt;br /&gt;
&lt;br /&gt;
To set up logging of screen windows set the shell variable SCREEN_LOGDIR to the directory you want the log files to go. Log files will appear with names like ''screen-$SERVICE_NAME-$TIMESTAMP.log'' in that dir and symbolic link screen-$SERVICE_NAME.log will link to the latest log file. Logs are kept for as long specified in the LOGDAYS variable.&lt;br /&gt;
&lt;br /&gt;
Both SCREEN_LOGDIR and LOGDAYS are shell variables so you need to set them either in your shell or in localrc. Use shell commands if you only want the logs to work this one time. Use ''localrc'' if you always want to have log files appear.&lt;br /&gt;
&lt;br /&gt;
Assuming you have already made a directory...&lt;br /&gt;
&lt;br /&gt;
 $ mkdir ~/log&lt;br /&gt;
&lt;br /&gt;
Then, if you only want logs this one time, in your bash shell say...&lt;br /&gt;
&lt;br /&gt;
 $ export SCREEN_LOGDIR=~/log&lt;br /&gt;
 $ export LOGDAYS=2&lt;br /&gt;
&lt;br /&gt;
... or if you ''always'' want log files, in your localrc add the lines ...&lt;br /&gt;
&lt;br /&gt;
 SCREEN_LOGDIR=~/log&lt;br /&gt;
 LOGDAYS=2&lt;br /&gt;
&lt;br /&gt;
The stack.sh script will automatically rotate the log files for you.&lt;br /&gt;
&lt;br /&gt;
== MySQL issues ==&lt;br /&gt;
If you get stuck with Keystone try...&lt;br /&gt;
 $ mysql -u root -pnova&lt;br /&gt;
... if that doesn't work you probably have a broken mysql install. If you have problems getting mysql to behave, try purging the OpenStack version of the install and install the database manually. Here’s how to rip everything down and install mysql-server from scratch yourself.&lt;br /&gt;
&lt;br /&gt;
 $ ./unstack&lt;br /&gt;
 $ sudo apt-get purge mysql-server&lt;br /&gt;
... you may need to use the name mysql-server-5.5 instead ...&lt;br /&gt;
 $ sudo apt-get autoremove&lt;br /&gt;
 $ sudo apt-get install mysql-server-5.5&lt;br /&gt;
 $ sudo mysql_install_db&lt;br /&gt;
 $ sudo mysqladmin -u root password 'nova'&lt;br /&gt;
 $ sudo service mysql restart&lt;br /&gt;
 $ ./stack&lt;br /&gt;
&lt;br /&gt;
== Keystone Issues ==&lt;br /&gt;
If you get stuck when you are checking your keystone connection via curl then it’s your proxy settings.  Try setting the following in /etc/environment&lt;br /&gt;
 no_proxy=localhost,127.0.0.0/8,127.0.1.1,127.0.1.1*,local.home&lt;br /&gt;
&lt;br /&gt;
== General Database Issues ==&lt;br /&gt;
If you have trouble with testing or other database heavy activities you may need to follow:&lt;br /&gt;
 http://codeinthehole.com/writing/how-to-set-up-mysql-for-python-on-ubuntu/&lt;br /&gt;
&lt;br /&gt;
== rootwrap Issues ==&lt;br /&gt;
If networking suddenly stops working with an error like this&lt;br /&gt;
&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;/usr/bin/nova-rootwrap&amp;quot;, line 59, in &amp;lt;module&amp;gt;&lt;br /&gt;
     from nova.rootwrap import wrapper&lt;br /&gt;
 ImportError: No module named rootwrap&lt;br /&gt;
&lt;br /&gt;
Then something has added a broken rootwrap to /usr/bin.  Remove the /usr/bin/nova-rootwrap and it will use the correct one in /usr/local/bin&lt;br /&gt;
&lt;br /&gt;
=== Check if nova-compute is running ===&lt;br /&gt;
 $ screen -x&lt;br /&gt;
Note the tab n-cpu is running in. It is usually #6 but it could be a different tab on occasion. Tab to n-cpu's tab. '''ctl+a''' then '''6'''. If you see:&lt;br /&gt;
 $ cd /opt/stack/nova &amp;amp;&amp;amp; sg  '/usr/local/bin/nova-compute --config-file /etc/nova/nova.conf' || touch &amp;quot;/opt/stack/status/stack/n-cpu.failure&amp;quot;&lt;br /&gt;
 sg: group '/usr/local/bin/nova-compute --config-file /etc/nova/nova.conf' does not exist&lt;br /&gt;
 $&lt;br /&gt;
... then nova-compute did not start. You can manually start nova-compute by editing the command to read:&lt;br /&gt;
 $ cd /opt/stack/nova &amp;amp;&amp;amp; /usr/local/bin/nova-compute --config-file /etc/nova/nova.conf || touch &amp;quot;/opt/stack/status/stack/n-cpu.failure&amp;quot;&lt;br /&gt;
... which is permissible for development (but not for production).&lt;br /&gt;
&lt;br /&gt;
== Networking Troubleshooting ==&lt;br /&gt;
Remotely accessed workstations need to have an IP for you to SSH or VNC into in order to do work. These instructions mostly assume a ''locally accessible'' VM or physical machine. If you are working with a remotely hosted Ubuntu developer's workstation, you may have special networking concerns. If you find your use of nova-network is stealing your workstations IP in your environment (does not manifest in all environments so it's located here as a troubleshooting step) then set up a second interface for nova-network to use. &lt;br /&gt;
&lt;br /&gt;
=== Configure a fake networking interface ===&lt;br /&gt;
Configure a fake interface so that nova-network does not steal the real IP that you need to access the host remotely.  On Ubuntu: &lt;br /&gt;
&lt;br /&gt;
 $ sudo ip tuntap add dev tapfoo mode tap&lt;br /&gt;
 $ sudo ifconfig tapfoo $some_ip up &lt;br /&gt;
&lt;br /&gt;
NOTE: assign the interface an ip address that will be appropriate for your environment.&lt;br /&gt;
&lt;br /&gt;
Now that you have a fake ethernet interface, change your localrc and re-run ./stack.sh so that you can start nova-network on the new interface.&lt;br /&gt;
&lt;br /&gt;
add to your ''localrc'' file&lt;br /&gt;
 FLAT_INTERFACE=tapfoo&lt;br /&gt;
&lt;br /&gt;
=== Configure a Proxy ===&lt;br /&gt;
Some workplaces may have to use special networking and/or proxy settings and that these may change when you are mobile. Those issues can cause problems with apt-get, git and other parts of OpenStack. If you are in a place that needs special proxy rules, [https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy setup apt-get with a proxy]. You may also have to set [http://askubuntu.com/questions/158557/setting-proxy-from-terminal other proxy settings] depending on your company's particular firewall rules.&lt;br /&gt;
&lt;br /&gt;
=Appendix=&lt;br /&gt;
&lt;br /&gt;
==Converting Images==&lt;br /&gt;
&lt;br /&gt;
===Converting other disk images to vmdk using qemu-img=== &lt;br /&gt;
Disk images in several formats (e.g. qcow2) can be converted to the VMDK format usable by the vmware nova driver using the qemu-img utility.&lt;br /&gt;
&lt;br /&gt;
For example the following command can be used to convert a qcow2 Ubuntu Precise cloud image (downloadable from http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img):&lt;br /&gt;
 &amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; qemu-img convert -f raw ~/Downloads/precise-server-cloudimg-amd64-disk1.img -O vmdk precise-server-cloudimg-amd64-disk1.vmdk&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Converting a sparse vmdk to an ESX-compatible format=== &lt;br /&gt;
&lt;br /&gt;
Due to a bug (fixed with the following proposed [https://review.openstack.org/#/c/43994/ patch], currently under review) in how sparse vmdk disks are handled in the VC driver, &lt;br /&gt;
sparse disks have to be pre-converted to thin-provisioned or preallocated disks before they can be uploaded to glance to be used by the driver.&lt;br /&gt;
&lt;br /&gt;
There are several ways to perform such a conversion:&lt;br /&gt;
&lt;br /&gt;
====1. Using vSphere CLI (or sometimes called the remote CLI or rCLI) tools.====&lt;br /&gt;
&lt;br /&gt;
The latest version from the date this was written is 5.1 and the link is [https://my.vmware.com/web/vmware/details?downloadGroup=VSP510-VCLI-510&amp;amp;productId=285 here].&lt;br /&gt;
&lt;br /&gt;
Assuming that the sparse disk is made available on a datastore accessible by an ESX host, the following command converts it to preallocated format:&lt;br /&gt;
&lt;br /&gt;
 vmkfstools --server=ip_of_some_ESX_host -i /vmfs/volumes/datastore1/sparse.vmdk /vmfs/volumes/datastore1/converted.vmdk&lt;br /&gt;
&lt;br /&gt;
(note the vifs tool from the same CLI package can be used to upload the disk to be converted and downloaded the converted disk if necessary)&lt;br /&gt;
&lt;br /&gt;
====2. Using vmkfstools directly on the ESX host====&lt;br /&gt;
&lt;br /&gt;
If the SSH service is enabled on an ESX host, the sparse disk can be uploaded to the ESX datastore via scp, and the vmkfstools local to the ESX host can use used to perform the conversion: &lt;br /&gt;
&lt;br /&gt;
(After logging to the host via ssh)&lt;br /&gt;
 vmkfstools -i /vmfs/volumes/datastore1/sparse.vmdk /vmfs/volumes/datastore1/converted.vmdk&lt;br /&gt;
&lt;br /&gt;
====3. vmware-vdiskmanager====&lt;br /&gt;
&lt;br /&gt;
vmware-vdiskmanager is a utility that comes bundled with VMware Fusion and VMware Workstation. &lt;br /&gt;
Below is an example of converting a sparse disk to preallocated format:&lt;br /&gt;
&lt;br /&gt;
 '/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager' -r sparse.vmdk -t 4 converted.vmdk&lt;br /&gt;
&lt;br /&gt;
In all the above cases, the converted vmdk is actually a pair of files, the descriptor file &amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;.vmdk and the actual virtual disk data file &amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;-flat.vmdk. The file to be uploaded to glance is &amp;lt;b&amp;gt;&amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;-flat.vmdk&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
===Specifying correct adapter type when uploading and image to glance===&lt;br /&gt;
&lt;br /&gt;
Currently, there is a limitation that OS boot vmdk disks with an ide adapter type cannot be attached to a virtual SCSI controller, and likewise disks with one of the scsi adapter types (e.g. busLogic, lsiLogic) cannot be attached to the IDE controller. Therefore it is important when uploading an image to glance that the correct vmware_adaptertype property be set. In particular, images converted from qemu-img will _always_ if a monolithic sparse ide vmdk. So using the above example of the Precise Ubuntu image, after the qemu-img conversion and conversion to a preallocated disk, the command to upload the vmdk disk should be something like:&lt;br /&gt;
&lt;br /&gt;
   glance image-create --name precise-cloud --is-public=True --container-format=bare --disk-format=vmdk --property vmware_disktype=&amp;quot;preallocated&amp;quot; --property vmware_adaptertype=&amp;quot;ide&amp;quot; &amp;lt; converted-flat.vmdk&lt;br /&gt;
&lt;br /&gt;
====Obtaining the adapter type associated with a vmdk====&lt;br /&gt;
&lt;br /&gt;
If the vmdk is a monolithic file (such as one produced by the qemu-img conversion) the adapter type can be retrieved by &lt;br /&gt;
&lt;br /&gt;
   head -20 some_monolithic.vmdk&lt;br /&gt;
&lt;br /&gt;
and looking for the ddb.adapterType=XXX property&lt;br /&gt;
&lt;br /&gt;
If the vmdk has a descriptor/data file pair (foo.vmdk and foo-XXXX.vmdk). The descriptor file foo.vmdk can be examined for the same ddb.adapterType property)&lt;br /&gt;
&lt;br /&gt;
==List of Reviews in progress==&lt;br /&gt;
https://review.openstack.org/#/q/message:vmware+OR+message:vcenter+OR+message:vsphere+OR+message:esx+OR+message:vcdriver+OR+message:datastore,n,z&lt;/div&gt;</summary>
		<author><name>Vui</name></author>	</entry>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=NovaVMware/DeveloperGuide&amp;diff=30434</id>
		<title>NovaVMware/DeveloperGuide</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=NovaVMware/DeveloperGuide&amp;diff=30434"/>
				<updated>2013-09-20T07:03:06Z</updated>
		
		<summary type="html">&lt;p&gt;Vui: /* Converting Images */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Developer's DevStack + vSphere Guide=&lt;br /&gt;
&lt;br /&gt;
This is a short guide for developers interested in working on OpenStack and [[vSphere]] (ESX, [[ESXi]], and [[vCenter]]) drivers.&lt;br /&gt;
&lt;br /&gt;
==vSphere Environment and Inventory==&lt;br /&gt;
&lt;br /&gt;
Set up a vSphere 5.1 (or better) developer's environment. For development purposes, you'll need to have one of this inventory type:&lt;br /&gt;
&lt;br /&gt;
[[File:VCenter cluster inventory.png|framed|none|inventory with a DRS cluster]]&lt;br /&gt;
&lt;br /&gt;
Note: The cluster should be DRS enabled with &amp;quot;Fully automated&amp;quot; placement turned on. Also, if you can't get two or more ESX hosts to work with, you can still work with one host in the cluster, but you won't be able to observe VM placement behaviors since there won't be anywhere to place the VMs except for the solitary host.&lt;br /&gt;
&lt;br /&gt;
=Development Environment=&lt;br /&gt;
== Get an Ubuntu 12.04 (suggested) VM setup==&lt;br /&gt;
This Ubuntu workstation can run as a VM itself, but it should have public internet access (ideally direct, but http proxy is workable if you don’t need to commit code back to OpenStack if you do, see the troubleshooting page for steps that ''may'' help).  It should also have a reasonably high bandwidth link to the the vSphere hosts, as it will need to stream images from the Ubuntu workstation to the vSphere host. &lt;br /&gt;
&lt;br /&gt;
We suggest your Ubuntu workstation have&lt;br /&gt;
* at least 10 GB disk, with 20+ GB being ideal. &lt;br /&gt;
* at least one vCPU, with 2 being ideal.&lt;br /&gt;
* 4 GB of RAM.&lt;br /&gt;
&lt;br /&gt;
=== optional setup ===&lt;br /&gt;
If you are using a remote workstation (not running locally on your physical computer) you may have to follow some of the extra steps under [[NovaVMware/DeveloperGuide#Networking_Troubleshooting|Network Troubleshooting]]&lt;br /&gt;
&lt;br /&gt;
==install Devstack (http://devstack.org/) in your new VM==&lt;br /&gt;
Once booted, run: &lt;br /&gt;
 sudo apt-get install git&lt;br /&gt;
 git clone http://github.com/openstack-dev/devstack.git&lt;br /&gt;
 cd devstack&lt;br /&gt;
&lt;br /&gt;
=Setup localrc for DevStack=&lt;br /&gt;
create a file named “localrc” in your devstack directory with the content shown below (for each item with $variable_name, you will need to enter values specific to your environment, the rest you can just leave as is).  &lt;br /&gt;
&lt;br /&gt;
file ~/devstack/''localrc''&lt;br /&gt;
 ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-cpu,n-net,n-cond,n-sch,rabbit,mysql,horizon&lt;br /&gt;
 VIRT_DRIVER=vsphere&lt;br /&gt;
 VMWAREAPI_IP='''$your_vCenter_ip_address'''&lt;br /&gt;
 VMWAREAPI_USER=root&lt;br /&gt;
 VMWAREAPI_PASSWORD='''$password_goes_here'''&lt;br /&gt;
 VMWAREAPI_CLUSTER='''$your_cluster_name'''&lt;br /&gt;
 DATABASE_PASSWORD=nova&lt;br /&gt;
 RABBIT_PASSWORD=nova&lt;br /&gt;
 SERVICE_TOKEN=nova&lt;br /&gt;
 SERVICE_PASSWORD=nova&lt;br /&gt;
 ADMIN_PASSWORD=nova&lt;br /&gt;
 HOST_IP='''$your_development_vm_ip'''&lt;br /&gt;
&lt;br /&gt;
Note: if you would like to use a specific datastore then configure ''VMWAREAPI_DATASTORE_REGEX''&lt;br /&gt;
&lt;br /&gt;
Note: omit the line ''VMWAREAPI_CLUSTER'' if you are using the ''trivial'' inventory example.&lt;br /&gt;
&lt;br /&gt;
Note: If you want the logs to be written to disk (not just accessible via screen), use the define SCREEN_LOGDIR to point to path &lt;br /&gt;
where you want to the logs to reside.  For example&lt;br /&gt;
&lt;br /&gt;
SCREEN_LOGDIR=/var/log&lt;br /&gt;
&lt;br /&gt;
=start stack (first time)=&lt;br /&gt;
 ./stack.sh&lt;br /&gt;
This will take a long time the first time, as it pulls down all code and dependencies.&lt;br /&gt;
Note: may fail on first start.&lt;br /&gt;
&lt;br /&gt;
=Credentials and Environment Variables=&lt;br /&gt;
get the OpenStack API credentials in your environment variables:&lt;br /&gt;
&lt;br /&gt;
 $ source openrc demo demo&lt;br /&gt;
&lt;br /&gt;
This is needed anytime you make a call using an openstack CLI client like ‘nova’, ‘glance’, or ‘quantum’.  You can rerun this at any time from the devstack directory if you need to re-login in at a later point.  If you want admin credentials then use admin ($ source openrc admin admin)&lt;br /&gt;
&lt;br /&gt;
=Glance Initial Setup=&lt;br /&gt;
Get a VMDK to use as a disk image and upload it to OpenStack using the Glance API.  The latest code (mid-Aug) has a change which uploads the image when you 1st run devstack.  After glance starts, run the following command to see if you have a pre-configured image in glance&lt;br /&gt;
&lt;br /&gt;
$ glance image-list&lt;br /&gt;
&lt;br /&gt;
==Get an initial VMDK to work with==&lt;br /&gt;
There are a lot of “gotchas” around what VMDK disks work with OpenStack + vSphere, so we strongly suggest using the provided image to start.  In the Appendix there is information about creating/converting your own images.  &lt;br /&gt;
&lt;br /&gt;
download the image 1 GB debian disk image (user/password to login this image after booting is nicira/nicira).  &lt;br /&gt;
 http://partnerweb.vmware.com/programs/vmdkimage/debian-2.6.32-i686.vmdk &lt;br /&gt;
Place the file under your home directory &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;~/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: if you are using nested hyper-visors you will need to obtain a 32bit image to use or troubleshoot: how to enable nested ESXi &amp;amp; other Hypervisors in vSphere 5.1 - See more at: http://www.virtuallyghetto.com/2012/08/how-to-enable-nested-esxi-other.html#sthash.NJ2VNiwt.dpuf&lt;br /&gt;
&lt;br /&gt;
==Upload your VMDK to glance==&lt;br /&gt;
&lt;br /&gt;
 $ glance add name=&amp;quot;Debian&amp;quot; disk_format=vmdk container_format=bare is_public=true \&lt;br /&gt;
    --property vmware_disktype=&amp;quot;preallocated&amp;quot; &amp;lt; ~/debian-2.6.32-i686.vmdk&lt;br /&gt;
... or ...&lt;br /&gt;
 $ glance image-create --name Debian --is-public=True --container-format=bare \&lt;br /&gt;
    --disk-format=vmdk --property vmware-disktype=&amp;quot;preallocated&amp;quot; &amp;lt; ~/debian-2.6.32-i686.vmdk &lt;br /&gt;
&lt;br /&gt;
This will print out an &amp;lt;image-id&amp;gt; for use below.  If you forget it, you can always run “glance image-list” to see all existing images.&lt;br /&gt;
&lt;br /&gt;
There is also an IDE based image that can be used. &lt;br /&gt;
&lt;br /&gt;
 http://partnerweb.vmware.com/programs/vmdkimage/trend-tinyvm1-flat.vmdk&lt;br /&gt;
Note the vmware_adaptertype is set to &amp;quot;ide&amp;quot; and vmware_disktype is set to &amp;quot;thin&amp;quot;&lt;br /&gt;
 $ glance image-create --name trend-thin --is-public=True --container-format=bare --disk-format=vmdk --property vmware_disktype=&amp;quot;thin&amp;quot; --property vmware_adaptertype=&amp;quot;ide&amp;quot; &amp;lt; trend-tinyvm1-flat.vmdk&lt;br /&gt;
&lt;br /&gt;
=Nova Boot=&lt;br /&gt;
boot a VM using the “&amp;lt;image-id&amp;gt;” from above&lt;br /&gt;
&lt;br /&gt;
 $ nova boot --image &amp;lt;image-id&amp;gt; --flavor 1 test1&lt;br /&gt;
&lt;br /&gt;
Now you can interact with the image using other nova client commands.  &lt;br /&gt;
For example&lt;br /&gt;
 $ nova list&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
 | ID                                   | Name  | Status | Task State | Power State | Networks         |&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
 | 9bb724bf-298d-4a63-a653-dab7fcbd9ac7 | test1 | ACTIVE  | None       | NOSTATE     | private=10.0.0.2 |&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
&lt;br /&gt;
Note: if your disk is big, it can take a VERY long time to stream the image from glance to your datastore (e.g., ~7 minutes for a 1 GB thick image).   This will happen only the first time a new image UUID is used on a datastore. You can monitor progress by viewing the size of the file in the vmware_base directory of the filestore.  &lt;br /&gt;
&lt;br /&gt;
Once this is done, you can view the VM using vCenter. The username/password for the above Debian image is nicira/nicira .&lt;br /&gt;
&lt;br /&gt;
You can access the OpenStack Web GUI (called horizon) by accessing your Ubuntu host on port 80, though currently VNC access via Horizon is broken (see: https://review.openstack.org/#/c/30036/ for a patch to fix this).&lt;br /&gt;
&lt;br /&gt;
=Using Screen=&lt;br /&gt;
Use screen to interact with individual openstack services&lt;br /&gt;
&lt;br /&gt;
 $ screen -x stack&lt;br /&gt;
&lt;br /&gt;
See: http://www.gnu.org/software/screen/manual/screen.html &amp;lt;- for how to use&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Control + a&amp;quot; enters command mode... enter this for each new command character&lt;br /&gt;
characters 0 through 9 switch tabs&lt;br /&gt;
** the 'd' character detaches the session&lt;br /&gt;
** the '[' character enters &amp;quot;copy mode&amp;quot; which allows you to navigate the screen trace and 'escape' escapes the copy mode.&lt;br /&gt;
** the '&amp;quot;' character shows a list of screens which you can navigate with the up and down arrows&lt;br /&gt;
&lt;br /&gt;
For example the nova-compute service runs on the n-cpu tab which is usually number 6. So to navigate to it, hit Ctrl+a then press '6' and you'll tab to it. You can then interact with the terminal for n-cpu.&lt;br /&gt;
&lt;br /&gt;
=Working the Development Environment=&lt;br /&gt;
If you want to reset your environment, run: &lt;br /&gt;
 ./unstack.sh &lt;br /&gt;
 ./stack.sh &lt;br /&gt;
&lt;br /&gt;
* This run of stack.sh will be faster (~1 minute) as it resets all database and service state, but does not need to re-download packages or source code.  &lt;br /&gt;
* After running ./unstack be sure to clean out all your datastores and delete any files left behind on accident. This will prevent a great number of problems people won't see in production environments. (For example: partially uploaded VMDK.)&lt;br /&gt;
&lt;br /&gt;
Note: the source code is not automatically updated when you reset your environment.  This is valuable, as you can manage your source code manually via git, having many branches, etc.  &lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
==Install python support libraries==&lt;br /&gt;
===apt-get libs===&lt;br /&gt;
 $ sudo apt-get install python-dev libmysqlclient-dev python-pip build-essential &lt;br /&gt;
 $ sudo apt-get install libxml2-dev libxslt1-dev libpq-dev&lt;br /&gt;
&lt;br /&gt;
===pip based tool installs===&lt;br /&gt;
 $ sudo pip install --upgrade pip &lt;br /&gt;
 $ sudo pip install --upgrade virtualenv&lt;br /&gt;
 $ sudo pip install MySQL-python&lt;br /&gt;
 $ sudo pip install tox&lt;br /&gt;
 $ sudo pip install python-subunit&lt;br /&gt;
&lt;br /&gt;
====pip proxy troubleshooting====&lt;br /&gt;
If you get connection refused here - try this&lt;br /&gt;
 export PIP_INDEX_URL=&amp;quot;http://pypi.openstack.org/openstack&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====Install OpenStack libs====&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ sudo pip install -i http://pypi.openstack.org/openstack  -r requirements.txt -r test-requirements.txt &lt;br /&gt;
&lt;br /&gt;
Note: make sure everything in the requires lists gets installed. Some installers have individual issues that you may have to clear one at a time. In particular lxslt has some issues that may require attention to properly clear.&lt;br /&gt;
&lt;br /&gt;
==Using TOX for testing==&lt;br /&gt;
See: https://wiki.openstack.org/wiki/ProjectTestingInterface&lt;br /&gt;
&lt;br /&gt;
Important tests to run before submitting for code review are&lt;br /&gt;
 tox -e py26,py27&lt;br /&gt;
 tox -e pep8&lt;br /&gt;
&lt;br /&gt;
As of this writing the run_tests.sh is the better way to run tests.&lt;br /&gt;
&lt;br /&gt;
== Using run_tests.sh for testing ==&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ ./run_tests.sh&lt;br /&gt;
... or ...&lt;br /&gt;
 $ ./run_tests.sh nova.tests.virt.vmwareapi&lt;br /&gt;
... to run only the vmware unit tests.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: If you want to use the python packages in your normal (non-virtual) environment then pass the -N flag&lt;br /&gt;
&lt;br /&gt;
==Code Coverage tests and information==&lt;br /&gt;
&lt;br /&gt;
=== with tox ===&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ tox -e cover  (code coverage)&lt;br /&gt;
&lt;br /&gt;
look under the cover directory for html reports on the code coverage for that module.  The file index.html contains the overall coverage report&lt;br /&gt;
&lt;br /&gt;
NOTE: tests may run 10, 20, or as long as 65 minutes (depending on your hardware, network, and system) and produce no output until they complete. This is normal. You system may become sluggish but should not lock up entirely, a system hang can be symptomatic of an improperly configured test environment. Tests will run on Mac OSX. 2 Cores with 2GB of RAM on an Ubuntu 12.04 machine that is properly configured should take between 10 and 20 minutes to complete.&lt;br /&gt;
&lt;br /&gt;
=== with run_tests.sh ===&lt;br /&gt;
  $ cd /opt/stack/nova&lt;br /&gt;
  $ ./run_tests.sh --coverage&lt;br /&gt;
&lt;br /&gt;
==Additional setup==&lt;br /&gt;
If you are on Ubuntu 12.04 and need to use Python 2.6 (which OpenStack needs for some test scripts) install the old version of python by doing the following:&lt;br /&gt;
&lt;br /&gt;
 $ sudo add-apt-repository ppa:fkrull/deadsnakes&lt;br /&gt;
 $ sudo apt-get update&lt;br /&gt;
 $ sudo apt-get install python2.6 python2.6-dev&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
''Some workplaces may have to use special networking and/or proxy settings and that these may change when you are mobile. Those issues can cause problems with apt-get, git and other parts of OpenStack. If you are in a place that needs special proxy rules, [https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy setup apt-get with a proxy]. You may also have to set [http://askubuntu.com/questions/158557/setting-proxy-from-terminal other proxy settings] depending on your company's particular firewall rules.''&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
You may have a situation where you need to monitor devstack's log files. Here's how you set up logging to file with the least amount of fuss.&lt;br /&gt;
&lt;br /&gt;
To set up logging of screen windows set the shell variable SCREEN_LOGDIR to the directory you want the log files to go. Log files will appear with names like ''screen-$SERVICE_NAME-$TIMESTAMP.log'' in that dir and symbolic link screen-$SERVICE_NAME.log will link to the latest log file. Logs are kept for as long specified in the LOGDAYS variable.&lt;br /&gt;
&lt;br /&gt;
Both SCREEN_LOGDIR and LOGDAYS are shell variables so you need to set them either in your shell or in localrc. Use shell commands if you only want the logs to work this one time. Use ''localrc'' if you always want to have log files appear.&lt;br /&gt;
&lt;br /&gt;
Assuming you have already made a directory...&lt;br /&gt;
&lt;br /&gt;
 $ mkdir ~/log&lt;br /&gt;
&lt;br /&gt;
Then, if you only want logs this one time, in your bash shell say...&lt;br /&gt;
&lt;br /&gt;
 $ export SCREEN_LOGDIR=~/log&lt;br /&gt;
 $ export LOGDAYS=2&lt;br /&gt;
&lt;br /&gt;
... or if you ''always'' want log files, in your localrc add the lines ...&lt;br /&gt;
&lt;br /&gt;
 SCREEN_LOGDIR=~/log&lt;br /&gt;
 LOGDAYS=2&lt;br /&gt;
&lt;br /&gt;
The stack.sh script will automatically rotate the log files for you.&lt;br /&gt;
&lt;br /&gt;
== MySQL issues ==&lt;br /&gt;
If you get stuck with Keystone try...&lt;br /&gt;
 $ mysql -u root -pnova&lt;br /&gt;
... if that doesn't work you probably have a broken mysql install. If you have problems getting mysql to behave, try purging the OpenStack version of the install and install the database manually. Here’s how to rip everything down and install mysql-server from scratch yourself.&lt;br /&gt;
&lt;br /&gt;
 $ ./unstack&lt;br /&gt;
 $ sudo apt-get purge mysql-server&lt;br /&gt;
... you may need to use the name mysql-server-5.5 instead ...&lt;br /&gt;
 $ sudo apt-get autoremove&lt;br /&gt;
 $ sudo apt-get install mysql-server-5.5&lt;br /&gt;
 $ sudo mysql_install_db&lt;br /&gt;
 $ sudo mysqladmin -u root password 'nova'&lt;br /&gt;
 $ sudo service mysql restart&lt;br /&gt;
 $ ./stack&lt;br /&gt;
&lt;br /&gt;
== Keystone Issues ==&lt;br /&gt;
If you get stuck when you are checking your keystone connection via curl then it’s your proxy settings.  Try setting the following in /etc/environment&lt;br /&gt;
 no_proxy=localhost,127.0.0.0/8,127.0.1.1,127.0.1.1*,local.home&lt;br /&gt;
&lt;br /&gt;
== General Database Issues ==&lt;br /&gt;
If you have trouble with testing or other database heavy activities you may need to follow:&lt;br /&gt;
 http://codeinthehole.com/writing/how-to-set-up-mysql-for-python-on-ubuntu/&lt;br /&gt;
&lt;br /&gt;
== rootwrap Issues ==&lt;br /&gt;
If networking suddenly stops working with an error like this&lt;br /&gt;
&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;/usr/bin/nova-rootwrap&amp;quot;, line 59, in &amp;lt;module&amp;gt;&lt;br /&gt;
     from nova.rootwrap import wrapper&lt;br /&gt;
 ImportError: No module named rootwrap&lt;br /&gt;
&lt;br /&gt;
Then something has added a broken rootwrap to /usr/bin.  Remove the /usr/bin/nova-rootwrap and it will use the correct one in /usr/local/bin&lt;br /&gt;
&lt;br /&gt;
=== Check if nova-compute is running ===&lt;br /&gt;
 $ screen -x&lt;br /&gt;
Note the tab n-cpu is running in. It is usually #6 but it could be a different tab on occasion. Tab to n-cpu's tab. '''ctl+a''' then '''6'''. If you see:&lt;br /&gt;
 $ cd /opt/stack/nova &amp;amp;&amp;amp; sg  '/usr/local/bin/nova-compute --config-file /etc/nova/nova.conf' || touch &amp;quot;/opt/stack/status/stack/n-cpu.failure&amp;quot;&lt;br /&gt;
 sg: group '/usr/local/bin/nova-compute --config-file /etc/nova/nova.conf' does not exist&lt;br /&gt;
 $&lt;br /&gt;
... then nova-compute did not start. You can manually start nova-compute by editing the command to read:&lt;br /&gt;
 $ cd /opt/stack/nova &amp;amp;&amp;amp; /usr/local/bin/nova-compute --config-file /etc/nova/nova.conf || touch &amp;quot;/opt/stack/status/stack/n-cpu.failure&amp;quot;&lt;br /&gt;
... which is permissible for development (but not for production).&lt;br /&gt;
&lt;br /&gt;
== Networking Troubleshooting ==&lt;br /&gt;
Remotely accessed workstations need to have an IP for you to SSH or VNC into in order to do work. These instructions mostly assume a ''locally accessible'' VM or physical machine. If you are working with a remotely hosted Ubuntu developer's workstation, you may have special networking concerns. If you find your use of nova-network is stealing your workstations IP in your environment (does not manifest in all environments so it's located here as a troubleshooting step) then set up a second interface for nova-network to use. &lt;br /&gt;
&lt;br /&gt;
=== Configure a fake networking interface ===&lt;br /&gt;
Configure a fake interface so that nova-network does not steal the real IP that you need to access the host remotely.  On Ubuntu: &lt;br /&gt;
&lt;br /&gt;
 $ sudo ip tuntap add dev tapfoo mode tap&lt;br /&gt;
 $ sudo ifconfig tapfoo $some_ip up &lt;br /&gt;
&lt;br /&gt;
NOTE: assign the interface an ip address that will be appropriate for your environment.&lt;br /&gt;
&lt;br /&gt;
Now that you have a fake ethernet interface, change your localrc and re-run ./stack.sh so that you can start nova-network on the new interface.&lt;br /&gt;
&lt;br /&gt;
add to your ''localrc'' file&lt;br /&gt;
 FLAT_INTERFACE=tapfoo&lt;br /&gt;
&lt;br /&gt;
=== Configure a Proxy ===&lt;br /&gt;
Some workplaces may have to use special networking and/or proxy settings and that these may change when you are mobile. Those issues can cause problems with apt-get, git and other parts of OpenStack. If you are in a place that needs special proxy rules, [https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy setup apt-get with a proxy]. You may also have to set [http://askubuntu.com/questions/158557/setting-proxy-from-terminal other proxy settings] depending on your company's particular firewall rules.&lt;br /&gt;
&lt;br /&gt;
=Appendix=&lt;br /&gt;
&lt;br /&gt;
==Converting Images==&lt;br /&gt;
&lt;br /&gt;
Disk images in several formats (e.g. qcow2) can be converted to the VMDK format usable by the vmware nova driver using the qemu-img utility.&lt;br /&gt;
&lt;br /&gt;
For example the following command can be used to convert a qcow2 Ubuntu Precise cloud image (downloadable from http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img):&lt;br /&gt;
 &amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; qemu-img convert -f raw ~/Downloads/precise-server-cloudimg-amd64-disk1.img -O vmdk precise-server-cloudimg-amd64-disk1.vmdk&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Convert a sparse vmdk to an ESX-compatible format=== &lt;br /&gt;
&lt;br /&gt;
Due to a bug (fixed with the following proposed [https://review.openstack.org/#/c/43994/ patch], currently under review) in how sparse vmdk disks are handled in the VC driver, &lt;br /&gt;
sparse disks have to be pre-converted to thin-provisioned or preallocated disks before they can be uploaded to glance to be used by the driver.&lt;br /&gt;
&lt;br /&gt;
There are several ways to perform such a conversion:&lt;br /&gt;
&lt;br /&gt;
====1. Using vSphere CLI (or sometimes called the remote CLI or rCLI) tools.====&lt;br /&gt;
&lt;br /&gt;
The latest version from the date this was written is 5.1 and the link is [https://my.vmware.com/web/vmware/details?downloadGroup=VSP510-VCLI-510&amp;amp;productId=285 here].&lt;br /&gt;
&lt;br /&gt;
Assuming that the sparse disk is made available on a datastore accessible by an ESX host, the following command converts it to preallocated format:&lt;br /&gt;
&lt;br /&gt;
 vmkfstools --server=ip_of_some_ESX_host -i /vmfs/volumes/datastore1/sparse.vmdk /vmfs/volumes/datastore1/converted.vmdk&lt;br /&gt;
&lt;br /&gt;
(note the vifs tool from the same CLI package can be used to upload the disk to be converted and downloaded the converted disk if necessary)&lt;br /&gt;
&lt;br /&gt;
====2. Using vmkfstools directly on the ESX host====&lt;br /&gt;
&lt;br /&gt;
If the SSH service is enabled on an ESX host, the sparse disk can be uploaded to the ESX datastore via scp, and the vmkfstools local to the ESX host can use used to perform the conversion: &lt;br /&gt;
&lt;br /&gt;
(After logging to the host via ssh)&lt;br /&gt;
 vmkfstools -i /vmfs/volumes/datastore1/sparse.vmdk /vmfs/volumes/datastore1/converted.vmdk&lt;br /&gt;
&lt;br /&gt;
====3. vmware-vdiskmanager====&lt;br /&gt;
&lt;br /&gt;
vmware-vdiskmanager is a utility that comes bundled with VMware Fusion and VMware Workstation. &lt;br /&gt;
Below is an example of converting a sparse disk to preallocated format:&lt;br /&gt;
&lt;br /&gt;
 '/Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager' -r sparse.vmdk -t 4 converted.vmdk&lt;br /&gt;
&lt;br /&gt;
In all the above cases, the converted vmdk is actually a pair of files, the descriptor file &amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;.vmdk and the actual virtual disk data file &amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;-flat.vmdk. The file to be uploaded to glance is &amp;lt;b&amp;gt;&amp;lt;i&amp;gt;converted&amp;lt;/i&amp;gt;-flat.vmdk&amp;lt;/b&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
===Specifying correct adapter type when uploading and image to glance===&lt;br /&gt;
&lt;br /&gt;
Currently, there is a limitation that OS boot vmdk disks with an ide adapter type cannot be attached to a virtual SCSI controller, and likewise disks with one of the scsi adapter types (e.g. busLogic, lsiLogic) cannot be attached to the IDE controller. Therefore it is important when uploading an image to glance that the correct vmware_adaptertype property be set. In particular, images converted from qemu-img will _always_ if a monolithic sparse ide vmdk. So using the above example of the Precise Ubuntu image, after the qemu-img conversion and conversion to a preallocated disk, the command to upload the vmdk disk should be something like:&lt;br /&gt;
&lt;br /&gt;
   glance image-create --name precise-cloud --is-public=True --container-format=bare --disk-format=vmdk --property vmware_disktype=&amp;quot;preallocated&amp;quot; --property vmware_adaptertype=&amp;quot;ide&amp;quot; &amp;lt; converted-flat.vmdk&lt;br /&gt;
&lt;br /&gt;
====Obtaining the adapter type associated with a vmdk====&lt;br /&gt;
&lt;br /&gt;
If the vmdk is a monolithic file (such as one produced by the qemu-img conversion) the adapter type can be retrieved by &lt;br /&gt;
&lt;br /&gt;
   head -20 some_monolithic.vmdk&lt;br /&gt;
&lt;br /&gt;
and looking for the ddb.adapterType=XXX property&lt;br /&gt;
&lt;br /&gt;
If the vmdk has a descriptor/data file pair (foo.vmdk and foo-XXXX.vmdk). The descriptor file foo.vmdk can be examined for the same ddb.adapterType property)&lt;br /&gt;
&lt;br /&gt;
==List of Reviews in progress==&lt;br /&gt;
https://review.openstack.org/#/q/message:vmware+OR+message:vcenter+OR+message:vsphere+OR+message:esx+OR+message:vcdriver+OR+message:datastore,n,z&lt;/div&gt;</summary>
		<author><name>Vui</name></author>	</entry>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=NovaVMware/DeveloperGuide&amp;diff=27483</id>
		<title>NovaVMware/DeveloperGuide</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=NovaVMware/DeveloperGuide&amp;diff=27483"/>
				<updated>2013-08-04T05:15:44Z</updated>
		
		<summary type="html">&lt;p&gt;Vui: libpq-dev needed to build psycopg2&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Developer's DevStack + vSphere Guide=&lt;br /&gt;
&lt;br /&gt;
This is a short guide for developers interested in working on OpenStack and vSphere (ESX, ESXi, and vCenter) drivers.&lt;br /&gt;
&lt;br /&gt;
==vSphere Environment and Inventory==&lt;br /&gt;
&lt;br /&gt;
Set up a vSphere 5.1 (or better) developer's environment. For development purposes, you'll need to have one of these inventory types.&lt;br /&gt;
&lt;br /&gt;
[[File:VCenter trivial inventory.png|framed|none|a trivial Inventory]]&lt;br /&gt;
&lt;br /&gt;
... or ...&lt;br /&gt;
&lt;br /&gt;
[[File:VCenter cluster inventory.png|framed|none|inventory with a DRS cluster]]&lt;br /&gt;
&lt;br /&gt;
Note: The cluster should be DRS enabled with &amp;quot;Fully automated&amp;quot; placement turned on. Also, if you can't get two or more ESX hosts to work with, you can still work with one host in the cluster, but you won't be able to observe VM placement behaviors since there won't be anywhere to place the VMs except for the solitary host.&lt;br /&gt;
&lt;br /&gt;
=Development Environment=&lt;br /&gt;
== Get an Ubuntu 12.04 (suggested) VM setup==&lt;br /&gt;
This Ubuntu workstation can run as a VM itself, but it should have public internet access (ideally direct, but http proxy is workable if you don’t need to commit code back to OpenStack if you do, see the troubleshooting page for steps that ''may'' help).  It should also have a reasonably high bandwidth link to the the vSphere hosts, as it will need to stream images from the Ubuntu workstation to the vSphere host. &lt;br /&gt;
&lt;br /&gt;
We suggest your Ubuntu workstation have&lt;br /&gt;
* at least 10 GB disk, with 20+ GB being ideal. &lt;br /&gt;
* at least one vCPU, with 2 being ideal.&lt;br /&gt;
* 4 GB of RAM.&lt;br /&gt;
&lt;br /&gt;
=== optional setup ===&lt;br /&gt;
If you are using a remote workstation (not running locally on your physical computer) you may have to follow some of the extra steps under [[NovaVMware/DeveloperGuide#Networking_Troubleshooting|Network Troubleshooting]]&lt;br /&gt;
&lt;br /&gt;
==install Devstack (http://devstack.org/) in your new VM==&lt;br /&gt;
Once booted, run: &lt;br /&gt;
 sudo apt-get install git&lt;br /&gt;
 git clone http://github.com/openstack-dev/devstack.git&lt;br /&gt;
 cd devstack&lt;br /&gt;
&lt;br /&gt;
=Setup localrc for DevStack=&lt;br /&gt;
create a file named “localrc” in your devstack directory with the content shown below (for each item with $variable_name, you will need to enter values specific to your environment, the rest you can just leave as is).  &lt;br /&gt;
&lt;br /&gt;
file ~/devstack/''localrc''&lt;br /&gt;
 ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-cpu,n-net,n-cond,n-sch,rabbit,mysql,horizon&lt;br /&gt;
 VIRT_DRIVER=vsphere&lt;br /&gt;
 VMWAREAPI_IP='''$your_vCenter_ip_address'''&lt;br /&gt;
 VMWAREAPI_USER=root&lt;br /&gt;
 VMWAREAPI_PASSWORD='''$password_goes_here'''&lt;br /&gt;
 VMWAREAPI_CLUSTER='''$your_cluster_name'''&lt;br /&gt;
 DATABASE_PASSWORD=nova&lt;br /&gt;
 RABBIT_PASSWORD=nova&lt;br /&gt;
 SERVICE_TOKEN=nova&lt;br /&gt;
 SERVICE_PASSWORD=nova&lt;br /&gt;
 ADMIN_PASSWORD=nova&lt;br /&gt;
 HOST_IP='''$your_development_vm_ip'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Note: omit the line ''VMWAREAPI_CLUSTER'' if you are using the ''trivial'' inventory example.&lt;br /&gt;
Note: If you want the logs to be written to disk (not just accessible via screen), use the define SCREEN_LOGDIR to point to path &lt;br /&gt;
where you want to the logs to reside.  For example&lt;br /&gt;
&lt;br /&gt;
SCREEN_LOGDIR=/var/log&lt;br /&gt;
&lt;br /&gt;
=start stack (first time)=&lt;br /&gt;
 ./stack.sh&lt;br /&gt;
This will take a long time the first time, as it pulls down all code and dependencies.&lt;br /&gt;
Note: may fail on first start.&lt;br /&gt;
&lt;br /&gt;
=Credentials and Environment Variables=&lt;br /&gt;
get the OpenStack API credentials in your environment variables:&lt;br /&gt;
&lt;br /&gt;
 $ source openrc demo demo&lt;br /&gt;
&lt;br /&gt;
This is needed anytime you make a call using an openstack CLI client like ‘nova’, ‘glance’, or ‘quantum’.  You can rerun this at any time from the devstack directory if you need to re-login in at a later point.&lt;br /&gt;
&lt;br /&gt;
=Glance Initial Setup=&lt;br /&gt;
Get a VMDK to use as a disk image and upload it to OpenStack using the Glance API.  &lt;br /&gt;
&lt;br /&gt;
==Get an initial VMDK to work with==&lt;br /&gt;
There are a lot of “gotchas” around what VMDK disks work with OpenStack + vSphere, so we strongly suggest using the provided image to start.  In the Appendix there is information about creating/converting your own images.  &lt;br /&gt;
&lt;br /&gt;
download the image 1 GB debian disk image (user/password to login this image after booting is nicira/nicira).  &lt;br /&gt;
 https://www.dropbox.com/s/utvri5bw3zztty6/Debian-flat.vmdk&lt;br /&gt;
&lt;br /&gt;
Place the file under your home directory &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;~/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
NOTE: if you are using nested hyper-visors you will need to obtain a 32bit image to use or troubleshoot: how to enable nested ESXi &amp;amp; other Hypervisors in vSphere 5.1 - See more at: http://www.virtuallyghetto.com/2012/08/how-to-enable-nested-esxi-other.html#sthash.NJ2VNiwt.dpuf&lt;br /&gt;
&lt;br /&gt;
==Upload your VMDK to glance==&lt;br /&gt;
&lt;br /&gt;
 $ glance add name=&amp;quot;Debian&amp;quot; disk_format=vmdk container_format=bare is_public=true \&lt;br /&gt;
    --property vmware_disktype=&amp;quot;preallocated&amp;quot; &amp;lt; ~/Debian-flat.vmdk&lt;br /&gt;
... or ...&lt;br /&gt;
 $ glance image-create --name Debian --is-public=True --container-format=bare \&lt;br /&gt;
    --disk-format=vmdk --property vmware-disktype=&amp;quot;preallocated&amp;quot; &amp;lt; ~/Debian-flat.vmdk &lt;br /&gt;
&lt;br /&gt;
This will print out an &amp;lt;image-id&amp;gt; for use below.  If you forget it, you can always run “glance image-list” to see all existing images.&lt;br /&gt;
&lt;br /&gt;
=Nova Boot=&lt;br /&gt;
boot a VM using the “&amp;lt;image-id&amp;gt;” from above&lt;br /&gt;
&lt;br /&gt;
 $ nova boot --image &amp;lt;image-id&amp;gt; --flavor 1 test1&lt;br /&gt;
&lt;br /&gt;
Now you can interact with the image using other nova client commands.  &lt;br /&gt;
For example&lt;br /&gt;
 $ nova list&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
 | ID                                   | Name  | Status | Task State | Power State | Networks         |&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
 | 9bb724bf-298d-4a63-a653-dab7fcbd9ac7 | test1 | ACTIVE  | None       | NOSTATE     | private=10.0.0.2 |&lt;br /&gt;
 +--------------------------------------+-------+--------+------------+-------------+------------------+&lt;br /&gt;
&lt;br /&gt;
Note: if your disk is big, it can take a VERY long time to stream the image from glance to your datastore (e.g., ~7 minutes for a 1 GB thick image).   This will happen only the first time a new image UUID is used on a datastore. You can monitor progress by viewing the size of the file in the vmware_base directory of the filestore.  &lt;br /&gt;
&lt;br /&gt;
Once this is done, you can view the VM using vCenter. The username/password for the above Debian image is nicira/nicira .&lt;br /&gt;
&lt;br /&gt;
You can access the OpenStack Web GUI (called horizon) by accessing your Ubuntu host on port 80, though currently VNC access via Horizon is broken (see: https://review.openstack.org/#/c/30036/ for a patch to fix this).&lt;br /&gt;
&lt;br /&gt;
=Using Screen=&lt;br /&gt;
Use screen to interact with individual openstack services&lt;br /&gt;
&lt;br /&gt;
 $ screen -x stack&lt;br /&gt;
&lt;br /&gt;
See: http://www.gnu.org/software/screen/manual/screen.html &amp;lt;- for how to use&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Control + a&amp;quot; enters command mode... enter this for each new command character&lt;br /&gt;
characters 0 through 9 switch tabs&lt;br /&gt;
** the 'd' character detaches the session&lt;br /&gt;
** the '[' character enters &amp;quot;copy mode&amp;quot; which allows you to navigate the screen trace and 'escape' escapes the copy mode.&lt;br /&gt;
&lt;br /&gt;
For example the nova-compute service runs on the n-cpu tab which is usually number 6. So to navigate to it, hit Ctrl+a then press '6' and you'll tab to it. You can then interact with the terminal for n-cpu.&lt;br /&gt;
&lt;br /&gt;
=Working the Development Environment=&lt;br /&gt;
If you want to reset your environment, run: &lt;br /&gt;
 ./unstack.sh &lt;br /&gt;
 ./stack.sh &lt;br /&gt;
&lt;br /&gt;
* This run of stack.sh will be faster (~1 minute) as it resets all database and service state, but does not need to re-download packages or source code.  &lt;br /&gt;
* After running ./unstack be sure to clean out all your datastores and delete any files left behind on accident. This will prevent a great number of problems people won't see in production environments. (For example: partially uploaded VMDK.)&lt;br /&gt;
&lt;br /&gt;
Note: the source code is not automatically updated when you reset your environment.  This is valuable, as you can manage your source code manually via git, having many branches, etc.  &lt;br /&gt;
&lt;br /&gt;
=Testing=&lt;br /&gt;
==Install python support libraries==&lt;br /&gt;
===apt-get libs===&lt;br /&gt;
 $ sudo apt-get install python-dev libmysqlclient-dev python-pip build-essential &lt;br /&gt;
 $ sudo apt-get install libxml2-dev libxslt1-dev libpq-dev&lt;br /&gt;
&lt;br /&gt;
===pip based tool installs===&lt;br /&gt;
 $ sudo pip install --upgrade pip &lt;br /&gt;
 $ sudo pip install --upgrade virtualenv&lt;br /&gt;
 $ sudo pip install MySQL-python&lt;br /&gt;
 $ sudo pip install tox&lt;br /&gt;
 $ sudo pip install python-subunit&lt;br /&gt;
&lt;br /&gt;
====pip proxy troubleshooting====&lt;br /&gt;
If you get connection refused here - try this&lt;br /&gt;
 export PIP_INDEX_URL=&amp;quot;http://pypi.openstack.org/openstack&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====Install OpenStack libs====&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ sudo pip install -i http://pypi.openstack.org/openstack  -r requirements.txt -r test-requirements.txt &lt;br /&gt;
&lt;br /&gt;
Note: make sure everything in the requires lists gets installed. Some installers have individual issues that you may have to clear one at a time. In particular lxslt has some issues that may require attention to properly clear.&lt;br /&gt;
&lt;br /&gt;
==Using TOX for testing==&lt;br /&gt;
See: https://wiki.openstack.org/wiki/ProjectTestingInterface&lt;br /&gt;
&lt;br /&gt;
Important tests to run before submitting for code review are&lt;br /&gt;
 tox -e py26,py27&lt;br /&gt;
 tox -e pep8&lt;br /&gt;
&lt;br /&gt;
As of this writing the run_tests.sh is the better way to run tests.&lt;br /&gt;
&lt;br /&gt;
== Using run_tests.sh for testing ==&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ ./run_tests.sh&lt;br /&gt;
... or ...&lt;br /&gt;
 $ ./run_tests.sh nova.tests.virt.vmwareapi&lt;br /&gt;
... to run only the vmware unit tests.&lt;br /&gt;
&lt;br /&gt;
==Code Coverage tests and information==&lt;br /&gt;
&lt;br /&gt;
=== with tox ===&lt;br /&gt;
 $ cd /opt/stack/nova&lt;br /&gt;
 $ tox -e cover  (code coverage)&lt;br /&gt;
&lt;br /&gt;
look under the cover directory for html reports on the code coverage for that module.  The file index.html contains the overall coverage report&lt;br /&gt;
&lt;br /&gt;
NOTE: tests may run 10, 20, or as long as 65 minutes (depending on your hardware, network, and system) and produce no output until they complete. This is normal. You system may become sluggish but should not lock up entirely, a system hang can be symptomatic of an improperly configured test environment. Tests will run on Mac OSX. 2 Cores with 2GB of RAM on an Ubuntu 12.04 machine that is properly configured should take between 10 and 20 minutes to complete.&lt;br /&gt;
&lt;br /&gt;
=== with run_tests.sh ===&lt;br /&gt;
  $ cd /opt/stack/nova&lt;br /&gt;
  $ ./run_tests.sh --coverage&lt;br /&gt;
&lt;br /&gt;
==Additional setup==&lt;br /&gt;
If you are on Ubuntu 12.04 and need to use Python 2.6 (which OpenStack needs for some test scripts) install the old version of python by doing the following:&lt;br /&gt;
&lt;br /&gt;
 $ sudo add-apt-repository ppa:fkrull/deadsnakes&lt;br /&gt;
 $ sudo apt-get update&lt;br /&gt;
 $ sudo apt-get install python2.6 python2.6-dev&lt;br /&gt;
&lt;br /&gt;
=Troubleshooting=&lt;br /&gt;
''Some workplaces may have to use special networking and/or proxy settings and that these may change when you are mobile. Those issues can cause problems with apt-get, git and other parts of OpenStack. If you are in a place that needs special proxy rules, [https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy setup apt-get with a proxy]. You may also have to set [http://askubuntu.com/questions/158557/setting-proxy-from-terminal other proxy settings] depending on your company's particular firewall rules.''&lt;br /&gt;
&lt;br /&gt;
== Logging ==&lt;br /&gt;
You may have a situation where you need to monitor devstack's log files. Here's how you set up logging to file with the least amount of fuss.&lt;br /&gt;
&lt;br /&gt;
To set up logging of screen windows set the shell variable SCREEN_LOGDIR to the directory you want the log files to go. Log files will appear with names like ''screen-$SERVICE_NAME-$TIMESTAMP.log'' in that dir and symbolic link screen-$SERVICE_NAME.log will link to the latest log file. Logs are kept for as long specified in the LOGDAYS variable.&lt;br /&gt;
&lt;br /&gt;
Both SCREEN_LOGDIR and LOGDAYS are shell variables so you need to set them either in your shell or in localrc. Use shell commands if you only want the logs to work this one time. Use ''localrc'' if you always want to have log files appear.&lt;br /&gt;
&lt;br /&gt;
Assuming you have already made a directory...&lt;br /&gt;
&lt;br /&gt;
 $ mkdir ~/log&lt;br /&gt;
&lt;br /&gt;
Then, if you only want logs this one time, in your bash shell say...&lt;br /&gt;
&lt;br /&gt;
 $ export SCREEN_LOGDIR=~/log&lt;br /&gt;
 $ export LOGDAYS=2&lt;br /&gt;
&lt;br /&gt;
... or if you ''always'' want log files, in your localrc add the lines ...&lt;br /&gt;
&lt;br /&gt;
 SCREEN_LOGDIR=~/log&lt;br /&gt;
 LOGDAYS=2&lt;br /&gt;
&lt;br /&gt;
The stack.sh script will automatically rotate the log files for you.&lt;br /&gt;
&lt;br /&gt;
== MySQL issues ==&lt;br /&gt;
If you get stuck with Keystone try...&lt;br /&gt;
 $ mysql -u root -pnova&lt;br /&gt;
... if that doesn't work you probably have a broken mysql install. If you have problems getting mysql to behave, try purging the OpenStack version of the install and install the database manually. Here’s how to rip everything down and install mysql-server from scratch yourself.&lt;br /&gt;
&lt;br /&gt;
 $ ./unstack&lt;br /&gt;
 $ sudo apt-get purge mysql-server&lt;br /&gt;
... you may need to use the name mysql-server-5.5 instead ...&lt;br /&gt;
 $ sudo apt-get autoremove&lt;br /&gt;
 $ sudo apt-get install mysql-server-5.5&lt;br /&gt;
 $ sudo mysql_install_db&lt;br /&gt;
 $ sudo mysqladmin -u root password 'nova'&lt;br /&gt;
 $ sudo service mysql restart&lt;br /&gt;
 $ ./stack&lt;br /&gt;
&lt;br /&gt;
== Keystone Issues ==&lt;br /&gt;
If you get stuck when you are checking your keystone connection via curl then it’s your proxy settings.  Try setting the following in /etc/environment&lt;br /&gt;
 no_proxy=localhost,127.0.0.0/8,127.0.1.1,127.0.1.1*,local.home&lt;br /&gt;
&lt;br /&gt;
== General Database Issues ==&lt;br /&gt;
If you have trouble with testing or other database heavy activities you may need to follow:&lt;br /&gt;
 http://codeinthehole.com/writing/how-to-set-up-mysql-for-python-on-ubuntu/&lt;br /&gt;
&lt;br /&gt;
== rootwrap Issues ==&lt;br /&gt;
If networking suddenly stops working with an error like this&lt;br /&gt;
&lt;br /&gt;
 Traceback (most recent call last):&lt;br /&gt;
   File &amp;quot;/usr/bin/nova-rootwrap&amp;quot;, line 59, in &amp;lt;module&amp;gt;&lt;br /&gt;
     from nova.rootwrap import wrapper&lt;br /&gt;
 ImportError: No module named rootwrap&lt;br /&gt;
&lt;br /&gt;
Then something has added a broken rootwrap to /usr/bin.  Remove the /usr/bin/nova-rootwrap and it will use the correct one in /usr/local/bin&lt;br /&gt;
&lt;br /&gt;
=== Check if nova-compute is running ===&lt;br /&gt;
 $ screen -x&lt;br /&gt;
Note the tab n-cpu is running in. It is usually #6 but it could be a different tab on occasion. Tab to n-cpu's tab. '''ctl+a''' then '''6'''. If you see:&lt;br /&gt;
 $ cd /opt/stack/nova &amp;amp;&amp;amp; sg  '/usr/local/bin/nova-compute --config-file /etc/nova/nova.conf' || touch &amp;quot;/opt/stack/status/stack/n-cpu.failure&amp;quot;&lt;br /&gt;
 sg: group '/usr/local/bin/nova-compute --config-file /etc/nova/nova.conf' does not exist&lt;br /&gt;
 $&lt;br /&gt;
... then nova-compute did not start. You can manually start nova-compute by editing the command to read:&lt;br /&gt;
 $ cd /opt/stack/nova &amp;amp;&amp;amp; /usr/local/bin/nova-compute --config-file /etc/nova/nova.conf || touch &amp;quot;/opt/stack/status/stack/n-cpu.failure&amp;quot;&lt;br /&gt;
... which is permissible for development (but not for production).&lt;br /&gt;
&lt;br /&gt;
== Networking Troubleshooting ==&lt;br /&gt;
Remotely accessed workstations need to have an IP for you to SSH or VNC into in order to do work. These instructions mostly assume a ''locally accessible'' VM or physical machine. If you are working with a remotely hosted Ubuntu developer's workstation, you may have special networking concerns. If you find your use of nova-network is stealing your workstations IP in your environment (does not manifest in all environments so it's located here as a troubleshooting step) then set up a second interface for nova-network to use. &lt;br /&gt;
&lt;br /&gt;
=== Configure a fake networking interface ===&lt;br /&gt;
Configure a fake interface so that nova-network does not steal the real IP that you need to access the host remotely.  On Ubuntu: &lt;br /&gt;
&lt;br /&gt;
 $ sudo ip tuntap add dev tapfoo mode tap&lt;br /&gt;
 $ sudo ifconfig tapfoo $some_ip up &lt;br /&gt;
&lt;br /&gt;
NOTE: assign the interface an ip address that will be appropriate for your environment.&lt;br /&gt;
&lt;br /&gt;
Now that you have a fake ethernet interface, change your localrc and re-run ./stack.sh so that you can start nova-network on the new interface.&lt;br /&gt;
&lt;br /&gt;
add to your ''localrc'' file&lt;br /&gt;
 FLAT_INTERFACE=tapfoo&lt;br /&gt;
&lt;br /&gt;
=== Configure a Proxy ===&lt;br /&gt;
Some workplaces may have to use special networking and/or proxy settings and that these may change when you are mobile. Those issues can cause problems with apt-get, git and other parts of OpenStack. If you are in a place that needs special proxy rules, [https://help.ubuntu.com/community/AptGet/Howto/#Setting_up_apt-get_to_use_a_http-proxy setup apt-get with a proxy]. You may also have to set [http://askubuntu.com/questions/158557/setting-proxy-from-terminal other proxy settings] depending on your company's particular firewall rules.&lt;br /&gt;
&lt;br /&gt;
=Appendix=&lt;br /&gt;
==Converting Images==&lt;br /&gt;
# Download fresh Precise cloud image from: http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img&lt;br /&gt;
# Convert to VMDK using &amp;quot;qemu-img convert&amp;quot;.  For example &amp;lt;br /&amp;gt;&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt; qemu-img convert -f raw ~/Downloads/precise-server-cloudimg-amd64-disk1.img -O vmdk precise-server-cloudimg-amd64-disk1.vmdk&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
# Convert your existing vmdk from sparse to thick using vmware CLI &lt;br /&gt;
&lt;br /&gt;
Note: this is currently required, due to a bug we are investigating.  &lt;br /&gt;
&lt;br /&gt;
Once you have rCLI installed on your Ubuntu box you can follow the instructions in the link below.  You can download rCLI from vmware.com.  Go to vSphere downloads on the  drivers and tools tab.  The latest version from the date this was written is 5.1 and the link is here.  You may need to install perldoc and other required libraries but the installer will tell you what to do.&lt;br /&gt;
&lt;br /&gt;
Link to converting sparse vmdk files to thick - &lt;br /&gt;
 http://www.cosonok.com/2010/08/using-vmware-vsphere-cli-to-convert.html&lt;br /&gt;
&lt;br /&gt;
For example - create the new vmdk, rename the old, rename the new to the old name&lt;br /&gt;
&lt;br /&gt;
 vmkfstools --server=10.20.120.61 -i /vmfs/volumes/storage1/testVM/testVM.vmdk /vmfs/volumes/storage1/testVM/testVM_thick.vmdk &lt;br /&gt;
&lt;br /&gt;
 vmkfstools --server=10.20.120.61 -E /vmfs/volumes/storage1/testVM/testVM.vmdk /vmfs/volumes/storage1/testVM/testVM_sparse.vmdk &lt;br /&gt;
&lt;br /&gt;
 vmkfstools --server=10.20.120.61 -E /vmfs/volumes/storage1/testVM/testVM_thick.vmdk /vmfs/volumes/storage1/testVM/testVM.vmdk&lt;br /&gt;
&lt;br /&gt;
==List of Reviews in progress==&lt;br /&gt;
https://review.openstack.org/#/q/message:vmware+OR+message:vcenter+OR+message:vsphere+OR+message:esx+OR+message:vcdriver+OR+message:datastore,n,z&lt;/div&gt;</summary>
		<author><name>Vui</name></author>	</entry>

	</feed>