FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 05-12-2012, 12:40 AM
"Brian C. Lane"
 
Default livemedia-creator: make libvirt module optional

From: "Brian C. Lane" <bcl@redhat.com>

When running with no-virt mode libvirt and virt-install are not needed
so make the import optional and update the usage info reflect that the
virt options are disabled.
---
src/sbin/livemedia-creator | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/sbin/livemedia-creator b/src/sbin/livemedia-creator
index 9730d99..3f3e4c2 100755
--- a/src/sbin/livemedia-creator
+++ b/src/sbin/livemedia-creator
@@ -32,7 +32,6 @@ import subprocess
import socket
import threading
import SocketServer
-import libvirt
from time import sleep
import shutil
import traceback
@@ -49,6 +48,11 @@ from pylorax.sysutils import joinpaths, remove, linktree
from pylorax.imgutils import PartitionMount, mksparse, mkext4img
from pylorax.executils import execWithRedirect, execWithCapture

+# no-virt mode doesn't need libvirt, so make it optional
+try:
+ import libvirt
+except Exception:
+ libvirt = None

# Default parameters for rebuilding initramfs, override with --dracut-args
DRACUT_DEFAULT = ["--xz", "--add", "livenet", "--add", "dmsquash-live",
@@ -558,7 +562,10 @@ if __name__ == '__main__':
"Defaults to the temporary working directory")

# Group of arguments to pass to virt-install
- virt_group = parser.add_argument_group("virt-install arguments")
+ if not libvirt:
+ virt_group = parser.add_argument_group("virt-install arguments (DISABLED -- no libvirt)")
+ else:
+ virt_group = parser.add_argument_group("virt-install arguments")
virt_group.add_argument("--ram", metavar="MEMORY", default=1024,
help="Memory to allocate for installer in megabytes." )
virt_group.add_argument("--vcpus", default=1,
@@ -648,6 +655,10 @@ if __name__ == '__main__':
logger.fatal("the volume id cannot be longer than 32 characters")
sys.exit(1)

+ if not opts.no_virt and not libvirt:
+ log.error("virt-install requires libvirt to be installed.")
+ sys.exit(1)
+
# Make the disk image
if not opts.disk_image:
# Parse the kickstart to get the partition sizes
--
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 05:27 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org