def test3 (self): print "uploadig to http://5cbbf0b78d3f9873:[email protected]:80/vdi_uuid_5aad0561-944d-4404-af6d-b515562805e4" #bits.upload('/tmp/SnapshotTreeImportSample/e66e3c22-bdfa-4575-b35f-c9df8c7382ad.vhd', bits.upload('/tmp/SnapshotTreeImportSample/e66e3c22-bdfa-4575-b35f-c9df8c7382ad.vhd', 'http', '192.168.2.62', '80', '5cbbf0b78d3f9873', 'd4122dea8ea5f60e', '/vdi_uuid_5aad0561-944d-4404-af6d-b515562805e4') print 'upload successful'
def bits_upload_vhd(record, filename): protocol = "http" upload_path = protocol + "://" + record['username'] + ":" + record[ 'password'] + "@" + record['ip'] + ":80" + record['url_path'] + ".vhd" logging.debug("Uploading %s to path %s" % (filename, upload_path)) bits.upload(filename, protocol, record['ip'], "80", record['username'], record['password'], record['url_path'] + ".vhd")
def bits_upload(src, record, url_path): bits.upload(src, 'http', record['ip'], record['port'], record['username'], record['password'], url_path) print "Upload of %s complete." % src
def _upload_disk_contents (self, spms, disk_image_ref, src): [handle, disk_uri, ssl_cert, user, passwd] = ConnectToDisk (self.conn, spms, disk_image_ref, "bits", None, None, False, True) protocol = disk_uri.split('/')[0].split(':')[0] (server, port) = disk_uri.split('/')[2].split('@')[1].split(':') (user, passwd) = disk_uri.split('/')[2].split('@')[0].split(':') vdi_path = '/' + disk_uri.split('/')[3] disk_image = self.conn.GetInstance(disk_image_ref) print 'Uploading vhd %s (size %d) to disk %s (size %d) on server %s' % ( src, os.stat(src).st_size, vdi_path, disk_image['NumberOfBlocks'], server) bits.upload(src, protocol, server, port, user, passwd, vdi_path) DisconnectFromDisk (self.conn, spms, handle)
def _upload_disk_contents(self, spms, disk_image_ref, src): [handle, disk_uri, ssl_cert, user, passwd] = ConnectToDisk(self.conn, spms, disk_image_ref, "bits", None, None, False, True) protocol = disk_uri.split('/')[0].split(':')[0] (server, port) = disk_uri.split('/')[2].split('@')[1].split(':') (user, passwd) = disk_uri.split('/')[2].split('@')[0].split(':') vdi_path = '/' + disk_uri.split('/')[3] disk_image = self.conn.GetInstance(disk_image_ref) print 'Uploading vhd %s (size %d) to disk %s (size %d) on server %s' % ( src, os.stat(src).st_size, vdi_path, disk_image['NumberOfBlocks'], server) bits.upload(src, protocol, server, port, user, passwd, vdi_path) DisconnectFromDisk(self.conn, spms, handle)
def bits_upload(src, record, url_path): global total_upload_time global total_upload_size start = time.time() bits.upload(src, record['use_ssl'] and 'https' or 'http', record['ip'], record['port'], record['username'], record['password'], url_path) end = time.time() size = os.stat(src).st_size print ("Uploaded %d MB in %d secs = %d Mbit/s" % (int(size) >> 20, int(end - start), int(size / (end - start)) >> 17)) total_upload_time += (end - start) total_upload_size += size
def bits_upload_vhd(record, filename): protocol = "http" upload_path = protocol + "://" + record['username'] + ":" + record['password'] + "@" + record['ip'] + ":80" + record['url_path'] + ".vhd" logging.debug("Uploading %s to path %s" % (filename, upload_path)) bits.upload(filename, protocol, record['ip'], "80", record['username'], record['password'], record['url_path'] + ".vhd")