Open main menu

CDOT Wiki β

Changes

Talk:Fall 2008 SPR720 Sample Exam Questions

329 bytes added, 00:24, 11 December 2008
no edit summary
6. Write a python script which will ask the user for the name of a virtual machine and report whether that virtual machine is running. (Use libvirt).
===ANSWER===
<PRE>
#!/usr/bin/python
import libvirt
vm_Name=str(raw_input("Please enter your virtual machine's name: "))
conn=libvirt.open(None)
try:
vm=conn.lookupByName(vm_Name)
print "Yes, your vm is up and running."
 
except:
print "Sorry, your vm is not running."
</pre>
Nes.. finally.. i did it.. @@
7. Write a bash script which will print all of the files in your home directory which end in .ps -- you must be able to run the script from any directory.