Change in vdsm[master]: v2v: Convert VM from external source to Data Domain

danken at redhat.com danken at redhat.com
Tue Feb 24 12:19:53 UTC 2015


Dan Kenigsberg has posted comments on this change.

Change subject: v2v: Convert VM from external source to Data Domain
......................................................................


Patch Set 7: Code-Review-1

(4 comments)

http://gerrit.ovirt.org/#/c/37509/7/vdsm/v2v.py
File vdsm/v2v.py:

Line 196:                                 self._vmProperties['vmName'])
Line 197: 
Line 198:         logging.info('import vm, (jobId %s) started, cmd: %r', self._job_id,
Line 199:                      cmd)
Line 200:         proc = subprocess.Popen(cmd, env={'LIBGUESTFS_BACKEND': 'direct'},
_handle_process_input() reads the process's output. But the process itself can (and should!) be created using execCmd((_VIRT_V2V, "-ic", self._uri, ...), deathSignal=sigkill)

otherwise we must take care of funny character in commandline, and track stale processes on vdsm crash.
Line 201:                                 shell=True,
Line 202:                                 stdout=subprocess.PIPE,
Line 203:                                 stderr=subprocess.PIPE)
Line 204: 


Line 219: 
Line 220:     def _handle_process_input(self, proc):
Line 221:         re_copy_disk = re.compile(r'.*(Copying disk \d+/\d+).*')
Line 222:         while not self._abort:
Line 223:             line = proc.stdout.readline()
it seems that _handle_process_input() actually parses the *output* of v2v.

I'd love to see a unit test for this function. It would also be much more readable if it is made a module function, with a clear input and output, and no reference to "self".
Line 224: 
Line 225:             if line == '':
Line 226:                 self._handle_process_errors(proc)
Line 227:                 break


Line 298:             return ' '.join(images)
Line 299: 
Line 300:     def _get_domain_path(self):
Line 301:         ''' we are using the first disk since we are using only one storage
Line 302:             domain so any disk can be used for getting the domain path '''
Can you help me here? What is the output of virt-v2v? where does it place the images of disks? Where would it place the non-first disks? What is it's target? Doesn't it have to be an export domain?

If virt-v2v is expect to write the images directly onto the storage domain - how can it guess the imageUUID and volUUID? who prepare that storage area?
Line 303:         disk = self._vmProperties['disks'][0]
Line 304:         drive = {'device': 'disk',
Line 305:                  'poolID': self._vmProperties['poolID'],
Line 306:                  'domainID': self._vmProperties['domainID'],


Line 306:                  'domainID': self._vmProperties['domainID'],
Line 307:                  'imageID': disk['imageID'],
Line 308:                  'volumeID': disk['volumeID']}
Line 309: 
Line 310:         volPath = self._cif.prepareVolumePath(drive)
Please call 

 self._cif.irs.prepareImage()

directly, without the virt-only wrapper.
Line 311:         try:
Line 312:             return volPath.split('/images/')[0]
Line 313:         finally:
Line 314:             self._cif.teardownVolumePath(drive)


-- 
To view, visit http://gerrit.ovirt.org/37509
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I34bd86d5a87ea8c42113c4a732f87ddd4ceab9ea
Gerrit-PatchSet: 7
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi at redhat.com>
Gerrit-Reviewer: Shahar Havivi <shavivi at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list