~ubuntu-branches/ubuntu/quantal/virtinst/quantal-proposed

« back to all changes in this revision

Viewing changes to .pc/0002-Fix-path-to-pygrub.patch/virtinst/util.py

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-07-24 08:52:01 UTC
  • mfrom: (1.6.8 sid)
  • Revision ID: package-import@ubuntu.com-20120724085201-q3h0cbabg4t46gfm
Tags: 0.600.2-1ubuntu1
* Merge from debian unstable. Remaining changes:
  - debian/patches/9003-fix-path-to-hvmloader-in-testsuite.patch: adjust
    testsuite for 0001-fix-path-to-hvmloader.patch and
    0002-Fix-path-to-pygrub.patch.
  - debian/patches/9004_ubuntu_fix_tree_support.patch: Fix tree detection
    for all ISO/HTTP source, to not longer fail with cobbler/koan.
  - debian/patches/0004-Fix-path-to-qemu-dm.patch: fix the path to the
    qemu-dm binary.
  - debian/{control,rules,pyversions}: Build using dh_python2, use
    debhelper v8 instead of cdbs; for some reason the package build an
    empty binary package when using dh_python2.
  - debian/control: added acl package to depends.
  - debian/control: added libvirt-bin to recommends
* Dropped patches:
  - debian/patches/9005_ubuntu_releases.patch: Upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
178
178
# available under the LGPL,
179
179
# Copyright 2004, 2005 Mike Wray <mike.wray@hp.com>
180
180
# Copyright 2005 XenSource Ltd
181
 
def randomMAC(type="xen"):
 
181
def randomMAC(type="xen", conn=None):
182
182
    """Generate a random MAC address.
183
183
 
184
184
    00-16-3E allocated to xensource
200
200
 
201
201
    @return: MAC address string
202
202
    """
 
203
    if conn and hasattr(conn, "_virtinst__fake_conn_predictable"):
 
204
        # Testing hack
 
205
        return "00:11:22:33:44:55"
 
206
 
203
207
    ouis = { 'xen': [ 0x00, 0x16, 0x3E ], 'qemu': [ 0x52, 0x54, 0x00 ] }
204
208
 
205
209
    try:
222
226
 
223
227
    return [ random.randint(0, 255) for dummy in range(0, 16) ]
224
228
 
225
 
def uuidToString(u):
 
229
def uuidToString(u, conn=None):
 
230
    if conn and hasattr(conn, "_virtinst__fake_conn_predictable"):
 
231
        # Testing hack
 
232
        return "00000000-1111-2222-3333-444444444444"
 
233
 
226
234
    return "-".join(["%02x" * 4, "%02x" * 2, "%02x" * 2, "%02x" * 2,
227
235
                     "%02x" * 6]) % tuple(u)
228
236
 
430
438
    return scheme, username, netloc, uri, query, fragment
431
439
 
432
440
 
433
 
def is_uri_remote(uri):
 
441
def is_uri_remote(uri, conn=None):
 
442
    if conn and hasattr(conn, "_virtinst__fake_conn_remote"):
 
443
        # Testing hack
 
444
        return True
 
445
 
434
446
    try:
435
447
        split_uri = uri_split(uri)
436
448
        netloc = split_uri[2]