From garich at ptd.net Fri Aug 1 00:06:50 2008 From: garich at ptd.net (Gary Richardson) Date: Thu, 31 Jul 2008 20:06:50 -0400 Subject: [et-mgmt-tools] problem with virt-manager In-Reply-To: <489218A6.1060606@ptd.net> References: <489218A6.1060606@ptd.net> Message-ID: <4892539A.9040905@ptd.net> my previous message: >RunRunning virt-manager on my Fedora 9 system >running kernel: 2.6.26-0.115.rc9.git2.fc10.x86_64 SMP > >I get the following error: > >gar xp]# virt-manager >Traceback (most recent call last): > File "/usr/share/virt-manager/virt-manager.py", line 310, >in > main() > File "/usr/share/virt-manager/virt-manager.py", line 239, >in main > gtk.gdk.threads_init() >SystemError: error return without exception set I downloaded the source and loaded the debuging info. strace provide the following: open("/usr/share/virt-manager/virt-manager.py", O_RDONLY) = 7 write(2, " File \"/usr/share/virt-manager/v"..., 72 File "/usr/share/virt-manager/virt-manager.py", line 310, in ) = 72 fstat(7, {st_mode=S_IFREG|0644, st_size=11835, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffddeb05000 read(7, "# -*- python -*-\n#\n# Copyright (C"..., 4096) = 4096 read(7, "level from gconf, or command line"..., 4096) = 4096 read(7, ", \"uuid\", value) \n s = "..., 4096) = 3643 write(2, " "..., 4 ) = 4 write(2, "main()\n"..., 7main() ) = 7 close(7) = 0 munmap(0x7ffddeb05000, 4096) = 0 open("/usr/share/virt-manager/virt-manager.py", O_RDONLY) = 7 write(2, " File \"/usr/share/virt-manager/v"..., 68 File "/usr/share/virt-manager/virt-manager.py", line 239, in main ) = 68 fstat(7, {st_mode=S_IFREG|0644, st_size=11835, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ffddeb05000 read(7, "# -*- python -*-\n#\n# Copyright (C"..., 4096) = 4096 read(7, "level from gconf, or command line"..., 4096) = 4096 read(7, ", \"uuid\", value) \n s = "..., 4096) = 3643 write(2, " "..., 4 ) = 4 write(2, "gtk.gdk.threads_init()\n"..., 23gtk.gdk.threads_init() ) = 23 close(7) = 0 munmap(0x7ffddeb05000, 4096) = 0 write(2, "SystemError"..., 11SystemError) = 11 write(2, ": "..., 2: ) = 2 write(2, "error return without exception se"..., 34error return without exception set) = 34 write(2, "\n"..., 1 ) = 1 close(3) = 0 munmap(0x7ffddeb0d000, 4096) = 0 rt_sigaction(SIGINT, {SIG_DFL}, {0x3e230ea800, [], SA_RESTORER, 0x3e0a80f120}, 8) = 0 exit_group(1) = ? -- Gary Richardson Richardson Janitorial and More www.nodirtyfloors.com From crobinso at redhat.com Fri Aug 1 14:47:13 2008 From: crobinso at redhat.com (Cole Robinson) Date: Fri, 01 Aug 2008 10:47:13 -0400 Subject: [et-mgmt-tools] [PATCH] virt-manager: populate storage pools, vols Message-ID: <489321F1.1000700@redhat.com> The attached patch adds some of the lower level plumbing for libvirt storage api awareness in virt-manager. Similar to the vmmNetwork and vmmDomain classes, I've added a vmmStoragePool and vmmStorageVol to wrap the underlying libvirt objects and provide convenience methods. The only other changes in this patch are to the connection object to poll for currently available pools and make this info accessable. I've been carrying this for a while so I think it's pretty stable. Thanks, Cole -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: virt-manager-storage-poll-patch URL: From crobinso at redhat.com Fri Aug 1 14:48:54 2008 From: crobinso at redhat.com (Cole Robinson) Date: Fri, 01 Aug 2008 10:48:54 -0400 Subject: [et-mgmt-tools] [PATCH] virtinst: Remove most prompting from virt-* tools Message-ID: <48932256.6010106@redhat.com> The attached patch removes most parameter prompting from the virt command line tools. I think any usefulness they once had is largely gone, and they are becoming a maintainance burden. This burden is even more apparent trying to update this stuff to accommodate remote installs. Currently, if not specified, we prompt for: vm name (will now fail if not specified) vm ram (will now fail if not specified) install media (this is a real pain now. originally the install type matrix was far simpler, so abstracting what type of media the user 'really' means is actually impossible in some cases from this prompt) pv vs. hvm (this was actually dropped in last release) enable vnc (should just default to vnc if display is set, nographics otherwise) disk path (will now fail, and inform user they need to specify --nodisks if they don't want storage) disk size, if disk doesn't exist (will now fail) There are also some yes/no prompts to keep users from shooting themselves in the foot sparse disk max size exceeds physical disk capacity specified more vcpus than physical cpus I say we leave these in. I think these are generally useful, and any automated virt-install commands should use --force anyways. I've tried to test all the above cases and it seems to work as expected. Any feedback appreciated, wondering what people think about this. Thanks, Cole -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: virtinst-remove-prompting-patch URL: From astokes at redhat.com Sat Aug 2 14:39:11 2008 From: astokes at redhat.com (Adam Stokes) Date: Sat, 2 Aug 2008 10:39:11 -0400 Subject: [et-mgmt-tools] [PATCH] report block size in add hardware summary Message-ID: <20080802103911.372538c5@pimphand.strong> The way virt-manager is setup now is that it only reports sizes of file backed images and a "-" with storage partitions. This patch addresses that issue. I'll be filing a bug for RHEL5 as soon as bugzilla comes out of maintenance mode Thanks -- _|- | _ _ _\|_()|<(/__\ .----------------------------------. ( astokes at redhat.com || 919.754.4187 ) `----------------------------------' -------------- next part -------------- A non-text attachment was scrubbed... Name: virt-manager-block-size-summary.patch Type: text/x-patch Size: 823 bytes Desc: not available URL: From crobinso at redhat.com Sun Aug 3 18:09:21 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 03 Aug 2008 14:09:21 -0400 Subject: [et-mgmt-tools] [PATCH] report block size in add hardware summary In-Reply-To: <20080802103911.372538c5@pimphand.strong> References: <20080802103911.372538c5@pimphand.strong> Message-ID: <4895F451.8070807@redhat.com> Adam Stokes wrote: > The way virt-manager is setup now is that it only reports sizes of file > backed images and a "-" with storage partitions. I'm fine with the idea, however this patch needs a bit of work. First this will need to be duplicated in create.py for the guest creation wizard. I'd recommend breaking it out into it's own function as well so we don't start adding a lot of logic to the relatively simple get_config_* functions. Also, could you wrap this code in a try...except block, just log an error if we can't detect the size, and return None. > > This patch addresses that issue. > > I'll be filing a bug for RHEL5 as soon as bugzilla comes out of > maintenance mode > Actually could you just bring this up in bz 453061? It's basically covering the same issue. Thanks, Cole From astokes at redhat.com Mon Aug 4 10:47:42 2008 From: astokes at redhat.com (Adam Stokes) Date: Mon, 4 Aug 2008 06:47:42 -0400 Subject: [et-mgmt-tools] [PATCH] report block size in add hardware summary In-Reply-To: <4895F451.8070807@redhat.com> References: <20080802103911.372538c5@pimphand.strong> <4895F451.8070807@redhat.com> Message-ID: <20080804064742.066c3c88@pimphand.strong> > First this will need to be duplicated in create.py for the > guest creation wizard. I'd recommend breaking it out into > it's own function as well so we don't start adding a lot > of logic to the relatively simple get_config_* functions. This is complete, though for the logic part im not really sure the best way to handle the different varieties that can be seen here > > Also, could you wrap this code in a try...except block, just > log an error if we can't detect the size, and return None. Complete as well > Actually could you just bring this up in bz 453061? It's basically > covering the same issue. Sure thing I've appended this issue to the above BZ. Please let me know your thoughts on the latest patch Thanks -- _|- | _ _ _\|_()|<(/__\ .----------------------------------. ( astokes at redhat.com || 919.754.4187 ) `----------------------------------' -------------- next part -------------- A non-text attachment was scrubbed... Name: virt-manager-block-summary.patch Type: text/x-patch Size: 2257 bytes Desc: not available URL: From astokes at redhat.com Mon Aug 4 14:26:09 2008 From: astokes at redhat.com (Adam Stokes) Date: Mon, 4 Aug 2008 10:26:09 -0400 Subject: [et-mgmt-tools] [PATCH] virt-manager: access keys collision in gui Message-ID: <20080804102609.35645931@pimphand.strong> When going through the add-hardware or create wizard there is a access key collision in the network setup. This addresses the access key collision by changing the label for Setting the mac address to use _a rather than _f. Thanks -- _|- | _ _ _\|_()|<(/__\ .----------------------------------. ( astokes at redhat.com || 919.754.4187 ) `----------------------------------' -------------- next part -------------- A non-text attachment was scrubbed... Name: virt-manager-glade-accesskey.patch Type: text/x-patch Size: 1649 bytes Desc: not available URL: From crobinso at redhat.com Mon Aug 4 15:16:16 2008 From: crobinso at redhat.com (Cole Robinson) Date: Mon, 04 Aug 2008 11:16:16 -0400 Subject: [et-mgmt-tools] [PATCH] report block size in add hardware summary In-Reply-To: <20080804064742.066c3c88@pimphand.strong> References: <20080802103911.372538c5@pimphand.strong> <4895F451.8070807@redhat.com> <20080804064742.066c3c88@pimphand.strong> Message-ID: <48971D40.2060104@redhat.com> Adam Stokes wrote: >> First this will need to be duplicated in create.py for the >> guest creation wizard. I'd recommend breaking it out into >> it's own function as well so we don't start adding a lot >> of logic to the relatively simple get_config_* functions. > This is complete, though for the logic part im not really sure the best > way to handle the different varieties that can be seen here >> Also, could you wrap this code in a try...except block, just >> log an error if we can't detect the size, and return None. > Complete as well > >> Actually could you just bring this up in bz 453061? It's basically >> covering the same issue. > > Sure thing I've appended this issue to the above BZ. > > Please let me know your thoughts on the latest patch > > Thanks > Thanks! I've committed this: http://hg.et.redhat.com/virt/applications/virt-manager--devel?cs=7a0eb7f2ab10 - Cole From crobinso at redhat.com Mon Aug 4 15:19:05 2008 From: crobinso at redhat.com (Cole Robinson) Date: Mon, 04 Aug 2008 11:19:05 -0400 Subject: [et-mgmt-tools] [PATCH] virt-manager: access keys collision in gui In-Reply-To: <20080804102609.35645931@pimphand.strong> References: <20080804102609.35645931@pimphand.strong> Message-ID: <48971DE9.6080600@redhat.com> Adam Stokes wrote: > When going through the add-hardware or create wizard there is a access > key collision in the network setup. > > This addresses the access key collision by changing the label for > Setting the mac address to use _a rather than _f. > > Thanks > Yeah virt-manager really needs some love in the mnemonics/accelerators department. I've committed this: http://hg.et.redhat.com/virt/applications/virt-manager--devel?cs=f31200001da2 Thanks, Cole From crobinso at redhat.com Mon Aug 4 15:51:32 2008 From: crobinso at redhat.com (Cole Robinson) Date: Mon, 04 Aug 2008 11:51:32 -0400 Subject: [et-mgmt-tools] problem with virt-manager In-Reply-To: <4892539A.9040905@ptd.net> References: <489218A6.1060606@ptd.net> <4892539A.9040905@ptd.net> Message-ID: <48972584.7060707@redhat.com> Gary Richardson wrote: > my previous message: > >RunRunning virt-manager on my Fedora 9 system > >running kernel: 2.6.26-0.115.rc9.git2.fc10.x86_64 SMP > > > >I get the following error: > > > >gar xp]# virt-manager > >Traceback (most recent call last): > > File "/usr/share/virt-manager/virt-manager.py", line > 310, >in > > main() > > File "/usr/share/virt-manager/virt-manager.py", line > 239, >in main > > gtk.gdk.threads_init() > >SystemError: error return without exception set > > I'm really not sure what could be causing this error. If threads_init() is causing problems I'm inclined to say it's not a virt-manager issue. Have you only recently hit this problem? Or is this your first time trying out the app? - Cole From adam.huffman at gmail.com Mon Aug 4 16:59:31 2008 From: adam.huffman at gmail.com (Adam Huffman) Date: Mon, 04 Aug 2008 17:59:31 +0100 Subject: [et-mgmt-tools] problem with virt-manager In-Reply-To: <48972584.7060707@redhat.com> References: <489218A6.1060606@ptd.net> <4892539A.9040905@ptd.net> <48972584.7060707@redhat.com> Message-ID: <48973573.50304@gmail.com> Cole Robinson wrote: > Gary Richardson wrote: > >> my previous message: >> >RunRunning virt-manager on my Fedora 9 system >> >running kernel: 2.6.26-0.115.rc9.git2.fc10.x86_64 SMP >> > >> >I get the following error: >> > >> >gar xp]# virt-manager >> >Traceback (most recent call last): >> > File "/usr/share/virt-manager/virt-manager.py", line >> 310, >in >> > main() >> > File "/usr/share/virt-manager/virt-manager.py", line >> 239, >in main >> > gtk.gdk.threads_init() >> >SystemError: error return without exception set >> >> >> > > I'm really not sure what could be causing this error. If > threads_init() is causing problems I'm inclined to say > it's not a virt-manager issue. > > Have you only recently hit this problem? Or is this your > first time trying out the app? > > - Cole > > I saw this yesterday on a new install, which had been upgraded to Rawhide. That said, the packages seem to be the same as the F9 ones. As the original poster is also running a Rawhide kernel, perhaps that's part of the problem? Adam From bkearney at redhat.com Mon Aug 4 19:06:47 2008 From: bkearney at redhat.com (bkearney at redhat.com) Date: Mon, 04 Aug 2008 15:06:47 -0400 Subject: [et-mgmt-tools] [PATCH] multiple nic support for virt-image. Added support to allow multiple Message-ID: # HG changeset patch # User bkearney at localhost.localdomain # Date 1217876425 14400 # Node ID b75270d46d5c71e582ca4e850716dace951badb5 # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 multiple nic support for virt-image. Added support to allow multiple interface elements in the virt-image.xml. The command line can specify any number of -w or -b elements and the tool will add default networks up to the number of nics specified. It is assumbed that eth0 is the first item specified. diff -r 6a207373b908 -r b75270d46d5c doc/image.rng --- a/doc/image.rng Tue Jul 29 11:21:07 2008 -0400 +++ b/doc/image.rng Mon Aug 04 15:00:25 2008 -0400 @@ -47,8 +47,10 @@ - - + + + + diff -r 6a207373b908 -r b75270d46d5c virt-image --- a/virt-image Tue Jul 29 11:21:07 2008 -0400 +++ b/virt-image Mon Aug 04 15:00:25 2008 -0400 @@ -59,17 +59,13 @@ cli.get_vcpus(vcpus, check_cpu, guest, conn) def get_networks(domain, macs, bridges, networks, guest): - (macs, networks) = cli.digest_networks(macs, bridges, networks) - - nnics = 0 - if domain.interface: - nnics = 1 + (macs, networks) = cli.digest_networks(macs, bridges, networks, domain.interface) if nnics == 0 and len(networks) > 0: print >> sys.stderr, _("Warning: image does not support networking, ignoring network related options") return - elif nnics == 1 and len(networks) == 0: - fail(_("The image needs one network interface")) + elif nnics > len(networks) : + fail(_("The image requires %i network interface") % nnics) map(lambda m, n: cli.get_network(m, n, guest), macs, networks) diff -r 6a207373b908 -r b75270d46d5c virtinst/ImageParser.py --- a/virtinst/ImageParser.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/ImageParser.py Mon Aug 04 15:00:25 2008 -0400 @@ -90,7 +90,7 @@ self.boots = [] self.vcpu = None self.memory = None - self.interface = None + self.interface = 0 self.graphics = None if not node is None: self.parseXML(node) @@ -99,7 +99,7 @@ self.boots = [ Boot(b) for b in node.xpathEval("boot") ] self.vcpu = xpathString(node, "devices/vcpu", 1) self.memory = xpathString(node, "devices/memory") - self.interface = node.xpathEval("count(devices/interface)") > 0 + self.interface = node.xpathEval("count(devices/interface)") self.graphics = node.xpathEval("count(devices/graphics)") > 0 # FIXME: There must be a better way to check this diff -r 6a207373b908 -r b75270d46d5c virtinst/UnWare.py --- a/virtinst/UnWare.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/UnWare.py Mon Aug 04 15:00:25 2008 -0400 @@ -143,7 +143,9 @@ self.label = image.label self.vcpu = domain.vcpu self.memory = domain.memory - self.interface = domain.interface + # Make this a boolean based on the existence of one or more + # interfaces in the domain + self.interface = domain.interface > 0 self.disks = [] for d in boot.drives: diff -r 6a207373b908 -r b75270d46d5c virtinst/cli.py --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 @@ -262,41 +262,41 @@ fail(_("Unknown network type ") + network) guest.nics.append(n) -def digest_networks(macs, bridges, networks): +def digest_networks(macs, bridges, networks, nics = 1): if type(bridges) != list and bridges != None: bridges = [ bridges ] if type(macs) != list and macs != None: macs = [ macs ] + elif macs is None: + macs = [] if type(networks) != list and networks != None: networks = [ networks ] + elif networks is None: + networks = [] if bridges is not None and networks != None: fail(_("Cannot mix both --bridge and --network arguments")) - # ensure we have equal length lists + if bridges != None: networks = map(lambda b: "bridge:" + b, bridges) - - if networks != None: - if macs != None: - if len(macs) != len(networks): - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] * len(networks) - else: - if os.getuid() == 0: - net = util.default_network() - networks = [net[0] + ":" + net[1]] - else: - networks = ["user"] - if macs != None: - if len(macs) > 1: - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] - + + # ensure we have equal length lists + if len(macs) != len(networks): + fail(_("Need to pass equal numbers of networks & mac addresses")) + + # Create extra networks up to the number of nics requested + if len(macs) < nics: + for cnt in range(len(macs),nics): + if os.getuid() == 0: + net = util.default_network() + networks.append(net[0] + ":" + net[1]) + else: + networks.append("user") + macs.append(None) + return (macs, networks) def get_graphics(vnc, vncport, nographics, sdl, keymap, guest): From bkearney at redhat.com Tue Aug 5 12:15:42 2008 From: bkearney at redhat.com (bkearney at redhat.com) Date: Tue, 05 Aug 2008 08:15:42 -0400 Subject: [et-mgmt-tools] [PATCH] Resend of multiple nic patch Message-ID: <3507f83147d566fb690d.1217938542@localhost.localdomain> # HG changeset patch # User bkearney at localhost.localdomain # Date 1217876425 14400 # Node ID 3507f83147d566fb690dc9b87c0dbb35cd9e6f4c # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 multiple nic support for virt-image. Added support to allow multiple interface elements in the virt-image.xml. The command line can specify any number of -w or -b elements and the tool will add default networks up to the number of nics specified. It is assumbed that eth0 is the first item specified. diff -r 6a207373b908 -r 3507f83147d5 doc/image.rng --- a/doc/image.rng Tue Jul 29 11:21:07 2008 -0400 +++ b/doc/image.rng Mon Aug 04 15:00:25 2008 -0400 @@ -47,8 +47,10 @@ - - + + + + diff -r 6a207373b908 -r 3507f83147d5 tests/image.py --- a/tests/image.py Tue Jul 29 11:21:07 2008 -0400 +++ b/tests/image.py Mon Aug 04 15:00:25 2008 -0400 @@ -31,7 +31,16 @@ self.assertTrue(img.domain) self.assertEqual(5, len(img.storage)) self.assertEqual(2, len(img.domain.boots)) + self.assertEqual(1, img.domain.interface) boot = img.domain.boots[0] self.assertEqual("xvdb", boot.drives[1].target) + + def testMultipleNics(self): + file = open(os.path.join("tests", "image2nics.xml"), "r") + xml = file.read() + file.close() + + img = virtinst.ImageParser.parse(xml, ".") + self.assertEqual(2, img.domain.interface) if __name__ == "__main__": unittest.main() diff -r 6a207373b908 -r 3507f83147d5 tests/image.xml --- a/tests/image.xml Tue Jul 29 11:21:07 2008 -0400 +++ b/tests/image.xml Mon Aug 04 15:00:25 2008 -0400 @@ -28,10 +28,12 @@ - 7 - 262144 - - + + 7 + 262144 + + + diff -r 6a207373b908 -r 3507f83147d5 tests/image2nics.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/image2nics.xml Mon Aug 04 15:00:25 2008 -0400 @@ -0,0 +1,49 @@ + + test-image + + + + + xen + i386 + + + + pygrub + + + + + + + + i686 + + + + hvm + + + + + + + + 7 + 262144 + + + + + + + + + + + + + + + + diff -r 6a207373b908 -r 3507f83147d5 virt-image --- a/virt-image Tue Jul 29 11:21:07 2008 -0400 +++ b/virt-image Mon Aug 04 15:00:25 2008 -0400 @@ -59,17 +59,14 @@ cli.get_vcpus(vcpus, check_cpu, guest, conn) def get_networks(domain, macs, bridges, networks, guest): - (macs, networks) = cli.digest_networks(macs, bridges, networks) - - nnics = 0 - if domain.interface: - nnics = 1 + nnics = domain.interface + (macs, networks) = cli.digest_networks(macs, bridges, networks, nnics) if nnics == 0 and len(networks) > 0: print >> sys.stderr, _("Warning: image does not support networking, ignoring network related options") return - elif nnics == 1 and len(networks) == 0: - fail(_("The image needs one network interface")) + elif nnics > len(networks) : + fail(_("The image requires %i network interface") % nnics) map(lambda m, n: cli.get_network(m, n, guest), macs, networks) diff -r 6a207373b908 -r 3507f83147d5 virtinst/ImageParser.py --- a/virtinst/ImageParser.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/ImageParser.py Mon Aug 04 15:00:25 2008 -0400 @@ -90,7 +90,7 @@ self.boots = [] self.vcpu = None self.memory = None - self.interface = None + self.interface = 0 self.graphics = None if not node is None: self.parseXML(node) @@ -99,7 +99,7 @@ self.boots = [ Boot(b) for b in node.xpathEval("boot") ] self.vcpu = xpathString(node, "devices/vcpu", 1) self.memory = xpathString(node, "devices/memory") - self.interface = node.xpathEval("count(devices/interface)") > 0 + self.interface = int(node.xpathEval("count(devices/interface)")) self.graphics = node.xpathEval("count(devices/graphics)") > 0 # FIXME: There must be a better way to check this diff -r 6a207373b908 -r 3507f83147d5 virtinst/UnWare.py --- a/virtinst/UnWare.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/UnWare.py Mon Aug 04 15:00:25 2008 -0400 @@ -143,7 +143,9 @@ self.label = image.label self.vcpu = domain.vcpu self.memory = domain.memory - self.interface = domain.interface + # Make this a boolean based on the existence of one or more + # interfaces in the domain + self.interface = domain.interface > 0 self.disks = [] for d in boot.drives: diff -r 6a207373b908 -r 3507f83147d5 virtinst/cli.py --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 @@ -262,41 +262,41 @@ fail(_("Unknown network type ") + network) guest.nics.append(n) -def digest_networks(macs, bridges, networks): +def digest_networks(macs, bridges, networks, nics = 1): if type(bridges) != list and bridges != None: bridges = [ bridges ] if type(macs) != list and macs != None: macs = [ macs ] + elif macs is None: + macs = [] if type(networks) != list and networks != None: networks = [ networks ] + elif networks is None: + networks = [] if bridges is not None and networks != None: fail(_("Cannot mix both --bridge and --network arguments")) - # ensure we have equal length lists + if bridges != None: networks = map(lambda b: "bridge:" + b, bridges) - - if networks != None: - if macs != None: - if len(macs) != len(networks): - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] * len(networks) - else: - if os.getuid() == 0: - net = util.default_network() - networks = [net[0] + ":" + net[1]] - else: - networks = ["user"] - if macs != None: - if len(macs) > 1: - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] - + + # ensure we have equal length lists + if len(macs) != len(networks): + fail(_("Need to pass equal numbers of networks & mac addresses")) + + # Create extra networks up to the number of nics requested + if len(macs) < nics: + for cnt in range(len(macs),nics): + if os.getuid() == 0: + net = util.default_network() + networks.append(net[0] + ":" + net[1]) + else: + networks.append("user") + macs.append(None) + return (macs, networks) def get_graphics(vnc, vncport, nographics, sdl, keymap, guest): From dlutter at redhat.com Tue Aug 5 18:28:42 2008 From: dlutter at redhat.com (David Lutterkort) Date: Tue, 05 Aug 2008 11:28:42 -0700 Subject: [et-mgmt-tools] [PATCH] Resend of multiple nic patch In-Reply-To: <3507f83147d566fb690d.1217938542@localhost.localdomain> References: <3507f83147d566fb690d.1217938542@localhost.localdomain> Message-ID: <1217960922.19789.33.camel@localhost.localdomain> On Tue, 2008-08-05 at 08:15 -0400, bkearney at redhat.com wrote: > # HG changeset patch > # User bkearney at localhost.localdomain > # Date 1217876425 14400 > # Node ID 3507f83147d566fb690dc9b87c0dbb35cd9e6f4c > # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 > multiple nic support for virt-image. Added support to allow multiple > interface elements in the virt-image.xml. The command line can specify > any number of -w or -b elements and the tool will add default networks > up to the number of nics specified. It is assumbed that eth0 is the first > item specified. Looks good. Two small nits: > diff -r 6a207373b908 -r 3507f83147d5 virt-image > --- a/virt-image Tue Jul 29 11:21:07 2008 -0400 > +++ b/virt-image Mon Aug 04 15:00:25 2008 -0400 > @@ -59,17 +59,14 @@ > cli.get_vcpus(vcpus, check_cpu, guest, conn) > > def get_networks(domain, macs, bridges, networks, guest): > - (macs, networks) = cli.digest_networks(macs, bridges, networks) > - > - nnics = 0 > - if domain.interface: > - nnics = 1 > + nnics = domain.interface > + (macs, networks) = cli.digest_networks(macs, bridges, networks, nnics) > > if nnics == 0 and len(networks) > 0: > print >> sys.stderr, _("Warning: image does not support networking, ignoring network related options") > return This check should be 'if len(networks) > nnics' and then warn that the last len(networks) - nnics network specs will be ignored. > diff -r 6a207373b908 -r 3507f83147d5 virtinst/cli.py > --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 > +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 > @@ -262,41 +262,41 @@ > fail(_("Unknown network type ") + network) > guest.nics.append(n) > > -def digest_networks(macs, bridges, networks): > +def digest_networks(macs, bridges, networks, nics = 1): > if type(bridges) != list and bridges != None: > bridges = [ bridges ] > > if type(macs) != list and macs != None: > macs = [ macs ] > + elif macs is None: > + macs = [] > > if type(networks) != list and networks != None: > networks = [ networks ] > + elif networks is None: > + networks = [] It would be clearer to write these two as if macs is None: macs = [] elif type(macs) != list macs = [ macs ] same for networks David From bkearney at redhat.com Tue Aug 5 20:25:09 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Tue, 05 Aug 2008 16:25:09 -0400 Subject: [et-mgmt-tools] [PATCH] Resend of multiple nic patch In-Reply-To: <1217960922.19789.33.camel@localhost.localdomain> References: <3507f83147d566fb690d.1217938542@localhost.localdomain> <1217960922.19789.33.camel@localhost.localdomain> Message-ID: <4898B725.8040603@redhat.com> David Lutterkort wrote: > On Tue, 2008-08-05 at 08:15 -0400, bkearney at redhat.com wrote: >> # HG changeset patch >> # User bkearney at localhost.localdomain >> # Date 1217876425 14400 >> # Node ID 3507f83147d566fb690dc9b87c0dbb35cd9e6f4c >> # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 >> multiple nic support for virt-image. Added support to allow multiple >> interface elements in the virt-image.xml. The command line can specify >> any number of -w or -b elements and the tool will add default networks >> up to the number of nics specified. It is assumbed that eth0 is the first >> item specified. > > Looks good. Two small nits: > >> diff -r 6a207373b908 -r 3507f83147d5 virt-image >> --- a/virt-image Tue Jul 29 11:21:07 2008 -0400 >> +++ b/virt-image Mon Aug 04 15:00:25 2008 -0400 >> @@ -59,17 +59,14 @@ >> cli.get_vcpus(vcpus, check_cpu, guest, conn) >> >> def get_networks(domain, macs, bridges, networks, guest): >> - (macs, networks) = cli.digest_networks(macs, bridges, networks) >> - >> - nnics = 0 >> - if domain.interface: >> - nnics = 1 >> + nnics = domain.interface >> + (macs, networks) = cli.digest_networks(macs, bridges, networks, nnics) >> >> if nnics == 0 and len(networks) > 0: >> print >> sys.stderr, _("Warning: image does not support networking, ignoring network related options") >> return > > This check should be 'if len(networks) > nnics' and then warn that the > last len(networks) - nnics network specs will be ignored. Currently.. if you pass in more networks then nics then all are are used. Would you like me to lop off the last couple of networks? -- bk From bkearney at redhat.com Tue Aug 5 20:39:59 2008 From: bkearney at redhat.com (bkearney at redhat.com) Date: Tue, 05 Aug 2008 16:39:59 -0400 Subject: [et-mgmt-tools] [PATCH] Multiple nic patch with DLutterkort's comments applied Message-ID: # HG changeset patch # User bkearney at localhost.localdomain # Date 1217876425 14400 # Node ID d9910a83bbf6a7aa85ebcc14f949071c9e9c5eb6 # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 multiple nic support for virt-image. Added support to allow multiple interface elements in the virt-image.xml. The command line can specify any number of -w or -b elements and the tool will add default networks up to the number of nics specified. It is assumbed that eth0 is the first item specified. diff -r 6a207373b908 -r d9910a83bbf6 doc/image.rng --- a/doc/image.rng Tue Jul 29 11:21:07 2008 -0400 +++ b/doc/image.rng Mon Aug 04 15:00:25 2008 -0400 @@ -47,8 +47,10 @@ - - + + + + diff -r 6a207373b908 -r d9910a83bbf6 tests/image.py --- a/tests/image.py Tue Jul 29 11:21:07 2008 -0400 +++ b/tests/image.py Mon Aug 04 15:00:25 2008 -0400 @@ -31,7 +31,16 @@ self.assertTrue(img.domain) self.assertEqual(5, len(img.storage)) self.assertEqual(2, len(img.domain.boots)) + self.assertEqual(1, img.domain.interface) boot = img.domain.boots[0] self.assertEqual("xvdb", boot.drives[1].target) + + def testMultipleNics(self): + file = open(os.path.join("tests", "image2nics.xml"), "r") + xml = file.read() + file.close() + + img = virtinst.ImageParser.parse(xml, ".") + self.assertEqual(2, img.domain.interface) if __name__ == "__main__": unittest.main() diff -r 6a207373b908 -r d9910a83bbf6 tests/image.xml --- a/tests/image.xml Tue Jul 29 11:21:07 2008 -0400 +++ b/tests/image.xml Mon Aug 04 15:00:25 2008 -0400 @@ -28,10 +28,12 @@ - 7 - 262144 - - + + 7 + 262144 + + + diff -r 6a207373b908 -r d9910a83bbf6 tests/image2nics.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/image2nics.xml Mon Aug 04 15:00:25 2008 -0400 @@ -0,0 +1,49 @@ + + test-image + + + + + xen + i386 + + + + pygrub + + + + + + + + i686 + + + + hvm + + + + + + + + 7 + 262144 + + + + + + + + + + + + + + + + diff -r 6a207373b908 -r d9910a83bbf6 virt-image --- a/virt-image Tue Jul 29 11:21:07 2008 -0400 +++ b/virt-image Mon Aug 04 15:00:25 2008 -0400 @@ -59,17 +59,15 @@ cli.get_vcpus(vcpus, check_cpu, guest, conn) def get_networks(domain, macs, bridges, networks, guest): - (macs, networks) = cli.digest_networks(macs, bridges, networks) + nnics = domain.interface + (macs, networks) = cli.digest_networks(macs, bridges, networks, nnics) - nnics = 0 - if domain.interface: - nnics = 1 - - if nnics == 0 and len(networks) > 0: - print >> sys.stderr, _("Warning: image does not support networking, ignoring network related options") - return - elif nnics == 1 and len(networks) == 0: - fail(_("The image needs one network interface")) + if len(networks) > nnics: + print >> sys.stderr, (_("Warning: more networks were provided [%i] then nics required [%i]. All extras are ignored") % (len(networks), nnics)) + networks = networks[0:nnics] + macs = macs [0:nnics] + elif nnics > len(networks): + fail(_("The image requires %i network interface") % nnics) map(lambda m, n: cli.get_network(m, n, guest), macs, networks) diff -r 6a207373b908 -r d9910a83bbf6 virtinst/ImageParser.py --- a/virtinst/ImageParser.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/ImageParser.py Mon Aug 04 15:00:25 2008 -0400 @@ -90,7 +90,7 @@ self.boots = [] self.vcpu = None self.memory = None - self.interface = None + self.interface = 0 self.graphics = None if not node is None: self.parseXML(node) @@ -99,7 +99,7 @@ self.boots = [ Boot(b) for b in node.xpathEval("boot") ] self.vcpu = xpathString(node, "devices/vcpu", 1) self.memory = xpathString(node, "devices/memory") - self.interface = node.xpathEval("count(devices/interface)") > 0 + self.interface = int(node.xpathEval("count(devices/interface)")) self.graphics = node.xpathEval("count(devices/graphics)") > 0 # FIXME: There must be a better way to check this diff -r 6a207373b908 -r d9910a83bbf6 virtinst/UnWare.py --- a/virtinst/UnWare.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/UnWare.py Mon Aug 04 15:00:25 2008 -0400 @@ -143,7 +143,9 @@ self.label = image.label self.vcpu = domain.vcpu self.memory = domain.memory - self.interface = domain.interface + # Make this a boolean based on the existence of one or more + # interfaces in the domain + self.interface = domain.interface > 0 self.disks = [] for d in boot.drives: diff -r 6a207373b908 -r d9910a83bbf6 virtinst/cli.py --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 @@ -262,41 +262,41 @@ fail(_("Unknown network type ") + network) guest.nics.append(n) -def digest_networks(macs, bridges, networks): +def digest_networks(macs, bridges, networks, nics = 1): if type(bridges) != list and bridges != None: bridges = [ bridges ] - if type(macs) != list and macs != None: + if macs is None: + macs = [] + elif type(macs) != list: macs = [ macs ] - - if type(networks) != list and networks != None: - networks = [ networks ] + + if networks is None: + networks = [] + elif type(networks) != list: + networks = [ macs ] if bridges is not None and networks != None: fail(_("Cannot mix both --bridge and --network arguments")) - # ensure we have equal length lists + if bridges != None: networks = map(lambda b: "bridge:" + b, bridges) - - if networks != None: - if macs != None: - if len(macs) != len(networks): - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] * len(networks) - else: - if os.getuid() == 0: - net = util.default_network() - networks = [net[0] + ":" + net[1]] - else: - networks = ["user"] - if macs != None: - if len(macs) > 1: - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] - + + # ensure we have equal length lists + if len(macs) != len(networks): + fail(_("Need to pass equal numbers of networks & mac addresses")) + + # Create extra networks up to the number of nics requested + if len(macs) < nics: + for cnt in range(len(macs),nics): + if os.getuid() == 0: + net = util.default_network() + networks.append(net[0] + ":" + net[1]) + else: + networks.append("user") + macs.append(None) + return (macs, networks) def get_graphics(vnc, vncport, nographics, sdl, keymap, guest): From dlutter at redhat.com Tue Aug 5 21:19:46 2008 From: dlutter at redhat.com (David Lutterkort) Date: Tue, 05 Aug 2008 21:19:46 +0000 Subject: [et-mgmt-tools] [PATCH] Resend of multiple nic patch In-Reply-To: <4898B725.8040603@redhat.com> References: <3507f83147d566fb690d.1217938542@localhost.localdomain> <1217960922.19789.33.camel@localhost.localdomain> <4898B725.8040603@redhat.com> Message-ID: <1217971186.19789.43.camel@localhost.localdomain> On Tue, 2008-08-05 at 16:25 -0400, Bryan Kearney wrote: > > This check should be 'if len(networks) > nnics' and then warn that the > > last len(networks) - nnics network specs will be ignored. > > Currently.. if you pass in more networks then nics then all are are > used. Would you like me to lop off the last couple of networks? Yeah, it's more logical if only the first nnics networks are considered; that will also retain the way virt-image works right now if the image does not need a network interface. David From dlutter at redhat.com Tue Aug 5 21:28:54 2008 From: dlutter at redhat.com (David Lutterkort) Date: Tue, 05 Aug 2008 21:28:54 +0000 Subject: [et-mgmt-tools] [PATCH] Multiple nic patch with DLutterkort's comments applied In-Reply-To: References: Message-ID: <1217971734.19789.52.camel@localhost.localdomain> On Tue, 2008-08-05 at 16:39 -0400, bkearney at redhat.com wrote: > diff -r 6a207373b908 -r d9910a83bbf6 virtinst/cli.py > --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 > +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 > @@ -262,41 +262,41 @@ > fail(_("Unknown network type ") + network) > guest.nics.append(n) > > -def digest_networks(macs, bridges, networks): > +def digest_networks(macs, bridges, networks, nics = 1): > if type(bridges) != list and bridges != None: > bridges = [ bridges ] > > - if type(macs) != list and macs != None: > + if macs is None: > + macs = [] > + elif type(macs) != list: > macs = [ macs ] > - > - if type(networks) != list and networks != None: > - networks = [ networks ] > + > + if networks is None: > + networks = [] > + elif type(networks) != list: > + networks = [ macs ] > > if bridges is not None and networks != None: > fail(_("Cannot mix both --bridge and --network arguments")) > > - # ensure we have equal length lists > + > if bridges != None: > networks = map(lambda b: "bridge:" + b, bridges) > - > - if networks != None: > - if macs != None: > - if len(macs) != len(networks): > - fail(_("Need to pass equal numbers of networks & mac addresses")) > - else: > - macs = [ None ] * len(networks) > - else: > - if os.getuid() == 0: > - net = util.default_network() > - networks = [net[0] + ":" + net[1]] > - else: > - networks = ["user"] > - if macs != None: > - if len(macs) > 1: > - fail(_("Need to pass equal numbers of networks & mac addresses")) > - else: > - macs = [ None ] > - > + > + # ensure we have equal length lists > + if len(macs) != len(networks): > + fail(_("Need to pass equal numbers of networks & mac addresses")) > + > + # Create extra networks up to the number of nics requested > + if len(macs) < nics: > + for cnt in range(len(macs),nics): > + if os.getuid() == 0: > + net = util.default_network() > + networks.append(net[0] + ":" + net[1]) > + else: > + networks.append("user") > + macs.append(None) > + > return (macs, networks) I didn't notice this the first time through: it used to be that you could just specify the network/bridge to connect to, without giving an explicit MAC (so that you use a random MAC) We definitely want to keep that ability. I think the above should be changed so that the behavior is (1) you need to specify nnics networks and/or bridges (2) you may specify up to nnics explicit MACS, with the meaning that successive -w and -b options talk about successive interfaces, and explicit MACS are assigned to them in sequence. For interfaces that don't have an explicit MAC assigned, we'll generate a random MAC. For example, virt-image -b br0 -w default -m 00:16:.. would connect the first interface to the bridge 'br0' on the host, and the second interface to the 'default' network. The first interface would get the explicit MAC assigned, whereas the second one would get some random MAC. David From bkearney at redhat.com Wed Aug 6 12:08:12 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Wed, 06 Aug 2008 08:08:12 -0400 Subject: [et-mgmt-tools] [PATCH] Multiple nic patch with DLutterkort's comments applied In-Reply-To: <1217971734.19789.52.camel@localhost.localdomain> References: <1217971734.19789.52.camel@localhost.localdomain> Message-ID: <4899942C.3070704@redhat.com> David Lutterkort wrote: > On Tue, 2008-08-05 at 16:39 -0400, bkearney at redhat.com wrote: >> diff -r 6a207373b908 -r d9910a83bbf6 virtinst/cli.py >> --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 >> +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 >> @@ -262,41 +262,41 @@ >> fail(_("Unknown network type ") + network) >> guest.nics.append(n) >> >> -def digest_networks(macs, bridges, networks): >> +def digest_networks(macs, bridges, networks, nics = 1): >> if type(bridges) != list and bridges != None: >> bridges = [ bridges ] >> >> - if type(macs) != list and macs != None: >> + if macs is None: >> + macs = [] >> + elif type(macs) != list: >> macs = [ macs ] >> - >> - if type(networks) != list and networks != None: >> - networks = [ networks ] >> + >> + if networks is None: >> + networks = [] >> + elif type(networks) != list: >> + networks = [ macs ] >> >> if bridges is not None and networks != None: >> fail(_("Cannot mix both --bridge and --network arguments")) >> >> - # ensure we have equal length lists >> + >> if bridges != None: >> networks = map(lambda b: "bridge:" + b, bridges) >> - >> - if networks != None: >> - if macs != None: >> - if len(macs) != len(networks): >> - fail(_("Need to pass equal numbers of networks & mac addresses")) >> - else: >> - macs = [ None ] * len(networks) >> - else: >> - if os.getuid() == 0: >> - net = util.default_network() >> - networks = [net[0] + ":" + net[1]] >> - else: >> - networks = ["user"] >> - if macs != None: >> - if len(macs) > 1: >> - fail(_("Need to pass equal numbers of networks & mac addresses")) >> - else: >> - macs = [ None ] >> - >> + >> + # ensure we have equal length lists >> + if len(macs) != len(networks): >> + fail(_("Need to pass equal numbers of networks & mac addresses")) >> + >> + # Create extra networks up to the number of nics requested >> + if len(macs) < nics: >> + for cnt in range(len(macs),nics): >> + if os.getuid() == 0: >> + net = util.default_network() >> + networks.append(net[0] + ":" + net[1]) >> + else: >> + networks.append("user") >> + macs.append(None) >> + >> return (macs, networks) > > I didn't notice this the first time through: it used to be that you > could just specify the network/bridge to connect to, without giving an > explicit MAC (so that you use a random MAC) > > We definitely want to keep that ability. I think the above should be > changed so that the behavior is (1) you need to specify nnics networks > and/or bridges (2) you may specify up to nnics explicit MACS, with the > meaning that successive -w and -b options talk about successive > interfaces, and explicit MACS are assigned to them in sequence. For > interfaces that don't have an explicit MAC assigned, we'll generate a > random MAC. > > For example, > > virt-image -b br0 -w default -m 00:16:.. > > would connect the first interface to the bridge 'br0' on the host, and > the second interface to the 'default' network. The first interface would > get the explicit MAC assigned, whereas the second one would get some > random MAC. I will rework and submit. I will error out if you pass more MAC addresses then networks or bridges. -- bk From bkearney at redhat.com Wed Aug 6 12:22:14 2008 From: bkearney at redhat.com (bkearney at redhat.com) Date: Wed, 06 Aug 2008 08:22:14 -0400 Subject: [et-mgmt-tools] [PATCH] Multiple nic patch with DLutterkort's second comments applied Message-ID: # HG changeset patch # User bkearney at localhost.localdomain # Date 1217876425 14400 # Node ID b0886fb88ca8f5ae62fafd84e727555be259ee55 # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 multiple nic support for virt-image. Added support to allow multiple interface elements in the virt-image.xml. The command line can specify any number of -w or -b elements and the tool will add default networks up to the number of nics specified. It is assumbed that eth0 is the first item specified eth1 is the second, etc. The user can also specify any number mac address up to the number of networks specified. If they specify less, then they are auto assigned diff -r 6a207373b908 -r b0886fb88ca8 doc/image.rng --- a/doc/image.rng Tue Jul 29 11:21:07 2008 -0400 +++ b/doc/image.rng Mon Aug 04 15:00:25 2008 -0400 @@ -47,8 +47,10 @@ - - + + + + diff -r 6a207373b908 -r b0886fb88ca8 tests/image.py --- a/tests/image.py Tue Jul 29 11:21:07 2008 -0400 +++ b/tests/image.py Mon Aug 04 15:00:25 2008 -0400 @@ -31,7 +31,16 @@ self.assertTrue(img.domain) self.assertEqual(5, len(img.storage)) self.assertEqual(2, len(img.domain.boots)) + self.assertEqual(1, img.domain.interface) boot = img.domain.boots[0] self.assertEqual("xvdb", boot.drives[1].target) + + def testMultipleNics(self): + file = open(os.path.join("tests", "image2nics.xml"), "r") + xml = file.read() + file.close() + + img = virtinst.ImageParser.parse(xml, ".") + self.assertEqual(2, img.domain.interface) if __name__ == "__main__": unittest.main() diff -r 6a207373b908 -r b0886fb88ca8 tests/image.xml --- a/tests/image.xml Tue Jul 29 11:21:07 2008 -0400 +++ b/tests/image.xml Mon Aug 04 15:00:25 2008 -0400 @@ -28,10 +28,12 @@ - 7 - 262144 - - + + 7 + 262144 + + + diff -r 6a207373b908 -r b0886fb88ca8 tests/image2nics.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/image2nics.xml Mon Aug 04 15:00:25 2008 -0400 @@ -0,0 +1,49 @@ + + test-image + + + + + xen + i386 + + + + pygrub + + + + + + + + i686 + + + + hvm + + + + + + + + 7 + 262144 + + + + + + + + + + + + + + + + diff -r 6a207373b908 -r b0886fb88ca8 virt-image --- a/virt-image Tue Jul 29 11:21:07 2008 -0400 +++ b/virt-image Mon Aug 04 15:00:25 2008 -0400 @@ -59,17 +59,15 @@ cli.get_vcpus(vcpus, check_cpu, guest, conn) def get_networks(domain, macs, bridges, networks, guest): - (macs, networks) = cli.digest_networks(macs, bridges, networks) + nnics = domain.interface + (macs, networks) = cli.digest_networks(macs, bridges, networks, nnics) - nnics = 0 - if domain.interface: - nnics = 1 - - if nnics == 0 and len(networks) > 0: - print >> sys.stderr, _("Warning: image does not support networking, ignoring network related options") - return - elif nnics == 1 and len(networks) == 0: - fail(_("The image needs one network interface")) + if len(networks) > nnics: + print >> sys.stderr, (_("Warning: more networks were provided [%i] then nics required [%i]. All extras are ignored") % (len(networks), nnics)) + networks = networks[0:nnics] + macs = macs [0:nnics] + elif nnics > len(networks): + fail(_("The image requires %i network interface") % nnics) map(lambda m, n: cli.get_network(m, n, guest), macs, networks) diff -r 6a207373b908 -r b0886fb88ca8 virtinst/ImageParser.py --- a/virtinst/ImageParser.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/ImageParser.py Mon Aug 04 15:00:25 2008 -0400 @@ -90,7 +90,7 @@ self.boots = [] self.vcpu = None self.memory = None - self.interface = None + self.interface = 0 self.graphics = None if not node is None: self.parseXML(node) @@ -99,7 +99,7 @@ self.boots = [ Boot(b) for b in node.xpathEval("boot") ] self.vcpu = xpathString(node, "devices/vcpu", 1) self.memory = xpathString(node, "devices/memory") - self.interface = node.xpathEval("count(devices/interface)") > 0 + self.interface = int(node.xpathEval("count(devices/interface)")) self.graphics = node.xpathEval("count(devices/graphics)") > 0 # FIXME: There must be a better way to check this diff -r 6a207373b908 -r b0886fb88ca8 virtinst/UnWare.py --- a/virtinst/UnWare.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/UnWare.py Mon Aug 04 15:00:25 2008 -0400 @@ -143,7 +143,9 @@ self.label = image.label self.vcpu = domain.vcpu self.memory = domain.memory - self.interface = domain.interface + # Make this a boolean based on the existence of one or more + # interfaces in the domain + self.interface = domain.interface > 0 self.disks = [] for d in boot.drives: diff -r 6a207373b908 -r b0886fb88ca8 virtinst/cli.py --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 @@ -262,41 +262,46 @@ fail(_("Unknown network type ") + network) guest.nics.append(n) -def digest_networks(macs, bridges, networks): +def digest_networks(macs, bridges, networks, nics = 1): if type(bridges) != list and bridges != None: bridges = [ bridges ] - if type(macs) != list and macs != None: + if macs is None: + macs = [] + elif type(macs) != list: macs = [ macs ] - - if type(networks) != list and networks != None: - networks = [ networks ] + + if networks is None: + networks = [] + elif type(networks) != list: + networks = [ macs ] if bridges is not None and networks != None: fail(_("Cannot mix both --bridge and --network arguments")) - # ensure we have equal length lists + if bridges != None: networks = map(lambda b: "bridge:" + b, bridges) - - if networks != None: - if macs != None: - if len(macs) != len(networks): - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] * len(networks) + + # ensure we have less macs then networks. Auto fill in the remaining + # macs + if len(macs) > len(networks): + fail(_("Need to pass equal numbers of networks & mac addresses")) else: - if os.getuid() == 0: - net = util.default_network() - networks = [net[0] + ":" + net[1]] - else: - networks = ["user"] - if macs != None: - if len(macs) > 1: - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] - + for cnt in range (len(macs),len(networks)): + macs.append(None) + + + # Create extra networks up to the number of nics requested + if len(macs) < nics: + for cnt in range(len(macs),nics): + if os.getuid() == 0: + net = util.default_network() + networks.append(net[0] + ":" + net[1]) + else: + networks.append("user") + macs.append(None) + return (macs, networks) def get_graphics(vnc, vncport, nographics, sdl, keymap, guest): From crobinso at redhat.com Wed Aug 6 16:17:03 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 12:17:03 -0400 Subject: [et-mgmt-tools] [PATCH] virtinst: interface for building libvirt storage xml Message-ID: <4899CE7F.40501@redhat.com> The attached patch adds an API to virtinst for building libvirt storage pool and storage volume xml. This largely works as it did in my previous posting, but it has had more thorough testing. There is also some documentation in the code that should make the design a bit more clear. The general workflow is as follows: ========================================= import virtinst.Storage.StoragePool as sp # This gives the appropriate class for the specified pool type pool_class = sp.get_pool_class(sp.TYPE_FOO) # Only required params are a conn/uri and name. Default formats # and target paths have default values, but source paths/ # devices and hostnames obviously have no sensible default, but # they still aren't required for object instantiation pool = pool_class(name="foo", conn=someVirConnectInstance) pool.source_path = "/dev/foo" etc. # Prints xml config: will error if all required members aren't # specified pool.get_xml_config() # Attempts to install and build pool on the passed connection poolobj = pool.install() # Will return appropriate volume class for this pool type vol_class = pool.get_volume_class() # For volumes, we require a pool instead of conn/uri, as well # as name and capacity vol = vol_class(name="volfoo", pool=poolobj, capacity=1234) volobj = vol.install() ===================================== This doesn't include iscsi, disk, or logical pools or block device volumes, but those should mostly be a cut and paste job and I haven't found the time to test them out yet. There is no harm in them coming later though. Any comments appreciated. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-build-storage-xml.patch Type: text/x-patch Size: 31172 bytes Desc: not available URL: From crobinso at redhat.com Wed Aug 6 16:18:37 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 12:18:37 -0400 Subject: [et-mgmt-tools] [PATCH 0/6]: virt-install: support remote guest creation Message-ID: <4899CEDD.30503@redhat.com> The following series implements the needed pieces to allow virt-install to provision VMs on remote connections. The main pieces of this are: - Teaching VirtualDisk about libvirt storage management - Teaching relevant Installers to expect storage parameters for cdrom media - Adding an interface to virt-install for users to specify storage managed. This also has a requirement on the storage building api I just posted. More detail will be in each individual email. Thanks, Cole From crobinso at redhat.com Wed Aug 6 16:20:29 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 12:20:29 -0400 Subject: [et-mgmt-tools] [PATCH 1/6]: Move VirtualDisk to its own file In-Reply-To: <4899CEDD.30503@redhat.com> References: <4899CEDD.30503@redhat.com> Message-ID: <4899CF4D.50406@redhat.com> This patch is a simple move to prepare for the fun stuff. VirtualDisk is removed out of Guest.py and put into its own file VirtualDisk.py. All files that were relatively importing VirtualDisk needed to be fixed up as well. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-remote-01-move-vdisk.patch Type: text/x-patch Size: 27283 bytes Desc: not available URL: From crobinso at redhat.com Wed Aug 6 16:21:46 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 12:21:46 -0400 Subject: [et-mgmt-tools] [PATCH 2/6] Add a few helper util functions In-Reply-To: <4899CEDD.30503@redhat.com> References: <4899CEDD.30503@redhat.com> Message-ID: <4899CF9A.4050402@redhat.com> This patch adds a few functions to virtinst.util: 1. is_storage_capable: receives an active connection and attempts to determine if it supports storage management. This is used in a few places to maintain existing behavior and error paths for connections to older libvirt versions. 2. is_remote: receives a uri and determines if it specifies a remote connection. Used for various validation checks. 3. get_xml_path: Receives an xml blob and an xPath, and returns that path from the xml. This is largely a convenience function since we have this code duplicated in about 10 places throughout virtinst and virt-manager. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-remote-02-util-helpers.patch Type: text/x-patch Size: 3031 bytes Desc: not available URL: From crobinso at redhat.com Wed Aug 6 16:22:37 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 12:22:37 -0400 Subject: [et-mgmt-tools] [PATCH 3/6] Add VirtualDevice class In-Reply-To: <4899CEDD.30503@redhat.com> References: <4899CEDD.30503@redhat.com> Message-ID: <4899CFCD.7070601@redhat.com> The patch below adds a VirtualDevice class. My goal is to eventually have all device classes extend this, but it is not a pressing need at the moment. This is added in preparation for the VirtualDevice fixes coming next. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-remote-03-add-vdevice.patch Type: text/x-patch Size: 2873 bytes Desc: not available URL: From crobinso at redhat.com Wed Aug 6 16:24:01 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 12:24:01 -0400 Subject: [et-mgmt-tools] [PATCH 4/6] Make VirtualDisk libvirt storage aware In-Reply-To: <4899CEDD.30503@redhat.com> References: <4899CEDD.30503@redhat.com> Message-ID: <4899D021.8080403@redhat.com> The following patch fixes up VirtualDisk validation and adds options for specifying libvirt managed storage. The whole validation mechanism is fixed to allow setting properties outside of object init time and still having useful validation. A lot of documentation is added as well. The main interface changes are as follows (ripped from the code docs): =========================== If creating a disk object from an existing local block device or file, a path is all that should be required. If you want to create a local file, a size also needs to be specified. The remote case is a bit more complex. The options are: 1. A libvirt virStorageVol instance (passed as 'volObject') for an existing storage volume. 2. A virtinst L{StorageVolume} instance for creating a volume (passed as 'volInstall'). 3. An active connection ('conn') and a path to a storage volume on that connection. 4. An active connection and a tuple of the form ("poolname", "volumename") (passed as 'volName') For the last two cases, the lookup will be performed, and 'vol_object' will be set to the returned virStorageVol. All the above cases also work on a local connection as well, the only difference being that option 3 won't neccessarily error out if the volume isn't found. =========================== This is a pretty ugly patch, I was changing several things at once, sorry. I've tried to test all new and old use cases and the code seems to be pretty solid. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-remote-04-vdisk-storage-api.patch Type: text/x-patch Size: 25216 bytes Desc: not available URL: From crobinso at redhat.com Wed Aug 6 16:25:29 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 12:25:29 -0400 Subject: [et-mgmt-tools] [PATCH 5/6] Pass storage parameters to installer classes In-Reply-To: <4899CEDD.30503@redhat.com> References: <4899CEDD.30503@redhat.com> Message-ID: <4899D079.6000409@redhat.com> The following patch updates the relevant installer classes to deal with storage parameters for cdrom media. A 'conn' attribute is added to all installer classes so we can provide proper storage lookup and validation. If a remote conn is specified and a path (presumably to cdrom media) is passed to 'location', we can attempt to determine if the path is managed on the connection. So passing a connection and a managed path on the remote host should cause everything to just work. The other change is that 'location' can now be a (poolname, volname) tuple that it passes off to VirtualDisk's new volName init parameter. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-remote-05-installer-storage-api.patch Type: text/x-patch Size: 7984 bytes Desc: not available URL: From crobinso at redhat.com Wed Aug 6 16:26:48 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 12:26:48 -0400 Subject: [et-mgmt-tools] [PATCH 6/6] update virt-install options for specifying managed storage In-Reply-To: <4899CEDD.30503@redhat.com> References: <4899CEDD.30503@redhat.com> Message-ID: <4899D0C8.9050909@redhat.com> The attached patch updates virt-install to allow specifying libvirt managed storage. --file can specified managed storage using: - An absolute path to a managed volume - A volume passed as --file volume:poolname:volname - A pool to create storage on, using --file pool:poolname --cdrom can use the first of the above two options (doesn't make sense to create install media). There is an obvious problem with this approach though: Specifying pool:foo or volume:foo:bar could collide with existing file names, and volume:foo:bar would fail if the specified pool had a colon in it. This was mostly my quick solution so I could test it all out, i'm open to suggestions how to change it. Once an interface is decided on I'll update the docs. This is built on the patch to remove prompting from virt-install, fyi. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-remote-06-virt-install-managed-storage.patch Type: text/x-patch Size: 6319 bytes Desc: not available URL: From dlutter at redhat.com Wed Aug 6 17:15:47 2008 From: dlutter at redhat.com (David Lutterkort) Date: Wed, 06 Aug 2008 17:15:47 +0000 Subject: [et-mgmt-tools] [PATCH] Multiple nic patch with DLutterkort's second comments applied In-Reply-To: References: Message-ID: <1218042947.19789.79.camel@localhost.localdomain> On Wed, 2008-08-06 at 08:22 -0400, bkearney at redhat.com wrote: > # HG changeset patch > # User bkearney at localhost.localdomain > # Date 1217876425 14400 > # Node ID b0886fb88ca8f5ae62fafd84e727555be259ee55 > # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 > multiple nic support for virt-image. Added support to allow multiple > interface elements in the virt-image.xml. The command line can specify > any number of -w or -b elements and the tool will add default networks > up to the number of nics specified. It is assumbed that eth0 is the first > item specified eth1 is the second, etc. The user can also specify any number mac address up to the number of networks specified. If they specify less, then they are auto assigned Sorry for doing this drip-torture style, but I just noticed one more thing: > diff -r 6a207373b908 -r b0886fb88ca8 virtinst/cli.py > --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 > +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 > @@ -262,41 +262,46 @@ > fail(_("Unknown network type ") + network) > guest.nics.append(n) > > -def digest_networks(macs, bridges, networks): > +def digest_networks(macs, bridges, networks, nics = 1): That restricts virt-install to one NIC, since virt-install calls digest_networks w/o a nics argument. The default needs to be something that indicates 'unbounded/unknown number of nics' - could just make the default 10000, which clearly is infinite; cleaner default of course is None or -1 David From bkearney at redhat.com Wed Aug 6 17:52:37 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Wed, 06 Aug 2008 13:52:37 -0400 Subject: [et-mgmt-tools] [PATCH] Multiple nic patch with DLutterkort's second comments applied In-Reply-To: <1218042947.19789.79.camel@localhost.localdomain> References: <1218042947.19789.79.camel@localhost.localdomain> Message-ID: <4899E4E5.8060403@redhat.com> David Lutterkort wrote: > On Wed, 2008-08-06 at 08:22 -0400, bkearney at redhat.com wrote: >> # HG changeset patch >> # User bkearney at localhost.localdomain >> # Date 1217876425 14400 >> # Node ID b0886fb88ca8f5ae62fafd84e727555be259ee55 >> # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 >> multiple nic support for virt-image. Added support to allow multiple >> interface elements in the virt-image.xml. The command line can specify >> any number of -w or -b elements and the tool will add default networks >> up to the number of nics specified. It is assumbed that eth0 is the first >> item specified eth1 is the second, etc. The user can also specify any number mac address up to the number of networks specified. If they specify less, then they are auto assigned > > Sorry for doing this drip-torture style, but I just noticed one more > thing: > >> diff -r 6a207373b908 -r b0886fb88ca8 virtinst/cli.py >> --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 >> +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 >> @@ -262,41 +262,46 @@ >> fail(_("Unknown network type ") + network) >> guest.nics.append(n) >> >> -def digest_networks(macs, bridges, networks): >> +def digest_networks(macs, bridges, networks, nics = 1): > > That restricts virt-install to one NIC, since virt-install calls > digest_networks w/o a nics argument. The default needs to be something > that indicates 'unbounded/unknown number of nics' - could just make the > default 10000, which clearly is infinite; cleaner default of course is > None or -1 the nics code is used to force a minimum number of nics. This should have been zero. The "lopping off" of unneeded nics is done in virt-image. I will patch and re-send. -- bk From bkearney at redhat.com Wed Aug 6 17:59:40 2008 From: bkearney at redhat.com (bkearney at redhat.com) Date: Wed, 06 Aug 2008 13:59:40 -0400 Subject: [et-mgmt-tools] [PATCH] Multiple nic patch with DLutterkort's second comments applied Message-ID: # HG changeset patch # User bkearney at localhost.localdomain # Date 1217876425 14400 # Node ID f66deca582937dc181192bdec177ad4b2153c6c2 # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 multiple nic support for virt-image. Added support to allow multiple interface elements in the virt-image.xml. The command line can specify any number of -w or -b elements and the tool will add default networks up to the number of nics specified. It is assumbed that eth0 is the first item specified eth1 is the second, etc. The user can also specify any number mac address up to the number of networks specified. If they specify less, then they are auto assigned diff -r 6a207373b908 -r f66deca58293 doc/image.rng --- a/doc/image.rng Tue Jul 29 11:21:07 2008 -0400 +++ b/doc/image.rng Mon Aug 04 15:00:25 2008 -0400 @@ -47,8 +47,10 @@ - - + + + + diff -r 6a207373b908 -r f66deca58293 tests/image.py --- a/tests/image.py Tue Jul 29 11:21:07 2008 -0400 +++ b/tests/image.py Mon Aug 04 15:00:25 2008 -0400 @@ -31,7 +31,16 @@ self.assertTrue(img.domain) self.assertEqual(5, len(img.storage)) self.assertEqual(2, len(img.domain.boots)) + self.assertEqual(1, img.domain.interface) boot = img.domain.boots[0] self.assertEqual("xvdb", boot.drives[1].target) + + def testMultipleNics(self): + file = open(os.path.join("tests", "image2nics.xml"), "r") + xml = file.read() + file.close() + + img = virtinst.ImageParser.parse(xml, ".") + self.assertEqual(2, img.domain.interface) if __name__ == "__main__": unittest.main() diff -r 6a207373b908 -r f66deca58293 tests/image.xml --- a/tests/image.xml Tue Jul 29 11:21:07 2008 -0400 +++ b/tests/image.xml Mon Aug 04 15:00:25 2008 -0400 @@ -28,10 +28,12 @@ - 7 - 262144 - - + + 7 + 262144 + + + diff -r 6a207373b908 -r f66deca58293 tests/image2nics.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/image2nics.xml Mon Aug 04 15:00:25 2008 -0400 @@ -0,0 +1,49 @@ + + test-image + + + + + xen + i386 + + + + pygrub + + + + + + + + i686 + + + + hvm + + + + + + + + 7 + 262144 + + + + + + + + + + + + + + + + diff -r 6a207373b908 -r f66deca58293 virt-image --- a/virt-image Tue Jul 29 11:21:07 2008 -0400 +++ b/virt-image Mon Aug 04 15:00:25 2008 -0400 @@ -59,17 +59,15 @@ cli.get_vcpus(vcpus, check_cpu, guest, conn) def get_networks(domain, macs, bridges, networks, guest): - (macs, networks) = cli.digest_networks(macs, bridges, networks) + nnics = domain.interface + (macs, networks) = cli.digest_networks(macs, bridges, networks, nnics) - nnics = 0 - if domain.interface: - nnics = 1 - - if nnics == 0 and len(networks) > 0: - print >> sys.stderr, _("Warning: image does not support networking, ignoring network related options") - return - elif nnics == 1 and len(networks) == 0: - fail(_("The image needs one network interface")) + if len(networks) > nnics: + print >> sys.stderr, (_("Warning: more networks were provided [%i] then nics required [%i]. All extras are ignored") % (len(networks), nnics)) + networks = networks[0:nnics] + macs = macs [0:nnics] + elif nnics > len(networks): + fail(_("The image requires %i network interface") % nnics) map(lambda m, n: cli.get_network(m, n, guest), macs, networks) diff -r 6a207373b908 -r f66deca58293 virtinst/ImageParser.py --- a/virtinst/ImageParser.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/ImageParser.py Mon Aug 04 15:00:25 2008 -0400 @@ -90,7 +90,7 @@ self.boots = [] self.vcpu = None self.memory = None - self.interface = None + self.interface = 0 self.graphics = None if not node is None: self.parseXML(node) @@ -99,7 +99,7 @@ self.boots = [ Boot(b) for b in node.xpathEval("boot") ] self.vcpu = xpathString(node, "devices/vcpu", 1) self.memory = xpathString(node, "devices/memory") - self.interface = node.xpathEval("count(devices/interface)") > 0 + self.interface = int(node.xpathEval("count(devices/interface)")) self.graphics = node.xpathEval("count(devices/graphics)") > 0 # FIXME: There must be a better way to check this diff -r 6a207373b908 -r f66deca58293 virtinst/UnWare.py --- a/virtinst/UnWare.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/UnWare.py Mon Aug 04 15:00:25 2008 -0400 @@ -143,7 +143,9 @@ self.label = image.label self.vcpu = domain.vcpu self.memory = domain.memory - self.interface = domain.interface + # Make this a boolean based on the existence of one or more + # interfaces in the domain + self.interface = domain.interface > 0 self.disks = [] for d in boot.drives: diff -r 6a207373b908 -r f66deca58293 virtinst/cli.py --- a/virtinst/cli.py Tue Jul 29 11:21:07 2008 -0400 +++ b/virtinst/cli.py Mon Aug 04 15:00:25 2008 -0400 @@ -262,41 +262,46 @@ fail(_("Unknown network type ") + network) guest.nics.append(n) -def digest_networks(macs, bridges, networks): +def digest_networks(macs, bridges, networks, nics = 0): if type(bridges) != list and bridges != None: bridges = [ bridges ] - if type(macs) != list and macs != None: + if macs is None: + macs = [] + elif type(macs) != list: macs = [ macs ] - - if type(networks) != list and networks != None: - networks = [ networks ] + + if networks is None: + networks = [] + elif type(networks) != list: + networks = [ macs ] if bridges is not None and networks != None: fail(_("Cannot mix both --bridge and --network arguments")) - # ensure we have equal length lists + if bridges != None: networks = map(lambda b: "bridge:" + b, bridges) - - if networks != None: - if macs != None: - if len(macs) != len(networks): - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] * len(networks) + + # ensure we have less macs then networks. Auto fill in the remaining + # macs + if len(macs) > len(networks): + fail(_("Need to pass equal numbers of networks & mac addresses")) else: - if os.getuid() == 0: - net = util.default_network() - networks = [net[0] + ":" + net[1]] - else: - networks = ["user"] - if macs != None: - if len(macs) > 1: - fail(_("Need to pass equal numbers of networks & mac addresses")) - else: - macs = [ None ] - + for cnt in range (len(macs),len(networks)): + macs.append(None) + + + # Create extra networks up to the number of nics requested + if len(macs) < nics: + for cnt in range(len(macs),nics): + if os.getuid() == 0: + net = util.default_network() + networks.append(net[0] + ":" + net[1]) + else: + networks.append("user") + macs.append(None) + return (macs, networks) def get_graphics(vnc, vncport, nographics, sdl, keymap, guest): From crobinso at redhat.com Wed Aug 6 18:58:14 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 14:58:14 -0400 Subject: [et-mgmt-tools] [PATCH] Multiple nic patch with DLutterkort's second comments applied In-Reply-To: References: Message-ID: <4899F446.3080709@redhat.com> bkearney at redhat.com wrote: > # HG changeset patch > # User bkearney at localhost.localdomain > # Date 1217876425 14400 > # Node ID f66deca582937dc181192bdec177ad4b2153c6c2 > # Parent 6a207373b908ab521d33cd675c7c8d3854bdc1f1 > multiple nic support for virt-image. Added support to allow multiple > interface elements in the virt-image.xml. The command line can specify > any number of -w or -b elements and the tool will add default networks > up to the number of nics specified. It is assumbed that eth0 is the first > item specified eth1 is the second, etc. The user can also specify any number mac address up to the number of networks specified. If they specify less, then they are auto assigned > Thanks, I've committed this: http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=9428ea1e91c0 - Cole From crobinso at redhat.com Wed Aug 6 18:59:20 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 06 Aug 2008 14:59:20 -0400 Subject: [et-mgmt-tools] [PATCH] virtinst: Remove most prompting from virt-* tools In-Reply-To: <48932256.6010106@redhat.com> References: <48932256.6010106@redhat.com> Message-ID: <4899F488.50300@redhat.com> Cole Robinson wrote: > The attached patch removes most parameter prompting from > the virt command line tools. I think any usefulness they > once had is largely gone, and they are becoming a maintainance > burden. This burden is even more apparent trying to > update this stuff to accommodate remote installs. FYI, I've committed this. http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=a0c7e10b1e92 - Cole From rjones at redhat.com Wed Aug 6 20:00:24 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Wed, 6 Aug 2008 21:00:24 +0100 Subject: [et-mgmt-tools] [ANNOUNCE] virt-mem tools version 0.2.8 released Message-ID: <20080806200024.GA13809@amd.home.annexia.org> I'm pleased to announce the latest release of the virt-mem tools, version 0.2.8. These are tools for system administrators which let you find things like kernel messages, process lists and network information of your guests. For example: virt-uname 'uname' command, shows OS version, architecture, etc. virt-dmesg 'dmesg' command, shows kernel messages virt-ps 'ps' command, shows process list Nothing needs to be installed in the guest for this to work, and the tools are specifically designed to allow easy scripting and integration with databases and monitoring systems. Source is available from the web page here: http://et.redhat.com/~rjones/virt-mem/ The latest version (0.2.8) reworks the internals substantially so that we have direct access to basically any kernel structure, and this will allow us to quickly add the remaining features that people have asked for (memory usage information, lists of network interfaces and so on). As usual, patches, feedback, suggestions etc. are very welcome! Binaries will be available in Fedora 10 (Rawhide) at some point soon. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From terry.allen.gotzon at census.gov Wed Aug 6 21:04:48 2008 From: terry.allen.gotzon at census.gov (terry.allen.gotzon at census.gov) Date: Wed, 6 Aug 2008 17:04:48 -0400 Subject: [et-mgmt-tools] Terry Gotzon is out of the office. Message-ID: I will be out of the office starting 08/06/2008 and will not return until 08/12/2008. I will respond to your email when I return. In the mean time, please contact Jason Leidner or James McDermott for any technical issues concerning blade servers. From fj0873gn at aa.jp.fujitsu.com Thu Aug 7 01:58:36 2008 From: fj0873gn at aa.jp.fujitsu.com (Nobuhiro Itou) Date: Thu, 7 Aug 2008 10:58:36 +0900 Subject: [et-mgmt-tools] [PATCH] virtinst: Remove most prompting fromvirt-* tools In-Reply-To: <4899F488.50300@redhat.com> References: <48932256.6010106@redhat.com> <4899F488.50300@redhat.com> Message-ID: <200808071058.EJG51540.HGOK9804@aa.jp.fujitsu.com> virt-install????????????????????? ???????????????????????????????? ?????????????????? <4899F488.50300 at redhat.com> ?? "Re: [et-mgmt-tools] [PATCH] virtinst: Remove most prompting fromvirt-* tools" ????? "Cole Robinson "????????? > Cole Robinson wrote: > > The attached patch removes most parameter prompting from > > the virt command line tools. I think any usefulness they > > once had is largely gone, and they are becoming a maintainance > > burden. This burden is even more apparent trying to > > update this stuff to accommodate remote installs. > > FYI, I've committed this. > > http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=a0c7e10b1e92 > > - Cole > > _______________________________________________ > et-mgmt-tools mailing list > et-mgmt-tools at redhat.com > https://www.redhat.com/mailman/listinfo/et-mgmt-tools > From fj0873gn at aa.jp.fujitsu.com Thu Aug 7 02:20:52 2008 From: fj0873gn at aa.jp.fujitsu.com (Nobuhiro Itou) Date: Thu, 7 Aug 2008 11:20:52 +0900 Subject: [et-mgmt-tools] [PATCH] virtinst: Remove most promptingfromvirt-* tools In-Reply-To: <200808071058.EJG51540.HGOK9804@aa.jp.fujitsu.com> References: <48932256.6010106@redhat.com> <4899F488.50300@redhat.com> <200808071058.EJG51540.HGOK9804@aa.jp.fujitsu.com> Message-ID: <200808071120.AGG09046.804HKOG9@aa.jp.fujitsu.com> Oops.. I made a mistake in address. Please ignore the email of a while ago. Nobuhiro Itou > > Cole Robinson wrote: > > > The attached patch removes most parameter prompting from > > > the virt command line tools. I think any usefulness they > > > once had is largely gone, and they are becoming a maintainance > > > burden. This burden is even more apparent trying to > > > update this stuff to accommodate remote installs. > > > > FYI, I've committed this. > > > > http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=a0c7e10b1e92 > > > > - Cole > > > > _______________________________________________ > > et-mgmt-tools mailing list > > et-mgmt-tools at redhat.com > > https://www.redhat.com/mailman/listinfo/et-mgmt-tools > > > > _______________________________________________ > et-mgmt-tools mailing list > et-mgmt-tools at redhat.com > https://www.redhat.com/mailman/listinfo/et-mgmt-tools > From mniranjan at redhat.com Thu Aug 7 05:55:04 2008 From: mniranjan at redhat.com ( Niranjan M.R) Date: Thu, 07 Aug 2008 11:25:04 +0530 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <200808071120.AGG09046.804HKOG9@aa.jp.fujitsu.com> References: <48932256.6010106@redhat.com> <4899F488.50300@redhat.com> <200808071058.EJG51540.HGOK9804@aa.jp.fujitsu.com> <200808071120.AGG09046.804HKOG9@aa.jp.fujitsu.com> Message-ID: <489A8E38.3050005@redhat.com> Hi all, I am using FC9 x86_64 and trying to install virt-mem-0.2.8, But i get below error when trying to do "make" [root at dhcp7-90 virt-mem-0.2.8]# make for d in lib uname dmesg ps mem extract/fedora-koji extract/codegen po; do \ make -C $d all; \ if [ $? -ne 0 ]; then exit 1; fi; \ done make[1]: Entering directory `/opt/virt-mem-0.2.8/lib' ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_gettext.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_version.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_utils.ml gcc -g -O2 -Wall -Werror -I/usr/lib64/ocaml -I.. -c -o virt_mem_mmap_c.o virt_mem_mmap_c.c ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_mmap.ml File "virt_mem_mmap.ml", line 1, characters 0-1: Could not find the .cmi file for interface virt_mem_mmap.mli. make[1]: *** [virt_mem_mmap.cmo] Error 2 make[1]: Leaving directory `/opt/virt-mem-0.2.8/lib' make: *** [all] Error 1 Any ideas Regards Niranjan From berrange at redhat.com Thu Aug 7 09:56:08 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 7 Aug 2008 10:56:08 +0100 Subject: [et-mgmt-tools] [PATCH] virtinst: interface for building libvirt storage xml In-Reply-To: <4899CE7F.40501@redhat.com> References: <4899CE7F.40501@redhat.com> Message-ID: <20080807095608.GG32548@redhat.com> On Wed, Aug 06, 2008 at 12:17:03PM -0400, Cole Robinson wrote: > The attached patch adds an API to virtinst for building > libvirt storage pool and storage volume xml. This largely > works as it did in my previous posting, but it has had > more thorough testing. There is also some documentation > in the code that should make the design a bit more clear. > > The general workflow is as follows: ACK, gets my vote - I say commit it - we need to start using it to get some real world testing of it now as there's only so much repeated code reviews can do. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 7 09:57:46 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 7 Aug 2008 10:57:46 +0100 Subject: [et-mgmt-tools] [PATCH 1/6]: Move VirtualDisk to its own file In-Reply-To: <4899CF4D.50406@redhat.com> References: <4899CEDD.30503@redhat.com> <4899CF4D.50406@redhat.com> Message-ID: <20080807095746.GH32548@redhat.com> On Wed, Aug 06, 2008 at 12:20:29PM -0400, Cole Robinson wrote: > This patch is a simple move to prepare for the fun stuff. > > VirtualDisk is removed out of Guest.py and put into its > own file VirtualDisk.py. All files that were relatively > importing VirtualDisk needed to be fixed up as well. Simple no-op, move of code - ACK to commit. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 7 10:03:36 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 7 Aug 2008 11:03:36 +0100 Subject: [et-mgmt-tools] [PATCH 2/6] Add a few helper util functions In-Reply-To: <4899CF9A.4050402@redhat.com> References: <4899CEDD.30503@redhat.com> <4899CF9A.4050402@redhat.com> Message-ID: <20080807100335.GI32548@redhat.com> On Wed, Aug 06, 2008 at 12:21:46PM -0400, Cole Robinson wrote: > This patch adds a few functions to virtinst.util: > > 1. is_storage_capable: receives an active connection > and attempts to determine if it supports storage > management. This is used in a few places to maintain > existing behavior and error paths for connections > to older libvirt versions. Yes, useful code, since we can't be sure the libvirtd we're talking remotely to has storage support. > 2. is_remote: receives a uri and determines if it > specifies a remote connection. Used for various > validation checks. Ok, this is basically the existing code from virt-manager's file src/virtManager/connection.py, so looks good. While you're doing this I'd suggest that we might as well add the rest of the helpers there too - get_hostname, get_transport and get_driver, possibly also making uri_split public. Perhaps have them all in a virtinst.util.uri module - or at least put the 'uri' in their name, get get_uri_hostname, is_uri_remote, get_uri_transport, get_uri_driver. > 3. get_xml_path: Receives an xml blob and an > xPath, and returns that path from the xml. This > is largely a convenience function since we have > this code duplicated in about 10 places throughout > virtinst and virt-manager. Good idea Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 7 10:16:59 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 7 Aug 2008 11:16:59 +0100 Subject: [et-mgmt-tools] [PATCH 3/6] Add VirtualDevice class In-Reply-To: <4899CFCD.7070601@redhat.com> References: <4899CEDD.30503@redhat.com> <4899CFCD.7070601@redhat.com> Message-ID: <20080807101659.GJ32548@redhat.com> On Wed, Aug 06, 2008 at 12:22:37PM -0400, Cole Robinson wrote: > The patch below adds a VirtualDevice class. My goal is > to eventually have all device classes extend this, but > it is not a pressing need at the moment. This is added > in preparation for the VirtualDevice fixes coming next. ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 7 10:20:00 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 7 Aug 2008 11:20:00 +0100 Subject: [et-mgmt-tools] [PATCH 4/6] Make VirtualDisk libvirt storage aware In-Reply-To: <4899D021.8080403@redhat.com> References: <4899CEDD.30503@redhat.com> <4899D021.8080403@redhat.com> Message-ID: <20080807102000.GK32548@redhat.com> On Wed, Aug 06, 2008 at 12:24:01PM -0400, Cole Robinson wrote: > The following patch fixes up VirtualDisk validation and > adds options for specifying libvirt managed storage. > > The whole validation mechanism is fixed to allow setting > properties outside of object init time and still having > useful validation. A lot of documentation is added as well. > > The main interface changes are as follows (ripped from the > code docs): > > =========================== > > If creating a disk object from an existing local block > device or file, a path is all that should be required. If you want to > create a local file, a size also needs to be specified. > > The remote case is a bit more complex. The options are: > 1. A libvirt virStorageVol instance (passed as 'volObject') for an > existing storage volume. > 2. A virtinst L{StorageVolume} instance for creating a volume (passed > as 'volInstall'). > 3. An active connection ('conn') and a path to a storage volume on > that connection. > 4. An active connection and a tuple of the form ("poolname", > "volumename") (passed as 'volName') > > For the last two cases, the lookup will be performed, and 'vol_object' > will be set to the returned virStorageVol. All the above cases also > work on a local connection as well, the only difference being that > option 3 won't neccessarily error out if the volume isn't found. > > =========================== > > This is a pretty ugly patch, I was changing several things > at once, sorry. I've tried to test all new and old use cases > and the code seems to be pretty solid. If existing virt-install, virt-clone & virt-manager guest creation works then that has covered most existing use cases. The other out of tree user I know of it Koan - probably worth pinging Michael and asking him to test this doesn't break Koan once we've committed this series of patches, but before we release it. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 7 10:21:42 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 7 Aug 2008 11:21:42 +0100 Subject: [et-mgmt-tools] [PATCH 5/6] Pass storage parameters to installer classes In-Reply-To: <4899D079.6000409@redhat.com> References: <4899CEDD.30503@redhat.com> <4899D079.6000409@redhat.com> Message-ID: <20080807102142.GL32548@redhat.com> On Wed, Aug 06, 2008 at 12:25:29PM -0400, Cole Robinson wrote: > The following patch updates the relevant installer classes > to deal with storage parameters for cdrom media. > > A 'conn' attribute is added to all installer classes so > we can provide proper storage lookup and validation. If > a remote conn is specified and a path (presumably to > cdrom media) is passed to 'location', we can attempt to > determine if the path is managed on the connection. So > passing a connection and a managed path on the remote > host should cause everything to just work. ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 7 10:31:38 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 7 Aug 2008 11:31:38 +0100 Subject: [et-mgmt-tools] [PATCH 6/6] update virt-install options for specifying managed storage In-Reply-To: <4899D0C8.9050909@redhat.com> References: <4899CEDD.30503@redhat.com> <4899D0C8.9050909@redhat.com> Message-ID: <20080807103138.GM32548@redhat.com> On Wed, Aug 06, 2008 at 12:26:48PM -0400, Cole Robinson wrote: > The attached patch updates virt-install to allow specifying > libvirt managed storage. > > --file can specified managed storage using: > > - An absolute path to a managed volume > - A volume passed as --file volume:poolname:volname > - A pool to create storage on, using --file pool:poolname > > --cdrom can use the first of the above two options (doesn't > make sense to create install media). > > There is an obvious problem with this approach though: > Specifying pool:foo or volume:foo:bar could collide > with existing file names, and volume:foo:bar would > fail if the specified pool had a colon in it. This > was mostly my quick solution so I could test it all > out, i'm open to suggestions how to change it. Once an > interface is decided on I'll update the docs. The other option would be to leave --file & --cdrom as they already are, and instead use a more sensibly named option like --disk. People are often confused thinging that can't pass a block device to --file already. The --cdrom arg also allows specifying a URI, in which case it downloads the ISO image from the install tree for booting. So I'd suggest using URI syntax --disk file:///some/file/path[:cdrom|floppy][:ro|sh] --disk vol:///poolname:volname[:cdrom|floppy][:ro|sh] --disk pool:///poolname[:cdrom|floppy][:ro|sh] So this defaults to creating a harddisk, writable, but lets you annotate the arg to specify that its a cdrom, or floppy, and optionally readonly or read-write shared. In the future I expect we'll have more disk types like Flash, or USB massstorage, etc, so better to have a single --disk arg, than adding --floppy --usbmsd, --flash etc. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 7 10:47:39 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 7 Aug 2008 11:47:39 +0100 Subject: [et-mgmt-tools] Re: [libvirt] RE: [Qemu-devel] [ANNOUNCE] virt-mem tools version 0.2.8 released In-Reply-To: References: <20080806200024.GA13809@amd.home.annexia.org> Message-ID: <20080807104739.GN32548@redhat.com> On Thu, Aug 07, 2008 at 07:40:58PM +0900, Jun Koi wrote: > On Thu, Aug 7, 2008 at 7:20 PM, Alexey Eremenko > wrote: > > > > This seems to be great ! > > I think it is similar to OpenVZ concept of controlling VMs from Host, right > > ? > > > > How it works, if it is not installed in guest ? > > Basically he does that by inspecting the VM's memory. Something like > the "instrospection" mechanism. Yes they peek at the live guest kernel memory image to extract the data. > One of the problem is that these tools work via libvirt, so on a VM is > not managed by libvirt, these tools no longer work. That's not a problem - that's a reason to use libvirt :-) It allows the same tools to work whether using Xen, QEMU, KVM or any other full machine virtualization suported by libvirt, rather than being tied to one particular hypervisor. Not to mention ability to run them remotely, with authentication and encryption, etc Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From rjones at redhat.com Thu Aug 7 12:59:42 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 7 Aug 2008 13:59:42 +0100 Subject: [et-mgmt-tools] Re: [libvirt] RE: [Qemu-devel] [ANNOUNCE] virt-mem tools version 0.2.8 released In-Reply-To: <7fac565a0808070555t70220d0fi8d4b0087177e4309@mail.gmail.com> References: <20080806200024.GA13809@amd.home.annexia.org> <20080807104739.GN32548@redhat.com> <7fac565a0808070555t70220d0fi8d4b0087177e4309@mail.gmail.com> Message-ID: <20080807125942.GA28020@amd.home.annexia.org> On Thu, Aug 07, 2008 at 03:55:49PM +0300, Alexey Eremenko wrote: > The only problem: virt-mem doesn't compiles. It has a huge chain of dependencies actually. Maybe better off starting with our RPMs, either source or binary, from here: https://bugzilla.redhat.com/show_bug.cgi?id=450713 Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From rjones at redhat.com Thu Aug 7 13:06:27 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 7 Aug 2008 14:06:27 +0100 Subject: [et-mgmt-tools] Re: [libvirt] RE: [Qemu-devel] [ANNOUNCE] virt-mem tools version 0.2.8 released In-Reply-To: <20080807104739.GN32548@redhat.com> References: <20080806200024.GA13809@amd.home.annexia.org> <20080807104739.GN32548@redhat.com> Message-ID: <20080807130627.GA28036@amd.home.annexia.org> On Thu, Aug 07, 2008 at 11:47:39AM +0100, Daniel P. Berrange wrote: > On Thu, Aug 07, 2008 at 07:40:58PM +0900, Jun Koi wrote: > > One of the problem is that these tools work via libvirt, so on a VM is > > not managed by libvirt, these tools no longer work. > > That's not a problem - that's a reason to use libvirt :-) It allows the > same tools to work whether using Xen, QEMU, KVM or any other full machine > virtualization suported by libvirt, rather than being tied to one particular > hypervisor. Not to mention ability to run them remotely, with authentication > and encryption, etc We also support running the tools from memory images which you can capture using the QEMU "memsave" command (see the '-t' option). No libvirt required for that, _but_ to see any interesting stuff you'd need to capture the entire guest memory which could obviously be quite large. You could do 'virt-mem capture' which captures just the bits of memory that contain interesting data, and that reduces the amount of data you need to capture substantially. Unfortunately I broke 'virt-mem capture' in the latest release by accident, and in any case it requires libvirt to do the capturing. I think the message here is, install libvirt & be happy :-) Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From Charles_Duffy at messageone.com Thu Aug 7 18:56:40 2008 From: Charles_Duffy at messageone.com (Charles Duffy) Date: Thu, 07 Aug 2008 13:56:40 -0500 Subject: [et-mgmt-tools] virt-mem 0.2.9 build failure against ocaml-libvirt-0.4.4.2 In-Reply-To: <20080806200024.GA13809@amd.home.annexia.org> References: <20080806200024.GA13809@amd.home.annexia.org> Message-ID: <489B4568.7050301@messageone.com> Trying to build virt-mem 0.2.9 against CentOS 5 + GODI OCaml install, with ocaml-libvirt 0.4.4.2 and bitstring 1.9.7: ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_utsname.ml File "virt_mem_utsname.ml", line 81, characters 61-65: This expression has type unit but is here used with type Virt_mem_types.utsname option make[1]: *** [virt_mem_utsname.cmo] Error 2 make[1]: Leaving directory `/root/virt-mem-0.2.9/lib' make: *** [all] Error 1 From crobinso at redhat.com Thu Aug 7 21:12:42 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 07 Aug 2008 17:12:42 -0400 Subject: [et-mgmt-tools] [PATCH] virtinst: interface for building libvirt storage xml In-Reply-To: <20080807095608.GG32548@redhat.com> References: <4899CE7F.40501@redhat.com> <20080807095608.GG32548@redhat.com> Message-ID: <489B654A.8060108@redhat.com> Daniel P. Berrange wrote: > On Wed, Aug 06, 2008 at 12:17:03PM -0400, Cole Robinson wrote: >> The attached patch adds an API to virtinst for building >> libvirt storage pool and storage volume xml. This largely >> works as it did in my previous posting, but it has had >> more thorough testing. There is also some documentation >> in the code that should make the design a bit more clear. >> >> The general workflow is as follows: > > ACK, gets my vote - I say commit it - we need to start using it > to get some real world testing of it now as there's only so much > repeated code reviews can do. > > Daniel Committed: http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=bd1d0b87d5b6 Thanks, Cole From crobinso at redhat.com Thu Aug 7 21:14:31 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 07 Aug 2008 17:14:31 -0400 Subject: [et-mgmt-tools] [PATCH 0/6]: virt-install: support remote guest creation In-Reply-To: <4899CEDD.30503@redhat.com> References: <4899CEDD.30503@redhat.com> Message-ID: <489B65B7.8020104@redhat.com> Cole Robinson wrote: > The following series implements the needed pieces to allow > virt-install to provision VMs on remote connections. The > main pieces of this are: > > - Teaching VirtualDisk about libvirt storage management > - Teaching relevant Installers to expect storage parameters > for cdrom media > - Adding an interface to virt-install for users to specify > storage managed. > > This also has a requirement on the storage building api > I just posted. > > More detail will be in each individual email. > > Thanks, > Cole > I've committed the first 5 patches in this series. Patch 2 was augmented with the other uri functions that Dan recommended. Thanks, Cole From crobinso at redhat.com Thu Aug 7 21:39:45 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 07 Aug 2008 17:39:45 -0400 Subject: [et-mgmt-tools] [PATCH] virt-manager: populate storage pools, vols In-Reply-To: <489321F1.1000700@redhat.com> References: <489321F1.1000700@redhat.com> Message-ID: <489B6BA1.2020108@redhat.com> Cole Robinson wrote: > The attached patch adds some of the lower level plumbing for > libvirt storage api awareness in virt-manager. > > Similar to the vmmNetwork and vmmDomain classes, I've added > a vmmStoragePool and vmmStorageVol to wrap the underlying > libvirt objects and provide convenience methods. The only > other changes in this patch are to the connection object > to poll for currently available pools and make this info > accessable. > > I've been carrying this for a while so I think it's pretty > stable. > > Thanks, > Cole > > I've committed this: http://hg.et.redhat.com/virt/applications/virt-manager--devel?cs=68223bf84eec Thanks, Cole From Guillermo.Liarte at Unilever.com Fri Aug 8 09:38:33 2008 From: Guillermo.Liarte at Unilever.com (Liarte, Guillermo) Date: Fri, 8 Aug 2008 10:38:33 +0100 Subject: [et-mgmt-tools] Cobbler in static IP landscape and existing KS Message-ID: Hello, I am going to run a proof of concept using Cobbler and I need some advise as it differs substantially from the current scenario. At the moment this is the way we build our new servers: We have a build server with httpd that contains the kickstart tree and the kickstart configuration templates. We have an static website where we enter the information for a new build ( ip, netmask, console type, etc) and it passes the variables to an script that builds the kickstart file for that system feeding the template with the variables. Then using ILO or similar, we boot from a minimum cd, and we do a normal ks installation using http. That method has worked fine for RHEL3 and RHEL4 and people would just make some changes in the scripts and collectors and a new version could be used. However we don't mantain a decent documentation about howto do any of this and I started doing some research about it, until I found cobbler. What I need is Cobbler to be able to mantain my existing RHEL3 and 4 kickstart trees and kickstart templates ( we don't want to change them ) and also help me making more dynamic and diversified RHEL5 installations in a tidy, structured way. We are also willing to be able to upgrade servers using koan ( or any other method ). I would like someone to recommend some material I could follow to achieve this. No PXE, NoDHCP, NO Bind. We use static IPs. Thanks for your help in advance. Regards, Guillermo Liarte -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdehaan at redhat.com Fri Aug 8 12:22:08 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Fri, 08 Aug 2008 08:22:08 -0400 Subject: [et-mgmt-tools] Cobbler in static IP landscape and existing KS In-Reply-To: References: Message-ID: <489C3A70.3010100@redhat.com> Liarte, Guillermo wrote: > > Hello, > > I am going to run a proof of concept using Cobbler and I need some > advise as it differs substantially from the current scenario. > > At the moment this is the way we build our new servers: > > We have a build server with httpd that contains the kickstart > tree and the kickstart configuration templates. We have an static > website where we enter the information for a new build ( ip, netmask, > console type, etc) and it passes the variables to an script that > builds the kickstart file for that system feeding the template with > the variables. Then using ILO or similar, we boot from a minimum cd, > and we do a normal ks installation using http. > > That method has worked fine for RHEL3 and RHEL4 and people would > just make some changes in the scripts and collectors and a new version > could be used. However we don't mantain a decent documentation about > howto do any of this and I started doing some research about it, until > I found cobbler. > > What I need is Cobbler to be able to mantain my existing RHEL3 and > 4 kickstart trees and kickstart templates ( we don't want to change > them ) and also help me making more dynamic and diversified RHEL5 > installations in a tidy, structured way. > > > We are also willing to be able to upgrade servers using koan ( or any > other method ). > > I would like someone to recommend some material I could follow to > achieve this. No PXE, NoDHCP, NO Bind. We use static IPs. > > Thanks for your help in advance. > > Regards, > > Guillermo Liarte > > Hi Guillermo, Cobbler can definitely help with this and there are other users using it with static configurations and existing kickstart-builders. Since we've moved Cobbler's mailing list recently so it could get it's own space, could you please repost this question to https://fedorahosted.org/mailman/listinfo/cobbler ? You will need to sign up for the new list before you can post. Thanks! --Michael From rjones at redhat.com Fri Aug 8 13:35:56 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 8 Aug 2008 14:35:56 +0100 Subject: [et-mgmt-tools] [PATCH 0/5] virt-viewer: browser plugin rewritten as lightweight virt-viewer process launcher Message-ID: <20080808133556.GA32690@amd.home.annexia.org> This series of patches (re-)implements the virt-viewer browser plugin as a lightweight, hidden plugin which just launches an external virt-viewer process. The theory behind this is explained in more detail in these two postings: https://www.redhat.com/archives/ovirt-devel/2008-August/msg00004.html http://sourceforge.net/mailarchive/forum.php?thread_name=20080808093541.GA31923%40amd.home.annexia.org&forum_name=gtk-vnc-devel Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/ From rjones at redhat.com Fri Aug 8 13:37:48 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 8 Aug 2008 14:37:48 +0100 Subject: [et-mgmt-tools] [PATCH 1/5] Rename plugin/ directory to oldplugin/ In-Reply-To: <20080808133556.GA32690@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> Message-ID: <20080808133748.GA32767@amd.home.annexia.org> Rename plugin/ directory to oldplugin/ - Also fix .hgignore to ignore generated files in oldplugin directory. Note that most of this patch is simply renaming files, which stay identical. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 60 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora -------------- next part -------------- # HG changeset patch # User "Richard W.M. Jones " # Date 1218189313 -3600 # Node ID e268ed66e658bc364dea15f3d3f2541b2e28039e # Parent 57d1fb020d5706a4bb1c9556a6a3a576c627decf Rename plugin/ directory to oldplugin/ - Also fix .hgignore to ignore generated files in oldplugin directory. diff -r 57d1fb020d57 -r e268ed66e658 .hgignore --- a/.hgignore Tue Jun 17 04:02:50 2008 -0400 +++ b/.hgignore Fri Aug 08 10:55:13 2008 +0100 @@ -20,3 +20,10 @@ ^config.h.in$ ^man/Makefile$ ^man/virt-viewer\.1$ +^oldplugin/\.deps +^oldplugin/.*\.o +^oldplugin/Makefile$ +^oldplugin/\.libs +^oldplugin/virt-viewer-plugin\.la$ +^oldplugin/virt-viewer-plugin\.so$ +^oldplugin/virt_viewer_plugin_la-.*\.lo$ diff -r 57d1fb020d57 -r e268ed66e658 Makefile.am --- a/Makefile.am Tue Jun 17 04:02:50 2008 -0400 +++ b/Makefile.am Fri Aug 08 10:55:13 2008 +0100 @@ -1,5 +1,5 @@ -SUBDIRS = src man plugin +SUBDIRS = src man oldplugin EXTRA_DIST = @PACKAGE at .spec diff -r 57d1fb020d57 -r e268ed66e658 configure.ac --- a/configure.ac Tue Jun 17 04:02:50 2008 -0400 +++ b/configure.ac Fri Aug 08 10:55:13 2008 +0100 @@ -45,5 +45,5 @@ AC_OUTPUT(Makefile src/Makefile man/Makefile - plugin/Makefile + oldplugin/Makefile virt-viewer.spec) diff -r 57d1fb020d57 -r e268ed66e658 oldplugin/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/oldplugin/Makefile.am Fri Aug 08 10:55:13 2008 +0100 @@ -0,0 +1,33 @@ +if ENABLE_PLUGIN + +plugindir = $(libdir)/mozilla/plugins +plugin_LTLIBRARIES = virt-viewer-plugin.la + +virt_viewer_plugin_la_SOURCES = \ + ../src/main.c ../src/viewer.h \ + virt-viewer-plugin.c virt-viewer-plugin.h \ + npshell.c npunix.c +virt_viewer_plugin_la_LIBADD = \ + @FIREFOX_PLUGIN_LIBS@ \ + @GTKVNC_LIBS@ @GTK2_LIBS@ @LIBXML2_LIBS@ @LIBVIRT_LIBS@ +virt_viewer_plugin_la_LDFLAGS = \ + -module -avoid-version +virt_viewer_plugin_la_CFLAGS = \ + -DPLUGIN=1 -DENABLE_DEBUG=1 -DDEBUG=1 \ + @FIREFOX_PLUGIN_CFLAGS@ \ + @GTKVNC_CFLAGS@ @GTK2_CFLAGS@ @LIBXML2_CFLAGS@ @LIBVIRT_CFLAGS@ \ + @WARN_CFLAGS@ \ + -I$(top_srcdir)/src + +all-local: virt-viewer-plugin.so + +virt-viewer-plugin.so: virt-viewer-plugin.la + cp .libs/virt-viewer-plugin.so $@ + +# Only leave the .so file in the plugins directory. +install-data-hook: + rm -f $(plugindir)/virt-viewer-plugin.a $(plugindir)/virt-viewer-plugin.la + +CLEANFILES = virt-viewer-plugin.so + +endif diff -r 57d1fb020d57 -r e268ed66e658 oldplugin/npshell.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/oldplugin/npshell.c Fri Aug 08 10:55:13 2008 +0100 @@ -0,0 +1,390 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stephen Mak + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * npshell.c + * + * Netscape Client Plugin API + * - Function that need to be implemented by plugin developers + * + * This file defines a "shell" plugin that plugin developers can use + * as the basis for a real plugin. This shell just provides empty + * implementations of all functions that the plugin can implement + * that will be called by Netscape (the NPP_xxx methods defined in + * npapi.h). + * + * dp Suresh + * updated 5/1998 + * updated 9/2000 + * + */ + + +/* +The contents of this file are subject to the Mozilla Public License + +Version 1.1 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for +the specific language governing rights and limitations under the License. + +The Original Code is stub code that defines the binary interface to a Mozilla +plugin. + +The Initial Developer of the Original Code is Mozilla. + +Portions created by Adobe Systems Incorporated are Copyright (C) 2007. All Rights Reserved. + +Contributor(s): Adobe Systems Incorporated. +*/ + +#include + +#include +#include +#include +#include + +#include +#include + +#include "virt-viewer-plugin.h" + +/*********************************************************************** + * + * Implementations of plugin API functions + * + ***********************************************************************/ + +char * +NPP_GetMIMEDescription(void) +{ + return (char *) MIME_TYPES_HANDLED; +} + +NPError +NPP_GetValue(NPP instance G_GNUC_UNUSED, NPPVariable variable, void *value) +{ + NPError err = NPERR_NO_ERROR; + + debug ("NPP_GetValue %d", variable); + + switch (variable) { + case NPPVpluginNameString: + *((const char **)value) = PLUGIN_NAME; + break; + case NPPVpluginDescriptionString: + *((const char **)value) = PLUGIN_DESCRIPTION; + break; + case NPPVpluginNeedsXEmbed: + *((PRBool *)value) = PR_TRUE; + break; + default: + err = NPERR_GENERIC_ERROR; + } + return err; +} + +NPError +NPP_Initialize(void) +{ + debug ("NPP_Initialize"); + + gtk_init(0, 0); + + return NPERR_NO_ERROR; +} + +#ifdef OJI +jref +NPP_GetJavaClass() +{ + return NULL; +} +#endif + +void +NPP_Shutdown(void) +{ + debug ("NPP_Shutdown"); +} + +NPError +NPP_New(NPMIMEType pluginType G_GNUC_UNUSED, + NPP instance, + uint16 mode, + int16 argc, + char* argn[], + char* argv[], + NPSavedData *saved G_GNUC_UNUSED) +{ + PluginInstance *This; + NPError err = NPERR_NO_ERROR; + PRBool supportsXEmbed = PR_FALSE; + NPNToolkitType toolkit = 0; + int i; + + debug ("NPP_New"); + + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + /* http://developer.mozilla.org/en/docs/XEmbed_Extension_for_Mozilla_Plugins + * Check for XEmbed and Gtk toolkit. + */ + err = NPN_GetValue (instance, + NPNVSupportsXEmbedBool, + (void *)&supportsXEmbed); + if (err != NPERR_NO_ERROR || supportsXEmbed != PR_TRUE) + return NPERR_INCOMPATIBLE_VERSION_ERROR; + +#if 1 + err = NPN_GetValue (instance, + NPNVToolkit, + (void *)&toolkit); + if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2) + return NPERR_INCOMPATIBLE_VERSION_ERROR; +#endif + + instance->pdata = NPN_MemAlloc(sizeof(PluginInstance)); + + This = (PluginInstance*) instance->pdata; + + if (This == NULL) { + return NPERR_OUT_OF_MEMORY_ERROR; + } + + memset(This, 0, sizeof(PluginInstance)); + + /* Mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h). */ + This->mode = mode; + This->instance = instance; + This->uri = This->name = NULL; + This->direct = This->waitvnc = 0; + + /* Read the parameters passed to the plugin. */ + for (i = 0; i < argc; i++) + { + if (strcasecmp (argn[i], "uri") == 0) + This->uri = strdup (argv[i]); + else if (strcasecmp (argn[i], "name") == 0) + This->name = strdup (argv[i]); + else if (strcasecmp (argn[i], "direct") == 0) + This->direct = strcmp (argv[i], "1") == 0; + else if (strcasecmp (argn[i], "waitvnc") == 0) + This->waitvnc = strcmp (argv[i], "1") == 0; + } + + return NPERR_NO_ERROR; +} + +NPError +NPP_Destroy(NPP instance, NPSavedData** save G_GNUC_UNUSED) +{ + PluginInstance* This; + + debug ("NPP_Destroy"); + + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + This = (PluginInstance*) instance->pdata; + + if (This != NULL) + { + (void) VirtViewerDestroyWindow (instance); + if (This->uri) free (This->uri); + if (This->name) free (This->name); + NPN_MemFree(instance->pdata); + instance->pdata = NULL; + } + + return NPERR_NO_ERROR; +} + + +NPError +NPP_SetWindow(NPP instance, NPWindow* window) +{ + debug ("NPP_SetWindow"); + + return VirtViewerXSetWindow(instance, window); +} + +int32 +NPP_WriteReady(NPP instance, NPStream *stream) +{ + /*printf("NPP_WriteReady()\n");*/ + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + /* We don't want any data, kill the stream */ + NPN_DestroyStream(instance, stream, NPRES_DONE); + + /* Number of bytes ready to accept in NPP_Write() */ + return -1L; /* don't accept any bytes in NPP_Write() */ +} + +int32 +NPP_Write(NPP instance, NPStream *stream, + int32 offset G_GNUC_UNUSED, int32 len G_GNUC_UNUSED, + void *buffer G_GNUC_UNUSED) +{ + /*printf("NPP_Write()\n");*/ + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + /* We don't want any data, kill the stream */ + NPN_DestroyStream(instance, stream, NPRES_DONE); + + return -1L; /* don't accept any bytes in NPP_Write() */ +} + +NPError +NPP_DestroyStream(NPP instance, NPStream *stream G_GNUC_UNUSED, + NPError reason G_GNUC_UNUSED) +{ + /*printf("NPP_DestroyStream()\n");*/ + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + /***** Insert NPP_DestroyStream code here *****\ + PluginInstance* This; + This = (PluginInstance*) instance->pdata; + \**********************************************/ + + return NPERR_NO_ERROR; +} + +void +NPP_StreamAsFile(NPP instance G_GNUC_UNUSED, NPStream *stream G_GNUC_UNUSED, + const char* fname G_GNUC_UNUSED) +{ + /*printf("NPP_StreamAsFile()\n");*/ + /***** Insert NPP_StreamAsFile code here *****\ + PluginInstance* This; + if (instance != NULL) + This = (PluginInstance*) instance->pdata; + \*********************************************/ +} + +void +NPP_URLNotify(NPP instance G_GNUC_UNUSED, const char* url G_GNUC_UNUSED, + NPReason reason G_GNUC_UNUSED, void* notifyData G_GNUC_UNUSED) +{ + /*printf("NPP_URLNotify()\n");*/ + /***** Insert NPP_URLNotify code here *****\ + PluginInstance* This; + if (instance != NULL) + This = (PluginInstance*) instance->pdata; + \*********************************************/ +} + + +void +NPP_Print(NPP instance, NPPrint* printInfo) +{ + /*printf("NPP_Print()\n");*/ + if(printInfo == NULL) + return; + + if (instance != NULL) { + /***** Insert NPP_Print code here *****\ + PluginInstance* This = (PluginInstance*) instance->pdata; + \**************************************/ + + if (printInfo->mode == NP_FULL) { + /* + * PLUGIN DEVELOPERS: + * If your plugin would like to take over + * printing completely when it is in full-screen mode, + * set printInfo->pluginPrinted to TRUE and print your + * plugin as you see fit. If your plugin wants Netscape + * to handle printing in this case, set + * printInfo->pluginPrinted to FALSE (the default) and + * do nothing. If you do want to handle printing + * yourself, printOne is true if the print button + * (as opposed to the print menu) was clicked. + * On the Macintosh, platformPrint is a THPrint; on + * Windows, platformPrint is a structure + * (defined in npapi.h) containing the printer name, port, + * etc. + */ + + /***** Insert NPP_Print code here *****\ + void* platformPrint = + printInfo->print.fullPrint.platformPrint; + NPBool printOne = + printInfo->print.fullPrint.printOne; + \**************************************/ + + /* Do the default*/ + printInfo->print.fullPrint.pluginPrinted = FALSE; + } + else { /* If not fullscreen, we must be embedded */ + /* + * PLUGIN DEVELOPERS: + * If your plugin is embedded, or is full-screen + * but you returned false in pluginPrinted above, NPP_Print + * will be called with mode == NP_EMBED. The NPWindow + * in the printInfo gives the location and dimensions of + * the embedded plugin on the printed page. On the + * Macintosh, platformPrint is the printer port; on + * Windows, platformPrint is the handle to the printing + * device context. + */ + + /***** Insert NPP_Print code here *****\ + NPWindow* printWindow = + &(printInfo->print.embedPrint.window); + void* platformPrint = + printInfo->print.embedPrint.platformPrint; + \**************************************/ + } + } +} + +int16 NPP_HandleEvent(NPP instance, void* event) +{ + /*printf("NPP_HandleEvent()\n");*/ + + return VirtViewerXHandleEvent(instance, event); +} diff -r 57d1fb020d57 -r e268ed66e658 oldplugin/npunix.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/oldplugin/npunix.c Fri Aug 08 10:55:13 2008 +0100 @@ -0,0 +1,539 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stephen Mak + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * npunix.c + * + * Netscape Client Plugin API + * - Wrapper function to interface with the Netscape Navigator + * + * dp Suresh + * + *---------------------------------------------------------------------- + * PLUGIN DEVELOPERS: + * YOU WILL NOT NEED TO EDIT THIS FILE. + *---------------------------------------------------------------------- + */ + +#include + +#define XP_UNIX 1 + +#include +#include +#include + +#include /* just for G_GNUC_UNUSED */ + +/* + * Define PLUGIN_TRACE to have the wrapper functions print + * messages to stderr whenever they are called. + */ + +#ifdef PLUGIN_TRACE +#include +#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg) +#else +#define PLUGINDEBUGSTR(msg) +#endif + + +/*********************************************************************** + * + * Globals + * + ***********************************************************************/ + +static NPNetscapeFuncs gNetscapeFuncs; /* Netscape Function table */ + + +/*********************************************************************** + * + * Wrapper functions : plugin calling Netscape Navigator + * + * These functions let the plugin developer just call the APIs + * as documented and defined in npapi.h, without needing to know + * about the function table and call macros in npupp.h. + * + ***********************************************************************/ + +void +NPN_Version(int* plugin_major, int* plugin_minor, + int* netscape_major, int* netscape_minor) +{ + *plugin_major = NP_VERSION_MAJOR; + *plugin_minor = NP_VERSION_MINOR; + + /* Major version is in high byte */ + *netscape_major = gNetscapeFuncs.version >> 8; + /* Minor version is in low byte */ + *netscape_minor = gNetscapeFuncs.version & 0xFF; +} + +NPError +NPN_GetValue(NPP instance, NPNVariable variable, void *r_value) +{ + return CallNPN_GetValueProc(gNetscapeFuncs.getvalue, + instance, variable, r_value); +} + +NPError +NPN_SetValue(NPP instance, NPPVariable variable, void *value) +{ + return CallNPN_SetValueProc(gNetscapeFuncs.setvalue, + instance, variable, value); +} + +NPError +NPN_GetURL(NPP instance, const char* url, const char* window) +{ + return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window); +} + +NPError +NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData) +{ + return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData); +} + +NPError +NPN_PostURL(NPP instance, const char* url, const char* window, + uint32 len, const char* buf, NPBool file) +{ + return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance, + url, window, len, buf, file); +} + +NPError +NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, + const char* buf, NPBool file, void* notifyData) +{ + return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify, + instance, url, window, len, buf, file, notifyData); +} + +NPError +NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) +{ + return CallNPN_RequestReadProc(gNetscapeFuncs.requestread, + stream, rangeList); +} + +NPError +NPN_NewStream(NPP instance, NPMIMEType type, const char *window, + NPStream** stream_ptr) +{ + return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance, + type, window, stream_ptr); +} + +int32 +NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer) +{ + return CallNPN_WriteProc(gNetscapeFuncs.write, instance, + stream, len, buffer); +} + +NPError +NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason) +{ + return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream, + instance, stream, reason); +} + +void +NPN_Status(NPP instance, const char* message) +{ + CallNPN_StatusProc(gNetscapeFuncs.status, instance, message); +} + +const char* +NPN_UserAgent(NPP instance) +{ + return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance); +} + +void* +NPN_MemAlloc(uint32 size) +{ + return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size); +} + +void NPN_MemFree(void* ptr) +{ + CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr); +} + +uint32 NPN_MemFlush(uint32 size) +{ + return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size); +} + +void NPN_ReloadPlugins(NPBool reloadPages) +{ + CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages); +} + +#ifdef OJI +JRIEnv* NPN_GetJavaEnv() +{ + return CallNPN_GetJavaEnvProc(gNetscapeFuncs.getJavaEnv); +} + +jref NPN_GetJavaPeer(NPP instance) +{ + return CallNPN_GetJavaPeerProc(gNetscapeFuncs.getJavaPeer, + instance); +} +#endif + +void +NPN_InvalidateRect(NPP instance, NPRect *invalidRect) +{ + CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance, + invalidRect); +} + +void +NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion) +{ + CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance, + invalidRegion); +} + +void +NPN_ForceRedraw(NPP instance) +{ + CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance); +} + +void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) +{ + CallNPN_PushPopupsEnabledStateProc(gNetscapeFuncs.pushpopupsenabledstate, + instance, enabled); +} + +void NPN_PopPopupsEnabledState(NPP instance) +{ + CallNPN_PopPopupsEnabledStateProc(gNetscapeFuncs.poppopupsenabledstate, + instance); +} + + + +/*********************************************************************** + * + * Wrapper functions : Netscape Navigator -> plugin + * + * These functions let the plugin developer just create the APIs + * as documented and defined in npapi.h, without needing to + * install those functions in the function table or worry about + * setting up globals for 68K plugins. + * + ***********************************************************************/ + +static NPError +Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, + int16 argc, char* argn[], char* argv[], NPSavedData* saved) +{ + NPError ret; + PLUGINDEBUGSTR("New"); + ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved); + return ret; +} + +static NPError +Private_Destroy(NPP instance, NPSavedData** save) +{ + PLUGINDEBUGSTR("Destroy"); + return NPP_Destroy(instance, save); +} + +static NPError +Private_SetWindow(NPP instance, NPWindow* window) +{ + NPError err; + PLUGINDEBUGSTR("SetWindow"); + err = NPP_SetWindow(instance, window); + return err; +} + +static NPError +Private_NewStream(NPP instance G_GNUC_UNUSED, NPMIMEType type G_GNUC_UNUSED, + NPStream* stream G_GNUC_UNUSED, + NPBool seekable G_GNUC_UNUSED, uint16* stype G_GNUC_UNUSED) +{ + NPError err = NPERR_NO_ERROR; + PLUGINDEBUGSTR("NewStream"); +/* err = NPP_NewStream(instance, type, stream, seekable, stype);*/ + return err; +} + +static int32 +Private_WriteReady(NPP instance, NPStream* stream) +{ + unsigned int result; + PLUGINDEBUGSTR("WriteReady"); + result = NPP_WriteReady(instance, stream); + return result; +} + +static int32 +Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, + void* buffer) +{ + unsigned int result; + PLUGINDEBUGSTR("Write"); + result = NPP_Write(instance, stream, offset, len, buffer); + return result; +} + +static void +Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname) +{ + PLUGINDEBUGSTR("StreamAsFile"); + NPP_StreamAsFile(instance, stream, fname); +} + + +static NPError +Private_DestroyStream(NPP instance, NPStream* stream, NPError reason) +{ + NPError err; + PLUGINDEBUGSTR("DestroyStream"); + err = NPP_DestroyStream(instance, stream, reason); + return err; +} + +static void +Private_URLNotify(NPP instance, const char* url, + NPReason reason, void* notifyData) + +{ + PLUGINDEBUGSTR("URLNotify"); + NPP_URLNotify(instance, url, reason, notifyData); +} + +static NPError +Private_GetValue(void *instance, NPPVariable variable, void *result) +{ + NPError rv = NPP_GetValue(instance, variable, result); + return rv; +} + +static void +Private_Print(NPP instance, NPPrint* platformPrint) +{ + PLUGINDEBUGSTR("Print"); + NPP_Print(instance, platformPrint); +} + +#ifdef OJI +static JRIGlobalRef +Private_GetJavaClass(void) +{ + jref clazz = NPP_GetJavaClass(); + if (clazz) { + JRIEnv* env = NPN_GetJavaEnv(); + return JRI_NewGlobalRef(env, clazz); + } + return NULL; +} +#endif + +static int16 +Private_HandleEvent(NPP instance, void* event) +{ + return NPP_HandleEvent(instance, event); +} + +/*********************************************************************** + * + * These functions are located automagically by netscape. + * + ***********************************************************************/ + +/* + * NP_GetMIMEDescription + * - Netscape needs to know about this symbol + * - Netscape uses the return value to identify when an object instance + * of this plugin should be created. + */ +char * +NP_GetMIMEDescription(void) +{ + return NPP_GetMIMEDescription(); +} + +/* + * NP_GetValue [optional] + * - Netscape needs to know about this symbol. + * - Interfaces with plugin to get values for predefined variables + * that the navigator needs. + */ +NPError +NP_GetValue(void* future, NPPVariable variable, void *value) +{ + return NPP_GetValue(future, variable, value); +} + +/* + * NP_Initialize + * - Netscape needs to know about this symbol. + * - It calls this function after looking up its symbol before it + * is about to create the first ever object of this kind. + * + * PARAMETERS + * nsTable - The netscape function table. If developers just use these + * wrappers, they dont need to worry about all these function + * tables. + * RETURN + * pluginFuncs + * - This functions needs to fill the plugin function table + * pluginFuncs and return it. Netscape Navigator plugin + * library will use this function table to call the plugin. + * + */ +NPError +NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs) +{ + NPError err = NPERR_NO_ERROR; + + PLUGINDEBUGSTR("NP_Initialize"); + + /* validate input parameters */ + + if ((nsTable == NULL) || (pluginFuncs == NULL)) + err = NPERR_INVALID_FUNCTABLE_ERROR; + + /* + * Check the major version passed in Netscape's function table. + * We won't load if the major version is newer than what we expect. + * Also check that the function tables passed in are big enough for + * all the functions we need (they could be bigger, if Netscape added + * new APIs, but that's OK with us -- we'll just ignore them). + * + */ + + if (err == NPERR_NO_ERROR) { + if ((nsTable->version >> 8) > NP_VERSION_MAJOR) + err = NPERR_INCOMPATIBLE_VERSION_ERROR; + if (nsTable->size < sizeof(NPNetscapeFuncs)) + err = NPERR_INVALID_FUNCTABLE_ERROR; + if (pluginFuncs->size < sizeof(NPPluginFuncs)) + err = NPERR_INVALID_FUNCTABLE_ERROR; + } + + + if (err == NPERR_NO_ERROR) { + /* + * Copy all the fields of Netscape function table into our + * copy so we can call back into Netscape later. Note that + * we need to copy the fields one by one, rather than assigning + * the whole structure, because the Netscape function table + * could actually be bigger than what we expect. + */ + gNetscapeFuncs.version = nsTable->version; + gNetscapeFuncs.size = nsTable->size; + gNetscapeFuncs.posturl = nsTable->posturl; + gNetscapeFuncs.geturl = nsTable->geturl; + gNetscapeFuncs.geturlnotify = nsTable->geturlnotify; + gNetscapeFuncs.requestread = nsTable->requestread; + gNetscapeFuncs.newstream = nsTable->newstream; + gNetscapeFuncs.write = nsTable->write; + gNetscapeFuncs.destroystream = nsTable->destroystream; + gNetscapeFuncs.status = nsTable->status; + gNetscapeFuncs.uagent = nsTable->uagent; + gNetscapeFuncs.memalloc = nsTable->memalloc; + gNetscapeFuncs.memfree = nsTable->memfree; + gNetscapeFuncs.memflush = nsTable->memflush; + gNetscapeFuncs.reloadplugins = nsTable->reloadplugins; +#ifdef OJI + gNetscapeFuncs.getJavaEnv = nsTable->getJavaEnv; + gNetscapeFuncs.getJavaPeer = nsTable->getJavaPeer; +#endif + gNetscapeFuncs.getvalue = nsTable->getvalue; + gNetscapeFuncs.setvalue = nsTable->setvalue; + gNetscapeFuncs.pushpopupsenabledstate = nsTable->pushpopupsenabledstate; + gNetscapeFuncs.poppopupsenabledstate = nsTable->poppopupsenabledstate; + + /* + * Set up the plugin function table that Netscape will use to + * call us. Netscape needs to know about our version and size + * and have a UniversalProcPointer for every function we + * implement. + */ + pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; + pluginFuncs->size = sizeof(NPPluginFuncs); + pluginFuncs->newp = NewNPP_NewProc(Private_New); + pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy); + pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow); + pluginFuncs->newstream = NewNPP_NewStreamProc(Private_NewStream); + pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream); + pluginFuncs->asfile = NewNPP_StreamAsFileProc(Private_StreamAsFile); + pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady); + pluginFuncs->write = NewNPP_WriteProc(Private_Write); + pluginFuncs->print = NewNPP_PrintProc(Private_Print); + pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify); + pluginFuncs->getvalue = NewNPP_GetValueProc(Private_GetValue); + pluginFuncs->event = NewNPP_HandleEventProc(Private_HandleEvent); +#ifdef OJI + pluginFuncs->javaClass = Private_GetJavaClass(); +#endif + + err = NPP_Initialize(); + } + + return err; +} + +/* + * NP_Shutdown [optional] + * - Netscape needs to know about this symbol. + * - It calls this function after looking up its symbol after + * the last object of this kind has been destroyed. + * + */ +NPError +NP_Shutdown(void) +{ + PLUGINDEBUGSTR("NP_Shutdown"); + NPP_Shutdown(); + return NPERR_NO_ERROR; +} diff -r 57d1fb020d57 -r e268ed66e658 oldplugin/test.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/oldplugin/test.html Fri Aug 08 10:55:13 2008 +0100 @@ -0,0 +1,19 @@ + + + +

Virt Viewer plugin test

+ +

You will need to edit the source to + set uri, name etc.

+ + + + +

End of page

+ + + diff -r 57d1fb020d57 -r e268ed66e658 oldplugin/virt-viewer-plugin.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/oldplugin/virt-viewer-plugin.c Fri Aug 08 10:55:13 2008 +0100 @@ -0,0 +1,149 @@ +/* + VIRT-VIEWER-PLUGIN + + By Richard W.M. Jones + Copyright (C) 2008 Red Hat Inc. + + Largely based on DiamondX (http://multimedia.cx/diamondx/), which itself + is based on Mozilla sources. + + DiamondX copyright notice: + + Example XEmbed-aware Mozilla browser plugin by Adobe. + + Copyright (c) 2007 Adobe Systems Incorporated + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#include + +#include +#include +#include + +#include "virt-viewer-plugin.h" + +static GtkWidget * +get_container (void *thisv) +{ + PluginInstance *This = (PluginInstance *) thisv; + return This->container; +} + +NPError +VirtViewerXSetWindow (NPP instance, NPWindow *window) +{ + PluginInstance *This; + NPSetWindowCallbackStruct *ws_info; + int r; + + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + This = (PluginInstance*) instance->pdata; + + debug ("ViewViewerXSetWindow, This=%p", This); + + if (This == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + ws_info = (NPSetWindowCallbackStruct *)window->ws_info; + + /* Mozilla likes to re-run its greatest hits */ + if (window == This->window && + window->x == This->x && + window->y == This->y && + window->width == This->width && + window->height == This->height) { + debug ("virt-viewer-plugin: window re-run; returning"); + return NPERR_NO_ERROR; + } + + This->window = window; + This->x = window->x; + This->y = window->y; + This->width = window->width; + This->height = window->height; + + /* Create a GtkPlug container and a Gtk-VNC widget inside it. */ + This->container = gtk_plug_new ((GdkNativeWindow)(long)window->window); + + /* Make the VNC widget. */ + if (This->uri && This->name) { + debug ("calling viewer_start uri=%s name=%s direct=%d waitvnc=%d container=%p", This->uri, This->name, This->direct, This->waitvnc, This->container); + r = viewer_start (This->uri, This->name, This->direct, This->waitvnc, 1, + get_container, This, 0); + if (r != 0) + fprintf (stderr, "viewer_start returned %d != 0\n", r); + } + + gtk_widget_show_all (This->container); + + return NPERR_NO_ERROR; +} + +NPError +VirtViewerDestroyWindow (NPP instance) +{ + PluginInstance *This = (PluginInstance*) instance->pdata; + + debug ("VirtViewerDestroyWindow, This=%p", This); + + if (This && This->container) { + gtk_widget_destroy (This->container); + This->container = NULL; + } + + return NPERR_NO_ERROR; +} + +static NPWindow windowlessWindow; + +int16 +VirtViewerXHandleEvent(NPP instance, void *event) +{ + XGraphicsExposeEvent exposeEvent; + XEvent *nsEvent; + + debug ("VirtViewerXHandleEvent"); + + nsEvent = (XEvent *) event; + exposeEvent = nsEvent->xgraphicsexpose; + + /*printf(" event: x, y, w, h = %d, %d, %d, %d; display @ %p, window/drawable = %d\n", + exposeEvent.x, + exposeEvent.y, + exposeEvent.width, + exposeEvent.height, + exposeEvent.display, + exposeEvent.drawable);*/ + + windowlessWindow.window = exposeEvent.display; + windowlessWindow.x = exposeEvent.x; + windowlessWindow.y = exposeEvent.y; + windowlessWindow.width = exposeEvent.width; + windowlessWindow.height = exposeEvent.height; + windowlessWindow.ws_info = (void *)exposeEvent.drawable; + + NPP_SetWindow(instance, &windowlessWindow); + + return 0; +} diff -r 57d1fb020d57 -r e268ed66e658 oldplugin/virt-viewer-plugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/oldplugin/virt-viewer-plugin.h Fri Aug 08 10:55:13 2008 +0100 @@ -0,0 +1,83 @@ +/* + VIRT_VIEWER-PLUGIN + + By Richard W.M. Jones + Copyright (C) 2008 Red Hat Inc. + + Largely based on DiamondX (http://multimedia.cx/diamondx/), which itself + is based on Mozilla sources. + + DiamondX copyright notice: + + Example XEmbed-aware Mozilla browser plugin by Adobe. + + Copyright (c) 2007 Adobe Systems Incorporated + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef VIRT_VIEWER_PLUGIN_H +#define VIRT_VIEWER_PLUGIN_H + +#include +#include +#include +#include "viewer.h" + +#define PLUGIN_NAME "Virt-viewer browser plugin" +#define MIME_TYPES_HANDLED "application/x-virt-viewer:virt-viewer:Virt viewer" +#define PLUGIN_DESCRIPTION "Virtual machine console viewer plugin" + +typedef struct { + uint16 mode; + NPWindow *window; + int32 x, y; + uint32 width, height; + + NPP instance; + NPBool pluginsHidden; + + GtkWidget *container; + + char *uri, *name; + int direct, waitvnc; +} PluginInstance; + +extern NPError VirtViewerXSetWindow (NPP instance, NPWindow* window); +extern NPError VirtViewerDestroyWindow (NPP instance); +extern int16 VirtViewerXHandleEvent (NPP instance, void* event); + +#ifdef ENABLE_DEBUG +static void +debug (const char *msg, ...) +{ + va_list args; + + va_start (args, msg); + vfprintf (stderr, msg, args); + va_end (args); + fprintf (stderr, "\n"); + fflush (stderr); +} +#else +static void debug (const char *msg G_GNUC_UNUSED, ...) { } +#endif + +#endif /* VIRT_VIEWER_PLUGIN_H */ diff -r 57d1fb020d57 -r e268ed66e658 plugin/Makefile.am --- a/plugin/Makefile.am Tue Jun 17 04:02:50 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -if ENABLE_PLUGIN - -plugindir = $(libdir)/mozilla/plugins -plugin_LTLIBRARIES = virt-viewer-plugin.la - -virt_viewer_plugin_la_SOURCES = \ - ../src/main.c ../src/viewer.h \ - virt-viewer-plugin.c virt-viewer-plugin.h \ - npshell.c npunix.c -virt_viewer_plugin_la_LIBADD = \ - @FIREFOX_PLUGIN_LIBS@ \ - @GTKVNC_LIBS@ @GTK2_LIBS@ @LIBXML2_LIBS@ @LIBVIRT_LIBS@ -virt_viewer_plugin_la_LDFLAGS = \ - -module -avoid-version -virt_viewer_plugin_la_CFLAGS = \ - -DPLUGIN=1 -DENABLE_DEBUG=1 -DDEBUG=1 \ - @FIREFOX_PLUGIN_CFLAGS@ \ - @GTKVNC_CFLAGS@ @GTK2_CFLAGS@ @LIBXML2_CFLAGS@ @LIBVIRT_CFLAGS@ \ - @WARN_CFLAGS@ \ - -I$(top_srcdir)/src - -all-local: virt-viewer-plugin.so - -virt-viewer-plugin.so: virt-viewer-plugin.la - cp .libs/virt-viewer-plugin.so $@ - -# Only leave the .so file in the plugins directory. -install-data-hook: - rm -f $(plugindir)/virt-viewer-plugin.a $(plugindir)/virt-viewer-plugin.la - -CLEANFILES = virt-viewer-plugin.so - -endif diff -r 57d1fb020d57 -r e268ed66e658 plugin/npshell.c --- a/plugin/npshell.c Tue Jun 17 04:02:50 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,390 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Stephen Mak - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - * npshell.c - * - * Netscape Client Plugin API - * - Function that need to be implemented by plugin developers - * - * This file defines a "shell" plugin that plugin developers can use - * as the basis for a real plugin. This shell just provides empty - * implementations of all functions that the plugin can implement - * that will be called by Netscape (the NPP_xxx methods defined in - * npapi.h). - * - * dp Suresh - * updated 5/1998 - * updated 9/2000 - * - */ - - -/* -The contents of this file are subject to the Mozilla Public License - -Version 1.1 (the "License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ - -Software distributed under the License is distributed on an "AS IS" basis, -WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -the specific language governing rights and limitations under the License. - -The Original Code is stub code that defines the binary interface to a Mozilla -plugin. - -The Initial Developer of the Original Code is Mozilla. - -Portions created by Adobe Systems Incorporated are Copyright (C) 2007. All Rights Reserved. - -Contributor(s): Adobe Systems Incorporated. -*/ - -#include - -#include -#include -#include -#include - -#include -#include - -#include "virt-viewer-plugin.h" - -/*********************************************************************** - * - * Implementations of plugin API functions - * - ***********************************************************************/ - -char * -NPP_GetMIMEDescription(void) -{ - return (char *) MIME_TYPES_HANDLED; -} - -NPError -NPP_GetValue(NPP instance G_GNUC_UNUSED, NPPVariable variable, void *value) -{ - NPError err = NPERR_NO_ERROR; - - debug ("NPP_GetValue %d", variable); - - switch (variable) { - case NPPVpluginNameString: - *((const char **)value) = PLUGIN_NAME; - break; - case NPPVpluginDescriptionString: - *((const char **)value) = PLUGIN_DESCRIPTION; - break; - case NPPVpluginNeedsXEmbed: - *((PRBool *)value) = PR_TRUE; - break; - default: - err = NPERR_GENERIC_ERROR; - } - return err; -} - -NPError -NPP_Initialize(void) -{ - debug ("NPP_Initialize"); - - gtk_init(0, 0); - - return NPERR_NO_ERROR; -} - -#ifdef OJI -jref -NPP_GetJavaClass() -{ - return NULL; -} -#endif - -void -NPP_Shutdown(void) -{ - debug ("NPP_Shutdown"); -} - -NPError -NPP_New(NPMIMEType pluginType G_GNUC_UNUSED, - NPP instance, - uint16 mode, - int16 argc, - char* argn[], - char* argv[], - NPSavedData *saved G_GNUC_UNUSED) -{ - PluginInstance *This; - NPError err = NPERR_NO_ERROR; - PRBool supportsXEmbed = PR_FALSE; - NPNToolkitType toolkit = 0; - int i; - - debug ("NPP_New"); - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - /* http://developer.mozilla.org/en/docs/XEmbed_Extension_for_Mozilla_Plugins - * Check for XEmbed and Gtk toolkit. - */ - err = NPN_GetValue (instance, - NPNVSupportsXEmbedBool, - (void *)&supportsXEmbed); - if (err != NPERR_NO_ERROR || supportsXEmbed != PR_TRUE) - return NPERR_INCOMPATIBLE_VERSION_ERROR; - -#if 1 - err = NPN_GetValue (instance, - NPNVToolkit, - (void *)&toolkit); - if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2) - return NPERR_INCOMPATIBLE_VERSION_ERROR; -#endif - - instance->pdata = NPN_MemAlloc(sizeof(PluginInstance)); - - This = (PluginInstance*) instance->pdata; - - if (This == NULL) { - return NPERR_OUT_OF_MEMORY_ERROR; - } - - memset(This, 0, sizeof(PluginInstance)); - - /* Mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h). */ - This->mode = mode; - This->instance = instance; - This->uri = This->name = NULL; - This->direct = This->waitvnc = 0; - - /* Read the parameters passed to the plugin. */ - for (i = 0; i < argc; i++) - { - if (strcasecmp (argn[i], "uri") == 0) - This->uri = strdup (argv[i]); - else if (strcasecmp (argn[i], "name") == 0) - This->name = strdup (argv[i]); - else if (strcasecmp (argn[i], "direct") == 0) - This->direct = strcmp (argv[i], "1") == 0; - else if (strcasecmp (argn[i], "waitvnc") == 0) - This->waitvnc = strcmp (argv[i], "1") == 0; - } - - return NPERR_NO_ERROR; -} - -NPError -NPP_Destroy(NPP instance, NPSavedData** save G_GNUC_UNUSED) -{ - PluginInstance* This; - - debug ("NPP_Destroy"); - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; - - if (This != NULL) - { - (void) VirtViewerDestroyWindow (instance); - if (This->uri) free (This->uri); - if (This->name) free (This->name); - NPN_MemFree(instance->pdata); - instance->pdata = NULL; - } - - return NPERR_NO_ERROR; -} - - -NPError -NPP_SetWindow(NPP instance, NPWindow* window) -{ - debug ("NPP_SetWindow"); - - return VirtViewerXSetWindow(instance, window); -} - -int32 -NPP_WriteReady(NPP instance, NPStream *stream) -{ - /*printf("NPP_WriteReady()\n");*/ - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - /* We don't want any data, kill the stream */ - NPN_DestroyStream(instance, stream, NPRES_DONE); - - /* Number of bytes ready to accept in NPP_Write() */ - return -1L; /* don't accept any bytes in NPP_Write() */ -} - -int32 -NPP_Write(NPP instance, NPStream *stream, - int32 offset G_GNUC_UNUSED, int32 len G_GNUC_UNUSED, - void *buffer G_GNUC_UNUSED) -{ - /*printf("NPP_Write()\n");*/ - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - /* We don't want any data, kill the stream */ - NPN_DestroyStream(instance, stream, NPRES_DONE); - - return -1L; /* don't accept any bytes in NPP_Write() */ -} - -NPError -NPP_DestroyStream(NPP instance, NPStream *stream G_GNUC_UNUSED, - NPError reason G_GNUC_UNUSED) -{ - /*printf("NPP_DestroyStream()\n");*/ - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - /***** Insert NPP_DestroyStream code here *****\ - PluginInstance* This; - This = (PluginInstance*) instance->pdata; - \**********************************************/ - - return NPERR_NO_ERROR; -} - -void -NPP_StreamAsFile(NPP instance G_GNUC_UNUSED, NPStream *stream G_GNUC_UNUSED, - const char* fname G_GNUC_UNUSED) -{ - /*printf("NPP_StreamAsFile()\n");*/ - /***** Insert NPP_StreamAsFile code here *****\ - PluginInstance* This; - if (instance != NULL) - This = (PluginInstance*) instance->pdata; - \*********************************************/ -} - -void -NPP_URLNotify(NPP instance G_GNUC_UNUSED, const char* url G_GNUC_UNUSED, - NPReason reason G_GNUC_UNUSED, void* notifyData G_GNUC_UNUSED) -{ - /*printf("NPP_URLNotify()\n");*/ - /***** Insert NPP_URLNotify code here *****\ - PluginInstance* This; - if (instance != NULL) - This = (PluginInstance*) instance->pdata; - \*********************************************/ -} - - -void -NPP_Print(NPP instance, NPPrint* printInfo) -{ - /*printf("NPP_Print()\n");*/ - if(printInfo == NULL) - return; - - if (instance != NULL) { - /***** Insert NPP_Print code here *****\ - PluginInstance* This = (PluginInstance*) instance->pdata; - \**************************************/ - - if (printInfo->mode == NP_FULL) { - /* - * PLUGIN DEVELOPERS: - * If your plugin would like to take over - * printing completely when it is in full-screen mode, - * set printInfo->pluginPrinted to TRUE and print your - * plugin as you see fit. If your plugin wants Netscape - * to handle printing in this case, set - * printInfo->pluginPrinted to FALSE (the default) and - * do nothing. If you do want to handle printing - * yourself, printOne is true if the print button - * (as opposed to the print menu) was clicked. - * On the Macintosh, platformPrint is a THPrint; on - * Windows, platformPrint is a structure - * (defined in npapi.h) containing the printer name, port, - * etc. - */ - - /***** Insert NPP_Print code here *****\ - void* platformPrint = - printInfo->print.fullPrint.platformPrint; - NPBool printOne = - printInfo->print.fullPrint.printOne; - \**************************************/ - - /* Do the default*/ - printInfo->print.fullPrint.pluginPrinted = FALSE; - } - else { /* If not fullscreen, we must be embedded */ - /* - * PLUGIN DEVELOPERS: - * If your plugin is embedded, or is full-screen - * but you returned false in pluginPrinted above, NPP_Print - * will be called with mode == NP_EMBED. The NPWindow - * in the printInfo gives the location and dimensions of - * the embedded plugin on the printed page. On the - * Macintosh, platformPrint is the printer port; on - * Windows, platformPrint is the handle to the printing - * device context. - */ - - /***** Insert NPP_Print code here *****\ - NPWindow* printWindow = - &(printInfo->print.embedPrint.window); - void* platformPrint = - printInfo->print.embedPrint.platformPrint; - \**************************************/ - } - } -} - -int16 NPP_HandleEvent(NPP instance, void* event) -{ - /*printf("NPP_HandleEvent()\n");*/ - - return VirtViewerXHandleEvent(instance, event); -} diff -r 57d1fb020d57 -r e268ed66e658 plugin/npunix.c --- a/plugin/npunix.c Tue Jun 17 04:02:50 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,539 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- - * - * ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Stephen Mak - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -/* - * npunix.c - * - * Netscape Client Plugin API - * - Wrapper function to interface with the Netscape Navigator - * - * dp Suresh - * - *---------------------------------------------------------------------- - * PLUGIN DEVELOPERS: - * YOU WILL NOT NEED TO EDIT THIS FILE. - *---------------------------------------------------------------------- - */ - -#include - -#define XP_UNIX 1 - -#include -#include -#include - -#include /* just for G_GNUC_UNUSED */ - -/* - * Define PLUGIN_TRACE to have the wrapper functions print - * messages to stderr whenever they are called. - */ - -#ifdef PLUGIN_TRACE -#include -#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg) -#else -#define PLUGINDEBUGSTR(msg) -#endif - - -/*********************************************************************** - * - * Globals - * - ***********************************************************************/ - -static NPNetscapeFuncs gNetscapeFuncs; /* Netscape Function table */ - - -/*********************************************************************** - * - * Wrapper functions : plugin calling Netscape Navigator - * - * These functions let the plugin developer just call the APIs - * as documented and defined in npapi.h, without needing to know - * about the function table and call macros in npupp.h. - * - ***********************************************************************/ - -void -NPN_Version(int* plugin_major, int* plugin_minor, - int* netscape_major, int* netscape_minor) -{ - *plugin_major = NP_VERSION_MAJOR; - *plugin_minor = NP_VERSION_MINOR; - - /* Major version is in high byte */ - *netscape_major = gNetscapeFuncs.version >> 8; - /* Minor version is in low byte */ - *netscape_minor = gNetscapeFuncs.version & 0xFF; -} - -NPError -NPN_GetValue(NPP instance, NPNVariable variable, void *r_value) -{ - return CallNPN_GetValueProc(gNetscapeFuncs.getvalue, - instance, variable, r_value); -} - -NPError -NPN_SetValue(NPP instance, NPPVariable variable, void *value) -{ - return CallNPN_SetValueProc(gNetscapeFuncs.setvalue, - instance, variable, value); -} - -NPError -NPN_GetURL(NPP instance, const char* url, const char* window) -{ - return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window); -} - -NPError -NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData) -{ - return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData); -} - -NPError -NPN_PostURL(NPP instance, const char* url, const char* window, - uint32 len, const char* buf, NPBool file) -{ - return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance, - url, window, len, buf, file); -} - -NPError -NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, - const char* buf, NPBool file, void* notifyData) -{ - return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify, - instance, url, window, len, buf, file, notifyData); -} - -NPError -NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) -{ - return CallNPN_RequestReadProc(gNetscapeFuncs.requestread, - stream, rangeList); -} - -NPError -NPN_NewStream(NPP instance, NPMIMEType type, const char *window, - NPStream** stream_ptr) -{ - return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance, - type, window, stream_ptr); -} - -int32 -NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer) -{ - return CallNPN_WriteProc(gNetscapeFuncs.write, instance, - stream, len, buffer); -} - -NPError -NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason) -{ - return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream, - instance, stream, reason); -} - -void -NPN_Status(NPP instance, const char* message) -{ - CallNPN_StatusProc(gNetscapeFuncs.status, instance, message); -} - -const char* -NPN_UserAgent(NPP instance) -{ - return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance); -} - -void* -NPN_MemAlloc(uint32 size) -{ - return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size); -} - -void NPN_MemFree(void* ptr) -{ - CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr); -} - -uint32 NPN_MemFlush(uint32 size) -{ - return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size); -} - -void NPN_ReloadPlugins(NPBool reloadPages) -{ - CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages); -} - -#ifdef OJI -JRIEnv* NPN_GetJavaEnv() -{ - return CallNPN_GetJavaEnvProc(gNetscapeFuncs.getJavaEnv); -} - -jref NPN_GetJavaPeer(NPP instance) -{ - return CallNPN_GetJavaPeerProc(gNetscapeFuncs.getJavaPeer, - instance); -} -#endif - -void -NPN_InvalidateRect(NPP instance, NPRect *invalidRect) -{ - CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance, - invalidRect); -} - -void -NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion) -{ - CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance, - invalidRegion); -} - -void -NPN_ForceRedraw(NPP instance) -{ - CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance); -} - -void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) -{ - CallNPN_PushPopupsEnabledStateProc(gNetscapeFuncs.pushpopupsenabledstate, - instance, enabled); -} - -void NPN_PopPopupsEnabledState(NPP instance) -{ - CallNPN_PopPopupsEnabledStateProc(gNetscapeFuncs.poppopupsenabledstate, - instance); -} - - - -/*********************************************************************** - * - * Wrapper functions : Netscape Navigator -> plugin - * - * These functions let the plugin developer just create the APIs - * as documented and defined in npapi.h, without needing to - * install those functions in the function table or worry about - * setting up globals for 68K plugins. - * - ***********************************************************************/ - -static NPError -Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, - int16 argc, char* argn[], char* argv[], NPSavedData* saved) -{ - NPError ret; - PLUGINDEBUGSTR("New"); - ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved); - return ret; -} - -static NPError -Private_Destroy(NPP instance, NPSavedData** save) -{ - PLUGINDEBUGSTR("Destroy"); - return NPP_Destroy(instance, save); -} - -static NPError -Private_SetWindow(NPP instance, NPWindow* window) -{ - NPError err; - PLUGINDEBUGSTR("SetWindow"); - err = NPP_SetWindow(instance, window); - return err; -} - -static NPError -Private_NewStream(NPP instance G_GNUC_UNUSED, NPMIMEType type G_GNUC_UNUSED, - NPStream* stream G_GNUC_UNUSED, - NPBool seekable G_GNUC_UNUSED, uint16* stype G_GNUC_UNUSED) -{ - NPError err = NPERR_NO_ERROR; - PLUGINDEBUGSTR("NewStream"); -/* err = NPP_NewStream(instance, type, stream, seekable, stype);*/ - return err; -} - -static int32 -Private_WriteReady(NPP instance, NPStream* stream) -{ - unsigned int result; - PLUGINDEBUGSTR("WriteReady"); - result = NPP_WriteReady(instance, stream); - return result; -} - -static int32 -Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, - void* buffer) -{ - unsigned int result; - PLUGINDEBUGSTR("Write"); - result = NPP_Write(instance, stream, offset, len, buffer); - return result; -} - -static void -Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname) -{ - PLUGINDEBUGSTR("StreamAsFile"); - NPP_StreamAsFile(instance, stream, fname); -} - - -static NPError -Private_DestroyStream(NPP instance, NPStream* stream, NPError reason) -{ - NPError err; - PLUGINDEBUGSTR("DestroyStream"); - err = NPP_DestroyStream(instance, stream, reason); - return err; -} - -static void -Private_URLNotify(NPP instance, const char* url, - NPReason reason, void* notifyData) - -{ - PLUGINDEBUGSTR("URLNotify"); - NPP_URLNotify(instance, url, reason, notifyData); -} - -static NPError -Private_GetValue(void *instance, NPPVariable variable, void *result) -{ - NPError rv = NPP_GetValue(instance, variable, result); - return rv; -} - -static void -Private_Print(NPP instance, NPPrint* platformPrint) -{ - PLUGINDEBUGSTR("Print"); - NPP_Print(instance, platformPrint); -} - -#ifdef OJI -static JRIGlobalRef -Private_GetJavaClass(void) -{ - jref clazz = NPP_GetJavaClass(); - if (clazz) { - JRIEnv* env = NPN_GetJavaEnv(); - return JRI_NewGlobalRef(env, clazz); - } - return NULL; -} -#endif - -static int16 -Private_HandleEvent(NPP instance, void* event) -{ - return NPP_HandleEvent(instance, event); -} - -/*********************************************************************** - * - * These functions are located automagically by netscape. - * - ***********************************************************************/ - -/* - * NP_GetMIMEDescription - * - Netscape needs to know about this symbol - * - Netscape uses the return value to identify when an object instance - * of this plugin should be created. - */ -char * -NP_GetMIMEDescription(void) -{ - return NPP_GetMIMEDescription(); -} - -/* - * NP_GetValue [optional] - * - Netscape needs to know about this symbol. - * - Interfaces with plugin to get values for predefined variables - * that the navigator needs. - */ -NPError -NP_GetValue(void* future, NPPVariable variable, void *value) -{ - return NPP_GetValue(future, variable, value); -} - -/* - * NP_Initialize - * - Netscape needs to know about this symbol. - * - It calls this function after looking up its symbol before it - * is about to create the first ever object of this kind. - * - * PARAMETERS - * nsTable - The netscape function table. If developers just use these - * wrappers, they dont need to worry about all these function - * tables. - * RETURN - * pluginFuncs - * - This functions needs to fill the plugin function table - * pluginFuncs and return it. Netscape Navigator plugin - * library will use this function table to call the plugin. - * - */ -NPError -NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs) -{ - NPError err = NPERR_NO_ERROR; - - PLUGINDEBUGSTR("NP_Initialize"); - - /* validate input parameters */ - - if ((nsTable == NULL) || (pluginFuncs == NULL)) - err = NPERR_INVALID_FUNCTABLE_ERROR; - - /* - * Check the major version passed in Netscape's function table. - * We won't load if the major version is newer than what we expect. - * Also check that the function tables passed in are big enough for - * all the functions we need (they could be bigger, if Netscape added - * new APIs, but that's OK with us -- we'll just ignore them). - * - */ - - if (err == NPERR_NO_ERROR) { - if ((nsTable->version >> 8) > NP_VERSION_MAJOR) - err = NPERR_INCOMPATIBLE_VERSION_ERROR; - if (nsTable->size < sizeof(NPNetscapeFuncs)) - err = NPERR_INVALID_FUNCTABLE_ERROR; - if (pluginFuncs->size < sizeof(NPPluginFuncs)) - err = NPERR_INVALID_FUNCTABLE_ERROR; - } - - - if (err == NPERR_NO_ERROR) { - /* - * Copy all the fields of Netscape function table into our - * copy so we can call back into Netscape later. Note that - * we need to copy the fields one by one, rather than assigning - * the whole structure, because the Netscape function table - * could actually be bigger than what we expect. - */ - gNetscapeFuncs.version = nsTable->version; - gNetscapeFuncs.size = nsTable->size; - gNetscapeFuncs.posturl = nsTable->posturl; - gNetscapeFuncs.geturl = nsTable->geturl; - gNetscapeFuncs.geturlnotify = nsTable->geturlnotify; - gNetscapeFuncs.requestread = nsTable->requestread; - gNetscapeFuncs.newstream = nsTable->newstream; - gNetscapeFuncs.write = nsTable->write; - gNetscapeFuncs.destroystream = nsTable->destroystream; - gNetscapeFuncs.status = nsTable->status; - gNetscapeFuncs.uagent = nsTable->uagent; - gNetscapeFuncs.memalloc = nsTable->memalloc; - gNetscapeFuncs.memfree = nsTable->memfree; - gNetscapeFuncs.memflush = nsTable->memflush; - gNetscapeFuncs.reloadplugins = nsTable->reloadplugins; -#ifdef OJI - gNetscapeFuncs.getJavaEnv = nsTable->getJavaEnv; - gNetscapeFuncs.getJavaPeer = nsTable->getJavaPeer; -#endif - gNetscapeFuncs.getvalue = nsTable->getvalue; - gNetscapeFuncs.setvalue = nsTable->setvalue; - gNetscapeFuncs.pushpopupsenabledstate = nsTable->pushpopupsenabledstate; - gNetscapeFuncs.poppopupsenabledstate = nsTable->poppopupsenabledstate; - - /* - * Set up the plugin function table that Netscape will use to - * call us. Netscape needs to know about our version and size - * and have a UniversalProcPointer for every function we - * implement. - */ - pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; - pluginFuncs->size = sizeof(NPPluginFuncs); - pluginFuncs->newp = NewNPP_NewProc(Private_New); - pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy); - pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow); - pluginFuncs->newstream = NewNPP_NewStreamProc(Private_NewStream); - pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream); - pluginFuncs->asfile = NewNPP_StreamAsFileProc(Private_StreamAsFile); - pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady); - pluginFuncs->write = NewNPP_WriteProc(Private_Write); - pluginFuncs->print = NewNPP_PrintProc(Private_Print); - pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify); - pluginFuncs->getvalue = NewNPP_GetValueProc(Private_GetValue); - pluginFuncs->event = NewNPP_HandleEventProc(Private_HandleEvent); -#ifdef OJI - pluginFuncs->javaClass = Private_GetJavaClass(); -#endif - - err = NPP_Initialize(); - } - - return err; -} - -/* - * NP_Shutdown [optional] - * - Netscape needs to know about this symbol. - * - It calls this function after looking up its symbol after - * the last object of this kind has been destroyed. - * - */ -NPError -NP_Shutdown(void) -{ - PLUGINDEBUGSTR("NP_Shutdown"); - NPP_Shutdown(); - return NPERR_NO_ERROR; -} diff -r 57d1fb020d57 -r e268ed66e658 plugin/test.html --- a/plugin/test.html Tue Jun 17 04:02:50 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ - - - -

Virt Viewer plugin test

- -

You will need to edit the source to - set uri, name etc.

- - - - -

End of page

- - - diff -r 57d1fb020d57 -r e268ed66e658 plugin/virt-viewer-plugin.c --- a/plugin/virt-viewer-plugin.c Tue Jun 17 04:02:50 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,149 +0,0 @@ -/* - VIRT-VIEWER-PLUGIN - - By Richard W.M. Jones - Copyright (C) 2008 Red Hat Inc. - - Largely based on DiamondX (http://multimedia.cx/diamondx/), which itself - is based on Mozilla sources. - - DiamondX copyright notice: - - Example XEmbed-aware Mozilla browser plugin by Adobe. - - Copyright (c) 2007 Adobe Systems Incorporated - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include - -#include -#include -#include - -#include "virt-viewer-plugin.h" - -static GtkWidget * -get_container (void *thisv) -{ - PluginInstance *This = (PluginInstance *) thisv; - return This->container; -} - -NPError -VirtViewerXSetWindow (NPP instance, NPWindow *window) -{ - PluginInstance *This; - NPSetWindowCallbackStruct *ws_info; - int r; - - if (instance == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - This = (PluginInstance*) instance->pdata; - - debug ("ViewViewerXSetWindow, This=%p", This); - - if (This == NULL) - return NPERR_INVALID_INSTANCE_ERROR; - - ws_info = (NPSetWindowCallbackStruct *)window->ws_info; - - /* Mozilla likes to re-run its greatest hits */ - if (window == This->window && - window->x == This->x && - window->y == This->y && - window->width == This->width && - window->height == This->height) { - debug ("virt-viewer-plugin: window re-run; returning"); - return NPERR_NO_ERROR; - } - - This->window = window; - This->x = window->x; - This->y = window->y; - This->width = window->width; - This->height = window->height; - - /* Create a GtkPlug container and a Gtk-VNC widget inside it. */ - This->container = gtk_plug_new ((GdkNativeWindow)(long)window->window); - - /* Make the VNC widget. */ - if (This->uri && This->name) { - debug ("calling viewer_start uri=%s name=%s direct=%d waitvnc=%d container=%p", This->uri, This->name, This->direct, This->waitvnc, This->container); - r = viewer_start (This->uri, This->name, This->direct, This->waitvnc, 1, - get_container, This, 0); - if (r != 0) - fprintf (stderr, "viewer_start returned %d != 0\n", r); - } - - gtk_widget_show_all (This->container); - - return NPERR_NO_ERROR; -} - -NPError -VirtViewerDestroyWindow (NPP instance) -{ - PluginInstance *This = (PluginInstance*) instance->pdata; - - debug ("VirtViewerDestroyWindow, This=%p", This); - - if (This && This->container) { - gtk_widget_destroy (This->container); - This->container = NULL; - } - - return NPERR_NO_ERROR; -} - -static NPWindow windowlessWindow; - -int16 -VirtViewerXHandleEvent(NPP instance, void *event) -{ - XGraphicsExposeEvent exposeEvent; - XEvent *nsEvent; - - debug ("VirtViewerXHandleEvent"); - - nsEvent = (XEvent *) event; - exposeEvent = nsEvent->xgraphicsexpose; - - /*printf(" event: x, y, w, h = %d, %d, %d, %d; display @ %p, window/drawable = %d\n", - exposeEvent.x, - exposeEvent.y, - exposeEvent.width, - exposeEvent.height, - exposeEvent.display, - exposeEvent.drawable);*/ - - windowlessWindow.window = exposeEvent.display; - windowlessWindow.x = exposeEvent.x; - windowlessWindow.y = exposeEvent.y; - windowlessWindow.width = exposeEvent.width; - windowlessWindow.height = exposeEvent.height; - windowlessWindow.ws_info = (void *)exposeEvent.drawable; - - NPP_SetWindow(instance, &windowlessWindow); - - return 0; -} diff -r 57d1fb020d57 -r e268ed66e658 plugin/virt-viewer-plugin.h --- a/plugin/virt-viewer-plugin.h Tue Jun 17 04:02:50 2008 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - VIRT_VIEWER-PLUGIN - - By Richard W.M. Jones - Copyright (C) 2008 Red Hat Inc. - - Largely based on DiamondX (http://multimedia.cx/diamondx/), which itself - is based on Mozilla sources. - - DiamondX copyright notice: - - Example XEmbed-aware Mozilla browser plugin by Adobe. - - Copyright (c) 2007 Adobe Systems Incorporated - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef VIRT_VIEWER_PLUGIN_H -#define VIRT_VIEWER_PLUGIN_H - -#include -#include -#include -#include "viewer.h" - -#define PLUGIN_NAME "Virt-viewer browser plugin" -#define MIME_TYPES_HANDLED "application/x-virt-viewer:virt-viewer:Virt viewer" -#define PLUGIN_DESCRIPTION "Virtual machine console viewer plugin" - -typedef struct { - uint16 mode; - NPWindow *window; - int32 x, y; - uint32 width, height; - - NPP instance; - NPBool pluginsHidden; - - GtkWidget *container; - - char *uri, *name; - int direct, waitvnc; -} PluginInstance; - -extern NPError VirtViewerXSetWindow (NPP instance, NPWindow* window); -extern NPError VirtViewerDestroyWindow (NPP instance); -extern int16 VirtViewerXHandleEvent (NPP instance, void* event); - -#ifdef ENABLE_DEBUG -static void -debug (const char *msg, ...) -{ - va_list args; - - va_start (args, msg); - vfprintf (stderr, msg, args); - va_end (args); - fprintf (stderr, "\n"); - fflush (stderr); -} -#else -static void debug (const char *msg G_GNUC_UNUSED, ...) { } -#endif - -#endif /* VIRT_VIEWER_PLUGIN_H */ From rjones at redhat.com Fri Aug 8 13:38:27 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 8 Aug 2008 14:38:27 +0100 Subject: [et-mgmt-tools] [PATCH 2/5] Change --enable-plugin => --enable-oldplugin, and add a new --enable-plugin. In-Reply-To: <20080808133556.GA32690@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> Message-ID: <20080808133827.GB32767@amd.home.annexia.org> Change --enable-plugin => --enable-oldplugin, and add a new --enable-plugin. - Ignore generated files in the (new) plugin/ directory. - -DPLUGIN=1 => -DOLDPLUGIN=1 in src/main.c. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top -------------- next part -------------- # HG changeset patch # User "Richard W.M. Jones " # Date 1218190993 -3600 # Node ID 319f0a7da787989ab8a4304984b0970a3270c5f4 # Parent e268ed66e658bc364dea15f3d3f2541b2e28039e Change --enable-plugin => --enable-oldplugin, and add a new --enable-plugin. - Ignore generated files in the (new) plugin/ directory. - -DPLUGIN=1 => -DOLDPLUGIN=1 in src/main.c. diff -r e268ed66e658 -r 319f0a7da787 .hgignore --- a/.hgignore Fri Aug 08 10:55:13 2008 +0100 +++ b/.hgignore Fri Aug 08 11:23:13 2008 +0100 @@ -27,3 +27,10 @@ ^oldplugin/virt-viewer-plugin\.la$ ^oldplugin/virt-viewer-plugin\.so$ ^oldplugin/virt_viewer_plugin_la-.*\.lo$ +^plugin/\.deps +^plugin/.*\.o +^plugin/Makefile$ +^plugin/\.libs +^plugin/virt-viewer-plugin\.la$ +^plugin/virt-viewer-plugin\.so$ +^plugin/virt_viewer_plugin_la-.*\.lo$ diff -r e268ed66e658 -r 319f0a7da787 Makefile.am --- a/Makefile.am Fri Aug 08 10:55:13 2008 +0100 +++ b/Makefile.am Fri Aug 08 11:23:13 2008 +0100 @@ -1,5 +1,5 @@ -SUBDIRS = src man oldplugin +SUBDIRS = src man oldplugin plugin EXTRA_DIST = @PACKAGE at .spec diff -r e268ed66e658 -r 319f0a7da787 configure.ac --- a/configure.ac Fri Aug 08 10:55:13 2008 +0100 +++ b/configure.ac Fri Aug 08 11:23:13 2008 +0100 @@ -19,14 +19,17 @@ PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.10.0) PKG_CHECK_MODULES(GTKVNC, gtk-vnc-1.0 >= 0.3.5) -dnl --enable-plugin to enable the browser plugin. +dnl --enable-oldplugin and --enable-plugin to enable the browser plugin(s). NSPR_REQUIRED=4.0.0 FIREFOX_PLUGIN_REQUIRED=1.5.0 MOZILLA_PLUGIN_REQUIRED=1.8 +AC_ARG_ENABLE(oldplugin, + [ --enable-oldplugin=[no/yes] enable old browser plugin [default=no]],, + enable_oldplugin=no) AC_ARG_ENABLE(plugin, [ --enable-plugin=[no/yes] enable browser plugin [default=no]],, enable_plugin=no) -if test "x$enable_plugin" = "xyes"; then +if test "x$enable_oldplugin" = "xyes" -o "x$enable_plugin" = "xyes"; then dnl Check for Netscape Portable Runtime development package. PKG_CHECK_MODULES(NSPR, nspr >= $NSPR_REQUIRED) dnl Check for Firefox plugin package (also includes NSPR cflags/libs). @@ -40,10 +43,12 @@ AC_SUBST(FIREFOX_PLUGIN_CFLAGS) AC_SUBST(FIREFOX_PLUGIN_LIBS) fi +AM_CONDITIONAL(ENABLE_OLDPLUGIN, [test "x$enable_oldplugin" = "xyes"]) AM_CONDITIONAL(ENABLE_PLUGIN, [test "x$enable_plugin" = "xyes"]) AC_OUTPUT(Makefile src/Makefile man/Makefile oldplugin/Makefile + plugin/Makefile virt-viewer.spec) diff -r e268ed66e658 -r 319f0a7da787 oldplugin/Makefile.am --- a/oldplugin/Makefile.am Fri Aug 08 10:55:13 2008 +0100 +++ b/oldplugin/Makefile.am Fri Aug 08 11:23:13 2008 +0100 @@ -1,4 +1,4 @@ -if ENABLE_PLUGIN +if ENABLE_OLDPLUGIN plugindir = $(libdir)/mozilla/plugins plugin_LTLIBRARIES = virt-viewer-plugin.la @@ -13,7 +13,7 @@ virt_viewer_plugin_la_LDFLAGS = \ -module -avoid-version virt_viewer_plugin_la_CFLAGS = \ - -DPLUGIN=1 -DENABLE_DEBUG=1 -DDEBUG=1 \ + -DOLDPLUGIN=1 -DENABLE_DEBUG=1 -DDEBUG=1 \ @FIREFOX_PLUGIN_CFLAGS@ \ @GTKVNC_CFLAGS@ @GTK2_CFLAGS@ @LIBXML2_CFLAGS@ @LIBVIRT_CFLAGS@ \ @WARN_CFLAGS@ \ diff -r e268ed66e658 -r 319f0a7da787 plugin/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/Makefile.am Fri Aug 08 11:23:13 2008 +0100 @@ -0,0 +1,4 @@ +if ENABLE_PLUGIN + + +endif diff -r e268ed66e658 -r 319f0a7da787 src/main.c --- a/src/main.c Fri Aug 08 10:55:13 2008 +0100 +++ b/src/main.c Fri Aug 08 11:23:13 2008 +0100 @@ -871,7 +871,7 @@ return 0; } -#ifndef PLUGIN +#ifndef OLDPLUGIN /* Standalone program. */ static GtkWidget *viewer_get_toplevel (void *data G_GNUC_UNUSED) @@ -949,7 +949,7 @@ return 0; } -#endif /* !PLUGIN */ +#endif /* !OLDPLUGIN */ /* * Local variables: From rjones at redhat.com Fri Aug 8 13:39:01 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 8 Aug 2008 14:39:01 +0100 Subject: [et-mgmt-tools] [PATCH 3/5] Document --enable-plugin and --enable-oldplugin, and how to use the plugins. In-Reply-To: <20080808133556.GA32690@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> Message-ID: <20080808133901.GC32767@amd.home.annexia.org> Document --enable-plugin and --enable-oldplugin, and how to use the plugins. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top -------------- next part -------------- # HG changeset patch # User "Richard W.M. Jones " # Date 1218191011 -3600 # Node ID b8a8da640ff33ce6771bec489260a8860fd49061 # Parent 319f0a7da787989ab8a4304984b0970a3270c5f4 Document --enable-plugin and --enable-oldplugin, and how to use the plugins. diff -r 319f0a7da787 -r b8a8da640ff3 README --- a/README Fri Aug 08 11:23:13 2008 +0100 +++ b/README Fri Aug 08 11:23:31 2008 +0100 @@ -27,4 +27,28 @@ http://virt-manager.org/mailinglist.html +Browser plugin +-------------- + +There are two browser plugins supplied, called "oldplugin" and +"plugin". They are not built by default, so to build them you have to +enable them during configure: + + ./configure --enable-plugin +or: + ./configure --enable-oldplugin + +"oldplugin" is a full Gtk-VNC widget embedded inside the browser. +Unfortunately this turns out to be a bit unstable (occasionally +crashes the browser). + +"plugin" is much simpler - it just launches an external virt-viewer +program. + +To try out the plugins, drop the 'virt-viewer-plugin.so' file into +your plugins directory (eg. $HOME/.mozilla/plugins or +/usr/lib/mozilla/plugins). Then try browsing to the 'test.html' files +which you will find in the corresponding oldplugin or plugin +subdirectory in the virt-viewer source. + -- End From rjones at redhat.com Fri Aug 8 13:39:39 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 8 Aug 2008 14:39:39 +0100 Subject: [et-mgmt-tools] [PATCH 4/5] Add 'test.html' to EXTRA_DIST. In-Reply-To: <20080808133556.GA32690@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> Message-ID: <20080808133939.GD32767@amd.home.annexia.org> Add 'test.html' to EXTRA_DIST. ('test.html' file isn't being distributed in the tarball at present, which is a bug). -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top -------------- next part -------------- # HG changeset patch # User "Richard W.M. Jones " # Date 1218191391 -3600 # Node ID dc12fc3a78696ea36adb442ed0aa3304cbf06596 # Parent b8a8da640ff33ce6771bec489260a8860fd49061 Add 'test.html' to EXTRA_DIST. diff -r b8a8da640ff3 -r dc12fc3a7869 oldplugin/Makefile.am --- a/oldplugin/Makefile.am Fri Aug 08 11:23:31 2008 +0100 +++ b/oldplugin/Makefile.am Fri Aug 08 11:29:51 2008 +0100 @@ -30,4 +30,6 @@ CLEANFILES = virt-viewer-plugin.so +EXTRA_DIST = test.html + endif From rjones at redhat.com Fri Aug 8 13:43:14 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 8 Aug 2008 14:43:14 +0100 Subject: [et-mgmt-tools] [PATCH 5/5] "Launch virt-viewer" (new) browser plugin. In-Reply-To: <20080808133556.GA32690@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> Message-ID: <20080808134314.GE32767@amd.home.annexia.org> "Launch virt-viewer" (new) browser plugin. - Based on npshell from xulrunner 1.9.0. - Includes test page. The file 'npunix.c' is pretty much identical to what is in xulrunner 1.9.0, except that I made a few const-correctness fixes. The file 'npshell.c' is only minimally modified from what is in xulrunner, just changed so that it calls the new plugin entry points. The interesting stuff happens in 'launcher_plugin.c' and 'test.html'. The easiest way to test this is: ./autogen.sh --enable-plugin make cp plugin/virt-viewer-plugin.so ~/.mozilla/plugins/ firefox `pwd`/plugin/test.html Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/ -------------- next part -------------- # HG changeset patch # User "Richard W.M. Jones " # Date 1218201453 -3600 # Node ID a378a0a13abae0ea86d07d2dacc1384f0ac712a8 # Parent dc12fc3a78696ea36adb442ed0aa3304cbf06596 "Launch virt-viewer" (new) browser plugin. - Based on npshell from xulrunner 1.9.0. - Includes test page. diff -r dc12fc3a7869 -r a378a0a13aba plugin/Makefile.am --- a/plugin/Makefile.am Fri Aug 08 11:29:51 2008 +0100 +++ b/plugin/Makefile.am Fri Aug 08 14:17:33 2008 +0100 @@ -1,4 +1,29 @@ if ENABLE_PLUGIN +plugindir = $(libdir)/mozilla/plugins +plugin_LTLIBRARIES = virt-viewer-plugin.la + +virt_viewer_plugin_la_SOURCES = \ + npshell.c npunix.c launcher_plugin.c launcher_plugin.h +virt_viewer_plugin_la_LIBADD = @FIREFOX_PLUGIN_LIBS@ +virt_viewer_plugin_la_LDFLAGS = -module -avoid-version +virt_viewer_plugin_la_CFLAGS = \ + -DENABLE_DEBUG=1 -DDEBUG=1 \ + @FIREFOX_PLUGIN_CFLAGS@ \ + @WARN_CFLAGS@ + +all-local: virt-viewer-plugin.so + +virt-viewer-plugin.so: virt-viewer-plugin.la + cp .libs/virt-viewer-plugin.so $@ + +# Only leave the .so file in the plugins directory. +install-data-hook: + rm -f $(plugindir)/virt-viewer-plugin.a \ + $(plugindir)/virt-viewer-plugin.la + +CLEANFILES = virt-viewer-plugin.so + +EXTRA_DIST = test.html endif diff -r dc12fc3a7869 -r a378a0a13aba plugin/launcher_plugin.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/launcher_plugin.c Fri Aug 08 14:17:33 2008 +0100 @@ -0,0 +1,160 @@ +/* + * Virt Viewer New Browser Plugin + * + * Copyright (C) 2008 Red Hat. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Richard W.M. Jones + */ + +#include + +#include +#include +#include +#include +#include + +#include +#include + +#include "launcher_plugin.h" + +static void startVirtViewerAndExit (PluginInstance *, const char *uri, const char *name, int direct, int waitvnc); + +NPError +launcherRun (PluginInstance *self, + int16 argc, char* argn[], char* argv[]) +{ + int i; + const char *uri = NULL; + const char *name = NULL; + int direct = 0; + int waitvnc = 0; + int pid; + + /* Protect against being called multiple times. */ + if (!self->launched) { + self->launched = TRUE; + + /* Parse the parameters given in . */ + i = argc; + while (i > 0) { + i --; + if (argv[i] != NULL) { + if (!PL_strcasecmp (argn[i], "URI")) + uri = argv[i]; + else if (!PL_strcasecmp (argn[i], "NAME")) + name = argv[i]; + else if (!PL_strcasecmp (argn[i], "DIRECT")) + direct = strcmp (argv[i], "1") == 0; + else if (!PL_strcasecmp (argn[i], "WAITVNC")) + waitvnc = strcmp (argv[i], "1") == 0; + } + } + + /* Create child process. */ + pid = fork (); + if (pid < 0) { + perror ("fork"); + return NPERR_GENERIC_ERROR; + } + if (pid == 0) /* Child. */ + startVirtViewerAndExit (self, uri, name, direct, waitvnc); + else /* Parent. */ + waitpid (pid, NULL, 0); + } + + return NPERR_NO_ERROR; +} + +static void +startVirtViewerAndExit (PluginInstance *self ATTRIBUTE_UNUSED, + const char *uri, const char *name, + int direct, int waitvnc) +{ + int pid; + int i, maxfd, len; + const char **argv; + + /* Fork again to detach ourselves completely from the browser + * process (probably not necessary on Windoze). + */ + pid = fork (); + if (pid < 0) { + perror ("fork"); + return; + } + if (pid > 0) /* Parent. */ + _exit (0); + + /* Child ... Close any open file descriptors, leaving 0, 1 & 2 + * connected so that we'll still see any error messages. + */ + maxfd = sysconf (_SC_OPEN_MAX) - 1; + for (i = 3; i <= maxfd; ++i) + close (i); + + /* Build the argument array. */ + len = 1 + /* "virt-viewer" (argv 0) */ + (uri ? 2 : 0) + /* "-c" uri */ + (direct ? 1 : 0) + /* "-d" */ + (waitvnc ? 1 : 0) + /* "-w" */ + 1 + /* name */ + 1; /* NULL */ + argv = NPN_MemAlloc (sizeof (char *) * len); + if (!argv) { + perror ("malloc"); + goto cleanup; + } + + i = 0; + argv[i++] = "virt-viewer"; + if (uri) { + argv[i++] = "-c"; + argv[i++] = uri; + } + if (direct) + argv[i++] = "-d"; + if (waitvnc) + argv[i++] = "-w"; + argv[i++] = name; + + argv[i++] = NULL; + + if (i != len) { + fprintf (stderr, + "virt-viewer launcher_plugin: internal error: i=%d != len=%d\n", + i, len); + goto cleanup; + } + + execvp ("virt-viewer", argv); + perror ("execvp"); + + cleanup: + _exit (1); +} + +void +launcherDestroy (PluginInstance *self) +{ + /* Nothing to free. Just stop launcherRun from doing anything if + * the browser tries to (incorrectly) call it a second time. Not + * that well-written browsers would do anything like that. Oh no. + */ + self->launched = TRUE; +} diff -r dc12fc3a7869 -r a378a0a13aba plugin/launcher_plugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/launcher_plugin.h Fri Aug 08 14:17:33 2008 +0100 @@ -0,0 +1,88 @@ +/* + * Virt Viewer New Browser Plugin + * + * Copyright (C) 2008 Red Hat. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Richard W.M. Jones + */ + +#include + +#ifndef LAUNCHER_PLUGIN_H +#define LAUNCHER_PLUGIN_H + +#include +#include + +#define PLUGIN_NAME "Virt-viewer new browser plugin" +#define MIME_TYPES_HANDLED "application/x-virt-viewer:virt-viewer:Virt viewer" +#define PLUGIN_DESCRIPTION "Browser plugin which launches 'virt-viewer' program to display virtual machine consoles." + +struct _PluginInstance { + /* These standard fields are filled in by npshell, based on + * standard parameters given to the plugin (eg. in ). + */ + uint16 mode; +#ifdef MOZ_X11 + NPWindow *window; + int32 x, y; + uint32 width, height; +#endif + + NPMIMEType type; + NPP instance; + char *pluginsPageUrl; + char *pluginsFileUrl; + NPBool pluginsHidden; + + /* Custom fields for this plugin. */ + NPBool launched; /* Did we launch the external program yet? */ +}; + +typedef struct _PluginInstance PluginInstance; + +/* These functions in launcher_plugin.c are called from npshell + * when significant events happen in the lifecycle of the plugin + * instance. + */ +extern NPError launcherRun (PluginInstance *, + int16 argc, char* argn[], char* argv[]); +extern void launcherDestroy (PluginInstance *); + +#ifdef __GNUC__ +#define ATTRIBUTE_UNUSED __attribute__((__unused__)) +#else +#define ATTRIBUTE_UNUSED +#endif + +#ifdef ENABLE_DEBUG +static void +debug (const char *msg, ...) +{ + va_list args; + + va_start (args, msg); + vfprintf (stderr, msg, args); + va_end (args); + fprintf (stderr, "\n"); + fflush (stderr); +} +#else +static void debug (const char *msg ATTRIBUTE_UNUSED, ...) { } +#endif + +#endif /* LAUNCHER_PLUGIN_H */ diff -r dc12fc3a7869 -r a378a0a13aba plugin/npshell.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/npshell.c Fri Aug 08 14:17:33 2008 +0100 @@ -0,0 +1,424 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stephen Mak + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * npshell.c + * + * Netscape Client Plugin API + * - Function that need to be implemented by plugin developers + * + * This file defines a "shell" plugin that plugin developers can use + * as the basis for a real plugin. This shell just provides empty + * implementations of all functions that the plugin can implement + * that will be called by Netscape (the NPP_xxx methods defined in + * npapi.h). + * + * dp Suresh + * updated 5/1998 + * updated 9/2000 + * + */ + +#define _BSD_SOURCE 1 /* for strdup */ + +#include +#include + +#include +#include + +#include "launcher_plugin.h" + +/*********************************************************************** + * + * Implementations of plugin API functions + * + ***********************************************************************/ + +char * +NPP_GetMIMEDescription(void) +{ + return((char *) MIME_TYPES_HANDLED); +} + +NPError +NPP_GetValue(NPP instance ATTRIBUTE_UNUSED, NPPVariable variable, void *value) +{ + NPError err = NPERR_NO_ERROR; + + switch (variable) { + case NPPVpluginNameString: + *((char **)value) = (char *) PLUGIN_NAME; + break; + case NPPVpluginDescriptionString: + *((char **)value) = (char *) PLUGIN_DESCRIPTION; + break; + default: + err = NPERR_GENERIC_ERROR; + } + return err; +} + +NPError +NPP_Initialize(void) +{ + return NPERR_NO_ERROR; +} + +#ifdef OJI +jref +NPP_GetJavaClass() +{ + return NULL; +} +#endif + +void +NPP_Shutdown(void) +{ +} + +static NPMIMEType +dupMimeType(NPMIMEType type) +{ + NPMIMEType mimetype = NPN_MemAlloc(strlen(type)+1); + if (mimetype) + strcpy(mimetype, type); + return(mimetype); +} + +NPError +NPP_New(NPMIMEType pluginType, + NPP instance, + uint16 mode, + int16 argc, + char* argn[], + char* argv[], + NPSavedData* saved ATTRIBUTE_UNUSED) +{ + PluginInstance* This; + int i; + + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + instance->pdata = NPN_MemAlloc(sizeof(PluginInstance)); + + This = (PluginInstance*) instance->pdata; + + if (This == NULL) + { + return NPERR_OUT_OF_MEMORY_ERROR; + } + + memset(This, 0, sizeof(PluginInstance)); + + /* mode is NP_EMBED, NP_FULL, or NP_BACKGROUND (see npapi.h) */ + This->mode = mode; + This->type = dupMimeType(pluginType); + This->instance = instance; + This->pluginsPageUrl = NULL; + + /* Parse argument list passed to plugin instance */ + /* We are interested in these arguments + * PLUGINSPAGE = + */ + i = argc; + while (i > 0) + { + i --; + if (argv[i] != NULL) + { + if (!PL_strcasecmp(argn[i], "PLUGINSPAGE")) + This->pluginsPageUrl = strdup(argv[i]); + else if (!PL_strcasecmp(argn[i], "PLUGINURL")) + This->pluginsFileUrl = strdup(argv[i]); + else if (!PL_strcasecmp(argn[i], "CODEBASE")) + This->pluginsPageUrl = strdup(argv[i]); + else if (!PL_strcasecmp(argn[i], "CLASSID")) + This->pluginsFileUrl = strdup(argv[i]); + else if (!PL_strcasecmp(argn[i], "HIDDEN")) + This->pluginsHidden = (!PL_strcasecmp(argv[i], + "TRUE")); + } + } + + return launcherRun (This, argc, argn, argv); +} + +NPError +NPP_Destroy(NPP instance, NPSavedData** save ATTRIBUTE_UNUSED) +{ + + PluginInstance* This; + + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + This = (PluginInstance*) instance->pdata; + + if (This != NULL) { + launcherDestroy (This); + if (This->type) + NPN_MemFree(This->type); + if (This->pluginsPageUrl) + NPN_MemFree(This->pluginsPageUrl); + if (This->pluginsFileUrl) + NPN_MemFree(This->pluginsFileUrl); + NPN_MemFree(instance->pdata); + instance->pdata = NULL; + } + + return NPERR_NO_ERROR; +} + + +NPError +NPP_SetWindow(NPP instance, NPWindow* window) +{ + PluginInstance* This; + NPSetWindowCallbackStruct *ws_info; + + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + This = (PluginInstance*) instance->pdata; + + if (This == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + ws_info = (NPSetWindowCallbackStruct *)window->ws_info; + +#ifdef MOZ_X11 + if (This->window == (Window) window->window) { + /* The page with the plugin is being resized. + Save any UI information because the next time + around expect a SetWindow with a new window + id. + */ +#ifdef DEBUG + fprintf(stderr, "Nullplugin: plugin received window resize.\n"); + fprintf(stderr, "Window=(%i)\n", (int)window); + fprintf(stderr, "W=(%i) H=(%i)\n", + (int)window->width, (int)window->height); +#endif + return NPERR_NO_ERROR; + } else { + + This->window = (Window) window->window; + This->x = window->x; + This->y = window->y; + This->width = window->width; + This->height = window->height; + This->display = ws_info->display; + This->visual = ws_info->visual; + This->depth = ws_info->depth; + This->colormap = ws_info->colormap; + makePixmap(This); + makeWidget(This); + } +#endif /* #ifdef MOZ_X11 */ + + return NPERR_NO_ERROR; +} + + +NPError +NPP_NewStream(NPP instance, + NPMIMEType type ATTRIBUTE_UNUSED, + NPStream *stream ATTRIBUTE_UNUSED, + NPBool seekable ATTRIBUTE_UNUSED, + uint16 *stype ATTRIBUTE_UNUSED) +{ + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + return NPERR_NO_ERROR; +} + + +int32 +NPP_WriteReady(NPP instance, NPStream *stream) +{ + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + /* We don't want any data, kill the stream */ + NPN_DestroyStream(instance, stream, NPRES_DONE); + + /* Number of bytes ready to accept in NPP_Write() */ + return -1L; /* don't accept any bytes in NPP_Write() */ +} + + +int32 +NPP_Write(NPP instance, NPStream *stream, + int32 offset ATTRIBUTE_UNUSED, + int32 len ATTRIBUTE_UNUSED, + void *buffer ATTRIBUTE_UNUSED) +{ + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + /* We don't want any data, kill the stream */ + NPN_DestroyStream(instance, stream, NPRES_DONE); + + return -1L; /* don't accept any bytes in NPP_Write() */ +} + + +NPError +NPP_DestroyStream(NPP instance, + NPStream *stream ATTRIBUTE_UNUSED, + NPError reason ATTRIBUTE_UNUSED) +{ + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + /***** Insert NPP_DestroyStream code here *****\ + PluginInstance* This; + This = (PluginInstance*) instance->pdata; + \**********************************************/ + + return NPERR_NO_ERROR; +} + + +void +NPP_StreamAsFile(NPP instance ATTRIBUTE_UNUSED, + NPStream *stream ATTRIBUTE_UNUSED, + const char* fname ATTRIBUTE_UNUSED) +{ + /***** Insert NPP_StreamAsFile code here *****\ + PluginInstance* This; + if (instance != NULL) + This = (PluginInstance*) instance->pdata; + \*********************************************/ +} + + +void +NPP_URLNotify(NPP instance ATTRIBUTE_UNUSED, + const char* url ATTRIBUTE_UNUSED, + NPReason reason ATTRIBUTE_UNUSED, + void* notifyData ATTRIBUTE_UNUSED) +{ + /***** Insert NPP_URLNotify code here *****\ + PluginInstance* This; + if (instance != NULL) + This = (PluginInstance*) instance->pdata; + \*********************************************/ +} + + +void +NPP_Print(NPP instance, NPPrint* printInfo) +{ + if(printInfo == NULL) + return; + + if (instance != NULL) { + /***** Insert NPP_Print code here *****\ + PluginInstance* This = (PluginInstance*) instance->pdata; + \**************************************/ + + if (printInfo->mode == NP_FULL) { + /* + * PLUGIN DEVELOPERS: + * If your plugin would like to take over + * printing completely when it is in full-screen mode, + * set printInfo->pluginPrinted to TRUE and print your + * plugin as you see fit. If your plugin wants Netscape + * to handle printing in this case, set + * printInfo->pluginPrinted to FALSE (the default) and + * do nothing. If you do want to handle printing + * yourself, printOne is true if the print button + * (as opposed to the print menu) was clicked. + * On the Macintosh, platformPrint is a THPrint; on + * Windows, platformPrint is a structure + * (defined in npapi.h) containing the printer name, port, + * etc. + */ + + /***** Insert NPP_Print code here *****\ + void* platformPrint = + printInfo->print.fullPrint.platformPrint; + NPBool printOne = + printInfo->print.fullPrint.printOne; + \**************************************/ + + /* Do the default*/ + printInfo->print.fullPrint.pluginPrinted = FALSE; + } + else { /* If not fullscreen, we must be embedded */ + /* + * PLUGIN DEVELOPERS: + * If your plugin is embedded, or is full-screen + * but you returned false in pluginPrinted above, NPP_Print + * will be called with mode == NP_EMBED. The NPWindow + * in the printInfo gives the location and dimensions of + * the embedded plugin on the printed page. On the + * Macintosh, platformPrint is the printer port; on + * Windows, platformPrint is the handle to the printing + * device context. + */ + + /***** Insert NPP_Print code here *****\ + NPWindow* printWindow = + &(printInfo->print.embedPrint.window); + void* platformPrint = + printInfo->print.embedPrint.platformPrint; + \**************************************/ + } + } +} + +/* + * vim: set tabstop=4: + * vim: set shiftwidth=4: + * vim: set expandtab: + */ +/* + * Local variables: + * indent-tabs-mode: nil + * c-indent-level: 4 + * c-basic-offset: 4 + * tab-width: 4 + * End: + */ diff -r dc12fc3a7869 -r a378a0a13aba plugin/npunix.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/npunix.c Fri Aug 08 14:17:33 2008 +0100 @@ -0,0 +1,696 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Stephen Mak + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +/* + * npunix.c + * + * Netscape Client Plugin API + * - Wrapper function to interface with the Netscape Navigator + * + * dp Suresh + * + *---------------------------------------------------------------------- + * PLUGIN DEVELOPERS: + * YOU WILL NOT NEED TO EDIT THIS FILE. + *---------------------------------------------------------------------- + */ + +#define XP_UNIX 1 + +#include +#include "npapi.h" +#include "npupp.h" + +/* + * Define PLUGIN_TRACE to have the wrapper functions print + * messages to stderr whenever they are called. + */ + +#ifdef PLUGIN_TRACE +#include +#define PLUGINDEBUGSTR(msg) fprintf(stderr, "%s\n", msg) +#else +#define PLUGINDEBUGSTR(msg) +#endif + + +/*********************************************************************** + * + * Globals + * + ***********************************************************************/ + +static NPNetscapeFuncs gNetscapeFuncs; /* Netscape Function table */ + + +/*********************************************************************** + * + * Wrapper functions : plugin calling Netscape Navigator + * + * These functions let the plugin developer just call the APIs + * as documented and defined in npapi.h, without needing to know + * about the function table and call macros in npupp.h. + * + ***********************************************************************/ + +void +NPN_Version(int* plugin_major, int* plugin_minor, + int* netscape_major, int* netscape_minor) +{ + *plugin_major = NP_VERSION_MAJOR; + *plugin_minor = NP_VERSION_MINOR; + + /* Major version is in high byte */ + *netscape_major = gNetscapeFuncs.version >> 8; + /* Minor version is in low byte */ + *netscape_minor = gNetscapeFuncs.version & 0xFF; +} + +NPError +NPN_GetValue(NPP instance, NPNVariable variable, void *r_value) +{ + return CallNPN_GetValueProc(gNetscapeFuncs.getvalue, + instance, variable, r_value); +} + +NPError +NPN_SetValue(NPP instance, NPPVariable variable, void *value) +{ + return CallNPN_SetValueProc(gNetscapeFuncs.setvalue, + instance, variable, value); +} + +NPError +NPN_GetURL(NPP instance, const char* url, const char* window) +{ + return CallNPN_GetURLProc(gNetscapeFuncs.geturl, instance, url, window); +} + +NPError +NPN_GetURLNotify(NPP instance, const char* url, const char* window, void* notifyData) +{ + return CallNPN_GetURLNotifyProc(gNetscapeFuncs.geturlnotify, instance, url, window, notifyData); +} + +NPError +NPN_PostURL(NPP instance, const char* url, const char* window, + uint32 len, const char* buf, NPBool file) +{ + return CallNPN_PostURLProc(gNetscapeFuncs.posturl, instance, + url, window, len, buf, file); +} + +NPError +NPN_PostURLNotify(NPP instance, const char* url, const char* window, uint32 len, + const char* buf, NPBool file, void* notifyData) +{ + return CallNPN_PostURLNotifyProc(gNetscapeFuncs.posturlnotify, + instance, url, window, len, buf, file, notifyData); +} + +NPError +NPN_RequestRead(NPStream* stream, NPByteRange* rangeList) +{ + return CallNPN_RequestReadProc(gNetscapeFuncs.requestread, + stream, rangeList); +} + +NPError +NPN_NewStream(NPP instance, NPMIMEType type, const char *window, + NPStream** stream_ptr) +{ + return CallNPN_NewStreamProc(gNetscapeFuncs.newstream, instance, + type, window, stream_ptr); +} + +int32 +NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer) +{ + return CallNPN_WriteProc(gNetscapeFuncs.write, instance, + stream, len, buffer); +} + +NPError +NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason) +{ + return CallNPN_DestroyStreamProc(gNetscapeFuncs.destroystream, + instance, stream, reason); +} + +void +NPN_Status(NPP instance, const char* message) +{ + CallNPN_StatusProc(gNetscapeFuncs.status, instance, message); +} + +const char* +NPN_UserAgent(NPP instance) +{ + return CallNPN_UserAgentProc(gNetscapeFuncs.uagent, instance); +} + +void* +NPN_MemAlloc(uint32 size) +{ + return CallNPN_MemAllocProc(gNetscapeFuncs.memalloc, size); +} + +void NPN_MemFree(void* ptr) +{ + CallNPN_MemFreeProc(gNetscapeFuncs.memfree, ptr); +} + +uint32 NPN_MemFlush(uint32 size) +{ + return CallNPN_MemFlushProc(gNetscapeFuncs.memflush, size); +} + +void NPN_ReloadPlugins(NPBool reloadPages) +{ + CallNPN_ReloadPluginsProc(gNetscapeFuncs.reloadplugins, reloadPages); +} + +#ifdef OJI +JRIEnv* NPN_GetJavaEnv() +{ + return CallNPN_GetJavaEnvProc(gNetscapeFuncs.getJavaEnv); +} + +jref NPN_GetJavaPeer(NPP instance) +{ + return CallNPN_GetJavaPeerProc(gNetscapeFuncs.getJavaPeer, + instance); +} +#endif + +void +NPN_InvalidateRect(NPP instance, NPRect *invalidRect) +{ + CallNPN_InvalidateRectProc(gNetscapeFuncs.invalidaterect, instance, + invalidRect); +} + +void +NPN_InvalidateRegion(NPP instance, NPRegion invalidRegion) +{ + CallNPN_InvalidateRegionProc(gNetscapeFuncs.invalidateregion, instance, + invalidRegion); +} + +void +NPN_ForceRedraw(NPP instance) +{ + CallNPN_ForceRedrawProc(gNetscapeFuncs.forceredraw, instance); +} + +void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) +{ + CallNPN_PushPopupsEnabledStateProc(gNetscapeFuncs.pushpopupsenabledstate, + instance, enabled); +} + +void NPN_PopPopupsEnabledState(NPP instance) +{ + CallNPN_PopPopupsEnabledStateProc(gNetscapeFuncs.poppopupsenabledstate, + instance); +} + +NPIdentifier NPN_GetStringIdentifier(const NPUTF8 *name) +{ + return CallNPN_GetStringIdentifierProc(gNetscapeFuncs.getstringidentifier, + name); +} + +void NPN_GetStringIdentifiers(const NPUTF8 **names, int32_t nameCount, + NPIdentifier *identifiers) +{ + CallNPN_GetStringIdentifiersProc(gNetscapeFuncs.getstringidentifiers, + names, nameCount, identifiers); +} + +NPIdentifier NPN_GetIntIdentifier(int32_t intid) +{ + return CallNPN_GetIntIdentifierProc(gNetscapeFuncs.getintidentifier, intid); +} + +bool NPN_IdentifierIsString(NPIdentifier identifier) +{ + return CallNPN_IdentifierIsStringProc(gNetscapeFuncs.identifierisstring, + identifier); +} + +NPUTF8 *NPN_UTF8FromIdentifier(NPIdentifier identifier) +{ + return CallNPN_UTF8FromIdentifierProc(gNetscapeFuncs.utf8fromidentifier, + identifier); +} + +int32_t NPN_IntFromIdentifier(NPIdentifier identifier) +{ + return CallNPN_IntFromIdentifierProc(gNetscapeFuncs.intfromidentifier, + identifier); +} + +NPObject *NPN_CreateObject(NPP npp, NPClass *aClass) +{ + return CallNPN_CreateObjectProc(gNetscapeFuncs.createobject, npp, aClass); +} + +NPObject *NPN_RetainObject(NPObject *obj) +{ + return CallNPN_RetainObjectProc(gNetscapeFuncs.retainobject, obj); +} + +void NPN_ReleaseObject(NPObject *obj) +{ + CallNPN_ReleaseObjectProc(gNetscapeFuncs.releaseobject, obj); +} + +bool NPN_Invoke(NPP npp, NPObject* obj, NPIdentifier methodName, + const NPVariant *args, uint32_t argCount, NPVariant *result) +{ + return CallNPN_InvokeProc(gNetscapeFuncs.invoke, npp, obj, methodName, + args, argCount, result); +} + +bool NPN_InvokeDefault(NPP npp, NPObject* obj, const NPVariant *args, + uint32_t argCount, NPVariant *result) +{ + return CallNPN_InvokeDefaultProc(gNetscapeFuncs.invokeDefault, npp, obj, + args, argCount, result); +} + +bool NPN_Evaluate(NPP npp, NPObject* obj, NPString *script, + NPVariant *result) +{ + return CallNPN_EvaluateProc(gNetscapeFuncs.evaluate, npp, obj, script, result); +} + +bool NPN_GetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, + NPVariant *result) +{ + return CallNPN_GetPropertyProc(gNetscapeFuncs.getproperty, npp, obj, + propertyName, result); +} + +bool NPN_SetProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, + const NPVariant *value) +{ + return CallNPN_SetPropertyProc(gNetscapeFuncs.setproperty, npp, obj, + propertyName, value); +} + +bool NPN_RemoveProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) +{ + return CallNPN_RemovePropertyProc(gNetscapeFuncs.removeproperty, npp, obj, + propertyName); +} + +bool NPN_HasProperty(NPP npp, NPObject* obj, NPIdentifier propertyName) +{ + return CallNPN_HasPropertyProc(gNetscapeFuncs.hasproperty, npp, obj, + propertyName); +} + +bool NPN_HasMethod(NPP npp, NPObject* obj, NPIdentifier methodName) +{ + return CallNPN_HasMethodProc(gNetscapeFuncs.hasmethod, npp, obj, methodName); +} + +void NPN_ReleaseVariantValue(NPVariant *variant) +{ + CallNPN_ReleaseVariantValueProc(gNetscapeFuncs.releasevariantvalue, variant); +} + +void NPN_SetException(NPObject* obj, const NPUTF8 *message) +{ + CallNPN_SetExceptionProc(gNetscapeFuncs.setexception, obj, message); +} + + +/*********************************************************************** + * + * Wrapper functions : Netscape Navigator -> plugin + * + * These functions let the plugin developer just create the APIs + * as documented and defined in npapi.h, without needing to + * install those functions in the function table or worry about + * setting up globals for 68K plugins. + * + ***********************************************************************/ + +NPError +Private_New(NPMIMEType pluginType, NPP instance, uint16 mode, + int16 argc, char* argn[], char* argv[], NPSavedData* saved) +{ + NPError ret; + PLUGINDEBUGSTR("New"); + ret = NPP_New(pluginType, instance, mode, argc, argn, argv, saved); + return ret; +} + +NPError +Private_Destroy(NPP instance, NPSavedData** save) +{ + PLUGINDEBUGSTR("Destroy"); + return NPP_Destroy(instance, save); +} + +NPError +Private_SetWindow(NPP instance, NPWindow* window) +{ + NPError err; + PLUGINDEBUGSTR("SetWindow"); + err = NPP_SetWindow(instance, window); + return err; +} + +NPError +Private_NewStream(NPP instance, NPMIMEType type, NPStream* stream, + NPBool seekable, uint16* stype) +{ + NPError err; + PLUGINDEBUGSTR("NewStream"); + err = NPP_NewStream(instance, type, stream, seekable, stype); + return err; +} + +int32 +Private_WriteReady(NPP instance, NPStream* stream) +{ + unsigned int result; + PLUGINDEBUGSTR("WriteReady"); + result = NPP_WriteReady(instance, stream); + return result; +} + +int32 +Private_Write(NPP instance, NPStream* stream, int32 offset, int32 len, + void* buffer) +{ + unsigned int result; + PLUGINDEBUGSTR("Write"); + result = NPP_Write(instance, stream, offset, len, buffer); + return result; +} + +void +Private_StreamAsFile(NPP instance, NPStream* stream, const char* fname) +{ + PLUGINDEBUGSTR("StreamAsFile"); + NPP_StreamAsFile(instance, stream, fname); +} + + +NPError +Private_DestroyStream(NPP instance, NPStream* stream, NPError reason) +{ + NPError err; + PLUGINDEBUGSTR("DestroyStream"); + err = NPP_DestroyStream(instance, stream, reason); + return err; +} + +void +Private_URLNotify(NPP instance, const char* url, + NPReason reason, void* notifyData) + +{ + PLUGINDEBUGSTR("URLNotify"); + NPP_URLNotify(instance, url, reason, notifyData); +} + + + +void +Private_Print(NPP instance, NPPrint* platformPrint) +{ + PLUGINDEBUGSTR("Print"); + NPP_Print(instance, platformPrint); +} + +#ifdef OJI +JRIGlobalRef +Private_GetJavaClass(void) +{ + jref clazz = NPP_GetJavaClass(); + if (clazz) { + JRIEnv* env = NPN_GetJavaEnv(); + return JRI_NewGlobalRef(env, clazz); + } + return NULL; +} +#endif + +/*********************************************************************** + * + * These functions are located automagically by netscape. + * + ***********************************************************************/ + +/* + * NP_GetMIMEDescription + * - Netscape needs to know about this symbol + * - Netscape uses the return value to identify when an object instance + * of this plugin should be created. + */ +char * +NP_GetMIMEDescription(void) +{ + return NPP_GetMIMEDescription(); +} + +/* + * NP_GetValue [optional] + * - Netscape needs to know about this symbol. + * - Interfaces with plugin to get values for predefined variables + * that the navigator needs. + */ +NPError +NP_GetValue(void* future, NPPVariable variable, void *value) +{ + return NPP_GetValue(future, variable, value); +} + +/* + * NP_Initialize + * - Netscape needs to know about this symbol. + * - It calls this function after looking up its symbol before it + * is about to create the first ever object of this kind. + * + * PARAMETERS + * nsTable - The netscape function table. If developers just use these + * wrappers, they don't need to worry about all these function + * tables. + * RETURN + * pluginFuncs + * - This functions needs to fill the plugin function table + * pluginFuncs and return it. Netscape Navigator plugin + * library will use this function table to call the plugin. + * + */ +NPError +NP_Initialize(NPNetscapeFuncs* nsTable, NPPluginFuncs* pluginFuncs) +{ + NPError err = NPERR_NO_ERROR; + + PLUGINDEBUGSTR("NP_Initialize"); + + /* validate input parameters */ + + if ((nsTable == NULL) || (pluginFuncs == NULL)) + err = NPERR_INVALID_FUNCTABLE_ERROR; + + /* + * Check the major version passed in Netscape's function table. + * We won't load if the major version is newer than what we expect. + * Also check that the function tables passed in are big enough for + * all the functions we need (they could be bigger, if Netscape added + * new APIs, but that's OK with us -- we'll just ignore them). + * + */ + + if (err == NPERR_NO_ERROR) { + if ((nsTable->version >> 8) > NP_VERSION_MAJOR) + err = NPERR_INCOMPATIBLE_VERSION_ERROR; + if (nsTable->size < ((char *)&nsTable->posturlnotify - (char *)nsTable)) + err = NPERR_INVALID_FUNCTABLE_ERROR; + if (pluginFuncs->size < sizeof(NPPluginFuncs)) + err = NPERR_INVALID_FUNCTABLE_ERROR; + } + + + if (err == NPERR_NO_ERROR) { + /* + * Copy all the fields of Netscape function table into our + * copy so we can call back into Netscape later. Note that + * we need to copy the fields one by one, rather than assigning + * the whole structure, because the Netscape function table + * could actually be bigger than what we expect. + */ + gNetscapeFuncs.version = nsTable->version; + gNetscapeFuncs.size = nsTable->size; + gNetscapeFuncs.posturl = nsTable->posturl; + gNetscapeFuncs.geturl = nsTable->geturl; + gNetscapeFuncs.geturlnotify = nsTable->geturlnotify; + gNetscapeFuncs.requestread = nsTable->requestread; + gNetscapeFuncs.newstream = nsTable->newstream; + gNetscapeFuncs.write = nsTable->write; + gNetscapeFuncs.destroystream = nsTable->destroystream; + gNetscapeFuncs.status = nsTable->status; + gNetscapeFuncs.uagent = nsTable->uagent; + gNetscapeFuncs.memalloc = nsTable->memalloc; + gNetscapeFuncs.memfree = nsTable->memfree; + gNetscapeFuncs.memflush = nsTable->memflush; + gNetscapeFuncs.reloadplugins = nsTable->reloadplugins; +#ifdef OJI + gNetscapeFuncs.getJavaEnv = nsTable->getJavaEnv; + gNetscapeFuncs.getJavaPeer = nsTable->getJavaPeer; +#endif + gNetscapeFuncs.getvalue = nsTable->getvalue; + gNetscapeFuncs.setvalue = nsTable->setvalue; + gNetscapeFuncs.posturlnotify = nsTable->posturlnotify; + + if (nsTable->size >= ((char *)&nsTable->setexception - (char *)nsTable)) + { + gNetscapeFuncs.invalidaterect = nsTable->invalidaterect; + gNetscapeFuncs.invalidateregion = nsTable->invalidateregion; + gNetscapeFuncs.forceredraw = nsTable->forceredraw; + gNetscapeFuncs.getstringidentifier = nsTable->getstringidentifier; + gNetscapeFuncs.getstringidentifiers = nsTable->getstringidentifiers; + gNetscapeFuncs.getintidentifier = nsTable->getintidentifier; + gNetscapeFuncs.identifierisstring = nsTable->identifierisstring; + gNetscapeFuncs.utf8fromidentifier = nsTable->utf8fromidentifier; + gNetscapeFuncs.intfromidentifier = nsTable->intfromidentifier; + gNetscapeFuncs.createobject = nsTable->createobject; + gNetscapeFuncs.retainobject = nsTable->retainobject; + gNetscapeFuncs.releaseobject = nsTable->releaseobject; + gNetscapeFuncs.invoke = nsTable->invoke; + gNetscapeFuncs.invokeDefault = nsTable->invokeDefault; + gNetscapeFuncs.evaluate = nsTable->evaluate; + gNetscapeFuncs.getproperty = nsTable->getproperty; + gNetscapeFuncs.setproperty = nsTable->setproperty; + gNetscapeFuncs.removeproperty = nsTable->removeproperty; + gNetscapeFuncs.hasproperty = nsTable->hasproperty; + gNetscapeFuncs.hasmethod = nsTable->hasmethod; + gNetscapeFuncs.releasevariantvalue = nsTable->releasevariantvalue; + gNetscapeFuncs.setexception = nsTable->setexception; + } + else + { + gNetscapeFuncs.invalidaterect = NULL; + gNetscapeFuncs.invalidateregion = NULL; + gNetscapeFuncs.forceredraw = NULL; + gNetscapeFuncs.getstringidentifier = NULL; + gNetscapeFuncs.getstringidentifiers = NULL; + gNetscapeFuncs.getintidentifier = NULL; + gNetscapeFuncs.identifierisstring = NULL; + gNetscapeFuncs.utf8fromidentifier = NULL; + gNetscapeFuncs.intfromidentifier = NULL; + gNetscapeFuncs.createobject = NULL; + gNetscapeFuncs.retainobject = NULL; + gNetscapeFuncs.releaseobject = NULL; + gNetscapeFuncs.invoke = NULL; + gNetscapeFuncs.invokeDefault = NULL; + gNetscapeFuncs.evaluate = NULL; + gNetscapeFuncs.getproperty = NULL; + gNetscapeFuncs.setproperty = NULL; + gNetscapeFuncs.removeproperty = NULL; + gNetscapeFuncs.hasproperty = NULL; + gNetscapeFuncs.releasevariantvalue = NULL; + gNetscapeFuncs.setexception = NULL; + } + if (nsTable->size >= + ((char *)&nsTable->poppopupsenabledstate - (char *)nsTable)) + { + gNetscapeFuncs.pushpopupsenabledstate = nsTable->pushpopupsenabledstate; + gNetscapeFuncs.poppopupsenabledstate = nsTable->poppopupsenabledstate; + } + else + { + gNetscapeFuncs.pushpopupsenabledstate = NULL; + gNetscapeFuncs.poppopupsenabledstate = NULL; + } + + /* + * Set up the plugin function table that Netscape will use to + * call us. Netscape needs to know about our version and size + * and have a UniversalProcPointer for every function we + * implement. + */ + pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; + pluginFuncs->size = sizeof(NPPluginFuncs); + pluginFuncs->newp = NewNPP_NewProc(Private_New); + pluginFuncs->destroy = NewNPP_DestroyProc(Private_Destroy); + pluginFuncs->setwindow = NewNPP_SetWindowProc(Private_SetWindow); + pluginFuncs->newstream = NewNPP_NewStreamProc(Private_NewStream); + pluginFuncs->destroystream = NewNPP_DestroyStreamProc(Private_DestroyStream); + pluginFuncs->asfile = NewNPP_StreamAsFileProc(Private_StreamAsFile); + pluginFuncs->writeready = NewNPP_WriteReadyProc(Private_WriteReady); + pluginFuncs->write = NewNPP_WriteProc(Private_Write); + pluginFuncs->print = NewNPP_PrintProc(Private_Print); + pluginFuncs->urlnotify = NewNPP_URLNotifyProc(Private_URLNotify); + pluginFuncs->event = NULL; +#ifdef OJI + pluginFuncs->javaClass = Private_GetJavaClass(); +#endif + // This function is supposedly loaded magically, but that doesn't + // seem to be true. + pluginFuncs->getvalue = NewNPP_GetValueProc(NP_GetValue); + + err = NPP_Initialize(); + } + + return err; +} + +/* + * NP_Shutdown [optional] + * - Netscape needs to know about this symbol. + * - It calls this function after looking up its symbol after + * the last object of this kind has been destroyed. + * + */ +NPError +NP_Shutdown(void) +{ + PLUGINDEBUGSTR("NP_Shutdown"); + NPP_Shutdown(); + return NPERR_NO_ERROR; +} diff -r dc12fc3a7869 -r a378a0a13aba plugin/test.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugin/test.html Fri Aug 08 14:17:33 2008 +0100 @@ -0,0 +1,19 @@ + + + +

Virt Viewer new plugin test

+ +

You will need to edit the source to + set uri, name etc.

+ + + + + +

End of page

+ + + From rjones at redhat.com Fri Aug 8 13:51:54 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 8 Aug 2008 14:51:54 +0100 Subject: [et-mgmt-tools] virt-mem 0.2.9 build failure against ocaml-libvirt-0.4.4.2 In-Reply-To: <489B4568.7050301@messageone.com> References: <20080806200024.GA13809@amd.home.annexia.org> <489B4568.7050301@messageone.com> Message-ID: <20080808135154.GB32690@amd.home.annexia.org> On Thu, Aug 07, 2008 at 01:56:40PM -0500, Charles Duffy wrote: > Trying to build virt-mem 0.2.9 against CentOS 5 + GODI OCaml install, > with ocaml-libvirt 0.4.4.2 and bitstring 1.9.7: > > ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package > unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c > virt_mem_utsname.ml > File "virt_mem_utsname.ml", line 81, characters 61-65: > This expression has type unit but is here used with type > Virt_mem_types.utsname option > make[1]: *** [virt_mem_utsname.cmo] Error 2 > make[1]: Leaving directory `/root/virt-mem-0.2.9/lib' > make: *** [all] Error 1 Yes, that'll be a bug then (and a rather nasty one at that in the ocaml-gettext package). This patch should fix it: http://hg.et.redhat.com/virt/applications/virt-mem--devel/?cs=80466cc75fbc Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 60 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora From Charles_Duffy at messageone.com Fri Aug 8 19:12:57 2008 From: Charles_Duffy at messageone.com (Charles Duffy) Date: Fri, 08 Aug 2008 14:12:57 -0500 Subject: [et-mgmt-tools] Re: [libvirt] [ANNOUNCE] virt-mem tools version 0.2.8 released In-Reply-To: <20080806200024.GA13809@amd.home.annexia.org> References: <20080806200024.GA13809@amd.home.annexia.org> Message-ID: One suggestion -- since you're using libvirt, why not leverage /domain/os/type/@os and @machine to set reasonable defaults for word size and endianness where possible? From rjones at redhat.com Fri Aug 8 19:41:22 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 8 Aug 2008 20:41:22 +0100 Subject: [et-mgmt-tools] Re: [libvirt] [ANNOUNCE] virt-mem tools version 0.2.8 released In-Reply-To: References: <20080806200024.GA13809@amd.home.annexia.org> Message-ID: <20080808194122.GA4339@amd.home.annexia.org> On Fri, Aug 08, 2008 at 02:12:57PM -0500, Charles Duffy wrote: > One suggestion -- since you're using libvirt, why not leverage > /domain/os/type/@os and @machine to set reasonable defaults for word > size and endianness where possible? Yes, this is a bug, or more accurately, not yet implemented. There's a big 'XXX' comment in the source to implement this (lib/virt_mem.ml). Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 60 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora From garich at ptd.net Sat Aug 9 10:04:51 2008 From: garich at ptd.net (Gary Richardson) Date: Sat, 09 Aug 2008 06:04:51 -0400 Subject: [et-mgmt-tools] re: virt-manager threads_init error Message-ID: <489D6BC3.5000200@ptd.net> >Cole Robinson wrote: >> Gary Richardson wrote: >> >>> my previous message: >>> >RunRunning virt-manager on my Fedora 9 system >>> >running kernel: 2.6.26-0.115.rc9.git2.fc10.x86_64 SMP >>> > >>> >I get the following error: >>> > >>> >gar xp]# virt-manager >>> >Traceback (most recent call last): >>> > File "/usr/share/virt-manager/virt-manager.py", line 310, >in >>> > main() >>> > File "/usr/share/virt-manager/virt-manager.py", line 239, >in main >>> > gtk.gdk.threads_init() >>> >SystemError: error return without exception set >>> >>> >>> >> >> I'm really not sure what could be causing this error. If >> threads_init() is causing problems I'm inclined to say >> it's not a virt-manager issue. >> >> Have you only recently hit this problem? Or is this your >> first time trying out the app? >> >> - Cole >>> >> >I saw this yesterday on a new install, which had been >upgraded to Rawhide. That said, the packages seem to be >the same as the F9 ones. > >As the original poster is also running a Rawhide kernel, >perhaps that's part of the problem? >Adam Yes, the problem is in pyobjects which must be upgraded to 2.15.2 in rawhide. Note: this is not just a rawhide issue. https://bugzilla.redhat.com/show_bug.cgi?id=457502 https://qa.mandriva.com/show_bug.cgi?id=42467 -- Gary Richardson Richardson Janitorial and More www.nodirtyfloors.com From rjones at redhat.com Sun Aug 10 10:07:32 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Sun, 10 Aug 2008 11:07:32 +0100 Subject: [et-mgmt-tools] Re: [libvirt] RE: [Qemu-devel] [ANNOUNCE] virt-mem tools version 0.2.8 released In-Reply-To: <20080810012827.GD20183@shareable.org> References: <20080806200024.GA13809@amd.home.annexia.org> <20080807104739.GN32548@redhat.com> <20080807130627.GA28036@amd.home.annexia.org> <90eb1dc70808070730q61ad5054r1796f8ce2ea73490@mail.gmail.com> <20080810012827.GD20183@shareable.org> Message-ID: <20080810100732.GA31209@amd.home.annexia.org> On Sun, Aug 10, 2008 at 02:28:27AM +0100, Jamie Lokier wrote: > Javier Guerra wrote: > > On Thu, Aug 7, 2008 at 8:06 AM, Richard W.M. Jones wrote: > > > I think the message here is, install libvirt & be happy :-) > > > > nice as this tool sounds, i would need far more than this to make me > > switch from a simple, easily scriptable command-line to a generic, > > 'lowest common', solution like libvirt. > > > > of course, i hope it keeps getting better. who knows? maybe in a year > > or so it would be comparable to the CLI. > > Regrettably I agree for the moment. > > I ended up writing a Perl management script for my KVM VMs because > libvirt was just too muddled and limited for my needs, and because the > config file format confused me, didn't handle everything I needed, and > I didn't find clear documentation on it. The configuration format is documented here: http://libvirt.org/formatdomain.html You can also print out the configuration from any existing guest using 'virsh dumpxml ' if you need examples. I'm intrigued by what your Perl management script needed that isn't exposed by libvirt. Libvirt deliberately doesn't expose the full feature set of any one hypervisor which it supports, but instead exposes common features. The reason for this is so that you can switch hypervisor technologies later on. Clearly, we all love KVM, but people have different needs from hypervisors and KVM won't fit all of them. For example, lightweight container-based approaches are better for some virtualization problems (particularly where you really need to run 100s or 1000s of guests on a single machine), and people will still be running Xen and VMWare for many years to come. [...] > What would be nicer is a VM management protocol build in to QEMU, KVM > and XEN, which is a bit like the monitor, but supports multiple client > connections and overlapping operations (where reasonable), and is a > bit more structured, so e.g. you can get the state of anything whose > state you can set, you can wait for events, etc. The somewhat > object-based config file work that's been discussed not long ago would > be a good thing to structure it around. This is what libvirt gives you (and lots more, eg. secure remote access to hypervisors, bindings to Perl & many other languages, etc.). Can you be more specfic about what you couldn't do with libvirt? Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From rjones at redhat.com Sun Aug 10 14:04:51 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Sun, 10 Aug 2008 15:04:51 +0100 Subject: [et-mgmt-tools] Re: [libvirt] RE: [Qemu-devel] [ANNOUNCE] virt-mem tools version 0.2.8 released In-Reply-To: <20080810100732.GA31209@amd.home.annexia.org> References: <20080806200024.GA13809@amd.home.annexia.org> <20080807104739.GN32548@redhat.com> <20080807130627.GA28036@amd.home.annexia.org> <90eb1dc70808070730q61ad5054r1796f8ce2ea73490@mail.gmail.com> <20080810012827.GD20183@shareable.org> <20080810100732.GA31209@amd.home.annexia.org> Message-ID: <20080810140415.GA31982@amd.home.annexia.org> On Sun, Aug 10, 2008 at 11:07:32AM +0100, Richard W.M. Jones wrote: > Libvirt deliberately doesn't expose the full > feature set of any one hypervisor which it supports, but instead > exposes common features. Judging by one private reply I got, I don't want this to be misinterpreted. Libvirt DOESN'T expose the minimum subset of all hypervisors (because that would be very small and useless). It exposes general virtualization features, even if those features only apply to one or two hypervisors. For example: migration - only works with Xen & KVM, but could be applicable to other hypervisors in the future when we support them and they support migration scheduler tuning - only for Xen, but generally applicable adding/dropping interfaces from live guests - a general feature supported by many but not all of the backends Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 60 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora From crobinso at redhat.com Mon Aug 11 01:47:37 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 10 Aug 2008 21:47:37 -0400 Subject: [et-mgmt-tools] [PATCH 0/3] virt-manager: manage and create libvirt storage Message-ID: <489F9A39.3090305@redhat.com> The following three patches add libvirt storage api management capabilities to virt-manager. Descriptions and screenshots provided with each individual patch. Thanks, Cole From crobinso at redhat.com Mon Aug 11 01:51:44 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 10 Aug 2008 21:51:44 -0400 Subject: [et-mgmt-tools] [PATCH 1/3]: Add a 'storage manager' in connection details In-Reply-To: <489F9A39.3090305@redhat.com> References: <489F9A39.3090305@redhat.com> Message-ID: <489F9B30.8070702@redhat.com> The attached patch adds a 'Storage Manager' to the connection details section. It's setup is similar to the network manager also in the connection details. The manager lists all pools on the connection and their associated details: name, type, total capacity and available space, as well as their associated volumes. All starting, stopping, and deleting of storage objects takes place here, as well as launching the the storage creation wizards (next patches). There is some small cleanup sprinkled in here as well of the existing network management code, nothing major though. Thanks to Tim Allen for most of the UI design. Screenshots can be seen here: http://fedorapeople.org/~crobinso/virt-manager/storage/storage-manager-01.png http://fedorapeople.org/~crobinso/virt-manager/storage/storage-manager-02.png http://fedorapeople.org/~crobinso/virt-manager/storage/storage-manager-03.png Thanks, Cole -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: virt-manager-storage-manager-patch URL: From crobinso at redhat.com Mon Aug 11 01:52:38 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 10 Aug 2008 21:52:38 -0400 Subject: [et-mgmt-tools] [PATCH 2/3] Add storage pool creation wizard In-Reply-To: <489F9A39.3090305@redhat.com> References: <489F9A39.3090305@redhat.com> Message-ID: <489F9B66.7070705@redhat.com> The attached patch adds a wizard for creating storage pools. It's pretty straight forward: the first screen asks for a name and a pool type (dir, fs, etc.), the next screen gets all the goodies as appropriate, like target path, format, hostname, and source path. This fields are all activated automagically by hasattr'ing the underlying virtinst object. The other option is whether to 'build' the pool or not. File based pools, this will be the default (since all it does is create a directory) however for things like disk pools we want to discourage this as it will wipe partition info if the user isn't careful. The logic for setting these defaults isn't in yet so for now it just defaults to nobuild. I intend for there to be info on the right hand side of the wizard that will update when the mouse rolls over the field, but I haven't filled this in yet either. Those issues aside the wizard works so I think it's in good enough shape to commit. Thanks to Tim Allen for most of the UI design. Page 1 screenshot: http://fedorapeople.org/~crobinso/virt-manager/storage/pool-usb-page1.png Page 2 screenshots: http://fedorapeople.org/~crobinso/virt-manager/storage/pool-usb-page2.png http://fedorapeople.org/~crobinso/virt-manager/storage/pool-nfs-page2.png Thanks, Cole -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: virt-manager-pool-wizard-patch URL: From crobinso at redhat.com Mon Aug 11 01:53:16 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 10 Aug 2008 21:53:16 -0400 Subject: [et-mgmt-tools] [PATCH 3/3] Add storage volume creation wizard In-Reply-To: <489F9A39.3090305@redhat.com> References: <489F9A39.3090305@redhat.com> Message-ID: <489F9B8C.5000504@redhat.com> The attached patch adds a storage volume creation wizard. This wizard is simpler than the one for storage pools: there is only one screen and fewer options. All that needs to be specified is a name, format, allocation and capacity. There is some interaction logic that isn't present yet, like disabling the name field for a disk volume, since we should just choose the next partition name. However it all works so it's in good shape to commit. Thanks to Tim Allen for most of the UI design. Screenshot: http://fedorapeople.org/~crobinso/virt-manager/storage/vol-create.png Thanks, Cole From mniranjan at redhat.com Mon Aug 11 06:02:44 2008 From: mniranjan at redhat.com ( Niranjan M.R) Date: Mon, 11 Aug 2008 11:32:44 +0530 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 Message-ID: <489FD604.2040204@redhat.com> Hi all, I am using FC9 x86_64 and trying to install virt-mem-0.2.8, But i get below error when trying to do "make" [root at dhcp7-90 virt-mem-0.2.8]# make for d in lib uname dmesg ps mem extract/fedora-koji extract/codegen po; do \ make -C $d all; \ if [ $? -ne 0 ]; then exit 1; fi; \ done make[1]: Entering directory `/opt/virt-mem-0.2.8/lib' ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_gettext.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_version.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_utils.ml gcc -g -O2 -Wall -Werror -I/usr/lib64/ocaml -I.. -c -o virt_mem_mmap_c.o virt_mem_mmap_c.c ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_mmap.ml File "virt_mem_mmap.ml", line 1, characters 0-1: Could not find the .cmi file for interface virt_mem_mmap.mli. make[1]: *** [virt_mem_mmap.cmo] Error 2 make[1]: Leaving directory `/opt/virt-mem-0.2.8/lib' make: *** [all] Error 1 Any ideas Regards Niranjan From crobinso at redhat.com Tue Aug 12 14:41:02 2008 From: crobinso at redhat.com (Cole Robinson) Date: Tue, 12 Aug 2008 10:41:02 -0400 Subject: [et-mgmt-tools] [PATCH 6/6] update virt-install options for specifying managed storage In-Reply-To: <20080807103138.GM32548@redhat.com> References: <4899CEDD.30503@redhat.com> <4899D0C8.9050909@redhat.com> <20080807103138.GM32548@redhat.com> Message-ID: <48A1A0FE.2060907@redhat.com> Daniel P. Berrange wrote: > On Wed, Aug 06, 2008 at 12:26:48PM -0400, Cole Robinson wrote: >> The attached patch updates virt-install to allow specifying >> libvirt managed storage. >> >> --file can specified managed storage using: >> >> - An absolute path to a managed volume >> - A volume passed as --file volume:poolname:volname >> - A pool to create storage on, using --file pool:poolname >> >> --cdrom can use the first of the above two options (doesn't >> make sense to create install media). >> >> There is an obvious problem with this approach though: >> Specifying pool:foo or volume:foo:bar could collide >> with existing file names, and volume:foo:bar would >> fail if the specified pool had a colon in it. This >> was mostly my quick solution so I could test it all >> out, i'm open to suggestions how to change it. Once an >> interface is decided on I'll update the docs. > > The other option would be to leave --file & --cdrom as they > already are, and instead use a more sensibly named option > like --disk. People are often confused thinging that can't > pass a block device to --file already. > > > The --cdrom arg also allows specifying a URI, in which case it > downloads the ISO image from the install tree for booting. > > So I'd suggest using URI syntax > > --disk file:///some/file/path[:cdrom|floppy][:ro|sh] > --disk vol:///poolname:volname[:cdrom|floppy][:ro|sh] > --disk pool:///poolname[:cdrom|floppy][:ro|sh] Hmm, I think this may be the way to go. Specifying all these options doesn't fit into the current model. The one issue I see with this, if we don't alter the --cdrom option, is how the user specifies they want to install off cdrom media. I guess if the user doesn't specify --pxe or --location we can check to see if they passed a cdrom (or floppy!) and try to use that. > > So this defaults to creating a harddisk, writable, but lets you annotate > the arg to specify that its a cdrom, or floppy, and optionally readonly > or read-write shared. In the future I expect we'll have more disk types > like Flash, or USB massstorage, etc, so better to have a single --disk > arg, than adding --floppy --usbmsd, --flash etc. > Agreed, I'll start working on this. Thanks, Cole From crobinso at redhat.com Tue Aug 12 21:06:38 2008 From: crobinso at redhat.com (Cole Robinson) Date: Tue, 12 Aug 2008 17:06:38 -0400 Subject: [et-mgmt-tools] [PATCH] virt-install cli options for managed storage Message-ID: <48A1FB5E.5070509@redhat.com> Per Dan's advice, I've changed the previously proposed virt-install cli options for specifying libvirt managed storage. This patch does not change any possible semantics of --file or --cdrom: they remain strictly for specifying local media. In this way they are basically deprecated. A new cli option is added: --disk. The format is: --disk path:///some/file/path[:device=cdrom|floppy][:permissions=ro|sh] --disk vol:///poolname/volname[:device=cdrom|floppy][:permissions=ro|sh] --disk pool:///poolname[:device=cdrom|floppy][:permissions=ro|sh] The changes from Dan's proposal are: - use of path:/// instead of file:///, since this will hopefully clear up any confusion users previously had with specifying block devices. - For vol:///, I used / as a delimiter vs. ':' between the pool and vol name, to avoid any extra collisions (since I assume '/' is not part of a legal pool name). - Explictly list what type of extra option we are appending (device, permissions). This adds clarity to the command line, reduces chance of name collision, and is similar to the approach used by qemu. The --disk option is quite useful even for the local case, since users can now add cdrom and floppy drives (and eventually other device types) via the cli. This could also be expanded to allow specifying file formats (qcow2, etc.) for creating new storage. The other functionality change is that disk:/// can be used to specify install media. If none of --pxe, --cdrom, or --location are specified, we look to see if a --disk device=cdrom was specified, and if so, use that for installation. We can eventually expand this to allow installing off floppies. One question: Is ':' an appropriate delimiter? qemu typically uses ',' for these types of cli options. May be an arbitrary choice, but perhaps someone has an opinion. There are some small changes in the patch to allow installers to skip setting up an install cdrom if no 'location' is specified, and just defering to the guests disks. The rest of the change is centered in virt-install. virt-install | 174 ++++++++++++++++++++++++++++++++++---------- virtinst/DistroManager.py | 6 + virtinst/LiveCDInstaller.py | 16 ++-- 3 files changed, 150 insertions(+), 46 deletions(-) Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virt-install-storage-cli.patch Type: text/x-patch Size: 12748 bytes Desc: not available URL: From crobinso at redhat.com Wed Aug 13 00:21:15 2008 From: crobinso at redhat.com (Cole Robinson) Date: Tue, 12 Aug 2008 20:21:15 -0400 Subject: [et-mgmt-tools] [PATCH] virtinst: add storage builders for logical pools and volumes Message-ID: <48A228FB.9000007@redhat.com> The attached patch adds virtinst support for building logical pools and volumes. Sort of. This will allow creating new volumes, but not creating pools (aka volume groups) from a specified set of physical disks. I believe libvirt supports this, but I haven't tried it yet. However this does allow the user to point at an existing lvm volume group and have it recognized as a storage pool which will be by far the common case. The nice thing about this is that it will all become immediately available in the virt-manager UI (posted previously). One thing I've encountered with this though: does a volume's target path have any significance upon creation? File volumes just seem to create a file based on the passed 'name', not target path. Disk volumes ignore both when creating. Logical vols also only use the name, but try to validate the target path after creation, which we shouldn't need passed (the result should simply be vgpath + "/" + volname). So it seems like target path has no real meaning when defining a volume. Am I missing something? Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-build-lv-pools.patch Type: text/x-diff Size: 3109 bytes Desc: not available URL: From berrange at redhat.com Wed Aug 13 10:56:05 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 13 Aug 2008 11:56:05 +0100 Subject: [et-mgmt-tools] [PATCH] virtinst: add storage builders for logical pools and volumes In-Reply-To: <48A228FB.9000007@redhat.com> References: <48A228FB.9000007@redhat.com> Message-ID: <20080813105605.GG11789@redhat.com> On Tue, Aug 12, 2008 at 08:21:15PM -0400, Cole Robinson wrote: > The attached patch adds virtinst support for building > logical pools and volumes. Sort of. This will allow > creating new volumes, but not creating pools (aka > volume groups) from a specified set of physical disks. > I believe libvirt supports this, but I haven't tried it > yet. Not a huge issue - using a pre-existing volume group is by far the most important use case here. > However this does allow the user to point at an existing > lvm volume group and have it recognized as a storage pool > which will be by far the common case. The nice thing > about this is that it will all become immediately available > in the virt-manager UI (posted previously). Looks good. > One thing I've encountered with this though: does a volume's > target path have any significance upon creation? File volumes > just seem to create a file based on the passed 'name', not > target path. Disk volumes ignore both when creating. Logical > vols also only use the name, but try to validate the target > path after creation, which we shouldn't need passed (the result > should simply be vgpath + "/" + volname). So it seems like > target path has no real meaning when defining a volume. Am > I missing something? That is correct - the target path for a volume is filled in according to the policy of the storage pool, often based off the name of the storage volume + the target path of the storage pool Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From rigg0022 at umn.edu Wed Aug 13 16:55:51 2008 From: rigg0022 at umn.edu (Ben Riggs) Date: Wed, 13 Aug 2008 11:55:51 -0500 Subject: [et-mgmt-tools] Missing? dependency for remote virt-manager on fc9 Message-ID: <48A31217.9040700@umn.edu> After a 'yum groupinstall virtualization' on a fresh fc9 install, calling virt-manager via ssh (w/ x-forwarding) does nothing. When calling virt-viewer, it reported a missing library. We traced the library to the package mesa-libGLU. After installing this pacakge via yum, virt-manager worked as expected. Thanks, Ben From crobinso at redhat.com Thu Aug 14 01:52:18 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 13 Aug 2008 21:52:18 -0400 Subject: [et-mgmt-tools] [PATCH] virt-install cli options for managed storage In-Reply-To: <48A1FB5E.5070509@redhat.com> References: <48A1FB5E.5070509@redhat.com> Message-ID: <48A38FD2.8020602@redhat.com> Cole Robinson wrote: > Per Dan's advice, I've changed the previously proposed > virt-install cli options for specifying libvirt managed > storage. > > This patch does not change any possible semantics of > --file or --cdrom: they remain strictly for specifying > local media. In this way they are basically deprecated. > > A new cli option is added: --disk. The format is: > > --disk path:///some/file/path[:device=cdrom|floppy][:permissions=ro|sh] > --disk vol:///poolname/volname[:device=cdrom|floppy][:permissions=ro|sh] > --disk pool:///poolname[:device=cdrom|floppy][:permissions=ro|sh] > > The changes from Dan's proposal are: > > - use of path:/// instead of file:///, since this will > hopefully clear up any confusion users previously had > with specifying block devices. > - For vol:///, I used / as a delimiter vs. ':' between > the pool and vol name, to avoid any extra collisions > (since I assume '/' is not part of a legal pool name). > - Explictly list what type of extra option we are > appending (device, permissions). This adds clarity > to the command line, reduces chance of name collision, > and is similar to the approach used by qemu. > > The --disk option is quite useful even for the local case, > since users can now add cdrom and floppy drives (and eventually > other device types) via the cli. This could also be expanded > to allow specifying file formats (qcow2, etc.) for creating > new storage. > > The other functionality change is that disk:/// can be used > to specify install media. If none of --pxe, --cdrom, or > --location are specified, we look to see if a --disk > device=cdrom was specified, and if so, use that for > installation. We can eventually expand this to allow > installing off floppies. > > One question: Is ':' an appropriate delimiter? qemu typically > uses ',' for these types of cli options. May be an arbitrary > choice, but perhaps someone has an opinion. > > There are some small changes in the patch to allow installers > to skip setting up an install cdrom if no 'location' is > specified, and just defering to the guests disks. The rest > of the change is centered in virt-install. > > Hmm. I've hit a problem in testing this. Using the URI syntax, bash doesn't seem to register it should auto complete paths. Basically, if you start entering '--disk path:///' tab autocompletetion doesn't work at all. I suggest changing this syntax then to use --disk path=/some/path --disk pool=poolname --disk vol=poolname/volname Thoughts? Thanks, Cole From berrange at redhat.com Thu Aug 14 08:16:46 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 09:16:46 +0100 Subject: [et-mgmt-tools] [PATCH] virt-install cli options for managed storage In-Reply-To: <48A38FD2.8020602@redhat.com> References: <48A1FB5E.5070509@redhat.com> <48A38FD2.8020602@redhat.com> Message-ID: <20080814081646.GB32102@redhat.com> On Wed, Aug 13, 2008 at 09:52:18PM -0400, Cole Robinson wrote: > Cole Robinson wrote: > Hmm. I've hit a problem in testing this. Using the URI syntax, bash doesn't > seem to register it should auto complete paths. Basically, if you start > entering '--disk path:///' tab autocompletetion doesn't work at all. > > I suggest changing this syntax then to use > > --disk path=/some/path Or just "--disk /some/path" - ie treat a leading '/' as a path, unless you want to allow relative paths ? Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 14 08:17:57 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 09:17:57 +0100 Subject: [et-mgmt-tools] Re: [PATCH] virt-install cli options for managed storage In-Reply-To: <48A1FB5E.5070509@redhat.com> References: <48A1FB5E.5070509@redhat.com> Message-ID: <20080814081757.GC32102@redhat.com> On Tue, Aug 12, 2008 at 05:06:38PM -0400, Cole Robinson wrote: > Per Dan's advice, I've changed the previously proposed > virt-install cli options for specifying libvirt managed > storage. > > This patch does not change any possible semantics of > --file or --cdrom: they remain strictly for specifying > local media. In this way they are basically deprecated. > > A new cli option is added: --disk. The format is: > > --disk path:///some/file/path[:device=cdrom|floppy][:permissions=ro|sh] > --disk vol:///poolname/volname[:device=cdrom|floppy][:permissions=ro|sh] > --disk pool:///poolname[:device=cdrom|floppy][:permissions=ro|sh] > > The changes from Dan's proposal are: > > - use of path:/// instead of file:///, since this will > hopefully clear up any confusion users previously had > with specifying block devices. > - For vol:///, I used / as a delimiter vs. ':' between > the pool and vol name, to avoid any extra collisions > (since I assume '/' is not part of a legal pool name). > - Explictly list what type of extra option we are > appending (device, permissions). This adds clarity > to the command line, reduces chance of name collision, > and is similar to the approach used by qemu. > > The --disk option is quite useful even for the local case, > since users can now add cdrom and floppy drives (and eventually > other device types) via the cli. This could also be expanded > to allow specifying file formats (qcow2, etc.) for creating > new storage. > > The other functionality change is that disk:/// can be used > to specify install media. If none of --pxe, --cdrom, or > --location are specified, we look to see if a --disk > device=cdrom was specified, and if so, use that for > installation. We can eventually expand this to allow > installing off floppies. > > One question: Is ':' an appropriate delimiter? qemu typically > uses ',' for these types of cli options. May be an arbitrary > choice, but perhaps someone has an opinion. You could use ',', or we could use full URI syntax vol:///poolname/volname?device=[cdrom|floppy][;permissions=ro|sh] Separating params by a ';' or '&' - the former avoids shell metacharacter expansion Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From agx at sigxcpu.org Thu Aug 14 08:18:45 2008 From: agx at sigxcpu.org (Guido =?iso-8859-1?Q?G=FCnther?=) Date: Thu, 14 Aug 2008 10:18:45 +0200 Subject: [et-mgmt-tools] [patch] set correct mac type on virt-clone Message-ID: <20080814081845.GA25868@bogon.ms20.nix> Hi, attached is a patch that sets the correct mac address type when using virt-clone. It continues to use the Xen prefix for unknown hypervisors but uses the correct one for kvm/qemu. I also added some doctest. virt-image/virt-inst still need to be fixed up at a later point. Cheers, -- Guido -------------- next part -------------- A non-text attachment was scrubbed... Name: mac-prefix.diff Type: text/x-diff Size: 2692 bytes Desc: not available URL: From berrange at redhat.com Thu Aug 14 08:49:08 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 09:49:08 +0100 Subject: [et-mgmt-tools] Missing? dependency for remote virt-manager on fc9 In-Reply-To: <48A31217.9040700@umn.edu> References: <48A31217.9040700@umn.edu> Message-ID: <20080814084908.GD32102@redhat.com> On Wed, Aug 13, 2008 at 11:55:51AM -0500, Ben Riggs wrote: > After a 'yum groupinstall virtualization' on a fresh fc9 install, > calling virt-manager via ssh (w/ x-forwarding) does nothing. When > calling virt-viewer, it reported a missing library. We traced the > library to the package mesa-libGLU. After installing this pacakge via > yum, virt-manager worked as expected. Your installation must have forced an install with dependancies at some point. There is a clear defined dependancy chain that would ensure mesa-libGLU gets installed - virt-viewer depends on gtk-vnc, which in turns depends on libGLU which is provided by mesa-libGLU. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From rjones at redhat.com Thu Aug 14 09:28:58 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 14 Aug 2008 10:28:58 +0100 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <489FD604.2040204@redhat.com> References: <489FD604.2040204@redhat.com> Message-ID: <20080814092858.GA22188@amd.home.annexia.org> On Mon, Aug 11, 2008 at 11:32:44AM +0530, Niranjan M.R wrote: > File "virt_mem_mmap.ml", line 1, characters 0-1: > Could not find the .cmi file for interface virt_mem_mmap.mli. Sorry, only just seen this email. These errors are always caused because the .depend file hasn't been rebuilt. Just doing 'make depend' should fix it. It's probably a bug in the .depend file we distribute with the tarball ... Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/ From mniranjan at redhat.com Thu Aug 14 10:36:14 2008 From: mniranjan at redhat.com (M.R Niranjan ) Date: Thu, 14 Aug 2008 16:06:14 +0530 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <20080814092858.GA22188@amd.home.annexia.org> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> Message-ID: <48A40A9E.1070208@redhat.com> Richard W.M. Jones wrote: > On Mon, Aug 11, 2008 at 11:32:44AM +0530, Niranjan M.R wrote: > >> File "virt_mem_mmap.ml", line 1, characters 0-1: >> Could not find the .cmi file for interface virt_mem_mmap.mli. >> > > Sorry, only just seen this email. > > These errors are always caused because the .depend file hasn't been > rebuilt. Just doing 'make depend' should fix it. It's probably a bug > in the .depend file we distribute with the tarball ... > > Rich. > > You mean, before i run make , i should type "make depend" and then run "make" and "make install" ? Regards Niranjan From rjones at redhat.com Thu Aug 14 10:44:28 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 14 Aug 2008 11:44:28 +0100 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <48A40A9E.1070208@redhat.com> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> Message-ID: <20080814104428.GA22420@amd.home.annexia.org> On Thu, Aug 14, 2008 at 04:06:14PM +0530, M.R Niranjan wrote: > You mean, before i run make , i should type "make depend" and then run > "make" and "make install" ? Yes, exactly. You might also want to try out version 0.3.0 which I (quietly) put out yesterday. I'm currently rewriting the parsing code again so it can load all kernel structures automatically -- this turned out to be necessary for virt-ifconfig because things like the network interface addresses are stored in multiple, indirect, linked lists of structures/ sub-structures/ sub-sub-..., and writing code to navigate through those manually was getting very tedious. Should have something to show for this by the weekend. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v From mniranjan at redhat.com Thu Aug 14 11:15:17 2008 From: mniranjan at redhat.com (M.R Niranjan ) Date: Thu, 14 Aug 2008 16:45:17 +0530 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <20080814104428.GA22420@amd.home.annexia.org> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> Message-ID: <48A413C5.5050605@redhat.com> Richard W.M. Jones wrote: > On Thu, Aug 14, 2008 at 04:06:14PM +0530, M.R Niranjan wrote: > >> You mean, before i run make , i should type "make depend" and then run >> "make" and "make install" ? >> > > Yes, exactly. > > I tried this, and i still got the error I did first ./configure --prefix=/usr/local/virt-mem then i ran make depend and i got the same error make depend for d in lib uname dmesg ps mem extract/fedora-koji extract/codegen; do \ make -C $d depend; \ if [ $? -ne 0 ]; then exit 1; fi; \ done make[1]: Entering directory `/opt/virt-mem-0.2.8/lib' rm -f .depend ocamlfind ocamldep -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -syntax bitstring.syntax kernel_net_device.mli kernel_task_struct.mli virt_mem_kallsyms.mli virt_mem_ksyms.mli virt_mem.mli virt_mem_mmap.mli virt_mem_types.mli virt_mem_utsname.mli kernel_net_device.ml kernel_task_struct.ml test_mmap.ml virt_mem_capture.ml virt_mem_gettext.ml virt_mem_kallsyms.ml virt_mem_ksyms.ml virt_mem.ml virt_mem_mmap.ml virt_mem_types.ml virt_mem_utils.ml virt_mem_utsname.ml virt_mem_version.ml > .depend make[1]: Leaving directory `/opt/virt-mem-0.2.8/lib' make[1]: Entering directory `/opt/virt-mem-0.2.8/lib' make[1]: Nothing to be done for `depend'. make[1]: Leaving directory `/opt/virt-mem-0.2.8/lib' make[1]: Entering directory `/opt/virt-mem-0.2.8/uname' make[1]: Nothing to be done for `depend'. make[1]: Leaving directory `/opt/virt-mem-0.2.8/uname' make[1]: Entering directory `/opt/virt-mem-0.2.8/dmesg' make[1]: Nothing to be done for `depend'. make[1]: Leaving directory `/opt/virt-mem-0.2.8/dmesg' make[1]: Entering directory `/opt/virt-mem-0.2.8/ps' make[1]: Nothing to be done for `depend'. make[1]: Leaving directory `/opt/virt-mem-0.2.8/ps' make[1]: Entering directory `/opt/virt-mem-0.2.8/mem' make[1]: Nothing to be done for `depend'. make[1]: Leaving directory `/opt/virt-mem-0.2.8/mem' make[1]: Entering directory `/opt/virt-mem-0.2.8/extract/fedora-koji' make[1]: Nothing to be done for `depend'. make[1]: Leaving directory `/opt/virt-mem-0.2.8/extract/fedora-koji' make[1]: Entering directory `/opt/virt-mem-0.2.8/extract/codegen' make[1]: Nothing to be done for `depend'. make[1]: Leaving directory `/opt/virt-mem-0.2.8/extract/codegen' [root at dhcp7-90 virt-mem-0.2.8]# make for d in lib uname dmesg ps mem extract/fedora-koji extract/codegen po; do \ make -C $d all; \ if [ $? -ne 0 ]; then exit 1; fi; \ done make[1]: Entering directory `/opt/virt-mem-0.2.8/lib' ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_gettext.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_version.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_utils.ml gcc -g -O2 -Wall -Werror -I/usr/lib64/ocaml -I.. -c -o virt_mem_mmap_c.o virt_mem_mmap_c.c ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_mmap.mli ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_mmap.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c kernel_task_struct.mli ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c kernel_task_struct.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c kernel_net_device.mli ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c kernel_net_device.ml ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_types.mli ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_types.ml File "virt_mem_types.ml", line 78, characters 6-19: Unbound value D.memory_peek make[1]: *** [virt_mem_types.cmo] Error 2 make[1]: Leaving directory `/opt/virt-mem-0.2.8/lib' make: *** [all] Error 1 > You might also want to try out version 0.3.0 which I (quietly) > put out yesterday. > I get the same above error for 0.3.0 also (Unbound value D.memory_peek) , I ran "make depend" before i ran "make" make for d in lib uname dmesg ps ifconfig mem extract/fedora-koji extract/codegen; do \ make -C $d all; \ if [ $? -ne 0 ]; then exit 1; fi; \ done make[1]: Entering directory `/opt/virt-mem-0.3.0/lib' ocamlfind ocamlc -dtypes -g -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -c virt_mem_types.ml File "virt_mem_types.ml", line 103, characters 6-19: Unbound value D.memory_peek make[1]: *** [virt_mem_types.cmo] Error 2 make[1]: Leaving directory `/opt/virt-mem-0.3.0/lib' make: *** [all] Error 1 Regards Niranjan > I'm currently rewriting the parsing code again so it can load all > kernel structures automatically -- this turned out to be necessary for > virt-ifconfig because things like the network interface addresses are > stored in multiple, indirect, linked lists of structures/ > sub-structures/ sub-sub-..., and writing code to navigate through > those manually was getting very tedious. Should have something to > show for this by the weekend. > > Rich. > > From rjones at redhat.com Thu Aug 14 11:35:07 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 14 Aug 2008 12:35:07 +0100 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <48A413C5.5050605@redhat.com> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> <48A413C5.5050605@redhat.com> Message-ID: <20080814113507.GA22545@amd.home.annexia.org> On Thu, Aug 14, 2008 at 04:45:17PM +0530, M.R Niranjan wrote: > File "virt_mem_types.ml", line 78, characters 6-19: > Unbound value D.memory_peek OK, so now you're getting a different error. This is because you need a newer ocaml-libvirt (try 0.4.4.2). The one you have doesn't support the libvirt virDomainMemoryPeek call, which was only added to libvirt quite recently. I will add a check into the configure file for that, and also a better error message. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into Xen guests. http://et.redhat.com/~rjones/virt-p2v From crobinso at redhat.com Thu Aug 14 13:36:11 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 14 Aug 2008 09:36:11 -0400 Subject: [et-mgmt-tools] Re: [PATCH] virt-install cli options for managed storage In-Reply-To: <20080814081757.GC32102@redhat.com> References: <48A1FB5E.5070509@redhat.com> <20080814081757.GC32102@redhat.com> Message-ID: <48A434CB.8060501@redhat.com> Daniel P. Berrange wrote: > On Tue, Aug 12, 2008 at 05:06:38PM -0400, Cole Robinson wrote: >> Per Dan's advice, I've changed the previously proposed >> virt-install cli options for specifying libvirt managed >> storage. >> >> This patch does not change any possible semantics of >> --file or --cdrom: they remain strictly for specifying >> local media. In this way they are basically deprecated. >> >> A new cli option is added: --disk. The format is: >> >> --disk path:///some/file/path[:device=cdrom|floppy][:permissions=ro|sh] >> --disk vol:///poolname/volname[:device=cdrom|floppy][:permissions=ro|sh] >> --disk pool:///poolname[:device=cdrom|floppy][:permissions=ro|sh] >> >> The changes from Dan's proposal are: >> >> - use of path:/// instead of file:///, since this will >> hopefully clear up any confusion users previously had >> with specifying block devices. >> - For vol:///, I used / as a delimiter vs. ':' between >> the pool and vol name, to avoid any extra collisions >> (since I assume '/' is not part of a legal pool name). >> - Explictly list what type of extra option we are >> appending (device, permissions). This adds clarity >> to the command line, reduces chance of name collision, >> and is similar to the approach used by qemu. >> >> The --disk option is quite useful even for the local case, >> since users can now add cdrom and floppy drives (and eventually >> other device types) via the cli. This could also be expanded >> to allow specifying file formats (qcow2, etc.) for creating >> new storage. >> >> The other functionality change is that disk:/// can be used >> to specify install media. If none of --pxe, --cdrom, or >> --location are specified, we look to see if a --disk >> device=cdrom was specified, and if so, use that for >> installation. We can eventually expand this to allow >> installing off floppies. >> >> One question: Is ':' an appropriate delimiter? qemu typically >> uses ',' for these types of cli options. May be an arbitrary >> choice, but perhaps someone has an opinion. > > You could use ',', or we could use full URI syntax > > vol:///poolname/volname?device=[cdrom|floppy][;permissions=ro|sh] > > Separating params by a ';' or '&' - the former avoids shell > metacharacter expansion > > Daniel I'm kind of leaning away from the URI syntax. Granted it is well known, but requiring people to remember at least 4 special delimiters ( type:///, ?, option=, ; or : or ,) seems a bit much. With the tab expansion issue as well, I think using the qemu -drive syntax of just 'option=' with a ',' delimiter is the way to go. - Cole From berrange at redhat.com Thu Aug 14 14:05:29 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 15:05:29 +0100 Subject: [et-mgmt-tools] [PATCH 1/5] Rename plugin/ directory to oldplugin/ In-Reply-To: <20080808133748.GA32767@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> <20080808133748.GA32767@amd.home.annexia.org> Message-ID: <20080814140528.GS32102@redhat.com> On Fri, Aug 08, 2008 at 02:37:48PM +0100, Richard W.M. Jones wrote: > > Rename plugin/ directory to oldplugin/ > - Also fix .hgignore to ignore generated files in oldplugin directory. I don't like this - I don't see why we can't just keep both plugins available in one directory. Just give them different names. eg call the new one virt-viewer-command-plugin.so and have the source for both in the plugins/ directory. In the binary build, we can have a separate sub-RPM for each plugin, so the user can choose which they prefer to use. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Thu Aug 14 14:07:20 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 15:07:20 +0100 Subject: [et-mgmt-tools] [PATCH 2/5] Change --enable-plugin => --enable-oldplugin, and add a new --enable-plugin. In-Reply-To: <20080808133827.GB32767@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> <20080808133827.GB32767@amd.home.annexia.org> Message-ID: <20080814140720.GT32102@redhat.com> On Fri, Aug 08, 2008 at 02:38:27PM +0100, Richard W.M. Jones wrote: > > Change --enable-plugin => --enable-oldplugin, and add a new --enable-plugin. > - Ignore generated files in the (new) plugin/ directory. > - -DPLUGIN=1 => -DOLDPLUGIN=1 in src/main.c. I'd like to see just a single '--enable-plugins' which turns on both plugins. If we want to distinguish then perhaps allow an optional argument --enable-plugins=internal for the inline plugin and --enable-plugins=external for the command launching variant Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From mniranjan at redhat.com Thu Aug 14 14:12:33 2008 From: mniranjan at redhat.com (M.R Niranjan ) Date: Thu, 14 Aug 2008 19:42:33 +0530 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <20080814113507.GA22545@amd.home.annexia.org> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> <48A413C5.5050605@redhat.com> <20080814113507.GA22545@amd.home.annexia.org> Message-ID: <48A43D51.6020606@redhat.com> Richard W.M. Jones wrote: > On Thu, Aug 14, 2008 at 04:45:17PM +0530, M.R Niranjan wrote: > >> File "virt_mem_types.ml", line 78, characters 6-19: >> Unbound value D.memory_peek >> > > Hi, i updated my ocaml-libvirt to 0.4.4.2-1 and issue "make" command, i get the below error [root at dhcp7-90 virt-mem-0.3.0]# make for d in lib uname dmesg ps ifconfig mem extract/fedora-koji extract/codegen; do \ make -C $d all; \ if [ $? -ne 0 ]; then exit 1; fi; \ done make[1]: Entering directory `/opt/virt-mem-0.3.0/lib' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/opt/virt-mem-0.3.0/lib' make[1]: Entering directory `/opt/virt-mem-0.3.0/uname' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/opt/virt-mem-0.3.0/uname' make[1]: Entering directory `/opt/virt-mem-0.3.0/dmesg' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/opt/virt-mem-0.3.0/dmesg' make[1]: Entering directory `/opt/virt-mem-0.3.0/ps' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/opt/virt-mem-0.3.0/ps' make[1]: Entering directory `/opt/virt-mem-0.3.0/ifconfig' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/opt/virt-mem-0.3.0/ifconfig' make[1]: Entering directory `/opt/virt-mem-0.3.0/mem' ocamlfind ocamlopt \ -syntax bitstring.syntax -package unix,bigarray,extlib,libvirt,xml-light,bitstring.syntax -I ../lib -linkpkg bitstring.cmxa ../lib/virt_mem.cmxa ../uname/virt_uname.cmx ../dmesg/virt_dmesg.cmx ../ps/virt_ps.cmx ../ifconfig/virt_ifconfig.cmx virt_mem_main.cmx -o virt-mem.opt /usr/bin/ld: cannot find -lvirt collect2: ld returned 1 exit status Error during linking make[1]: *** [virt-mem.opt] Error 2 make[1]: Leaving directory `/opt/virt-mem-0.3.0/mem' make: *** [all] Error 1 I am sure i am missing some thing, Any ideas ? Regards Niranjan > OK, so now you're getting a different error. > > This is because you need a newer ocaml-libvirt (try 0.4.4.2). The one > you have doesn't support the libvirt virDomainMemoryPeek call, which > was only added to libvirt quite recently. > > I will add a check into the configure file for that, and also a better > error message. > > Rich. > > From berrange at redhat.com Thu Aug 14 14:15:19 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 15:15:19 +0100 Subject: [et-mgmt-tools] [PATCH 5/5] "Launch virt-viewer" (new) browser plugin. In-Reply-To: <20080808134314.GE32767@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> <20080808134314.GE32767@amd.home.annexia.org> Message-ID: <20080814141519.GU32102@redhat.com> On Fri, Aug 08, 2008 at 02:43:14PM +0100, Richard W.M. Jones wrote: > +NPError > +launcherRun (PluginInstance *self, > + int16 argc, char* argn[], char* argv[]) > +{ > + int i; > + const char *uri = NULL; > + const char *name = NULL; > + int direct = 0; > + int waitvnc = 0; > + int pid; > + > + /* Protect against being called multiple times. */ > + if (!self->launched) { > + self->launched = TRUE; > + > + /* Parse the parameters given in . */ > + i = argc; > + while (i > 0) { > + i --; > + if (argv[i] != NULL) { > + if (!PL_strcasecmp (argn[i], "URI")) > + uri = argv[i]; > + else if (!PL_strcasecmp (argn[i], "NAME")) > + name = argv[i]; > + else if (!PL_strcasecmp (argn[i], "DIRECT")) > + direct = strcmp (argv[i], "1") == 0; > + else if (!PL_strcasecmp (argn[i], "WAITVNC")) > + waitvnc = strcmp (argv[i], "1") == 0; > + } > + } > + > + /* Create child process. */ > + pid = fork (); > + if (pid < 0) { > + perror ("fork"); > + return NPERR_GENERIC_ERROR; > + } > + if (pid == 0) /* Child. */ > + startVirtViewerAndExit (self, uri, name, direct, waitvnc); > + else /* Parent. */ > + waitpid (pid, NULL, 0); > + } > + > + return NPERR_NO_ERROR; > +} Am I understanding this correctly, that it'll launch the virt-viewer program immediately upon loading the HTML page containing the plugin snippet ? If so that's a huge security problem - you are spawning a program which is allowed to connect to any host on the internet. It is also a denial-of-service - malicous javascript could write a page containing thousands of snippets which would spawn thousands of processes. I'd rather expect the plugin to have a small embedded area in the HTML page showing the details of what host will be connected to, what port, and then a button which has to be explicitly pressed to launch the external viewer. For safety I think you also need to block all signals before doing the fork() and reset signal handlers before unblocking and exec'ing, and unblocking the parent. You don't want signal handlers from the browser running in the child between the fork/exec window. > + > +static void > +startVirtViewerAndExit (PluginInstance *self ATTRIBUTE_UNUSED, > + const char *uri, const char *name, > + int direct, int waitvnc) > +{ > + int pid; > + int i, maxfd, len; > + const char **argv; > + > + /* Fork again to detach ourselves completely from the browser > + * process (probably not necessary on Windoze). > + */ > + pid = fork (); Well Windows doesn't have fork()/exec() at all does it ? > + if (pid < 0) { > + perror ("fork"); > + return; > + } > + if (pid > 0) /* Parent. */ > + _exit (0); > + > + /* Child ... Close any open file descriptors, leaving 0, 1 & 2 > + * connected so that we'll still see any error messages. > + */ > + maxfd = sysconf (_SC_OPEN_MAX) - 1; > + for (i = 3; i <= maxfd; ++i) > + close (i); > + > + /* Build the argument array. */ > + len = 1 + /* "virt-viewer" (argv 0) */ > + (uri ? 2 : 0) + /* "-c" uri */ > + (direct ? 1 : 0) + /* "-d" */ > + (waitvnc ? 1 : 0) + /* "-w" */ > + 1 + /* name */ > + 1; /* NULL */ > + argv = NPN_MemAlloc (sizeof (char *) * len); > + if (!argv) { > + perror ("malloc"); > + goto cleanup; > + } > + > + i = 0; > + argv[i++] = "virt-viewer"; > + if (uri) { > + argv[i++] = "-c"; > + argv[i++] = uri; > + } > + if (direct) > + argv[i++] = "-d"; > + if (waitvnc) > + argv[i++] = "-w"; > + argv[i++] = name; > + > + argv[i++] = NULL; > + > + if (i != len) { > + fprintf (stderr, > + "virt-viewer launcher_plugin: internal error: i=%d != len=%d\n", > + i, len); > + goto cleanup; > + } > + > + execvp ("virt-viewer", argv); > + perror ("execvp"); > + > + cleanup: > + _exit (1); > +} > + > +void > +launcherDestroy (PluginInstance *self) > +{ > + /* Nothing to free. Just stop launcherRun from doing anything if > + * the browser tries to (incorrectly) call it a second time. Not > + * that well-written browsers would do anything like that. Oh no. > + */ > + self->launched = TRUE; > +} Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From rjones at redhat.com Thu Aug 14 16:02:32 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 14 Aug 2008 17:02:32 +0100 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <48A43D51.6020606@redhat.com> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> <48A413C5.5050605@redhat.com> <20080814113507.GA22545@amd.home.annexia.org> <48A43D51.6020606@redhat.com> Message-ID: <20080814160232.GB22545@amd.home.annexia.org> On Thu, Aug 14, 2008 at 07:42:33PM +0530, M.R Niranjan wrote: > /usr/bin/ld: cannot find -lvirt > collect2: ld returned 1 exit status > Error during linking You have got libvirt installed, right? If you installed libvirt on some non-standard path then you may need to tell configure where it is. I think you need to do: LIBS="/some/nonstandard/path" ./configure If that doesn't work try LIBRARY_PATH instead of LIBS. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/ From rjones at redhat.com Thu Aug 14 16:03:50 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 14 Aug 2008 17:03:50 +0100 Subject: [et-mgmt-tools] [PATCH 1/5] Rename plugin/ directory to oldplugin/ In-Reply-To: <20080814140528.GS32102@redhat.com> References: <20080808133556.GA32690@amd.home.annexia.org> <20080808133748.GA32767@amd.home.annexia.org> <20080814140528.GS32102@redhat.com> Message-ID: <20080814160350.GC22545@amd.home.annexia.org> On Thu, Aug 14, 2008 at 03:05:29PM +0100, Daniel P. Berrange wrote: > On Fri, Aug 08, 2008 at 02:37:48PM +0100, Richard W.M. Jones wrote: > > > > Rename plugin/ directory to oldplugin/ > > - Also fix .hgignore to ignore generated files in oldplugin directory. > > I don't like this - I don't see why we can't just keep both plugins > available in one directory. Just give them different names. eg call > the new one virt-viewer-command-plugin.so and have the source for > both in the plugins/ directory. In the binary build, we can have > a separate sub-RPM for each plugin, so the user can choose which > they prefer to use. I think I felt we should deprecate the old plugin. Keep it around for a while just in case anyone can make it work, otherwise delete it. What do you think? Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From rjones at redhat.com Thu Aug 14 16:07:09 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 14 Aug 2008 17:07:09 +0100 Subject: [et-mgmt-tools] [PATCH 5/5] "Launch virt-viewer" (new) browser plugin. In-Reply-To: <20080814141519.GU32102@redhat.com> References: <20080808133556.GA32690@amd.home.annexia.org> <20080808134314.GE32767@amd.home.annexia.org> <20080814141519.GU32102@redhat.com> Message-ID: <20080814160709.GD22545@amd.home.annexia.org> On Thu, Aug 14, 2008 at 03:15:19PM +0100, Daniel P. Berrange wrote: > Am I understanding this correctly, that it'll launch the virt-viewer > program immediately upon loading the HTML page containing the plugin > snippet ? If so that's a huge security problem - you are > spawning a program which is allowed to connect to any host on the > internet. It is also a denial-of-service - malicous javascript > could write a page containing thousands of snippets which > would spawn thousands of processes. > > I'd rather expect the plugin to have a small embedded area in the > HTML page showing the details of what host will be connected to, > what port, and then a button which has to be explicitly pressed > to launch the external viewer. Yes ... The trouble is if we do this, we end up needing to embed Gtk widgets in the browser, which takes us back to square one. I'll raise this on #virt, see if we can talk through the issues again. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From crobinso at redhat.com Thu Aug 14 16:28:24 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 14 Aug 2008 12:28:24 -0400 Subject: [et-mgmt-tools] [PATCH] virt-install cli options for managed storage In-Reply-To: <48A1FB5E.5070509@redhat.com> References: <48A1FB5E.5070509@redhat.com> Message-ID: <48A45D28.2010806@redhat.com> Cole Robinson wrote: > Per Dan's advice, I've changed the previously proposed > virt-install cli options for specifying libvirt managed > storage. > > This patch does not change any possible semantics of > --file or --cdrom: they remain strictly for specifying > local media. In this way they are basically deprecated. > Here's the second cut. Format for the cli options is --disk path=/some/path[,device=cdrom|floppy][,permissions=ro|sh] --disk pool=poolname[,device=cdrom|floppy][,permissions=ro|sh] --disk vol=poolname/volname[,device=cdrom|floppy][,permissions=ro|sh] Hopefully this will simplify things and fix the issues encountered. Once this is committed I'll be writing up the man pages and creating a wiki page detailing how this can all fit together for remote installs. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virtinst-storage-cli-02.patch Type: text/x-patch Size: 14477 bytes Desc: not available URL: From berrange at redhat.com Thu Aug 14 16:47:31 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 17:47:31 +0100 Subject: [et-mgmt-tools] [PATCH] virt-install cli options for managed storage In-Reply-To: <48A45D28.2010806@redhat.com> References: <48A1FB5E.5070509@redhat.com> <48A45D28.2010806@redhat.com> Message-ID: <20080814164731.GX32102@redhat.com> On Thu, Aug 14, 2008 at 12:28:24PM -0400, Cole Robinson wrote: > Cole Robinson wrote: > > Per Dan's advice, I've changed the previously proposed > > virt-install cli options for specifying libvirt managed > > storage. > > > > This patch does not change any possible semantics of > > --file or --cdrom: they remain strictly for specifying > > local media. In this way they are basically deprecated. > > > > Here's the second cut. Format for the cli options is > > --disk path=/some/path[,device=cdrom|floppy][,permissions=ro|sh] > --disk pool=poolname[,device=cdrom|floppy][,permissions=ro|sh] > --disk vol=poolname/volname[,device=cdrom|floppy][,permissions=ro|sh] > > Hopefully this will simplify things and fix the issues encountered. Ok, this looks good to me now, though shorten 'permissions' to 'perms' because I'm lazy typing. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From crobinso at redhat.com Thu Aug 14 17:15:42 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 14 Aug 2008 13:15:42 -0400 Subject: [et-mgmt-tools] [PATCH] virtinst: add storage builders for logical pools and volumes In-Reply-To: <20080813105605.GG11789@redhat.com> References: <48A228FB.9000007@redhat.com> <20080813105605.GG11789@redhat.com> Message-ID: <48A4683E.3040602@redhat.com> Daniel P. Berrange wrote: > On Tue, Aug 12, 2008 at 08:21:15PM -0400, Cole Robinson wrote: >> The attached patch adds virtinst support for building >> logical pools and volumes. Sort of. This will allow >> creating new volumes, but not creating pools (aka >> volume groups) from a specified set of physical disks. >> I believe libvirt supports this, but I haven't tried it >> yet. > > Not a huge issue - using a pre-existing volume group is by > far the most important use case here. > >> However this does allow the user to point at an existing >> lvm volume group and have it recognized as a storage pool >> which will be by far the common case. The nice thing >> about this is that it will all become immediately available >> in the virt-manager UI (posted previously). > > Looks good. > >> One thing I've encountered with this though: does a volume's >> target path have any significance upon creation? File volumes >> just seem to create a file based on the passed 'name', not >> target path. Disk volumes ignore both when creating. Logical >> vols also only use the name, but try to validate the target >> path after creation, which we shouldn't need passed (the result >> should simply be vgpath + "/" + volname). So it seems like >> target path has no real meaning when defining a volume. Am >> I missing something? > > That is correct - the target path for a volume is filled in > according to the policy of the storage pool, often based off > the name of the storage volume + the target path of the > storage pool > > Daniel > Okay, I've committed this. http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=95dfaa9a29a6 Thanks, Cole From crobinso at redhat.com Thu Aug 14 17:21:08 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 14 Aug 2008 13:21:08 -0400 Subject: [et-mgmt-tools] [PATCH 3/3] Add storage volume creation wizard In-Reply-To: <489F9B8C.5000504@redhat.com> References: <489F9A39.3090305@redhat.com> <489F9B8C.5000504@redhat.com> Message-ID: <48A46984.4070104@redhat.com> Cole Robinson wrote: > The attached patch adds a storage volume creation wizard. > > This wizard is simpler than the one for storage pools: > there is only one screen and fewer options. All that > needs to be specified is a name, format, allocation > and capacity. > > There is some interaction logic that isn't present yet, > like disabling the name field for a disk volume, since > we should just choose the next partition name. However > it all works so it's in good shape to commit. > > Thanks to Tim Allen for most of the UI design. > > Screenshot: > http://fedorapeople.org/~crobinso/virt-manager/storage/vol-create.png > > Thanks, > Cole > Whoops, I never attached the patch for this. Here it is: - Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virt-manager-create-vol.patch Type: text/x-patch Size: 41255 bytes Desc: not available URL: From mniranjan at redhat.com Thu Aug 14 17:48:21 2008 From: mniranjan at redhat.com (M.R Niranjan ) Date: Thu, 14 Aug 2008 23:18:21 +0530 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <20080814160232.GB22545@amd.home.annexia.org> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> <48A413C5.5050605@redhat.com> <20080814113507.GA22545@amd.home.annexia.org> <48A43D51.6020606@redhat.com> <20080814160232.GB22545@amd.home.annexia.org> Message-ID: <48A46FE5.3070600@redhat.com> Richard W.M. Jones wrote: > On Thu, Aug 14, 2008 at 07:42:33PM +0530, M.R Niranjan wrote: > >> /usr/bin/ld: cannot find -lvirt >> collect2: ld returned 1 exit status >> Error during linking >> > > You have got libvirt installed, right? If you installed libvirt on > some non-standard path then you may need to tell configure where it > is. I think you need to do: > Yes, libvirt is already installed, [root at dhcp7-90 virt-mem-0.3.0]# rpm -q libvirt libvirt-0.4.4-3.fc10.x86_64 libvirt-0.4.4-3.fc10.i386 > LIBS="/some/nonstandard/path" ./configure > > If that doesn't work try LIBRARY_PATH instead of LIBS > which path should i specify as LIBS or LIBRARY_PATH , as the libvirt rpm installs libraries of libvirt in /usr/lib64. > Rich. > > From rjones at redhat.com Thu Aug 14 19:38:23 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Thu, 14 Aug 2008 20:38:23 +0100 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <48A46FE5.3070600@redhat.com> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> <48A413C5.5050605@redhat.com> <20080814113507.GA22545@amd.home.annexia.org> <48A43D51.6020606@redhat.com> <20080814160232.GB22545@amd.home.annexia.org> <48A46FE5.3070600@redhat.com> Message-ID: <20080814193823.GE22545@amd.home.annexia.org> On Thu, Aug 14, 2008 at 11:18:21PM +0530, M.R Niranjan wrote: > Richard W.M. Jones wrote: >> On Thu, Aug 14, 2008 at 07:42:33PM +0530, M.R Niranjan wrote: >> >>> /usr/bin/ld: cannot find -lvirt >>> collect2: ld returned 1 exit status >>> Error during linking >> >> You have got libvirt installed, right? If you installed libvirt on >> some non-standard path then you may need to tell configure where it >> is. I think you need to do: >> > Yes, libvirt is already installed, > > [root at dhcp7-90 virt-mem-0.3.0]# rpm -q libvirt > libvirt-0.4.4-3.fc10.x86_64 > libvirt-0.4.4-3.fc10.i386 > > >> LIBS="/some/nonstandard/path" ./configure >> >> If that doesn't work try LIBRARY_PATH instead of LIBS >> > which path should i specify as LIBS or LIBRARY_PATH , as the libvirt rpm > installs libraries of libvirt in /usr/lib64. You should give /usr/lib64 as the path. As for why it doesn't work, though, I'm really very confused. Obviously I don't get the error you're seeing, and I don't understand how something as simple as '-lvirt' can fail if you have libvirt installed. Have you tried using our binaries? Might be easier than trying to build it: https://bugzilla.redhat.com/show_bug.cgi?id=450713 Also, the new version I'm preparing is much less alpha than the one you are trying to build. If you can wait until after this weekend, you may find a much better / more practical version for your needs. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 60 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora From mdehaan at redhat.com Thu Aug 14 21:32:00 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Thu, 14 Aug 2008 17:32:00 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... Message-ID: <48A4A450.4080509@redhat.com> I'm finding that RHEL 2 (last dot release) does not seem to have a virtual NIC of the type that Anaconda can discover. Has anyone tested EL2, and if so, should I be sending something extra down to python virtinst for that? --Michael From crobinso at redhat.com Thu Aug 14 21:55:51 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 14 Aug 2008 17:55:51 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A4A450.4080509@redhat.com> References: <48A4A450.4080509@redhat.com> Message-ID: <48A4A9E7.9090808@redhat.com> Michael DeHaan wrote: > I'm finding that RHEL 2 (last dot release) does not seem to have a > virtual NIC of the type that Anaconda can discover. > > Has anyone tested EL2, and if so, should I be sending something extra > down to python virtinst for that? > > --Michael > Actually I just committed some work to virtinst that may help solve this issue. Try running qemu-kvm manually and testing out the -nic models. Try 'qemu-kvm -hda /any/old/file -net nic,model=?' to see a list of the available ones. See if you can find a model that works, and we can trivially put it in the virtinst os database. So if someone in the future tries virt-install --os-type linux --os-variant rhel2.1 --blah ... We can automatically set the correct network model. Also, if you already have a rhel2.1 libvirt vm that isn't working, check out /var/log/libvirt/qemu/{vmname}.log to see what the qemu-kvm command line libvirt is generating, so you can just swap out the model, rather than trying to recreate the whole qemu-kvm cl from scratch. - Cole From crobinso at redhat.com Thu Aug 14 21:58:10 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 14 Aug 2008 17:58:10 -0400 Subject: [et-mgmt-tools] [PATCH] virt-install cli options for managed storage In-Reply-To: <20080814164731.GX32102@redhat.com> References: <48A1FB5E.5070509@redhat.com> <48A45D28.2010806@redhat.com> <20080814164731.GX32102@redhat.com> Message-ID: <48A4AA72.5060106@redhat.com> Daniel P. Berrange wrote: > On Thu, Aug 14, 2008 at 12:28:24PM -0400, Cole Robinson wrote: >> Cole Robinson wrote: >>> Per Dan's advice, I've changed the previously proposed >>> virt-install cli options for specifying libvirt managed >>> storage. >>> >>> This patch does not change any possible semantics of >>> --file or --cdrom: they remain strictly for specifying >>> local media. In this way they are basically deprecated. >>> >> Here's the second cut. Format for the cli options is >> >> --disk path=/some/path[,device=cdrom|floppy][,permissions=ro|sh] >> --disk pool=poolname[,device=cdrom|floppy][,permissions=ro|sh] >> --disk vol=poolname/volname[,device=cdrom|floppy][,permissions=ro|sh] >> >> Hopefully this will simplify things and fix the issues encountered. > > Ok, this looks good to me now, though shorten 'permissions' to 'perms' > because I'm lazy typing. > > Daniel Thanks, I've committed this with the suggested 'perms' fix: http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=354ea4aa8fda - Cole From mdehaan at redhat.com Thu Aug 14 22:00:10 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Thu, 14 Aug 2008 18:00:10 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A4A9E7.9090808@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> Message-ID: <48A4AAEA.4080606@redhat.com> Cole Robinson wrote: > Michael DeHaan wrote: > >> I'm finding that RHEL 2 (last dot release) does not seem to have a >> virtual NIC of the type that Anaconda can discover. >> >> Has anyone tested EL2, and if so, should I be sending something extra >> down to python virtinst for that? >> >> --Michael >> >> > > Actually I just committed some work to virtinst that may help solve > this issue. > > Try running qemu-kvm manually and testing out the -nic models. Try > 'qemu-kvm -hda /any/old/file -net nic,model=?' to see a list of the > available ones. See if you can find a model that works, and we can > trivially put it in the virtinst os database. So if someone in > the future tries > > virt-install --os-type linux --os-variant rhel2.1 --blah ... > > We can automatically set the correct network model. > > Also, if you already have a rhel2.1 libvirt vm that isn't > working, check out /var/log/libvirt/qemu/{vmname}.log to > see what the qemu-kvm command line libvirt is generating, > so you can just swap out the model, rather than trying to > recreate the whole qemu-kvm cl from scratch. > > - Cole > Will do. (and this is something I'd like to see backported if possible.) I'm not sure how much RHEL 2 is out there, but I'd rather it be running virtually than non-virtually. I'm guessing Xen works fine though and that is what most folks would be using now (probably would have heard of it otherwise). --Michael From mdehaan at redhat.com Thu Aug 14 22:14:09 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Thu, 14 Aug 2008 18:14:09 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A4AAEA.4080606@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> <48A4AAEA.4080606@redhat.com> Message-ID: <48A4AE31.1060606@redhat.com> Michael DeHaan wrote: > Cole Robinson wrote: >> Michael DeHaan wrote: >>> I'm finding that RHEL 2 (last dot release) does not seem to have a >>> virtual NIC of the type that Anaconda can discover. >>> >>> Has anyone tested EL2, and if so, should I be sending something >>> extra down to python virtinst for that? >>> >>> --Michael >>> >> >> Actually I just committed some work to virtinst that may help solve >> this issue. >> >> Try running qemu-kvm manually and testing out the -nic models. Try >> 'qemu-kvm -hda /any/old/file -net nic,model=?' to see a list of the >> available ones. See if you can find a model that works, and we can >> trivially put it in the virtinst os database. So if someone in >> the future tries >> >> virt-install --os-type linux --os-variant rhel2.1 --blah ... >> >> We can automatically set the correct network model. >> >> Also, if you already have a rhel2.1 libvirt vm that isn't >> working, check out /var/log/libvirt/qemu/{vmname}.log to >> see what the qemu-kvm command line libvirt is generating, >> so you can just swap out the model, rather than trying to >> recreate the whole qemu-kvm cl from scratch. >> >> - Cole > > Will do. (and this is something I'd like to see backported if possible.) > > I'm not sure how much RHEL 2 is out there, but I'd rather it be > running virtually than non-virtually. I'm guessing Xen works fine > though and that is what most folks would be using now (probably would > have heard of it otherwise). > > --Michael > > _______________________________________________ > et-mgmt-tools mailing list > et-mgmt-tools at redhat.com > https://www.redhat.com/mailman/listinfo/et-mgmt-tools Strike that backport bit, no qemu in RHEL. It's all good. Will test and get back with that... From berrange at redhat.com Thu Aug 14 22:15:57 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 23:15:57 +0100 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A4A9E7.9090808@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> Message-ID: <20080814221557.GF27276@redhat.com> On Thu, Aug 14, 2008 at 05:55:51PM -0400, Cole Robinson wrote: > Michael DeHaan wrote: > > I'm finding that RHEL 2 (last dot release) does not seem to have a > > virtual NIC of the type that Anaconda can discover. > > > > Has anyone tested EL2, and if so, should I be sending something extra > > down to python virtinst for that? > > > > --Michael > > > > Actually I just committed some work to virtinst that may help solve > this issue. > > Try running qemu-kvm manually and testing out the -nic models. Try > 'qemu-kvm -hda /any/old/file -net nic,model=?' to see a list of the > available ones. See if you can find a model that works, and we can > trivially put it in the virtinst os database. So if someone in > the future tries I've got to imagine that the ne2k NIC wil do the job, though I'm kinda suprised there's no rtl8139 support. > virt-install --os-type linux --os-variant rhel2.1 --blah ... > > We can automatically set the correct network model. Excellant - I assume you've got that setup to use VirtIO for F9/10 and Ubuntu Hardy ? Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From mdehaan at redhat.com Thu Aug 14 22:21:58 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Thu, 14 Aug 2008 18:21:58 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <20080814221557.GF27276@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> <20080814221557.GF27276@redhat.com> Message-ID: <48A4B006.5090808@redhat.com> Daniel P. Berrange wrote: > On Thu, Aug 14, 2008 at 05:55:51PM -0400, Cole Robinson wrote: > >> Michael DeHaan wrote: >> >>> I'm finding that RHEL 2 (last dot release) does not seem to have a >>> virtual NIC of the type that Anaconda can discover. >>> >>> Has anyone tested EL2, and if so, should I be sending something extra >>> down to python virtinst for that? >>> >>> --Michael >>> >>> >> Actually I just committed some work to virtinst that may help solve >> this issue. >> >> Try running qemu-kvm manually and testing out the -nic models. Try >> 'qemu-kvm -hda /any/old/file -net nic,model=?' to see a list of the >> available ones. See if you can find a model that works, and we can >> trivially put it in the virtinst os database. So if someone in >> the future tries >> > > I've got to imagine that the ne2k NIC wil do the job, though I'm kinda > suprised there's no rtl8139 support. > > >> virt-install --os-type linux --os-variant rhel2.1 --blah ... >> >> We can automatically set the correct network model. >> > > Excellant - I assume you've got that setup to use VirtIO for F9/10 > and Ubuntu Hardy ? > > Daniel > I'm not passing down variant now for virtinst API calls (but can probably do this in a future release if the user supplies it). Is there a suggestion to just make it default to the compatible NIC that would be good for all Fedora/RHEL (or are there performance issues in doing this or something)? --Michael From berrange at redhat.com Thu Aug 14 22:29:53 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Aug 2008 23:29:53 +0100 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A4B006.5090808@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> <20080814221557.GF27276@redhat.com> <48A4B006.5090808@redhat.com> Message-ID: <20080814222953.GH27276@redhat.com> On Thu, Aug 14, 2008 at 06:21:58PM -0400, Michael DeHaan wrote: > > I'm not passing down variant now for virtinst API calls (but can > probably do this in a future > release if the user supplies it). Is there a suggestion to just make it > default to the compatible NIC that would > be good for all Fedora/RHEL (or are there performance issues in doing > this or something)? That's the situation we've got already - we compile Xen and KVM to use the rtl8139 nic since that's the best lowest-common denominator. It was a barely passable approach so far, but with VirtIO it is now past its sell by date and we have to key off os type/variant. If we don't then we'll be limiting guests to 1/100 of the their potential performance. Not cool Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From mdehaan at redhat.com Thu Aug 14 22:33:14 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Thu, 14 Aug 2008 18:33:14 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <20080814222953.GH27276@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> <20080814221557.GF27276@redhat.com> <48A4B006.5090808@redhat.com> <20080814222953.GH27276@redhat.com> Message-ID: <48A4B2AA.4000306@redhat.com> Daniel P. Berrange wrote: > On Thu, Aug 14, 2008 at 06:21:58PM -0400, Michael DeHaan wrote: > >> I'm not passing down variant now for virtinst API calls (but can >> probably do this in a future >> release if the user supplies it). Is there a suggestion to just make it >> default to the compatible NIC that would >> be good for all Fedora/RHEL (or are there performance issues in doing >> this or something)? >> > > That's the situation we've got already - we compile Xen and KVM to use > the rtl8139 nic since that's the best lowest-common denominator. It was > a barely passable approach so far, but with VirtIO it is now past its sell > by date and we have to key off os type/variant. If we don't then we'll > be limiting guests to 1/100 of the their potential performance. Not cool > > > Daniel > Yikes :) I'll do some more manual creation tests tomorrow using the qemu command line. Passing in the OS version is doable as we should soon have "cobbler import" storing that data. Right now, it stores the name "RHEL5.2", etc, but that's not hard enough to key off of. --Michael From crobinso at redhat.com Fri Aug 15 00:59:58 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 14 Aug 2008 20:59:58 -0400 Subject: [et-mgmt-tools] [PATCH] virt-manager: Option to add sound device for vm create Message-ID: <48A4D50E.50609@redhat.com> The attached patch adds options to virt-manager's preferences section for adding an audio device to new VMs. The new option defaults to adding audio for all new local VMs, but skipping audio for remote VMs. I opted for the preferences screen approach since it seems like the type of thing users will either always or never want, and the new VM wizard is kind of cluttered as it is. Couple of screenshots: http://fedorapeople.org/~crobinso/virt-manager/virt-manager-sound-prefs.png http://fedorapeople.org/~crobinso/virt-manager/virt-manager-sound-summary.png Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: virt-manager-sound-prefs.patch Type: text/x-diff Size: 21805 bytes Desc: not available URL: From berrange at redhat.com Fri Aug 15 08:56:58 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Fri, 15 Aug 2008 09:56:58 +0100 Subject: [et-mgmt-tools] [PATCH 5/5] "Launch virt-viewer" (new) browser plugin. In-Reply-To: <20080814160709.GD22545@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> <20080808134314.GE32767@amd.home.annexia.org> <20080814141519.GU32102@redhat.com> <20080814160709.GD22545@amd.home.annexia.org> Message-ID: <20080815085658.GE20386@redhat.com> On Thu, Aug 14, 2008 at 05:07:09PM +0100, Richard W.M. Jones wrote: > On Thu, Aug 14, 2008 at 03:15:19PM +0100, Daniel P. Berrange wrote: > > Am I understanding this correctly, that it'll launch the virt-viewer > > program immediately upon loading the HTML page containing the plugin > > snippet ? If so that's a huge security problem - you are > > spawning a program which is allowed to connect to any host on the > > internet. It is also a denial-of-service - malicous javascript > > could write a page containing thousands of snippets which > > would spawn thousands of processes. > > > > I'd rather expect the plugin to have a small embedded area in the > > HTML page showing the details of what host will be connected to, > > what port, and then a button which has to be explicitly pressed > > to launch the external viewer. > > Yes ... The trouble is if we do this, we end up needing to embed Gtk > widgets in the browser, which takes us back to square one. Yeah I guess that does really :-( I must be possible to get GTK reliably embedded though because I use Totem for movie playback and its embeding GTK ok Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Fri Aug 15 08:58:41 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Fri, 15 Aug 2008 09:58:41 +0100 Subject: [et-mgmt-tools] [PATCH 1/5] Rename plugin/ directory to oldplugin/ In-Reply-To: <20080814160350.GC22545@amd.home.annexia.org> References: <20080808133556.GA32690@amd.home.annexia.org> <20080808133748.GA32767@amd.home.annexia.org> <20080814140528.GS32102@redhat.com> <20080814160350.GC22545@amd.home.annexia.org> Message-ID: <20080815085841.GF20386@redhat.com> On Thu, Aug 14, 2008 at 05:03:50PM +0100, Richard W.M. Jones wrote: > On Thu, Aug 14, 2008 at 03:05:29PM +0100, Daniel P. Berrange wrote: > > On Fri, Aug 08, 2008 at 02:37:48PM +0100, Richard W.M. Jones wrote: > > > > > > Rename plugin/ directory to oldplugin/ > > > - Also fix .hgignore to ignore generated files in oldplugin directory. > > > > I don't like this - I don't see why we can't just keep both plugins > > available in one directory. Just give them different names. eg call > > the new one virt-viewer-command-plugin.so and have the source for > > both in the plugins/ directory. In the binary build, we can have > > a separate sub-RPM for each plugin, so the user can choose which > > they prefer to use. > > I think I felt we should deprecate the old plugin. Keep it around for > a while just in case anyone can make it work, otherwise delete it. > What do you think? I'm not so sure - I can see both plugins being potentially desirable. All existing VNC plugins for example, use the fully embedded style so they may be people who prefer that approach, even though for oVirt we'd like to go the standalone approach. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From agx at sigxcpu.org Fri Aug 15 13:06:57 2008 From: agx at sigxcpu.org (Guido =?iso-8859-1?Q?G=FCnther?=) Date: Fri, 15 Aug 2008 15:06:57 +0200 Subject: [et-mgmt-tools] [PATCH] virt-image: catch ParserException and CapabilitiesParserException In-Reply-To: <20080814081845.GA25868@bogon.ms20.nix> References: <20080814081845.GA25868@bogon.ms20.nix> Message-ID: <20080815130657.GA4923@bogon.ms20.nix> On Thu, Aug 14, 2008 at 10:18:45AM +0200, Guido G?nther wrote: > attached is a patch that sets the correct mac address type when using > virt-clone. It continues to use the Xen prefix for unknown hypervisors > but uses the correct one for kvm/qemu. I also added some doctest. Here's another minor cleanup patch that fell out when fixing up some bugs against Debian's virtimage package. It tries to be a bit more helpful than the python exceptions in virt-image. Cheers, -- Guido -------------- next part -------------- A non-text attachment was scrubbed... Name: exceptions.diff Type: text/x-diff Size: 1139 bytes Desc: not available URL: From rjones at redhat.com Fri Aug 15 13:20:12 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Fri, 15 Aug 2008 14:20:12 +0100 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A4A450.4080509@redhat.com> References: <48A4A450.4080509@redhat.com> Message-ID: <20080815132012.GA26989@amd.home.annexia.org> On Thu, Aug 14, 2008 at 05:32:00PM -0400, Michael DeHaan wrote: > I'm finding that RHEL 2 (last dot release) does not seem to have a > virtual NIC of the type that Anaconda can discover. > > Has anyone tested EL2, and if so, should I be sending something extra > down to python virtinst for that? I have tested RHL 6.2 in KVM and found the same problem and a few others: http://marc.info/?l=kvm&m=121483789832440&w=2 Doubt it's worth changing virt-install to fix this though. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/ From crobinso at redhat.com Fri Aug 15 20:29:04 2008 From: crobinso at redhat.com (Cole Robinson) Date: Fri, 15 Aug 2008 16:29:04 -0400 Subject: [et-mgmt-tools] Re: [libvirt] virt-install and custom distros In-Reply-To: <48A5DEBC.8070302@renditionsoftware.com> References: <48A5DEBC.8070302@renditionsoftware.com> Message-ID: <48A5E710.8040209@redhat.com> Kay Williams wrote: > We have an application that builds custom distributions based on RHEL, CentOS or > Fedora. We would like to install these over the network using virt-install, but > we've run into an issue with the distro check logic. Specifically, virt-install > fails unless it finds a string "Red Hat Enterprise Linux", "Fedora" or "CentOS" > within the family field of the .treeinfo file. > > Our application currently sets the family field to the user-provided distro name > (see below). We have avoided using the base distro name given trademark concerns. > > [general] > family = > variant = > > We can get virt-install to pass the distro check by setting the family name to > one of the accepted values, e.g. > > [general] > family = Fedora > variant = [user provided distro name] > > Is this the expected/desired use for the family and variant fields? Or is there > another approach we should consider? > > Thanks, > Kay (cc-ing et-mgmt-tools, since that is the list for virt-install/ virt-manager) We shouldn't be failing if the family/variant is unknown: it's really just a convenience check. We can just assume it's an unknown distro and continue on, checking for [images-xen] and so on.. The code may need to be reworked a bit to accomodate this. Although we don't do it at the moment, I could see us in the future using this family/variant value to check our internal db on whether to set up virtio and other specific settings. So using custom values here may not allow virt-install to choose an optimal config, but we should still try and let the install proceed. - Cole From mniranjan at redhat.com Sat Aug 16 05:04:06 2008 From: mniranjan at redhat.com (M.R Niranjan ) Date: Sat, 16 Aug 2008 10:34:06 +0530 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <20080814193823.GE22545@amd.home.annexia.org> References: <489FD604.2040204@redhat.com> <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> <48A413C5.5050605@redhat.com> <20080814113507.GA22545@amd.home.annexia.org> <48A43D51.6020606@redhat.com> <20080814160232.GB22545@amd.home.annexia.org> <48A46FE5.3070600@redhat.com> <20080814193823.GE22545@amd.home.annexia.org> Message-ID: <48A65FC6.7070103@redhat.com> Richard W.M. Jones wrote: > On Thu, Aug 14, 2008 at 11:18:21PM +0530, M.R Niranjan wrote: > >> Richard W.M. Jones wrote: >> >>> On Thu, Aug 14, 2008 at 07:42:33PM +0530, M.R Niranjan wrote: >>> >>> >>>> /usr/bin/ld: cannot find -lvirt >>>> collect2: ld returned 1 exit status >>>> Error during linking >>>> >>> You have got libvirt installed, right? If you installed libvirt on >>> some non-standard path then you may need to tell configure where it >>> is. I think you need to do: >>> >>> >> Yes, libvirt is already installed, >> >> [root at dhcp7-90 virt-mem-0.3.0]# rpm -q libvirt >> libvirt-0.4.4-3.fc10.x86_64 >> libvirt-0.4.4-3.fc10.i386 >> >> >> >>> LIBS="/some/nonstandard/path" ./configure >>> >>> If that doesn't work try LIBRARY_PATH instead of LIBS >>> >>> >> which path should i specify as LIBS or LIBRARY_PATH , as the libvirt rpm >> installs libraries of libvirt in /usr/lib64. >> > > You should give /usr/lib64 as the path. > > As for why it doesn't work, though, I'm really very confused. > Obviously I don't get the error you're seeing, and I don't understand > how something as simple as '-lvirt' can fail if you have libvirt > installed. > > Have you tried using our binaries? Might be easier than trying to > build it: > > https://bugzilla.redhat.com/show_bug.cgi?id=450713 > > Also, the new version I'm preparing is much less alpha than the one > you are trying to build. If you can wait until after this weekend, > you may find a much better / more practical version for your needs. > > Rich. > > I will wait for some more time, till you release the updated version, is it possible to have a binary RPM ? Regards Niranjan From crobinso at redhat.com Sun Aug 17 18:50:23 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 17 Aug 2008 14:50:23 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A4AE31.1060606@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> <48A4AAEA.4080606@redhat.com> <48A4AE31.1060606@redhat.com> Message-ID: <48A872EF.5030801@redhat.com> Michael DeHaan wrote: > Strike that backport bit, no qemu in RHEL. It's all good. Will test > and get back with that... > It is still relevant actually: xen uses a forked qemu for device emulation for FV guests, and the network device model can be selected (see /etc/xen/xmexample.hvm, search for 'model'). The libvirt support for this isn't in 5.2, but it isn't impossible that we could end up backporting or rebasing it in. - Cole From crobinso at redhat.com Sun Aug 17 19:31:18 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 17 Aug 2008 15:31:18 -0400 Subject: [et-mgmt-tools] [PATCH] virt-image: catch ParserException and CapabilitiesParserException In-Reply-To: <20080815130657.GA4923@bogon.ms20.nix> References: <20080814081845.GA25868@bogon.ms20.nix> <20080815130657.GA4923@bogon.ms20.nix> Message-ID: <48A87C86.20807@redhat.com> Guido G?nther wrote: > On Thu, Aug 14, 2008 at 10:18:45AM +0200, Guido G?nther wrote: > >> attached is a patch that sets the correct mac address type when using >> virt-clone. It continues to use the Xen prefix for unknown hypervisors >> but uses the correct one for kvm/qemu. I also added some doctest. >> > Here's another minor cleanup patch that fell out when fixing up some > bugs against Debian's virtimage package. It tries to be a bit more > helpful than the python exceptions in virt-image. > Cheers, > -- Guido > Thanks, I've applied these two patches: http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=ece7be12556f http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=10f0b98b15d1 I also fixed mac generation for virt-install/other apps, and added you to the AUTHORS file. http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=e33c50bfb78b Thanks, Cole From crobinso at redhat.com Sun Aug 17 19:42:32 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 17 Aug 2008 15:42:32 -0400 Subject: [et-mgmt-tools] Virt-Install options In-Reply-To: <1E61D08F64B6BB4AB0EC91C72FBDB81613AB3D60@exchange.ag.state.la.us> References: <1E61D08F64B6BB4AB0EC91C72FBDB81613AB3740@exchange.ag.state.la.us><484403F4.1030505@redhat.com> <20080602143457.GF5069@redhat.com> <1E61D08F64B6BB4AB0EC91C72FBDB81613AB3D60@exchange.ag.state.la.us> Message-ID: <48A87F28.3040800@redhat.com> Seale, Mark wrote: > E1000 or pcnet would work from what I've been able to tell setting it up > with qemu. Thank you for the help! > FYI, I've just fixed this upstream: http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=3117341bd348 If you kick off an openbsd install with upstream virt-install, simply add the option '--os-variant openbsd4' and it will use pcnet for the nic model. You'll also need the latest libvirt. This should all end up in f10 (and most likely backported to f9 too). Sorry this took so long! Thanks for the info. - Cole From crobinso at redhat.com Sun Aug 17 19:50:45 2008 From: crobinso at redhat.com (Cole Robinson) Date: Sun, 17 Aug 2008 15:50:45 -0400 Subject: [et-mgmt-tools] [PATCH 0/3] virt-manager: manage and create libvirt storage In-Reply-To: <489F9A39.3090305@redhat.com> References: <489F9A39.3090305@redhat.com> Message-ID: <48A88115.5000407@redhat.com> Cole Robinson wrote: > The following three patches add libvirt storage api management > capabilities to virt-manager. Descriptions and screenshots > provided with each individual patch. > > Thanks, > Cole > FYI, I've committed this all upstream. - Cole From rjones at redhat.com Sun Aug 17 20:32:14 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Sun, 17 Aug 2008 21:32:14 +0100 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <48A65FC6.7070103@redhat.com> References: <20080814092858.GA22188@amd.home.annexia.org> <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> <48A413C5.5050605@redhat.com> <20080814113507.GA22545@amd.home.annexia.org> <48A43D51.6020606@redhat.com> <20080814160232.GB22545@amd.home.annexia.org> <48A46FE5.3070600@redhat.com> <20080814193823.GE22545@amd.home.annexia.org> <48A65FC6.7070103@redhat.com> Message-ID: <20080817203214.GA24439@amd.home.annexia.org> On Sat, Aug 16, 2008 at 10:34:06AM +0530, M.R Niranjan wrote: > I will wait for some more time, till you release the updated version, is > it possible to have a binary RPM ? Sure ... I'll be building binaries for 0.3.1 on Tuesday, or whenever the Fedora infrastructure comes back to life. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/ From mdehaan at redhat.com Mon Aug 18 14:15:48 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Mon, 18 Aug 2008 10:15:48 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A4B2AA.4000306@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> <20080814221557.GF27276@redhat.com> <48A4B006.5090808@redhat.com> <20080814222953.GH27276@redhat.com> <48A4B2AA.4000306@redhat.com> Message-ID: <48A98414.6070408@redhat.com> Michael DeHaan wrote: > Daniel P. Berrange wrote: >> On Thu, Aug 14, 2008 at 06:21:58PM -0400, Michael DeHaan wrote: >>> I'm not passing down variant now for virtinst API calls (but can >>> probably do this in a future >>> release if the user supplies it). Is there a suggestion to just make >>> it default to the compatible NIC that would >>> be good for all Fedora/RHEL (or are there performance issues in >>> doing this or something)? >> >> That's the situation we've got already - we compile Xen and KVM to use >> the rtl8139 nic since that's the best lowest-common denominator. It was >> a barely passable approach so far, but with VirtIO it is now past its >> sell >> by date and we have to key off os type/variant. If we don't then we'll >> be limiting guests to 1/100 of the their potential performance. Not cool >> >> >> Daniel > > Yikes :) > > I'll do some more manual creation tests tomorrow using the qemu > command line. > Passing in the OS version is doable as we should soon have "cobbler > import" storing that data. > > Right now, it stores the name "RHEL5.2", etc, but that's not hard > enough to key off of. > > --Michael > > > _______________________________________________ > et-mgmt-tools mailing list > et-mgmt-tools at redhat.com > https://www.redhat.com/mailman/listinfo/et-mgmt-tools Ok, so friday I tried walking through this with virt-manager and chose the OS/variant as 2.1, and it picked the wrong network driver there too and could not install 2.1. --Michael From crobinso at redhat.com Mon Aug 18 14:21:04 2008 From: crobinso at redhat.com (Cole Robinson) Date: Mon, 18 Aug 2008 10:21:04 -0400 Subject: [et-mgmt-tools] Installing RHEL 2 (yes, "*2*") inside a F9 KVM VM... In-Reply-To: <48A98414.6070408@redhat.com> References: <48A4A450.4080509@redhat.com> <48A4A9E7.9090808@redhat.com> <20080814221557.GF27276@redhat.com> <48A4B006.5090808@redhat.com> <20080814222953.GH27276@redhat.com> <48A4B2AA.4000306@redhat.com> <48A98414.6070408@redhat.com> Message-ID: <48A98550.8090303@redhat.com> Michael DeHaan wrote: > Michael DeHaan wrote: >> Daniel P. Berrange wrote: >>> On Thu, Aug 14, 2008 at 06:21:58PM -0400, Michael DeHaan wrote: >>>> I'm not passing down variant now for virtinst API calls (but can >>>> probably do this in a future >>>> release if the user supplies it). Is there a suggestion to just make >>>> it default to the compatible NIC that would >>>> be good for all Fedora/RHEL (or are there performance issues in >>>> doing this or something)? >>> That's the situation we've got already - we compile Xen and KVM to use >>> the rtl8139 nic since that's the best lowest-common denominator. It was >>> a barely passable approach so far, but with VirtIO it is now past its >>> sell >>> by date and we have to key off os type/variant. If we don't then we'll >>> be limiting guests to 1/100 of the their potential performance. Not cool >>> >>> >>> Daniel >> Yikes :) >> >> I'll do some more manual creation tests tomorrow using the qemu >> command line. >> Passing in the OS version is doable as we should soon have "cobbler >> import" storing that data. >> >> Right now, it stores the name "RHEL5.2", etc, but that's not hard >> enough to key off of. >> >> --Michael >> >> > > Ok, so friday I tried walking through this with virt-manager and chose > the OS/variant as 2.1, and it picked the wrong network > driver there too and could not install 2.1. > > > --Michael > Virt-manager just calls out to virtinst for this, so all the choosing is centralized. Also, prior to a week ago upstream we weren't doing any distro specific hardware selection for networking, everything was just using the default nic model rtl8139. - Cole From crobinso at redhat.com Mon Aug 18 15:28:18 2008 From: crobinso at redhat.com (Cole Robinson) Date: Mon, 18 Aug 2008 11:28:18 -0400 Subject: [et-mgmt-tools] [PATCH] virt-manager: Use avahi to poll for local servers Message-ID: <48A99512.8080704@redhat.com> The attached patch adds support for avahi polling to the virt-manager 'Open Connection' dialog. libvirtd advertises itself via avahi so we get the hard stuff for free :). To test this you will need to make sure Multicast DNS (mDNS, port 5353 udp) is open on your machine. I had a few more screenshots but fedorapeople isn't responding. The basic flow is: 'Open Conn' defaults to selecting a local connection, so the 'browse' checkbox and list are inactive. If a remote conn type is selected, the 'browse' checkbox and 'hostname' field become active, but we don't immediately default to actually browsing the network. Once the 'browse' checkbox is clicked the list becomes active and starts asynchronously populating. When an entry in the list is selected its hostname (or IP address if the hostname wasn't resolved) is placed in the "hostname" field. Thanks, Cole -------------- next part -------------- A non-text attachment was scrubbed... Name: vmm-avahi-polling.patch Type: text/x-patch Size: 18449 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: vmm-avahi-browse.png Type: image/png Size: 64038 bytes Desc: not available URL: From berrange at redhat.com Wed Aug 20 10:25:05 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 20 Aug 2008 11:25:05 +0100 Subject: [et-mgmt-tools] [PATCH] virt-manager: Use avahi to poll for local servers In-Reply-To: <48A99512.8080704@redhat.com> References: <48A99512.8080704@redhat.com> Message-ID: <20080820102505.GF1565@redhat.com> On Mon, Aug 18, 2008 at 11:28:18AM -0400, Cole Robinson wrote: > The attached patch adds support for avahi polling > to the virt-manager 'Open Connection' dialog. > libvirtd advertises itself via avahi so we get the > hard stuff for free :). To test this you will need > to make sure Multicast DNS (mDNS, port 5353 udp) is > open on your machine. > > I had a few more screenshots but fedorapeople isn't > responding. The basic flow is: 'Open Conn' defaults > to selecting a local connection, so the 'browse' > checkbox and list are inactive. If a remote conn > type is selected, the 'browse' checkbox and > 'hostname' field become active, but we don't > immediately default to actually browsing the > network. Once the 'browse' checkbox is clicked the > list becomes active and starts asynchronously > populating. When an entry in the list is selected > its hostname (or IP address if the hostname wasn't > resolved) is placed in the "hostname" field. If the avahi daemon isn't running virt-manager isn't toohappy. We probably need to make sure we fallback & disable this mDNS stuff when avahi fails Traceback (most recent call last): File "/home/berrange/src/xen/virt-manager--devel/src/virtManager/engine.py", line 183, in _do_show_connect self.show_connect() File "/home/berrange/src/xen/virt-manager--devel/src/virtManager/engine.py", line 248, in show_connect self.windowConnect = vmmConnect(self.get_config(), self) File "/home/berrange/src/xen/virt-manager--devel/src/virtManager/connect.py", line 91, in __init__ self.server = dbus.Interface(self.bus.get_object("org.freedesktop.Avahi", "/") File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 244, in get_object follow_name_owner_changes=follow_name_owner_changes) File "/usr/lib/python2.5/site-packages/dbus/proxies.py", line 241, in __init__ self._named_service = conn.activate_name_owner(bus_name) File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 183, in activate_name_owner self.start_service_by_name(bus_name) File "/usr/lib/python2.5/site-packages/dbus/bus.py", line 281, in start_service_by_name 'su', (bus_name, flags))) File "/usr/lib/python2.5/site-packages/dbus/connection.py", line 622, in call_blocking message, timeout) dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Avahi was not provided by any .service files Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From berrange at redhat.com Wed Aug 20 11:10:26 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 20 Aug 2008 12:10:26 +0100 Subject: [et-mgmt-tools] [PATCH] virt-manager: Use avahi to poll for local servers In-Reply-To: <20080820102505.GF1565@redhat.com> References: <48A99512.8080704@redhat.com> <20080820102505.GF1565@redhat.com> Message-ID: <20080820111026.GH1565@redhat.com> On Wed, Aug 20, 2008 at 11:25:05AM +0100, Daniel P. Berrange wrote: > On Mon, Aug 18, 2008 at 11:28:18AM -0400, Cole Robinson wrote: > > The attached patch adds support for avahi polling > > to the virt-manager 'Open Connection' dialog. > > libvirtd advertises itself via avahi so we get the > > hard stuff for free :). To test this you will need > > to make sure Multicast DNS (mDNS, port 5353 udp) is > > open on your machine. > > > > I had a few more screenshots but fedorapeople isn't > > responding. The basic flow is: 'Open Conn' defaults > > to selecting a local connection, so the 'browse' > > checkbox and list are inactive. If a remote conn > > type is selected, the 'browse' checkbox and > > 'hostname' field become active, but we don't > > immediately default to actually browsing the > > network. Once the 'browse' checkbox is clicked the > > list becomes active and starts asynchronously > > populating. When an entry in the list is selected > > its hostname (or IP address if the hostname wasn't > > resolved) is placed in the "hostname" field. I think there needs to be some uniqueness filtering because its adding the same entry multiple times ! The 'Browse hosts' checkbox is overkill - just always have it enabled. There's no need to provide a way to disable it, since they can already type in a hostname manually if desired. When presenting a browse list, the avahi recommendation is to present the service names "Virtual Host t60wlan" and not show the IP address / hostname to the user. Let the user pick a service name, and then turn that into an IP address/hostname when we need to connect. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From veillard at redhat.com Wed Aug 20 13:52:03 2008 From: veillard at redhat.com (Daniel Veillard) Date: Wed, 20 Aug 2008 15:52:03 +0200 Subject: [et-mgmt-tools] Re: [libvirt] Re: virsh/virt-install for dummies In-Reply-To: <20080820130828.GA29595@amd.home.annexia.org> References: <20080815103658.GK20386@redhat.com> <20080815110245.GL20386@redhat.com> <48A9724A.30708@redhat.com> <20080820130828.GA29595@amd.home.annexia.org> Message-ID: <20080820135202.GD27769@redhat.com> Well that really need to be archived on the proper list, i.e. et-mgmt-tools at redhat.com Daniel On Wed, Aug 20, 2008 at 02:08:28PM +0100, Richard W.M. Jones wrote: > On Tue, Aug 19, 2008 at 11:25:21AM +0900, Jun Koi wrote: > > Yes, that was a mistake. I changed -c to --connect, and get the error > > "Unsupported virtualization type" now. How can I fix it? > > I've been bitten by this very same error message in virt-install. > Took me absolutely ages to work out that I had to use the '--hvm' > option. It's a usability bug in virt-install, plain and simple. > Attached is a patch which clarifies the error message. > > Rich. > > -- > Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones > Read my OCaml programming blog: http://camltastic.blogspot.com/ > Fedora now supports 60 OCaml packages (the OPEN alternative to F#) > http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora > diff -r de5bcee1e78f virtinst/ImageManager.py > --- a/virtinst/ImageManager.py Mon Aug 18 16:33:57 2008 -0400 > +++ b/virtinst/ImageManager.py Wed Aug 20 14:08:00 2008 +0100 > @@ -46,7 +46,7 @@ > > self._guest = self._capabilities.guestForOSType(self._boot_caps.type, self._boot_caps.arch) > if self._guest is None: > - raise PlatformMatchException(_("Unsupported virtualization type")) > + raise PlatformMatchException(_("Unsupported virtualization type. If the host only supports full virtualization, try adding the --hvm option.")) > > self._domain = self._guest.bestDomainType() > self.type = self._domain.hypervisor_type > -- > Libvir-list mailing list > Libvir-list at redhat.com > https://www.redhat.com/mailman/listinfo/libvir-list -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/ From crobinso at redhat.com Wed Aug 20 14:33:57 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 20 Aug 2008 10:33:57 -0400 Subject: [et-mgmt-tools] Re: [libvirt] Re: virsh/virt-install for dummies In-Reply-To: <20080820130828.GA29595@amd.home.annexia.org> References: <20080815103658.GK20386@redhat.com> <20080815110245.GL20386@redhat.com> <48A9724A.30708@redhat.com> <20080820130828.GA29595@amd.home.annexia.org> Message-ID: <48AC2B55.4010403@redhat.com> Richard W.M. Jones wrote: > On Tue, Aug 19, 2008 at 11:25:21AM +0900, Jun Koi wrote: >> Yes, that was a mistake. I changed -c to --connect, and get the error >> "Unsupported virtualization type" now. How can I fix it? > > I've been bitten by this very same error message in virt-install. > Took me absolutely ages to work out that I had to use the '--hvm' > option. It's a usability bug in virt-install, plain and simple. > Attached is a patch which clarifies the error message. > > Rich. > > Hmm, the patch you presented is actually for virt-image, not virt-install. The current upstream for virt-install should already have this resolved though, attempting to remedy the issue in two ways: 1) If no virt type is specified, we default to the first capabilities entry matching the host's architecture. For xen this is PV, but for qemu (even w/ xenner present) this defaults to hvm with qemu hostarch binary. 2) The error message is now "Unsupported virtualization type %foo for arch %blah" Which will hopefully point out any errors. That said we do need an equivalent change for ImageManager/ virt-image so I'll see about centralizing the current code for use by both apps. Thanks, Cole From rjones at redhat.com Wed Aug 20 14:47:52 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Wed, 20 Aug 2008 15:47:52 +0100 Subject: [et-mgmt-tools] Re: [libvirt] Re: virsh/virt-install for dummies In-Reply-To: <48AC2B55.4010403@redhat.com> References: <20080815103658.GK20386@redhat.com> <20080815110245.GL20386@redhat.com> <48A9724A.30708@redhat.com> <20080820130828.GA29595@amd.home.annexia.org> <48AC2B55.4010403@redhat.com> Message-ID: <20080820144752.GA29892@amd.home.annexia.org> On Wed, Aug 20, 2008 at 10:33:57AM -0400, Cole Robinson wrote: > Hmm, the patch you presented is actually for virt-image, > not virt-install. Oh yes, bit stupid :-( > 1) If no virt type is specified, we default to the first > capabilities entry matching the host's architecture. > For xen this is PV, but for qemu (even w/ xenner > present) this defaults to hvm with qemu hostarch > binary. Yes, that sounds like the right thing to do. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From crobinso at redhat.com Wed Aug 20 14:55:17 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 20 Aug 2008 10:55:17 -0400 Subject: [et-mgmt-tools] Re: [libvirt] networking In-Reply-To: <48AB1BCF.5060101@bu.edu> References: <48AB1BCF.5060101@bu.edu> Message-ID: <48AC3055.4010204@redhat.com> James Bardin wrote: > Hello, > > I'm having trouble digging up some documentation on libvirt's network > config. > > I'm not sure where to set this up, but I have a bridged device br0 that > I would like to have available in virt-manager/virsh. > > Right now, I can edit the VM's xml interface element manually to use > br0. Virt-manager has an option for shared physical device, but it's > empty, and I can't figure out how to see it from virsh. > > cc-ing et-mgmt-tools which is the virt-manager list The bridge should be showing up in shared physical device drop down automatically, there shouldn't be anything you need to teach libvirt. What virt-manager version are you using? Distro? Is there anything showing up in the shared device drop down (even if you can't select it?) Also if you could attach ~/.virt-manager/virt-manager.log it might help. Thanks, Cole From crobinso at redhat.com Wed Aug 20 15:23:01 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 20 Aug 2008 11:23:01 -0400 Subject: [et-mgmt-tools] Re: [libvirt] networking In-Reply-To: <48AC3460.4010507@bu.edu> References: <48AB1BCF.5060101@bu.edu> <48AC3055.4010204@redhat.com> <48AC3460.4010507@bu.edu> Message-ID: <48AC36D5.1090604@redhat.com> James Bardin wrote: > Cole Robinson wrote: >> What virt-manager version are you using? >> Distro? > > libvirt: 0.4.0-2ubuntu8 > virt-manager: 0.5.3-0ubuntu10 > > Distro: Ubuntu 8.04.1 server x86_64 > >> Is there anything showing up in the shared device drop >> down (even if you can't select it?) >> > > The drop-down activates, but is empty. > >> Also if you could attach ~/.virt-manager/virt-manager.log >> it might help. >> > > This group popped up a lot yesterday: > > [Tue, 19 Aug 2008 14:55:19 virt-manager 5811] WARNING (connection:494) > Unable to list active networks > [Tue, 19 Aug 2008 14:55:19 virt-manager 5811] WARNING (connection:498) > Unable to list inactive networks > [Tue, 19 Aug 2008 14:55:19 virt-manager 5811] ERROR (engine:158) Could > not refresh connection qemu:///system > virConnectListDomainsID() failed Broken pipe > Traceback (most recent call last): > File "/usr/share/virt-manager/virtManager/engine.py", line 152, in _tick > self.connections[uri]["connection"].tick() > File "/usr/share/virt-manager/virtManager/connection.py", line 550, in > tick > newActiveIDs = self.vmm.listDomainsID() > File "/usr/lib/python2.5/site-packages/libvirt.py", line 795, in > listDomainsID > if ret is None: raise libvirtError ('virConnectListDomainsID() > failed', conn=self) > libvirtError: virConnectListDomainsID() failed Broken pipe > This is probably from a libvirtd restart while virt-manager was running. If so, nothing to worry about. > > Here's the output when I try to add a new network device: > > [Wed, 20 Aug 2008 10:57:39 virt-manager 6673] ERROR (connection:158) > Unable to connect to HAL to list network devices: '%s' 'dbus.exceptions.DBusException'> > org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Hal > was not provided by any .service files > Traceback (most recent call last): > File "/usr/share/virt-manager/virtManager/connection.py", line 144, in > detect_network_devices > hal_object = self.bus.get_object('org.freedesktop.Hal', > '/org/freedesktop/Hal/Manager') > File "/var/lib/python-support/python2.5/dbus/bus.py", line 244, in > get_object > follow_name_owner_changes=follow_name_owner_changes) > File "/var/lib/python-support/python2.5/dbus/proxies.py", line 241, in > __init__ > self._named_service = conn.activate_name_owner(bus_name) > File "/var/lib/python-support/python2.5/dbus/bus.py", line 183, in > activate_name_owner > self.start_service_by_name(bus_name) > File "/var/lib/python-support/python2.5/dbus/bus.py", line 281, in > start_service_by_name > 'su', (bus_name, flags))) > File "/var/lib/python-support/python2.5/dbus/connection.py", line 607, > in call_blocking > message, timeout) > DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name > org.freedesktop.Hal was not provided by any .service files > [Wed, 20 Aug 2008 10:57:47 virt-manager 6673] ERROR (console:106) Cannot > initialize notification > systemorg.freedesktop.DBus.Error.Spawn.ExecFailed: Failed to execute > dbus-launch to autolaunch D-Bus session > > This is the problem: we use dbus to contact hal to list physical net devices on the system, then we probe their /sys path to determine if they are in a bridge, among other things. Make sure hald (or some equivalently named service) is running. Bar that, you'll probably have to ask the ubuntu folks. Thanks, Cole From berrange at redhat.com Wed Aug 20 15:29:55 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 20 Aug 2008 16:29:55 +0100 Subject: [et-mgmt-tools] [PATCH] virt-manager: Use avahi to poll for local servers In-Reply-To: <20080820111026.GH1565@redhat.com> References: <48A99512.8080704@redhat.com> <20080820102505.GF1565@redhat.com> <20080820111026.GH1565@redhat.com> Message-ID: <20080820152955.GB6521@redhat.com> On Wed, Aug 20, 2008 at 12:10:26PM +0100, Daniel P. Berrange wrote: > On Wed, Aug 20, 2008 at 11:25:05AM +0100, Daniel P. Berrange wrote: > > On Mon, Aug 18, 2008 at 11:28:18AM -0400, Cole Robinson wrote: > > > The attached patch adds support for avahi polling > > > to the virt-manager 'Open Connection' dialog. > > > libvirtd advertises itself via avahi so we get the > > > hard stuff for free :). To test this you will need > > > to make sure Multicast DNS (mDNS, port 5353 udp) is > > > open on your machine. > > > > > > I had a few more screenshots but fedorapeople isn't > > > responding. The basic flow is: 'Open Conn' defaults > > > to selecting a local connection, so the 'browse' > > > checkbox and list are inactive. If a remote conn > > > type is selected, the 'browse' checkbox and > > > 'hostname' field become active, but we don't > > > immediately default to actually browsing the > > > network. Once the 'browse' checkbox is clicked the > > > list becomes active and starts asynchronously > > > populating. When an entry in the list is selected > > > its hostname (or IP address if the hostname wasn't > > > resolved) is placed in the "hostname" field. > > I think there needs to be some uniqueness filtering because its adding the > same entry multiple times ! > > The 'Browse hosts' checkbox is overkill - just always have it enabled. > There's no need to provide a way to disable it, since they can already > type in a hostname manually if desired. > > When presenting a browse list, the avahi recommendation is to present the > service names > > "Virtual Host t60wlan" > > and not show the IP address / hostname to the user. Let the user pick a > service name, and then turn that into an IP address/hostname when we need > to connect. This is an example of the listing I'm referring to http://0pointer.de/blog/projects/avahify-your-app.html Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From crobinso at redhat.com Wed Aug 20 15:41:20 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 20 Aug 2008 11:41:20 -0400 Subject: [et-mgmt-tools] Re: [libvirt] networking In-Reply-To: <48AC385B.1040308@bu.edu> References: <48AB1BCF.5060101@bu.edu> <48AC3055.4010204@redhat.com> <48AC3460.4010507@bu.edu> <48AC36D5.1090604@redhat.com> <48AC385B.1040308@bu.edu> Message-ID: <48AC3B20.8010202@redhat.com> James Bardin wrote: > > Cole Robinson wrote: >> Make sure hald (or some equivalently named service) is >> running. Bar that, you'll probably have to ask the >> ubuntu folks. >> > > It's running. I'll see if I can figure out where this went wrong. > > Does this apply to virsh as well? > > Thanks > -jim No virsh/libvirt doesn't use hal. If you want to try manually adding the bridge device to the domain, try the following. 'virsh dumpxml vmname > tmpxml' edit 'tmpxml', add to the section: 'virsh define tmpxml' Hope that helps, Cole From crobinso at redhat.com Wed Aug 20 15:47:43 2008 From: crobinso at redhat.com (Cole Robinson) Date: Wed, 20 Aug 2008 11:47:43 -0400 Subject: [et-mgmt-tools] [PATCH] virt-manager: Use avahi to poll for local servers In-Reply-To: <20080820152955.GB6521@redhat.com> References: <48A99512.8080704@redhat.com> <20080820102505.GF1565@redhat.com> <20080820111026.GH1565@redhat.com> <20080820152955.GB6521@redhat.com> Message-ID: <48AC3C9F.5010407@redhat.com> Daniel P. Berrange wrote: > On Wed, Aug 20, 2008 at 12:10:26PM +0100, Daniel P. Berrange wrote: >> On Wed, Aug 20, 2008 at 11:25:05AM +0100, Daniel P. Berrange wrote: >>> On Mon, Aug 18, 2008 at 11:28:18AM -0400, Cole Robinson wrote: >>>> The attached patch adds support for avahi polling >>>> to the virt-manager 'Open Connection' dialog. >>>> libvirtd advertises itself via avahi so we get the >>>> hard stuff for free :). To test this you will need >>>> to make sure Multicast DNS (mDNS, port 5353 udp) is >>>> open on your machine. >>>> >>>> I had a few more screenshots but fedorapeople isn't >>>> responding. The basic flow is: 'Open Conn' defaults >>>> to selecting a local connection, so the 'browse' >>>> checkbox and list are inactive. If a remote conn >>>> type is selected, the 'browse' checkbox and >>>> 'hostname' field become active, but we don't >>>> immediately default to actually browsing the >>>> network. Once the 'browse' checkbox is clicked the >>>> list becomes active and starts asynchronously >>>> populating. When an entry in the list is selected >>>> its hostname (or IP address if the hostname wasn't >>>> resolved) is placed in the "hostname" field. >> I think there needs to be some uniqueness filtering because its adding the >> same entry multiple times ! >> >> The 'Browse hosts' checkbox is overkill - just always have it enabled. >> There's no need to provide a way to disable it, since they can already >> type in a hostname manually if desired. >> >> When presenting a browse list, the avahi recommendation is to present the >> service names >> >> "Virtual Host t60wlan" >> >> and not show the IP address / hostname to the user. Let the user pick a >> service name, and then turn that into an IP address/hostname when we need >> to connect. > > This is an example of the listing I'm referring to > > http://0pointer.de/blog/projects/avahify-your-app.html > > Daniel Right, it's just the 'name' data returned by the avahi polling. Part of the issue using this though is that if the machine doesn't have a useful hostname (ex. something like localhost) you'll see entries like 'Virtual Host localhost #3'. We could probably have a column for advertised name and column for IP address and that would provide about as much identifying data as we can manage. I'll check out the other issues you raised (dupes, no avahi) Thanks, Cole From berrange at redhat.com Wed Aug 20 15:49:58 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 20 Aug 2008 16:49:58 +0100 Subject: [et-mgmt-tools] [PATCH] virt-manager: Use avahi to poll for local servers In-Reply-To: <48AC3C9F.5010407@redhat.com> References: <48A99512.8080704@redhat.com> <20080820102505.GF1565@redhat.com> <20080820111026.GH1565@redhat.com> <20080820152955.GB6521@redhat.com> <48AC3C9F.5010407@redhat.com> Message-ID: <20080820154958.GD6521@redhat.com> On Wed, Aug 20, 2008 at 11:47:43AM -0400, Cole Robinson wrote: > Daniel P. Berrange wrote: > > > > This is an example of the listing I'm referring to > > > > http://0pointer.de/blog/projects/avahify-your-app.html > > > > Daniel > > Right, it's just the 'name' data returned by the avahi polling. > > Part of the issue using this though is that if the machine > doesn't have a useful hostname (ex. something like localhost) > you'll see entries like 'Virtual Host localhost #3'. We could > probably have a column for advertised name and column for IP > address and that would provide about as much identifying data > as we can manage. Yes, that is an issue - but its something that should be solved on the hosts issuing the advertisement. In /etc/libvirt/libvirtd.conf you can actually customize the advertised name to whatever you like in the scenario where you don't have a sensible hostname. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From baltshul at yahoo.com Wed Aug 20 23:23:46 2008 From: baltshul at yahoo.com (Boris Altshul) Date: Wed, 20 Aug 2008 16:23:46 -0700 (PDT) Subject: [et-mgmt-tools] looks like a bug in LiveCdInstaller.py Message-ID: <14472.63551.qm@web63307.mail.re1.yahoo.com> I was trying to use some of my?virsh based scripts on Fedora 9 and ran into problems. After some debugging, it looks like that there is an issue with passing the parameter "os_type"?to the base class from LiveCdInstaller constructor. Take a look. In LiveCdInstaller.py ----------------------- class LiveCDInstaller(Guest.Installer): ? ? def __init__(self, type = "xen", location = None, os_type = None): ? ? ? ? Guest.Installer.__init__(self, type, location, os_type = None) -------------------------------------------- Should be ?class LiveCDInstaller(Guest.Installer): ? ? def __init__(self, type = "xen", location = None, os_type = None): ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? -------V? ? ? ? ? ? Guest.Installer.__init__(self, type, location, os_type=os_type) -------------- next part -------------- An HTML attachment was scrubbed... URL: From crobinso at redhat.com Thu Aug 21 13:26:39 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 21 Aug 2008 09:26:39 -0400 Subject: [et-mgmt-tools] looks like a bug in LiveCdInstaller.py In-Reply-To: <14472.63551.qm@web63307.mail.re1.yahoo.com> References: <14472.63551.qm@web63307.mail.re1.yahoo.com> Message-ID: <48AD6D0F.50905@redhat.com> Boris Altshul wrote: > I was trying to use some of my? virsh based scripts on Fedora 9 and ran into problems. After some debugging, it looks like that > there is an issue with passing the parameter "os_type"? to the base class from LiveCdInstaller constructor. Take a look. > In LiveCdInstaller.py > ----------------------- > > class LiveCDInstaller(Guest.Installer): > ? ? def __init__(self, type = "xen", location = None, os_type = None): > ? ? ? ? Guest.Installer.__init__(self, type, location, os_type = None) > -------------------------------------------- > Should be > > ???class LiveCDInstaller(Guest.Installer): > ? ? def __init__(self, type = "xen", location = None, os_type = None): > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? -------V? ? > ? ? ? ? Guest.Installer.__init__(self, type, location, os_type=os_type) > > Yes, thanks for the report. This was actually fixed upstream a couple months ago. http://hg.et.redhat.com/virt/applications/virtinst--devel?cs=7ce9673ddb72 We should be pushing a new release fairly soon, fyi. Thanks, Cole From berrange at redhat.com Thu Aug 21 20:51:44 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 21 Aug 2008 21:51:44 +0100 Subject: [et-mgmt-tools] [PATCH 0/3] virt-manager: manage and create libvirt storage In-Reply-To: <48A88115.5000407@redhat.com> References: <489F9A39.3090305@redhat.com> <48A88115.5000407@redhat.com> Message-ID: <20080821205144.GI1531@redhat.com> On Sun, Aug 17, 2008 at 03:50:45PM -0400, Cole Robinson wrote: > Cole Robinson wrote: > > The following three patches add libvirt storage api management > > capabilities to virt-manager. Descriptions and screenshots > > provided with each individual patch. > > > > FYI, I've committed this all upstream. Sorry I didn't get time to check this out before you commited. It all looks very good though, so glad it is done now ! A couple of very minor bugs I noticed - When starting a pool, the list of volumes doesn't automatically refresh - I had to select a different pool and then re-select the original - THe left hand list of pools doesn't refresh the usage - seems stuck on 0% - Should probably add mouse over hints on the 4 icon buttons below the pool list since there's no room for full labels. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From crobinso at redhat.com Thu Aug 21 21:13:33 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 21 Aug 2008 17:13:33 -0400 Subject: [et-mgmt-tools] [PATCH 0/3] virt-manager: manage and create libvirt storage In-Reply-To: <20080821205144.GI1531@redhat.com> References: <489F9A39.3090305@redhat.com> <48A88115.5000407@redhat.com> <20080821205144.GI1531@redhat.com> Message-ID: <48ADDA7D.7030609@redhat.com> Daniel P. Berrange wrote: > On Sun, Aug 17, 2008 at 03:50:45PM -0400, Cole Robinson wrote: >> Cole Robinson wrote: >>> The following three patches add libvirt storage api management >>> capabilities to virt-manager. Descriptions and screenshots >>> provided with each individual patch. >>> >> FYI, I've committed this all upstream. > > Sorry I didn't get time to check this out before you commited. It all > looks very good though, so glad it is done now ! A couple of very minor > bugs I noticed > > - When starting a pool, the list of volumes doesn't automatically > refresh - I had to select a different pool and then re-select > the original Ah, hadn't noticed that, thanks. > - THe left hand list of pools doesn't refresh the usage - seems > stuck on 0% > - Should probably add mouse over hints on the 4 icon buttons below > the pool list since there's no room for full labels. > Yeah these are on my long list of little things that need fixing :) Thanks, Cole From crobinso at redhat.com Fri Aug 22 19:03:47 2008 From: crobinso at redhat.com (Cole Robinson) Date: Fri, 22 Aug 2008 15:03:47 -0400 Subject: [et-mgmt-tools] [PATCH] virt-manager: Use avahi to poll for local servers In-Reply-To: <48A99512.8080704@redhat.com> References: <48A99512.8080704@redhat.com> Message-ID: <48AF0D93.8020205@redhat.com> Cole Robinson wrote: > The attached patch adds support for avahi polling > to the virt-manager 'Open Connection' dialog. > libvirtd advertises itself via avahi so we get the > hard stuff for free :). To test this you will need > to make sure Multicast DNS (mDNS, port 5353 udp) is > open on your machine. > Second cut of this patch. Issues resolved: - Removed the check box, unconditionally poll for connections if the user selects a remote conn option. - Only use advertised 'name' as the list entry. - Don't add duplicate list entries. - If creating the initial avahi dbus interface fails, just disable all polling, and never activate the connection list. - Sort list entries alphabetically by default, and add ability to sort ascend/descend Thanks, Cole -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: virt-manager-avahi-poll-02-patch URL: From macscr at macscr.com Sat Aug 23 21:24:34 2008 From: macscr at macscr.com (Mark Chaney) Date: Sat, 23 Aug 2008 16:24:34 -0500 Subject: [et-mgmt-tools] domu list? Message-ID: <02a401c90566$a52861e0$ef7925a0$@com> Where virt-manager stores its xml file list of domu's it administrates? I need to change some paths and also add some domu's that I have imported. Thanks, Mark From berrange at redhat.com Sun Aug 24 12:31:42 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Sun, 24 Aug 2008 13:31:42 +0100 Subject: [et-mgmt-tools] domu list? In-Reply-To: <02a401c90566$a52861e0$ef7925a0$@com> References: <02a401c90566$a52861e0$ef7925a0$@com> Message-ID: <20080824123142.GB1586@redhat.com> On Sat, Aug 23, 2008 at 04:24:34PM -0500, Mark Chaney wrote: > > Where virt-manager stores its xml file list of domu's it administrates? I > need to change some paths and also add some domu's that I have imported. virt-manager doesn't store persistent XML configs itself. The storage mechanism is specific to the underlying hypervisor it is talking to. The recommended approach to changing the config is to dump the existing XML config toa file, edit it as desired, and then re-define it again. eg virsh dumpxml VMNAME > VMNAME.xml vi VMNAME.xml (or emacs, or whatever) virsh define VMNAME.xml The next version of libvirt will include a convenient 'virsh edit' command which implements these 3 steps in one go. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From rjones at redhat.com Mon Aug 25 14:41:18 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Mon, 25 Aug 2008 15:41:18 +0100 Subject: [et-mgmt-tools] Error compiling virt-mem-2.8 In-Reply-To: <20080817203214.GA24439@amd.home.annexia.org> References: <48A40A9E.1070208@redhat.com> <20080814104428.GA22420@amd.home.annexia.org> <48A413C5.5050605@redhat.com> <20080814113507.GA22545@amd.home.annexia.org> <48A43D51.6020606@redhat.com> <20080814160232.GB22545@amd.home.annexia.org> <48A46FE5.3070600@redhat.com> <20080814193823.GE22545@amd.home.annexia.org> <48A65FC6.7070103@redhat.com> <20080817203214.GA24439@amd.home.annexia.org> Message-ID: <20080825144118.GA370@amd.home.annexia.org> Here's a build of 0.3.1: http://koji.fedoraproject.org/koji/taskinfo?taskID=784664 It failed on ppc64, I think simply because the compiler ran out of memory compiling one of the biggest source files (kernel.ml which corresponds to the kernel database). But it should be OK to use the i686 RPM on 32 bit guests. You should read the FAQ: http://et.redhat.com/~rjones/virt-mem/faq.html Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From rjones at redhat.com Wed Aug 27 17:09:20 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Wed, 27 Aug 2008 18:09:20 +0100 Subject: [et-mgmt-tools] ANNOUNCE: virt-what 1.0 - a shell script to detect if you are running in a virtual machine Message-ID: <20080827170920.GA19768@amd.home.annexia.org> I'm pleased to announce the first release of 'virt-what', which is a simple shell script that detects if you are running inside a virtual machine, and prints some "facts" about that virtual machine. This is a frequently requested feature. Home page: http://et.redhat.com/~rjones/virt-what/ Source and RPMs: http://et.redhat.com/~rjones/virt-what/files/ So far we can detect: - Xen - QEMU and KVM (but not distinguish between them) - VMware - Microsoft VirtualPC I'm hoping that people who run or develop other virtualization technology will be able to contribute snippets to detect those. It's worth saying (before Dan Berrange says it anyway) that although people often think they need this sort of feature, in most cases using this script is the WRONG THING. If you need a specific virtualization feature, then add code to your application to detect that feature. eg. If you need to make Xen hypervisor calls, your application should try to open /proc/xen/privcmd. As Dan once put it: A shell script just printing out 'native', 'dom0' or 'domU' is too simplistic to be broadly useful to management applications. The concepts are also ill-defined, eg 'native' as a concept can be a baremetal kernel, or a fully-virtualized guest, or both. 'DomU' does not distinguish full or paravirt. The distinction of 'dom0' vs 'native' is irrelevant in non-Xen virtualization systems (eg KVM). Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top From hhoffman at ip-solutions.net Thu Aug 28 11:44:30 2008 From: hhoffman at ip-solutions.net (Harry Hoffman) Date: Thu, 28 Aug 2008 07:44:30 -0400 Subject: [et-mgmt-tools] Sysdirector Message-ID: <48B68F9E.5010001@ip-solutions.net> Hi, Just stumbled across this and was wondering if the RH/Fedora folk have come across this and whether or not it fits up with Spacewalk, Cobbler, Func., etc. http://www.sysdirector.org/ Cheers, Harry From berrange at redhat.com Thu Aug 28 11:53:44 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 28 Aug 2008 12:53:44 +0100 Subject: [et-mgmt-tools] Sysdirector In-Reply-To: <48B68F9E.5010001@ip-solutions.net> References: <48B68F9E.5010001@ip-solutions.net> Message-ID: <20080828115344.GK10019@redhat.com> On Thu, Aug 28, 2008 at 07:44:30AM -0400, Harry Hoffman wrote: > Hi, > > Just stumbled across this and was wondering if the RH/Fedora folk have > come across this and whether or not it fits up with Spacewalk, Cobbler, > Func., etc. > > http://www.sysdirector.org/ "SysDirector is a template driven configuration management system that allows administrators to deliver content to machines in a protocol independent fashion." This is really solving the wrong problem. You really don't want to be working in terms of configuration file templates. You want to work based off functional configuration requirements, and have the tool itself decide what the actual config file settings need to be. This is the core benefit of using Puppet over cfengine. Combine puppet with Augeas, and you make it really easy to modify config file settings in-place without using templates. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From mdehaan at redhat.com Thu Aug 28 15:08:53 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Thu, 28 Aug 2008 11:08:53 -0400 Subject: [et-mgmt-tools] Sysdirector In-Reply-To: <20080828115344.GK10019@redhat.com> References: <48B68F9E.5010001@ip-solutions.net> <20080828115344.GK10019@redhat.com> Message-ID: <48B6BF85.2090800@redhat.com> Daniel P. Berrange wrote: > On Thu, Aug 28, 2008 at 07:44:30AM -0400, Harry Hoffman wrote: > >> Hi, >> >> Just stumbled across this and was wondering if the RH/Fedora folk have >> come across this and whether or not it fits up with Spacewalk, Cobbler, >> Func., etc. >> >> http://www.sysdirector.org/ >> > > "SysDirector is a template driven configuration management system that > allows administrators to deliver content to machines in a protocol > independent fashion." > > This is really solving the wrong problem. You really don't want to be > working in terms of configuration file templates. You want to work > based off functional configuration requirements, and have the tool > itself decide what the actual config file settings need to be. This is > the core benefit of using Puppet over cfengine. Combine puppet with > Augeas, and you make it really easy to modify config file settings > in-place without using templates. > > Daniel > I talked with one of the authors for a while on IRC last week, just to understand what they were trying to do, since typically Cobbler+puppet (or cfengine for some) is the way /most/ of the people here manage their systems. (That, and it seems nagios+cacti for monitoring/trending). Sysdirector is apparently glue for puppet/cfengine+their homegrown PXE provisioning. They had heard of Cobbler but had not looked at it. My main concern is that it uses Twisted to provide TFTP and HTTP services, rather than tftp-server and Apache. I suspect that will cause some rather painful scaling issues. Also there is no virtualization solution, and in present times, being able to support virtualization at the same level of physical systems is critical. Twisted has always struck me as a rather experimental "wouldn't it be cool if" kind of library, but not something I would consider for production server building. Ultimately, I wish them luck, and open source allows for choice. If people like it they will use it, but the real power in OSS development is in communities, feedback, and design. I am really proud of the community we have here and I expect that if there is something we're lacking you'll tell us (and maybe even help us build it). So, if there is something you like about sysdirector that we /don't/ do, or other tools integrating some of our favored tools don't exist, tell us what it is, and we'll try to make it better. --Michael From hhoffman at ip-solutions.net Thu Aug 28 15:28:33 2008 From: hhoffman at ip-solutions.net (Harry Hoffman) Date: Thu, 28 Aug 2008 11:28:33 -0400 Subject: [et-mgmt-tools] Sysdirector In-Reply-To: <48B6BF85.2090800@redhat.com> References: <48B68F9E.5010001@ip-solutions.net> <20080828115344.GK10019@redhat.com> <48B6BF85.2090800@redhat.com> Message-ID: <48B6C421.4060008@ip-solutions.net> Ah, I think I misunderstood the purpose of sysdirector. I envisioned being able to template puppet/cfengine config files much in the same way that we do now for kickstart, snippets, etc. Daniel spoke about it solving the wrong problem. I'm not sure I disagree with him but currently I think the vast majority of people who use some sort of configuration mgmt system wind up templating their files. I guess I need to look a bit more at Augeas. Cheers, Harry Michael DeHaan wrote: >> > > I talked with one of the authors for a while on IRC last week, just to > understand what they were trying to do, since typically Cobbler+puppet > (or cfengine for some) is the way /most/ of the people here manage their > systems. (That, and it seems nagios+cacti for monitoring/trending). > > Sysdirector is apparently glue for puppet/cfengine+their homegrown PXE > provisioning. They had heard of Cobbler but had not looked at it. > > My main concern is that it uses Twisted to provide TFTP and HTTP > services, rather than tftp-server and Apache. I suspect that will cause > some rather painful scaling issues. Also there is no virtualization > solution, and in present times, being able to support virtualization at > the same level of physical systems is critical. Twisted has always > struck me as a rather experimental "wouldn't it be cool if" kind of > library, but not something I would consider for production server building. > > Ultimately, I wish them luck, and open source allows for choice. If > people like it they will use it, but the real power in OSS development > is in communities, feedback, and design. I am really proud of the > community we have here and I expect that if there is something we're > lacking you'll tell us (and maybe even help us build it). So, if there > is something you like about sysdirector that we /don't/ do, or other > tools integrating some of our favored tools don't exist, tell us what it > is, and we'll try to make it better. > > --Michael > > _______________________________________________ > et-mgmt-tools mailing list > et-mgmt-tools at redhat.com > https://www.redhat.com/mailman/listinfo/et-mgmt-tools From berrange at redhat.com Thu Aug 28 15:32:17 2008 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 28 Aug 2008 16:32:17 +0100 Subject: [et-mgmt-tools] Sysdirector In-Reply-To: <48B6C421.4060008@ip-solutions.net> References: <48B68F9E.5010001@ip-solutions.net> <20080828115344.GK10019@redhat.com> <48B6BF85.2090800@redhat.com> <48B6C421.4060008@ip-solutions.net> Message-ID: <20080828153217.GE26373@redhat.com> On Thu, Aug 28, 2008 at 11:28:33AM -0400, Harry Hoffman wrote: > Ah, > > I think I misunderstood the purpose of sysdirector. > > I envisioned being able to template puppet/cfengine config files much in > the same way that we do now for kickstart, snippets, etc. > > Daniel spoke about it solving the wrong problem. I'm not sure I disagree > with him but currently I think the vast majority of people who use some > sort of configuration mgmt system wind up templating their files. I don't debate that - certainly today nearly everyone uses some kind of config file templates - primarily because there has never been a good quality tool like Augeas before to let them do a better job :-) Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| From bkearney at redhat.com Thu Aug 28 16:46:30 2008 From: bkearney at redhat.com (Bryan Kearney) Date: Thu, 28 Aug 2008 12:46:30 -0400 Subject: [et-mgmt-tools] replacing a file under kvm Message-ID: <48B6D666.3010504@redhat.com> I know you should not do this, but I am just curious. Assume I have a virtual machine running (git appliance) and I rebuild the image, thus replacing on the file system the backing for the machine I see in virt-manager. If I destroy the machine via virt-manager has it attempted to write bits to the underliing file? -- bk From crobinso at redhat.com Thu Aug 28 17:00:11 2008 From: crobinso at redhat.com (Cole Robinson) Date: Thu, 28 Aug 2008 13:00:11 -0400 Subject: [et-mgmt-tools] replacing a file under kvm In-Reply-To: <48B6D666.3010504@redhat.com> References: <48B6D666.3010504@redhat.com> Message-ID: <48B6D99B.4030400@redhat.com> Bryan Kearney wrote: > I know you should not do this, but I am just curious. Assume I have a > virtual machine running (git appliance) and I rebuild the image, thus > replacing on the file system the backing for the machine I see in > virt-manager. If I destroy the machine via virt-manager has it attempted > to write bits to the underliing file? > I'm a bit confused. What do you mean 'rebuild the image'? By 'backing' do you mean the virtual machine's disk image? Can you give a sequence of steps or commands of what you are doing? Thanks, Cole From mdehaan at redhat.com Thu Aug 28 18:03:54 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Thu, 28 Aug 2008 14:03:54 -0400 Subject: [et-mgmt-tools] Sysdirector In-Reply-To: <48B6C421.4060008@ip-solutions.net> References: <48B68F9E.5010001@ip-solutions.net> <20080828115344.GK10019@redhat.com> <48B6BF85.2090800@redhat.com> <48B6C421.4060008@ip-solutions.net> Message-ID: <48B6E88A.1070709@redhat.com> Harry Hoffman wrote: > Ah, > > I think I misunderstood the purpose of sysdirector. > > I envisioned being able to template puppet/cfengine config files much > in the same way that we do now for kickstart, snippets, etc. I think templating puppet recipes would be a bit too "meta". I think that is what the Puppet "class" system is for, right? To save what you did once to make it reusable? So in that way I think they already have that. --Michael From mdehaan at redhat.com Thu Aug 28 18:14:45 2008 From: mdehaan at redhat.com (Michael DeHaan) Date: Thu, 28 Aug 2008 14:14:45 -0400 Subject: [et-mgmt-tools] Sysdirector In-Reply-To: <48B6E88A.1070709@redhat.com> References: <48B68F9E.5010001@ip-solutions.net> <20080828115344.GK10019@redhat.com> <48B6BF85.2090800@redhat.com> <48B6C421.4060008@ip-solutions.net> <48B6E88A.1070709@redhat.com> Message-ID: <48B6EB15.1060807@redhat.com> Michael DeHaan wrote: > Harry Hoffman wrote: >> Ah, >> >> I think I misunderstood the purpose of sysdirector. >> >> I envisioned being able to template puppet/cfengine config files much >> in the same way that we do now for kickstart, snippets, etc. > > I think templating puppet recipes would be a bit too "meta". I > think that is what the Puppet "class" system is for, right? To save > what you did once to make it reusable? So in that way I think they > already have that. > > --Michael Perhaps you were talking about templating configurations on the managed systems instead, in which case that makes sense, and apologies if I got that confused :) --Michael From lutter at redhat.com Thu Aug 28 20:28:55 2008 From: lutter at redhat.com (David Lutterkort) Date: Thu, 28 Aug 2008 20:28:55 +0000 Subject: [et-mgmt-tools] Sysdirector In-Reply-To: <48B6C421.4060008@ip-solutions.net> References: <48B68F9E.5010001@ip-solutions.net> <20080828115344.GK10019@redhat.com> <48B6BF85.2090800@redhat.com> <48B6C421.4060008@ip-solutions.net> Message-ID: <1219955335.4728.346.camel@localhost.localdomain> On Thu, 2008-08-28 at 11:28 -0400, Harry Hoffman wrote: > I envisioned being able to template puppet/cfengine config files much in > the same way that we do now for kickstart, snippets, etc. If you need to generate config files from templates (and I think we all agree that sometimes it's a necessary evail, but always evil), puppet has builtin support for that, using Erb, ruby's templating engine. And as others have said, Augeas is a much more preferrable way to manipulate config files ;) David From lutter at redhat.com Thu Aug 28 20:31:32 2008 From: lutter at redhat.com (David Lutterkort) Date: Thu, 28 Aug 2008 20:31:32 +0000 Subject: [et-mgmt-tools] Sysdirector In-Reply-To: <48B6E88A.1070709@redhat.com> References: <48B68F9E.5010001@ip-solutions.net> <20080828115344.GK10019@redhat.com> <48B6BF85.2090800@redhat.com> <48B6C421.4060008@ip-solutions.net> <48B6E88A.1070709@redhat.com> Message-ID: <1219955492.4728.350.camel@localhost.localdomain> On Thu, 2008-08-28 at 14:03 -0400, Michael DeHaan wrote: > I think templating puppet recipes would be a bit too "meta". I think > that is what the Puppet "class" system is for, right? To save what you > did once to make it reusable? So in that way I think they already have > that. Yeah, generating puppet manifests from templates quickly turns into insanity. The puppet language should have enough features to make that unnecessary. If some part of a manifest do need to be generated dynamically, the recommended way for that is to use export/collect in the puppet manifest and write those dynamic resources directly to the database puppet uses to back export/collect. But legitimate uses for that are far and few between. David From lutter at redhat.com Thu Aug 28 20:33:39 2008 From: lutter at redhat.com (David Lutterkort) Date: Thu, 28 Aug 2008 20:33:39 +0000 Subject: [et-mgmt-tools] replacing a file under kvm In-Reply-To: <48B6D666.3010504@redhat.com> References: <48B6D666.3010504@redhat.com> Message-ID: <1219955619.4728.353.camel@localhost.localdomain> On Thu, 2008-08-28 at 12:46 -0400, Bryan Kearney wrote: > I know you should not do this, but I am just curious. Assume I have a > virtual machine running (git appliance) and I rebuild the image, thus > replacing on the file system the backing for the machine I see in > virt-manager. If I destroy the machine via virt-manager has it attempted > to write bits to the underliing file? If it's backed by a file, normal Unix fs semantics make sure that nothing evil happens: even though you deleted the file in the filesystem, it won't really go away until after it is not being used anymore, i.e. until after the VM shuts down. David From rjones at redhat.com Sun Aug 31 18:00:46 2008 From: rjones at redhat.com (Richard W.M. Jones) Date: Sun, 31 Aug 2008 19:00:46 +0100 Subject: [et-mgmt-tools] Re: [Fedora-xen] ANNOUNCE: virt-what 1.0 - a shell script to detect if you are running in a virtual machine In-Reply-To: References: <20080827170920.GA19768@amd.home.annexia.org> Message-ID: <20080831180046.GA3603@amd.home.annexia.org> On Sat, Aug 30, 2008 at 04:21:31PM -0400, Steve Thompson wrote: > On Wed, 27 Aug 2008, Richard W.M. Jones wrote: > >> I'm pleased to announce the first release of 'virt-what', which is a >> simple shell script that detects if you are running inside a virtual >> machine, and prints some "facts" about that virtual machine. This is >> a frequently requested feature. >> [...] > > On dom0 running a xen kernel (CentOS 5.2), I get: > > xen > xen-dom0 > > whether or not xend is started. > On PV guests, I get the same output (they have /proc/xen/privcmd > too). On HVM guests, I get no output. Oh dear, that's a bug. Which version of xen are you running? Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top