4 implementation


Published on

Published in: Engineering, Technology
  • Be the first to comment

  • Be the first to like this

4 implementation

  1. 1. RV College Of Engineering Dept Of Information Science Page 21 Chapter 4 IMPLEMENTATION The implementation phase of any project development is the most important phase as it yields the final solution, which solves the problem at hand. The implementation phase involves the actual materialization of the ideas, which are expressed in the analysis document and developed in the design phase. We have implemented rejuvenation on three domain OS, VM, VMM using warm migration and cold rejuvenation methods, based on Time and Prediction based rejuvenation policies. We also simulate the rejuvenation of these failing nodes. We have implemented petri-net modeling into our project. 4.1 Platform Selection: 4.1.1 KVM/QEMU: KVM (Kernel-based Virtual Machine) is a full virtualization solution for Linux on x86 hardware containing virtualization extensions (Intel VT or AMD-V). It consists of a loadable kernel module, kvm.ko that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko. KVM also requires a modified QEMU although work is underway to get the required changes upstream. Using KVM, one can run multiple virtual machines running unmodified Linux or Windows images. Each virtual machine has private virtualized hardware: a network card, disk, graphics adapter, etc. The kernel component of KVM is included in mainline Linux, as of 2.6.20.KVM is open source software. A wide variety of guest operating systems work with KVM, including many flavours of Linux, BSD, Solaris, Windows, Haiku,ReactOS, Plan 9, and AROS Research Operating System. In addition Android 2.2, GNU/Hurd (Debian K16), Minix 3.1.2a, Solaris 10 U3, Darwin
  2. 2. RV College Of Engineering Dept Of Information Science Page 22 8.0.1 and more OSs and some newer versions of these with limitations are known to work. A modified version of QEMU can use KVM to run Mac OS X. 4.1.2 SPNP (Stochastic Petri Net Package): This package was developed by Ciardo et.al. The model type used for input is a stochastic reward net (SRN). SRNs incorporate several structural extensions to GSPNs such as marking dependencies (marking dependent arc cardinalities, guards, etc.) and allow reward rates to be associated with each marking. The reward function can be marking dependent as well. They are specified using CSPL (C based SRN Language) which is an extension of the C programing language with additional constructs for describing the SRN models. SRN specifications are automatically converted into a Markov reward model which is then solved to compute a variety of transient, steady-state, cumulative, and sensitivity measures. For SRNs with absorbing markings, mean time to absorption and expected accumulated reward until absorption can be computed. The interface increases the power of SPNP (the Stochastic Petri Net Package) by providing a means of rapidly developing stochastic reward nets (SRNs); the model type used for input. Input to SPNP is specified using CSPL (C based SPN Language), but the interface removes this burden from the user by providing an interface for graphical representation of the model. The first interface was implemented with Tcl/Tk. Then JAVA was used to have to develop the new version, which makes the look and feel of the interface. 4.2 Programming Language Used (Language Selection): C is a general-purpose programming language initially developed by Dennis Ritchie . C is an imperative (procedural) language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal run-time support. C was therefore useful for many applications that had formerly been coded inassembly language, such as in system programming.
  3. 3. RV College Of Engineering Dept Of Information Science Page 23 Despite its low-level capabilities, the language was designed to encourage cross- platform programming. A standards-compliant and portably written C program can be compiled for a very wide variety of computer platforms and operating systems with few changes to its source code. The language has become available on a very wide range of platforms, from embedded microcontrollers to supercomputers. Header Name Description Stdio.h Defines standard buffered input/output Stdlib.h Defines numeric conversion functions, pseudo- random numbers generation functions, memory allocation, process control functions String.h Defines string handling functions. Ctype.h Defines set of functions used to classify characters by their types or to convert between upper and lower case in a way that is independent of the used character set Locale.h Defines localization functions. Sys/time.h Defines date and time handling functions Unistd.h Defines standard symbolic constants and types Fcntl.h Defines the following requests and arguments for use by the functions fcntl() and open(). Values for cmd used by fcntl()
  4. 4. RV College Of Engineering Dept Of Information Science Page 24 4.2 CentOS (OS selection) The CentOS Linux distribution is a stable, predictable, manageable and reproducible platform derived from the sources of Red Hat Enterprise Linux (RHEL). The process delivered has a clear governance model, increased transparency and access. Since March 2004, CentOS Linux has been a community-supported distribution derived from sources freely provided to the public by Red Hat. As such, CentOS Linux aims to be functionally compatible with RHEL. CentOS change packages to remove upstream vendor branding and artwork. CentOS Linux is no-cost and free to redistribute. CentOS Linux is developed by a small but growing team of core developers. In turn the core developers are supported by an active user community including system administrators, network administrators, managers, core Linux contributors, and Linux enthusiasts from around the world. We opt this OS because it is highly compatible and stable , it is very easy to install KVM and configure it .moreover configuring NFS is easy for beginners and ports can be resolved properly. The forums of this OS had all the solutions to problems we have faced in other OS like Ubuntu, fedora. Moreover it is open source and codes are available online 4.3 Installing and configuring KVM on cent OS 4.3.1 Check Hardware Virtualization support KVM requires hardware virtualization support such as Intel VT or AMD's AMD-V, which are instruction set extensions for hardware-assisted virtualization. Check if hardware virtualization support is available on CentOS host machine: $ egrep -i 'vmx|svm' --color=always /proc/cpuinfo If CPU flags contain "vmx" or "svm", it means hardware virtualization support is available.
  5. 5. RV College Of Engineering Dept Of Information Science Page 25 4.3.2 Configure FQDN for local host Configure FQDN (fully qualified domain name) for local host. Otherwise, you may get warnings while launching libvirtd daemon such as "getaddrinfo failed for 'myhost': Name or service not known". To configure FQDN, edit the following configuration file: $ sudo -e /etc/sysconfig/network HOSTNAME=xxx.yyy Disable SELinux Before installing KVM, be aware that there are several SELinux Booleans that can affect the behavior of KVM and libvirt. In this tutorial, I'm going to set SELinux to 0"Permissive" for demonstration purpose. If you do not wish to change SELinux mode. To disable SELinux on CentOS: $sudo -e /etc/selinux/config SELINUX=permissive Reboot the machine for the change to take effect. 4.4Install KVM, QEMU and user-space tools 4.4.1 Install KVM and virtinst (a tool to create VMs) as follows: $sudo yum install kvm libvirt python-virtinst qemu-kvm 4.4.2 Start libvirtd daemon, and set it to auto-start: $sudo service libvirtd start $sudo chkconfig libvirtd on 4.4.3 Check if KVM has successfully been installed. You should see no error as follows.
  6. 6. RV College Of Engineering Dept Of Information Science Page 26 $ sudo virsh -c qemu:///system list Id Name State ---------------------------------------------------- 4.4.4 Configure Linux Bridge for VM Networking Installing KVM alone does not allow VMs to communicate with each other or access external networks. You need to configure VM networking separately. In this tutorial, I am going to set up "bridged networking" via Linux bridge.  Install a package needed to create and manage bridge devices: $sudo yum install bridge-utils  Disable Network Manager service if it's enabled, and switch to default net manager as follows. $sudo service NetworkManager stop $sudo chkconfig NetworkManager off $sudo chkconfig network on $sudo service network start To configure a new bridge, you have to pick an active network interface (e.g., eth0), and enslave it to the bridge. Depending on whether the network interface is assigned an IP address via DHCP or statically, there are two different ways to configure a new bridge.  To configure bridge br0 via DHCP: $sudo -e /etc/sysconfig/network-scripts/ifcfg-eth0  Modify the file ifcfg-etho as shown below: DEVICE=eth0
  7. 7. RV College Of Engineering Dept Of Information Science Page 27 TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=yes BRIDGE=br0 $sudo -e /etc/sysconfig/network-scripts/ifcfg-br0  Modify the file ifcfg-br0 as shown below: DEVICE=br0 NM_CONTROLLED=yes ONBOOT=yes TYPE=Bridge BOOTPROTO=dhcp  Once configuration files are generated accordingly, run the following to activate the change. $sudo service network restart  You should now see br0 bridge interface with a proper IP address as follows. $ifconfig 4.4.5 Install VirtManager The final step is to install a desktop UI called VirtManager for managing virtual machines (VMs) through libvirt. To install VirtManager: $ sudo yum install virt-manager libvirt qemu-system-x86 openssh-askpass libcanberra- devel 4.5 Setup a minimal CentOS 6 NFS configuration 4.5.1 SERVER CONFIGURATION:  To setup the server:
  8. 8. RV College Of Engineering Dept Of Information Science Page 28  Before setup the server system needs update the packages: "yum update"  Once update is completed reboot the system. "shutdown -r now"  Install nfs-utils rpcbind system configuration package. "yum install nfs-utils rpcbind system-config-firewall-tui"  Modify the selinux file to disable SELINUX "vi /etc/sysconfig/selinux" and set "SELINUX=disabled". "setenforce 0"  Make a folder to be shared. eg: $ mkdir /var/lib/libvirt/images  Do the following: $ chkconfig nfs on $ chkconfig nfslock on $ chkconfig rpcbind on  Configure the firewall setting: $ "system-config-firewall-tui"  Modify the exports file to add the shared storage to make live migration from source to destination system
  9. 9. RV College Of Engineering Dept Of Information Science Page 29 /var/lib/libvirt/images (rw, sync, no_root_squash)  Modify the hosts.allow file by following lines: $ sudo /etc/hosts.allow mountd:  Modify the hosts.deny file by following lines portmap:ALL lockd:ALL mountd:ALL rquotad:ALL statd:ALL  Restart the following services on Server machine once you completed all the above steps: $ sudo service rpcbind restart $ sudo service nfs restart $ sudo service nfslock restart
  10. 10. RV College Of Engineering Dept Of Information Science Page 30 CLIENT CONFIGURATION:  To Setup The Client:  Before setup the client system needs update the packages: $ sudo yum update  Once update is completed reboot the system. $ sudo shutdown -r now  Install nfs-utils rpcbind system configuration package. $ sudo yum install nfs-utils rpcbind system-config- firewall-tui  Modify the selinux file to disable SELINUX $ sudo gedit /etc/sysconfig/selinux and set SELINUX=disabled $ setenforce 0  Make a folder to be the mount point. $ sudo mkdir /var/lib/libvirt/images  Start the following services $ sudo chkconfig nfs on $ sudo chkconfig nfslock on $ sudo chkconfig rpcbind on  Restart the following services on Server machine once you completed all the above steps: $ sudo service rpcbind restart $ sudo service nfs restart $ sudo service nfslock restart  To mount (do this as root):
  11. 11. RV College Of Engineering Dept Of Information Science Page 31  Append the following line to fstab file: $ sudo gedit /etc/fstab <Shared directory> <mount point> <type> <auto> 0 0 /var/lib/libvirt/images nfs auto 0 0 Server name mount File /var/lib/libvirt/images: Mounting point on client machine ( nfs : Type  Mount shared nfs file on client machine: $ sudo mount -t nfs /var/lib/libvirt/images