I accidentally a word.

Nov
24

Testing oVirt Engine on Amazon EC2

Red Hat recently launched an open source virtualization management project called oVirt. This project is based on the source code for their Red Hat Enterprise Virtualization product, including a new web administration interface that will appear in a future release.

Building and deploying the oVirt is, at the moment, quite time consuming. To give people an opportunity to quickly get an instance up and running to have a look at the new user interface I thought I would provide an Amazon Machine Image (AMI) for use on Amazon’s EC2 service.

Note that the image is for the oVirt Engine portion of the project only and consists of a very early build of the oVirt code and is not intended for anything other than testing and development use.

The image currently exists in us-east-1a region (Virginia) and identifies as ami-07438b6e and its name is oVirt Engine Appliance. When launching an instance based on the image ensure that you choose an instance type of m1.large or above to ensure enough RAM is available.

You must also use a security profile that allows access to the following ports:

  • 22
  • 8080
  • 8443

As always when using a public image on Amazon EC2 you should also take care to ensure that they are secure. Once the image is running you can view the new web administration by accessing:

     http://[MY_AWS_INSTANCE_ADDRESS]:8080/webadmin

The default user is admin with password letmein!. If you intend to leave the instance running then you must change this.

Obviously this image is not a long term solution for creating an oVirt environment with hosts attached on which you can launch virtual machines, but I thought it might assist people with seeing what all the fuss is about!

Nov
19

Network Bridging in Fedora 16 Without Disabling NetworkManager

Creating a network bridge to allow virtual machines direct access to the network, rather than using network address translation (NAT), is not a new concept. It is however a task that has become more complex since most popular Linux distributions switched to using NetworkManager for, you guessed it, network management.

NetworkManager, unlike the old network management tools, does not currently support the creation of network bridges. As a result of this oversight most articles I have seen on the web which discuss creation of network bridges on Linux recommend turning NetworkManager off. While this is indeed a valid way to handle the problem, it means that you must either manage all network interfaces using the old network management tools or switch NetworkManager on and off as needed.

Personally while I do have a need to create network bridges on a regular basis for my virtual machines I also prefer using the userland tools built on top of NetworkManager to manage my wireless connections.

To this end today I will be illustrating how to create a network bridge on a physical Ethernet interface managed by the old network service while continuing to run NetworkManager for my other connections. As usual my weapon of choice is Fedora, in this case version 16 which has just been released. Let’s get started!

Prerequisites

Before getting started make sure your existing network configuration is working by running ifconfig. In particular take note of the device name for your Ethernet device, if you have just moved to Fedora you may find it has changed from what you are used to.

$ ifconfig
p5p1      Link encap:Ethernet  HWaddr 78:84:3C:E0:C8:6D 
          inet addr:192.168.1.120  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::7a84:3cff:fee0:c86d/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:911 errors:0 dropped:0 overruns:0 frame:0
          TX packets:127 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:108021 (105.4 KiB)  TX bytes:10874 (10.6 KiB)
wlan0     Link encap:Ethernet  HWaddr 90:00:4E:C0:5A:0D
          inet addr:192.168.1.135  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::9200:4eff:fec0:5a0d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1300699 errors:0 dropped:0 overruns:0 frame:0
          TX packets:860018 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1695740220 (1.5 GiB)  TX bytes:102433188 (97.6 MiB)

From the output we can see that my onboard Ethernet card, which used to be referred to as eth0, is now referred to as p5p1. Importantly we can also see that both devices are up and working.

Stop Services

Before changing the network configuration files it is important to ensure that both the NetworkManager and network services are stopped. You must be root, or have root permissions via sudo, to perform this action.

# systemctl stop NetworkManager.service
# systemctl stop network.service

Stopping the network services can take some time. Note that usually only NetworkManager will be running, after all being able to run both at the same time is what we are out to achieve! Check that both services have actually stopped before continuing.

# systemctl status NetworkManager.service
# systemctl status network.service

The service’s current state will be listed in the ‘Active:’ field in the readout from each command.

Prepare to be Bridged

Change into the directory where the network configuration scripts live.

# cd /etc/sysconfig/network-scripts/

The configuration scripts for your network interfaces live in this folder. The script for each interface is named ifcfg-. So in my case the configuration for the wireless interface is ifcfg-wlan0 and the configuration for the physical Ethernet interface is ifcfg-p5p1.

As the wireless interface is to continue to be managed by NetworkManager no changes are required to its configuration. We do however need to make changes to the configuration of the physical Ethernet interface so that it is ready to be bridged.

Open the configuration for the physical Ethernet interface in your favourite text editor:

# vim ifcfg-p5p1

The exact contents will vary depending on your exact installation. Mine looks like this:

DEVICE=p5p1
TYPE=Ethernet
ONBOOT=”yes”
BOOTPROTO=”dhcp”
HWADDR=78:84:3C:E0:C8:6D
NM_CONTROLLED=”yes”

In particular note that the interface is brought up on boot, uses DHCP to obtain a network address, and is currently controlled my NetworkManager. The HWADDR listed is just the MAC address of the device, generally it should be left as is.

To prepare the device to be bridged we need to make two changes:

  1. Set NM_CONTROLLED to “no”, telling NetworkManager not to manage this interface.
  2. Add the line BRIDGE=”br0″ to indicate that the device is to be used by a bridge called br0.

The resultant file is as follows:

DEVICE=p5p1
TYPE=Ethernet
ONBOOT=”yes”
BOOTPROTO=”dhcp”
HWADDR=78:84:3C:E0:C8:6D
BRIDGE=br0
NM_CONTROLLED=”no”
At this point only half the configuration is complete. We now need to define the bridge itself.

Define the Bridge

Unlike the Ethernet interface configuration the configuration for the bridge will not exist yet. You will need to create it, usually the first bridge is called br0 and defined in the configuration file ifcfg-br0.

Create the file and add the following contents to it:

DEVICE=br0
TYPE=Bridge
BOOTPROTO=”dhcp”
ONBOOT=”yes”
NM_CONTROLLED=”no”

This sets up the bridge as an interface that uses DHCP to obtain a network address, starts on boot, and most importantly is not controlled by NetworkManager (not that NetworkManager knows how to control it anyway, but I digress).

Bringing it Up

Now that we’ve configured the bridge, it’s time to bring network services back up. The order in which you start the two services should not matter as the configurations explicitly say which devices should not be controlled by NetworkManager.

# systemctl start NetworkManager.service
# systemctl start network.service

If the services do not come up as expected check the output of systemctl status for the service(s) that fail(s). Other hints may also be present in /var/log/messages. One particular thing to look out for which I have encountered is SELinux issues affecting the DHCP client started by the network service.

Check ifconfig again to verify that both your wireless interface and your new bridge interface have been brought up successfully and have an IP address. Note that the physical Ethernet device will not have an IP address listed, it is instead assigned to the bridge.

Making it Stick

Once both services are running side by side it is necessary to ensure that both will start on reboot.

# systemctl enable NetworkManager.service
# systemctl enable network.service

Result

You have now successfully setup a network bridge while keeping your other network interfaces managed using NetworkManager. In particular this means you can continue to use the userland tools to manager your wireless connections while having a bridge which can be used by your Virtual Machines.

Here is the way the bridge appears in Virtual Machine Manager’s network interface view:

Nov
03

Installing OwnCloud on Openshift Express PaaS

Updated Friday May 25th to cover OwnCloud 4!

OpenShift Express is a free Platform as a Service (PaaS) solution provided by Red Hat. It allows developers to quickly and easily deploy their applications on cloud servers while Red Hat handles the management overhead.

Currently OpenShift Express supports applications created in a number of languages including PHP, Java, Ruby and Perl. As well as allowing developers to quickly and easily deploy their own applications OpenShift provides an easily accessible test bed for off the shelf open source web applications.

I am going to demonstrate quickly setting up OwnCloud. OwnCloud is a project aimed at providing users with the same abilities as many commercially backed personal clouds but with the ability to deploy it anywhere you choose.

Today our infrastructure of choice is provided by OpenShift but an OwnCloud installation can just as easily exist or be moved to a virtual private server, or the machine in your basement.

Register and Obtain Client Tools

Register With OpenShift Express, the registration page is available from  https://openshift.redhat.com/app/login. As part of the sign-up process you will also be prompted to create a key and install the client tools for OpenShift Express.

Create a Domain

If you did not do so during registration then you need to create an OpenShift domain. At the time of writing each user is permitted one domain name and five applications. The URLs for your applications will take the form:

http://.rhcloud.com/

The rhc-create-domain tool is used to create a domain, providing a name for the domain and your OpenShift login credentials:

$ rhc-create-domain -n -l

The tool prompts you for your password and, assuming it isn’t already taken, creates the domain.

Create the Application
Before you can deploy OwnCloud you must create a stub application in the format that OpenShift understands. OpenShift adds application support for programming languages, frameworks, and even databases based on ‘cartridges’.

Because OwnCloud is written in PHP we will be using the php-5.3 cartridge to create the application. Then to provide MySQL support we will also add the mysql-5.1 cartridge.

Use the rhc-create-app tool to create the application, providing a name for the application and your OpenShift login credentials. You will also need to provide the password associated with your key, created during registration, to complete application creation.

Note that by default the local copy of the application is created in your current working directory. This is where you will update and deploy your application from.

$ rhc-create-app -a -l -t php-5.3

Now use the rhc-ctl-app to add MySQL support.

$ rhc-ctl-app -a -l -e add-mysql-5.1

Be sure to take note of the Root User, Root Password, Database Name, and Connection URL of the database.

Install OwnCloud

Change into the directory that was created when you ran rhc-create-app. This directory contains a number of files and directories:

  • .openshift/
  • deplist.txt
  • libs/
  • misc/
  • php/
  • README

Check the README file for a full explanation of what each of these is for. For now we will be concentrating on deploying OwnCloud into the php/ subdirectory.

Change into the php/ subdirectory, download and extract the OwnCloud2 source tarball.
$ wget http://owncloud.org/owncloud-download-4-0-0 -O owncloud-4.0.0.tar.bz2
$ tar -xf owncloud-4.0.0.tar.bz2 –strip-components=1
$ rm owncloud-4.0.0.tar.bz2

Now our local copy is ready to deploy to the OpenShift Express servers. OpenShift Express uses git to facilitate version control and deployment. To deploy we must:

  • Add the new files to our commit, ensuring the .htaccess file is also added:
    • $ git add * .htaccess
  • Commit the new files, entering a commit message when prompted:
    • $ git commit
  • Push the commit to the remote server:
    • $ git push

Now, access your application in a web browser at the address of the form:

http://.rhcloud.com/

The OwnCloud setup wizard will appear.


Enter a Username and Password for your OwnCloud administration account. Remember that this application is running on the public internet and therefore must have a secure password.

Click Advanced and select MySQL as the storage engine. This enables a number of additional options.


These options should be set as follows:

  • The Data folder should be set to ../../data. This folder is the location of the persistent data storage for an OpenShift Express application.
  • The Database user must be set to the database username as returned when adding the MySQL cartridge.
  • The Database password must be set to the database password as returned when adding the MySQL cartridge.
  • The Database name must be set to the database name as returned when adding the MySQL cartridge.
  • The localhost value must be replaced with the appropriate host as returned when adding the MySQL cartridge. This will be in the form of an IP address, the protocol and port information can safely be discarded.

Once you are satisfied with the values entered, click Finish Setup.

Finished!
Assuming all has gone well you will be logged into your newly created OwnCloud installation running on OpenShift Express!

For some hints on what you can actually do with it, see:

http://owncloudtest.blogspot.com/2011/06/what-you-can-do-with-owncoud-today.html