On Thu, Jul 28, 2011 at 09:31:51AM -0400, Benjamin Lipton wrote: > On Thu, Jul 28, 2011 at 4:33 AM, Iustin Pop <[email protected]> wrote: > > > On Wed, Jul 27, 2011 at 04:02:13PM -0400, Ben Lipton wrote: > > > Automatically sets it to the smaller of: > > > * Size of the swap partition on source machine > > > * 10% of instance disk > > > > > > Signed-off-by: Ben Lipton <[email protected]>
> > > - nonswap_cyls = total_cyls - swap_cyls > > > - sfdisk_command = """sfdisk /dev/xvda <<EOF > > > + swap_output = subprocess.Popen(["swapon", "-s"], > > > + stdout=subprocess.PIPE, > > > + > > stderr=subprocess.PIPE).communicate()[0] > > > + swap_megs = 0 > > > + for line in swap_output.splitlines()[1:]: > > > + words = line.split() > > > + try: > > > + size_kb = int(words[2]) > > > + swap_megs += size_kb / 1024 > > > + except ValueError: > > > + pass # This line doesn't have data on it > > > > Wait, is this done on the bootstrap OS? > > > No, p2v_transfer.py is the script that's run on the transfer OS. Because I > moved some code from one function to another, the diff makes it look like > this code replaces something that edits /dev/xvda, but that code is actually > somewhere else now. Ah, OK. > Of course, this assumes that the transfer OS is using > the swap space on the disk. Maybe better to look through `fdisk -l /dev/sda` > for partitions of type Linux swap? Maybe simply parsing /etc/fstab on the source machine? Anyway, I'd not rate this important. Let's go with your original method here. thanks, iustin
