Richard W.M. Jones
2015-Jul-29 12:42 UTC
Re: [Libguestfs] \n didn't lead to a new line while using remote model
On Wed, Jul 29, 2015 at 04:18:02PM +0800, Yu Liu wrote: [...]> Let's make an example: > > #guestfish -a disk.img > >run > >mount /dev/sda1 / > >write-append /a.txt "Hello\n" > >write-append /a.txt "World\n" > >cat /a.txt > Hello > World > > >quit > > Another try: > eval `guestfish --listen` > guestfish --remote add disk.img > guestfish --remote run > guestfish --remote mount /dev/sda1 / > guestfish --remote write-append /a.txt "Hello\n" > guestfish --remote write-append /a.txt "World\n" > guestfish --remote cat /a.txt > Hello\nWorld\n > > # > libguestfs-1.20.11-11.el6.x86_64The problem is that \n is handled "specially" by guestfish when it is reading the ><fs> command line, but not when it is parsing commands sent via --remote. The way to do this is: $ guestfish --remote write /a.txt "hello world" $ guestfish --remote cat /a.txt hello world Note that you have to actually press the [Return] key after "hello Probably a better plan is to use something like python remoting: https://rwmj.wordpress.com/2013/05/07/using-libguestfs-remotely-with-python-and-rpyc/#content which will be more predictable. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Yu Liu
2015-Jul-30 01:45 UTC
Re: [Libguestfs] \n didn't lead to a new line while using remote model
Ah, I see. Many thanks. BTW, I see a function that it can add a ssh remote image, like guestfish -a ssh://root@example.com/path/disk.img, it's really powerful, but why couldn't I secceed? #guestfish -a http://slcn03cn15.us.oracle.com/packages/test1.img http://slcn03cn15.us.oracle.com/packages/test1.img: No such file or directory On 2015/7/29 20:42, Richard W.M. Jones wrote:> On Wed, Jul 29, 2015 at 04:18:02PM +0800, Yu Liu wrote: > [...] >> Let's make an example: >> >> #guestfish -a disk.img >>> run >>> mount /dev/sda1 / >>> write-append /a.txt "Hello\n" >>> write-append /a.txt "World\n" >>> cat /a.txt >> Hello >> World >> >>> quit >> Another try: >> eval `guestfish --listen` >> guestfish --remote add disk.img >> guestfish --remote run >> guestfish --remote mount /dev/sda1 / >> guestfish --remote write-append /a.txt "Hello\n" >> guestfish --remote write-append /a.txt "World\n" >> guestfish --remote cat /a.txt >> Hello\nWorld\n >> >> # >> libguestfs-1.20.11-11.el6.x86_64 > The problem is that \n is handled "specially" by guestfish when it is > reading the ><fs> command line, but not when it is parsing commands > sent via --remote. > > The way to do this is: > > $ guestfish --remote write /a.txt "hello > world" > $ guestfish --remote cat /a.txt > hello > world > > Note that you have to actually press the [Return] key after "hello > > Probably a better plan is to use something like python remoting: > > https://rwmj.wordpress.com/2013/05/07/using-libguestfs-remotely-with-python-and-rpyc/#content > > which will be more predictable. > > Rich. >-- Thanks! Luis Liu
Richard W.M. Jones
2015-Jul-30 08:04 UTC
Re: [Libguestfs] \n didn't lead to a new line while using remote model
On Thu, Jul 30, 2015 at 09:45:38AM +0800, Yu Liu wrote:> Ah, I see. Many thanks. > > BTW, I see a function that it can add a ssh remote image, like > guestfish -a ssh://root@example.com/path/disk.img, it's really > powerful, but why couldn't I secceed? > > #guestfish -a http://slcn03cn15.us.oracle.com/packages/test1.img > http://slcn03cn15.us.oracle.com/packages/test1.img: No such file or > directory> >>libguestfs-1.20.11-11.el6.x86_64For a couple of reasons: (1) This feature wasn't available in 1.20 (added in 1.22). (2) We disable this feature in RHEL 7. It works upstream and in Fedora & Debian. This is because we don't want to support it for RHEL customers. OEL is free to enable it if you want to support that -- it requires changes to the block device whitelist in the qemu spec file, as well as removing the disabling patch from the libguestfs spec file (0098-RHEL-7-Disable-unsupported-remote-drive-protocols-RH.patch). Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Possibly Parallel Threads
- Re: \n didn't lead to a new line while using remote model
- Re: \n didn't lead to a new line while using remote model
- Re: \n didn't lead to a new line while using remote model
- Re: \n didn't lead to a new line while using remote model
- febootstrap: no ext2 root device found