<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<STYLE type=text/css> <!--@import url(scrollbar.css); --></STYLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE> body{FONT-SIZE:12pt; FONT-FAMILY:宋体,serif;} </STYLE>
<META name=GENERATOR content="MSHTML 8.00.7600.16385"><BASE
target=_blank></HEAD>
<BODY
style="LINE-HEIGHT: 1.3; BORDER-RIGHT-WIDTH: 0px; MARGIN: 12px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px"
marginheight="0" marginwidth="0">
<DIV><FONT color=#000000 size=3 face=宋体>Hi Sylvain,</FONT></DIV>
<DIV> </DIV>
<DIV>The default value can be set to 0 ro -1, which means no limitation,</DIV>
<DIV>I think decreasing the niceness of nova-compute or cp/rsync/scp will
also need a configation,</DIV>
<DIV>because we cann't decrease it manully while the copy_image is
running.</DIV>
<DIV> </DIV>
<DIV>My another consideration is only decreasing the niceness of process
will have bad effect,</DIV>
<DIV>I have tested by `nice 19 cp src dst` and also `ionice -c 2 cp src
dst`,</DIV>
<DIV>the IO utils and bandwidth consumation seems to be not decreased as
before.</DIV>
<DIV> </DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 face=Verdana>2014-02-17</FONT></DIV>
<DIV align=left><FONT size=2 face=Verdana>
<HR style="WIDTH: 122px; HEIGHT: 2px" id=SignNameHR align=left SIZE=2>
</FONT></DIV>
<DIV align=left><FONT color=#c0c0c0 size=2 face=Verdana><SPAN
id=_FlashSignName>Wangpan</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Verdana>
<HR>
</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>发件人:</STRONG>Sylvain Bauza
<sylvain.bauza@gmail.com></FONT></DIV>
<DIV><FONT size=2
face=Verdana><STRONG>发送时间:</STRONG>2014-02-14 17:22</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>主题:</STRONG>Re: [openstack-dev] [nova]
Should we limit the disk IO bandwidth in copy_image while creating new
instance?</FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>收件人:</STRONG>"OpenStack Development
Mailing List (not for usage
questions)"<openstack-dev@lists.openstack.org></FONT></DIV>
<DIV><FONT size=2 face=Verdana><STRONG>抄送:</STRONG></FONT></DIV>
<DIV><FONT size=2 face=Verdana></FONT> </DIV>
<DIV><FONT size=2 face=Verdana>
<DIV dir=ltr>Instead of limitating the consumed bandwidth by proposiong a
configuration flag (yet another one, and which default value to be set ?), I
would propose to only decrease the niceness of the process itself, so that other
processes would get first the I/O access.
<DIV>That's not perfect I assume, but that's a quick workaround limitating the
frustration.</DIV>
<DIV><BR></DIV>
<DIV>-Sylvain</DIV></DIV>
<DIV class=gmail_extra><BR><BR>
<DIV class=gmail_quote>2014-02-14 4:52 GMT+01:00 Wangpan <SPAN dir=ltr><<A
href="mailto:hzwangpan@corp.netease.com"
target=_blank>hzwangpan@corp.netease.com</A>></SPAN>:<BR>
<BLOCKQUOTE
style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex"
class=gmail_quote><U></U>
<DIV
style="LINE-HEIGHT: 1.3; BORDER-RIGHT-WIDTH: 0px; MARGIN: 12px; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px"
marginheight="0" marginwidth="0"><U></U>
<DIV><FONT color=#000000 size=3 face=宋体>Currently nova doesn't limit the
disk IO bandwidth in copy_image() method while creating a new
instance, so the other instances on this host may be affected by this high
disk IO consuming operation, and some time-sensitive business(e.g RDS instance
with heartbeat) may be switched between master and slave.</FONT></DIV>
<DIV><FONT color=#000000 size=3></FONT> </DIV>
<DIV><FONT color=#000000 size=3 face=宋体>So can we use the `rsync
--bwlimit=${bandwidth} src dst` command instead of `cp src dst` while
copy_image in create_image() of libvirt driver, the remote image copy
operation also can be limited by `rsync --bwlimit=${bandwidth}` or `scp
-l=${bandwidth}`, this parameter ${bandwidth} can be a new configuration in
nova.conf which allow cloud admin to config it, it's default value is 0
which means no limitation, then the instances on this host will be not
affected while a new instance with not cached image is creating.</FONT></DIV>
<DIV><FONT color=#000000 size=3></FONT> </DIV>
<DIV><FONT color=#000000 size=3>the example codes:</FONT></DIV>
<DIV><FONT color=#000000 size=3>nova/virt/libvit/utils.py:</FONT></DIV>
<DIV><FONT color=#000000 size=3>diff --git a/nova/virt/libvirt/utils.py
b/nova/virt/libvirt/utils.py<BR>index e926d3d..5d7c935 100644<BR>---
a/nova/virt/libvirt/utils.py<BR>+++ b/nova/virt/libvirt/utils.py<BR>@@ -473,7
+473,10 @@ def copy_image(src, dest,
host=None):<BR> # sparse
files. I.E. holes will not be written to
DEST,<BR> # rather recreated
efficiently. In addition,
since<BR> # coreutils 8.11,
holes can be read efficiently
too.<BR>- execute('cp', src,
dest)<BR>+ if
CONF.mbps_in_copy_image >
0:<BR>+
execute('rsync', '--bwlimit=%s' % CONF.mbps_in_copy_image * 1024, src,
dest)<BR>+
else:<BR>+
execute('cp', src, dest)<BR>
else:<BR> dest = "%s:%s" %
(host, dest)<BR> # Try rsync
first as that can compress and create sparse dest files.<BR>@@ -484,11 +487,22
@@ def copy_image(src, dest,
host=None):<BR>
# Do a relatively light weight test first, so that
we<BR>
# can fall back to scp, without having run out of
space<BR>
# on the destination for
example.<BR>-
execute('rsync', '--sparse', '--compress', '--dry-run', src,
dest)<BR>+
if CONF.mbps_in_copy_image >
0:<BR>+
execute('rsync', '--sparse', '--compress',
'--dry-run',<BR>+
'--bwlimit=%s' % CONF.mbps_in_copy_image * 1024, src,
dest)<BR>+
else:<BR>+
execute('rsync', '--sparse', '--compress', '--dry-run', src,
dest)<BR> except
processutils.ProcessExecutionError:<BR>-
execute('scp', src,
dest)<BR>+
if CONF.mbps_in_copy_image >
0:<BR>+
execute('scp', '-l', '%s' % CONF.mbps_in_copy_image * 1024 * 8, src,
dest)<BR>+
else:<BR>+
execute('scp', src, dest)<BR>
else:<BR>-
execute('rsync', '--sparse', '--compress', src,
dest)<BR>+
if CONF.mbps_in_copy_image >
0:<BR>+
execute('rsync', '--sparse',
'--compress',<BR>+
'--bwlimit=%s' % CONF.mbps_in_copy_image * 1024, src,
dest)<BR>+
else:<BR>+
execute('rsync', '--sparse', '--compress', src, dest)</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV align=left><FONT color=#c0c0c0 face=Verdana>2014-02-14</FONT></DIV><FONT
face=Verdana>
<HR style="MIN-HEIGHT: 2px; WIDTH: 122px" align=left SIZE=2>
<SPAN class=HOEnZb><FONT color=#888888></FONT></SPAN></FONT><SPAN
class=HOEnZb><FONT color=#888888>
<DIV><FONT color=#c0c0c0
face=Verdana><SPAN>Wangpan</SPAN></FONT></DIV><U></U></FONT></SPAN></DIV><BR>_______________________________________________<BR>OpenStack-dev
mailing list<BR><A
href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</A><BR><A
href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev"
target=_blank>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</A><BR><BR></BLOCKQUOTE></DIV><BR></DIV></FONT></DIV></BODY></HTML>